-
Notifications
You must be signed in to change notification settings - Fork 5
Legacy Device UDP Server
This page will outline the UDP server available for current and legacy devices that may not allow for the use of MQTT and/or Codec JSON, as referenced in the Tutorial and Developer guides.
To allow support of all devices within OpenRemote, a new server has been developed. When the server receives properly-formatted and sequenced data, according to Teltonika's Codec documentation, the server will then connect with a unique MQTT client ID to the specified MQTT broker, sending the contents of the UDP Codec 8 payload formatted in the same way as a Codec JSON, MQTT payload message.
In this way, this server serves as an adapter between older devices with no support for MQTT and/or Codec JSON to the more recent transmission protocol and codec, assuring maximum compatibility of OpenRemote with the entirety of the product-line of Teltonika Telematics.
The server allows for Teltonika devices to connect using multiple Codec protocols. Any data that is sent to the server is sent via MQTT to any server and topic the user selects in Teltonika's Codec JSON format. Different devices use different UUIDs as the client ID.
The index file is the main developer interface for the server. The UDPServerManager is an EventEmitter, and the events emitted are where the MQTT messages are constructed and sent to the MQTT broker.
Here is a description of what each UdpServerManager
event is:
-
message
:imei, uuid, content
: When amessage
event is emitted, the device withimei
anduuid
has sent a data packet, which is of typeProtocolParser
. Using that class, you can check the metadata of the packet to ensure it contains data the user requires. -
connected
:imei, uuid
: A device with theimei
has connected, and it has been assigned withuuid
. Used for creating a connection to the MQTT broker using theuuid
as a client ID -
disconnected
:imei
: The device withimei
has disconnected.
- Compatibility is based solely on npm package
complete-teltonika-parser
, the base of this server - Allows for any type of MQTT(s) connection to be established
- Allows for TCP connection by the device to the application
- Allows multiple devices to be connected by managing WS states
- Raises events in UdpServerManager; for now, these events are fired when a device is connected, sends a message, and disconnects.
-
complete-teltonika-parser
: used to parse Teltonika payloads and conduct all necessary checks and data parsing from the devices. -
mqtt
: MQTT.js used for interfacing to the MQTT broker -
moment
: Used for timestamp manipulation, for correct payload formatting -
net
: Used for creating the UDPServer -
crypto
: Used for generating UUIDs. -
events
: Used for extending the EventEmitter