traceme-server
v0.0.13
Published
library providing a TCP server that speaks with KCS TraceME hardware
Downloads
6
Readme
traceme-server
TraceME IoT gateway
import { Server, ServerOptions, Connection } from "traceme-server";
const config = {
tcpDataFormat: "%s\n",
tcpExtraDataFormat: "%s\r%d\r%x\n",
socketTimeout: 120,
maxBufferSize: 4096,
cgpsPath: "/path/to/cgps.js"
};
const server = new Server(config);
server.on("connection", conn => {
conn.on("event", receivedEvent => {
if (receivedEvent.cgps.CanGetLatLong()) {
console.log(
`imei: ${receivedEvent.imei}`,
`lat: ${receivedEvent.cgps.GetLatitudeFLoat()}`,
`long: ${receivedEvent.cgps.GetLongitudeFloat()}`
);
}
conn.ack(receivedEvent.tsUuid);
});
});
server.listen(6700);
Introduction
Traceme-server is an easy to use node.js TraceME gateway.
Requirements
- Node.js installed on your system.
- A copy of the cgps.js file from the developers page on the TraceME website.
Installation
npm install traceme-server --save
Documentation
OTA Settings example