User manual
Automation Protocol Extended Commands
Miranda Technologies Ltd Page 85
Extended Commands
Extended commands are two-byte commands with parameters following
immediately on from the second command code byte. The first command
byte identifies a command group, with the second byte identifying the
specific command within the group.
All extended commands use fixed-width hexadecimal representations for
integer parameters.
All string parameters are variable length, and are therefore grouped at the end
of the packet. If multiple string parameters are required, they are delimited by
vertical bar characters (‘|’) which therefore cannot appear in the parameter.
String parameters can contain ‘escape’ sequences to include characters which
cannot otherwise be transmitted using the remote protocol – especially colon
‘\3A’, semicolon ‘\3B’ and vertical bar ‘\7C’. These are handled using C-
style escape sequences using a backslash character followed by two
hexadecimal bytes to form the code for a single byte. Note that backslash
itself must therefore be transmitted as ‘\5C’
This code converts normal ASCII strings into a format suitable for sending.
char * put_remote_str(char *instr, char *outstr)
{
char c;
for(;;)
{
c = *instr++;
if (c == 0)
{
*outstr = 0;
return outstr;
}
if ((c == ';') || (c == ':') ||
(c == '|') || (c == '\\'))
{
*outstr++ = '\\';
sprintf(outstr,"%02x",c);
}
else
{
*outstr++ = c;
}
}