Technical information

The RMS Enterprise SDK (v4)
30
RMS Enterprise - NetLinx Programmer’s Guide
RmsApi.axi - General Utility Functions
The following list of General Utility Functions can be found in the RmsApi.axi Include File:
RmsApi.axi - General Utility Functions
RmsDevToString Description: This function is used to convert a device variable of type DEV to a string representation
using the <D>:<P>:<S> formatting syntax.
Arguments:
DEV dvDPS
Returns: DPS string; example "5001:1:0"
Syntax:
DEFINE_FUNCTION CHAR[20] RmsDevToString(DEV dvDPS)
{
RETURN "ITOA(dvDPS.Number),':',ITOA(dvDPS.Port),':',ITOA(dvDPS.System)"
}
RmsDeviceIdInList Description: This function is used to determine if a Device ID (number) is included in a list of devices
IDs
Arguments:
INTEGER devID - Device ID (number) to search for
INTEGER devList[] - Device ID array to search in
Returns: Index of the device in array; 0 if not found
Syntax:
DEFINE_FUNCTION INTEGER RmsDeviceIdInList(INTEGER devId, INTEGER devList[])
{
STACK_VAR INTEGER index;
// iterate over the Device ID listing and search
// for a matching Device ID, return if found.
FOR(index = 1; index <= LENGTH_ARRAY(devList); index++)
{
IF(devList[index] == devId)
{
RETURN index;
}
}
RETURN 0;
}
RmsDeviceInList Description: This function is used to determine if a device instance is included in an array of devices.
Arguments:
DEV 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 RmsDeviceInList(DEV devTarget, DEV devList[])
{
STACK_VAR INTEGER index;
// NOTE: this function does not take the device SYSTEM number
// into account when evaluating a possible match.
// Data/Channel/Button event returned device instances
// may return the DPS structure with the real system
// number and the hard coded device definition only
// specified system '0'.
// 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(devList[index].NUMBER == devTarget.NUMBER &&
devList[index].PORT == devTarget.PORT)
{
RETURN index;
}
}
RETURN 0;
}