Code Monkey home page Code Monkey logo

teltonika-decoder's Introduction

teltonika-decoder

Decodes messages from Teltonika devices that use either Codec8 or Codec8Extended.

Installation

yarn add teltonika-decoder

Usage

const { decode } = require("teltonika-decoder")

const result = decode(Buffer.from("...", "hex"))

if (result.isImei) {
  // The imei number of the device was sent
  console.log(result.imei)
} else {
  // Telemetry data was sent
  console.log(result.data)
}

teltonika-decoder's People

Contributors

gerritse avatar

Stargazers

Jhamner Sifuentes Vasquez avatar Burhan avatar

Watchers

 avatar

teltonika-decoder's Issues

Buffer size must be a multiple of 64-bits

Hi,
Thank you for the decoder.
I have this error when decoding the package from device Teltonika FMC130. Can you help advise?
Much appreciated!

`node:buffer:1178
throw new ERR_INVALID_BUFFER_SIZE('64-bits');
^

RangeError [ERR_INVALID_BUFFER_SIZE]: Buffer size must be a multiple of 64-bits
at new NodeError (node:internal/errors:393:5)
at Buffer.swap64 (node:buffer:1178:11)
at decodeIOElement (/Users/duongtran/Works/Sencar/Dev/TCP/node_modules/teltonika-decoder/src/codecs/decode.js:72:46)
at decodeIOElements (/Users/duongtran/Works/Sencar/Dev/TCP/node_modules/teltonika-decoder/src/codecs/decodeCodec8.js:42:36)
at decodeRecord (/Users/duongtran/Works/Sencar/Dev/TCP/node_modules/teltonika-decoder/src/codecs/decodeCodec8.js:30:17)
at decodeCodec8 (/Users/duongtran/Works/Sencar/Dev/TCP/node_modules/teltonika-decoder/src/codecs/decodeCodec8.js:10:18)
at decodePackage (/Users/duongtran/Works/Sencar/Dev/TCP/node_modules/teltonika-decoder/src/decodePackage.js:24:11)
at decode (/Users/duongtran/Works/Sencar/Dev/TCP/node_modules/teltonika-decoder/src/decode.js:17:8)
at Socket. (/Users/duongtran/Works/Sencar/Dev/TCP/tcp_listener.js:21:20)
at Socket.emit (node:events:513:28) {
code: 'ERR_INVALID_BUFFER_SIZE'
}

Node.js v19.1.0`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.