Skip to content
This repository was archived by the owner on Nov 9, 2023. It is now read-only.
/ SLMF-HTTP-connector Public archive

Typescript implementation of a location message format HTTP Connector based on standard ISO/IEC 24730-1:2014

License

Notifications You must be signed in to change notification settings

F-Army/SLMF-HTTP-connector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

583a405 · Feb 9, 2019
Nov 15, 2018
Nov 12, 2018
Nov 15, 2018
Nov 11, 2018
Nov 11, 2018
Feb 9, 2019
Nov 14, 2018
Nov 11, 2018
Nov 15, 2018
Nov 15, 2018
Nov 13, 2018
Nov 10, 2018
Nov 12, 2018

Repository files navigation

SLMF-HTTP-connector

Build Status Coverage Status codebeat badge Known Vulnerabilities

Basic usage

Install this package simply using npm:

npm install slmf-http-connector

Let's begin by starting the connector:

const { SlmfHttpConnector } = require("slmf-http-connector");

const connector = new SlmfHttpConnector({
        accumulationPeriod : 500,
        maxAccumulatedMessages : 3,
        maxSlmfMessages : 2,
        maxRetries: 3,
        port: 8080,
        url : "http://127.0.0.1",
});

connector.start();

Now you are ready to add location messages from your server or application:

const { BatteryStatus, TagIdFormat } = require("slmf-http-connector");

connector.addMessages({
      source: "Infrastructure",
      format: "DFT",
      tagIdFormat: TagIdFormat.IEEE_EUI_64,
      tagId: 0,
      position: {
          x: 0,
          y: 0,
          z: 0,
      },
      battery: BatteryStatus.Good,
      timestamp: new Date(),
});

The messages will be sent to the target server using POST request in XML format (ISO/IEC 24730-1:2014)
If you need to stop the connector just do:

connector.stop(); // It will not send nor receive messages until started

Documentation

You can generate the library documentation inside the project folder using:

npm run docs