Working with TCP Agent and Asset

I have an OEM manufacturer sending diagnostic data over TCP/IP. This data is written from the device to a TCP port 19999. Using nc, I am able to listen to this port and see the packets coming in. The raw data is not structured as JSON. It’s just a text format with comma-separated values.

$$CLIENT_1NS,101010101,15, 1_36T04A05QREL_30,,17499,internet,T1:10 S,T2:1
M,Ad1:9164061023,Ad2:9164061023,TOF:0 S,, OSC:75 KM,OST:0 S, GPS: NO, Ignition: ON,*33\r\n

I have a docker container running on the same server. From here, I am able to use a TCP agent to connect to the TCP port 19999. The connection establishes, i.e., in ‘View’ mode, the Agent Status is ‘CONNECTED’.

The problem here is, if I want to assign a ‘Thing’ asset and process the packets, how do I do this. In the case of the HTTP Agent demo, we use a custom attribute to collect weather data and then assign it to attributes. Here I just get a packet (text).

Can you write Java code?

Hi Michal

Yes, I can. I initially thought of having some basic Java/Python client read the TCP packets and then push it to OpenRemote as JSON (probably expose it as a REST client).

Or if there is a simpler way you could do it within the manager UI, it would be great. I’m pretty new to OpenRemote, so any suggestion would be more than welcome.

Well, as OpenRemote is 100% open source and you can program Java, the most obvious way would be to write custom protocol aka agent. The best person to ask for help when you are stuck is @rich. He is free this week but should pickup the subject when he’s back from his break. Till then take a look in the WiKi. There is an example of implementation of such an agent.

Thank you Michal. I will investigate this. I’ll let you folks know how it’s going.