Technical information
The RMS Enterprise SDK (v4)
31
RMS Enterprise - NetLinx Programmer’s Guide
RmsApi.axi Functions (Cont.)
General Utility Functions (Cont.)
RmsDeviceStringInList Description: This function is used to determine if a device D:P:S string is found in and array of devices
Arguments:
• CHAR devTarget[] - target device to search for
• DEV devList[] - array of devices to search in
Returns: index of the device in array; 0 if not found
Syntax:
DEFINE_FUNCTION INTEGER RmsDeviceStringInList(CHAR devTarget[], DEV devList[])
{
STACK_VAR INTEGER index;
// iterate over the device listing (array) and search
// for a matching device instance, return index if found.
FOR(index = 1; index <= LENGTH_ARRAY(devList); index++)
{
IF(RmsDevToString(devList[index]) == devTarget)
{
RETURN index;
}
}
RETURN index;
}
RmsBooleanValue Description: This function is used to parse a string and return a char (bit) for boolean state.
Arguments:
• CHAR value[] - string to convert to char (bit)
Returns: 0 if string results in FALSE; 1 if string results in TRUE
Syntax:
DEFINE_FUNCTION CHAR RmsBooleanValue(CHAR value[])
{
IF(LOWER_STRING(value) == 'true' || value=='1' || LOWER_STRING(value) == 'on' )
{
RETURN TRUE;
}
ELSE
{
RETURN FALSE;
}
}
RmsBooleanString Description: This function is used to convert a char (bit) to a RMS boolean string of 'true' or 'false'.
Arguments:
• CHAR value - convert bit to boolean string
Returns: 'false' if char value is 0; 'true' if char value is >0
Syntax:
DEFINE_FUNCTION CHAR[5] RmsBooleanString(CHAR value)
{
IF(value)
{
RETURN 'true';
}
ELSE
{
RETURN 'false';
}
}