Technical information
RMS NetLinx Virtual Device API
122
RMS Enterprise - NetLinx Programmer’s Guide
RMS Command Escaping Functions
The Command Escaping Functions in the RmsApi.axi Include File are described in the following table:
RMS Command Escaping Functions
RmsParseDPS
FromString
Description: This function is used to parse a string and extract a D:P:S device instance.
Arguments:
• CHAR cCmd[] (in) - target string to search in
• DEV dvDPS (out) - device to return
Returns: -nothing-
Syntax:
DEFINE_FUNCTION RmsParseDPSFromString(CHAR cCmd[], DEV dvDPS)
STACK_VAR
INTEGER nPos
{
dvDPS.Number = ATOI(cCmd)
dvDPS.Port = 1
dvDPS.System = 0
nPos = FIND_STRING(cCmd,':',1)
IF (nPos)
{
nPos++
dvDPS.Port = ATOI(MID_STRING(cCmd,nPos,LENGTH_STRING(cCmd)-nPos+1))
nPos = FIND_STRING(cCmd,':',nPos)
IF (nPos)
{
nPos++
dvDPS.System = ATOI(MID_STRING(cCmd,nPos,LENGTH_STRING(
cCmd)-nPos+1))
}
}
RmsPackCmdHeader Description:
Adds the command header to the string and adds the command if missing.
This function assumes the standard Duet command separator '-'.
Parameters:
• (1) IN - sndcmd/str header
Returns: Packed header with command separator added if missing
Syntax:
DEFINE_FUNCTION CHAR[RMS_MAX_HDR_LEN] RmsPackCmdHeader(CHAR cHdr[])
{
STACK_VAR CHAR cSep[1]
cSep = '-'
IF (RIGHT_STRING(cHdr,LENGTH_STRING(cSep)) != cSep)
RETURN "cHdr,cSep";
RETURN cHdr;
}