[ANSWERED] Retrieving Hex values from a TCP in
-
Hello,
if I use TCP In Watcher -Text to retrieve a TCP message from a camera I cannot obtain the Hex data, but the Ascii.
I see in monitor the Hex string but I cannot have it as text in TCP Watcher.
I'm using parsing command msg:string={ 00-FF }
Any suggestion?
Thank you
Stefano
-
Can you please stake a screen capture of your Montior window, showing the incoming values?
-
Hi,
here it is, I would like to parse the hex command (in this case 90 50 0000 00 0C FF), I will use this to obtain parameters from a PTZ camera. (Visca protocol)
Thank you
Stefano
-
This is a little tricky.. I am not well versed in the Serial parsing syntax.
The best I could come up with is:val1:int=1 bytes val2:int=1 bytes val3:int=1 bytes val4:int=1 bytes val5:int=1 bytes val6:int=1 bytes val7:int=1 bytes val8:int=1 bytes
This will give you a decimal output for the first 8 hex values.
Then you can feed the Decimal into a Javascript actor and convert it to HEX.
function main() { hex = arguments[0].toString(16); if (hex.length > 1) { val = hex; }else{ val = "0" + hex; } return [val,hex.length]; }
The output didn't include the leading zero by default, so I added the quick IF test to insert a '0'.
-
That syntax in TCP In Watcher (val1:int=1 bytes...) doesn't work for me the msg rcv doesn't react and all parameters remain 0...
Sorry, but I'm not very good with this...
Thank you
Stefano
-
Please try running the attached file.
This file works for me.. and I don't see why the incoming data would be managed any differently in your case.
let me know if this file works for you