1.0.12 • Published 3 months ago

gt06 v1.0.12

Weekly downloads
6
License
ISC
Repository
github
Last release
3 months ago

Node.js CI Node.js Package npm audit

GT06 Message Parser

This is a GT06 GPS Tracker message parser implementation. It can be used to implement your own server. It parses all messages received from the device and creates the response message, if needed.

Shout out to Anton Holubenko because I've copied the initial version from him. repo/gt06n

Usage

const Gt06 = require('gt06');
const net = require('net');

var server = net.createServer((client) => {
  var gt06 = new Gt06();
  console.log('client connected');

  client.on('data', (data) => {
    try {
      gt06.parse(data);
    }
    catch (e) {
      console.log('err', e);
      return;
    }

    if (gt06.expectsResponse) {
      client.write(gt06.responseMsg);
    }

    gt06.msgBuffer.forEach(msg => {
      console.log(msg);
    });

    gt06.clearMsgBuffer();
  });
});

server.listen(serverPort, () => {
  console.log('started server on port:', 4711);
});
1.0.12

3 months ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

5 years ago