Technical information
RMS NetLinx Virtual Device API
124
RMS Enterprise - NetLinx Programmer’s Guide
RMS Command Escaping Functions (Cont.)
RmsParseCmdHeader Description: Use this function to parse out parameters from module SEND_COMMAND or
SEND_STRING. Parses the strings sent to or from modules extracting the command header.
Command separating character assumed to be '-', Duet standard
Parameters:
• (1) IN/OUT - sndcmd/str data
Returns: Parsed property/method name, still includes the leading '?' if present.
Syntax:
DEFINE_FUNCTION CHAR[RMS_MAX_HDR_LEN] RmsParseCmdHeader(CHAR cCmd[])
{
STACK_VAR CHAR cTemp[RMS_MAX_HDR_LEN]
STACK_VAR CHAR cSep[1]
cSep = '-'
// Assume the argument to be the command
cTemp = cCmd
// If we find the separator, remove it from the command
IF (FIND_STRING(cCmd,cSep,1) > 0)
{
cTemp = REMOVE_STRING(cCmd,cSep,1)
IF (LENGTH_STRING(cTemp))
cTemp = LEFT_STRING(cTemp,LENGTH_STRING(cTemp)-LENGTH_STRING(cSep))
}
// Did not find separator, argument is the command (like ?SOMETHING)
ELSE
cCmd = ""
RETURN cTemp;
}
RmsDuetParseCmd
Param
Description: Use this function to parse out parameters from module SEND_COMMAND or
SEND_STRING. Parses the strings sent to or from modules extracting the parameters.
• A single param is picked of the cmd string and removed, through the separator.
• The separator is NOT returned from the function.
• If the first character of the param is a double quote, the function will remove up to (and including) the
next double-quote and the separator without spaces.
• The double quotes will then be stripped from the parameter before it is returned.
• If the double-quote/separator sequence is not found, the function will remove up to (and including) the
separator character and the leading double quote will NOT be removed.
• If the separator is not found, the entire remained of the command is removed.
• Command separating character assumed to be ',', Duet standard
Parameters:
• (1) IN/OUT - sndcmd/str data
Returns: Parse parameter from the front of the string not including the separator.
Syntax:
DEFINE_FUNCTION CHAR[RMS_MAX_PARAM_LEN] RmsParseCmdParam(CHAR cCmd[])
{
RETURN RmsParseCmdParamEx(cCmd, ',');
}