Since Quicklaunch build 3.0.0.385 the Message Adapter now supports command line arguments.  This will allow the message adapter to be used with multiple devices.  Config files will no longer be necessary.



Command Line Arguments for TCP Communications


-MessageType TCP -ipAddress {ip-address}  -Port {port}  -Message {message}

  -CloseAfterUse {closeAfterUse} 



 
-MessageType
Message type will be TCP


-IpAddress
The TCPIP address to send the message to (i.e. 192.168.1.1)


-Port
The TCP port to send the message to (i.e. 8080)


-Message

the formatted message to send (for binary see the section below)


-CloseAfterUse

optional parameter.  Normally the message adapter will keep the socket open.  Set this parameter to "true" to close the socket after every call.





TCP Examples:


-MessageType Tcp -IpAddress 192.168.45.22 -Port 8080 -Message "Message for Tcp port 8080"


-MessageType Tcp -IpAddress 192.168.45.22 -Port 8080 -CloseAfterUse true -Message "Message for Tcp port 8080 then close"





Command Line Arguments for Serial Communcations


-MessageType SERIAL -Port {port}  -BaudRate {baud-rate} -Parity {parity} -StopBits {stopbits} 

-Message {message}




-MessageType
Message type will be SERIAL


-Port
The the communication port to use (e.g. COM3)


-BaudRate
The rate at which to configure the communication port (e.g 38400)


-Parity
The parity at which to configure the communication port
One of: [None, Odd, Even, Mark or Space]


-StopBits
The number of stop bits at which to configure the communication port
One of: [None, One, Two or OnePointFive]


-Message
the formatted message to send (for binary see the section below)


Serial Example:


-MessageType Serial -Port COM3 -BaudRate 38400 -Parity None -StopBits One -Message "Message for Serial"



Sending binary data in the message adapter


The  "-Message" can also contain dinary data in hex.  


\x is an escapes sequence for a 2 digit hex number. For example, "\x11" gets interpreted as a hex number 11 and converted to a single byte. 


\\ is an escape sequence that resolves to a single \ being output. Given this, "\\x11" results in a single byte for the "\" followed by 3 bytes for the "x11".


So for example: 


 -Message "\xAA\x11\x01\x01\x00\x13"

gets translated to the following bytes

170 17 1 1 0 19

 

 -Message  "\xAASyed\x11"

gets translated to the following bytes

170 82 121 101 100 17



To send a CRLF, use "\x10\x13" at the end of your message.


Testing Message Adapter


Download and install NCat from https://nmap.org/ncat/


Start a command prompt


Set current directory to c:\program files(x86)\nmap


start the listener:  ncat -l 4444