4.0.1 • Published 11 months ago

abeeway-asset-tracker-driver-v4 v4.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

Abeeway Asset Tracker Driver V4 Package

Description

The IoT Flow Abeeway Asset Tracker driver V4 implements the specification of javascript IoT flow drivers as described in the chapter below.

To use in javascript

First install the package: npm install abeeway-asset-tracker-driver-v4

Then:

//import the module
var driver = require("abeeway-asset-tracker-driver-v4");

//common functions
//convert a hex string to a hex array
function parseHexString(str){
    var result = [];
    while (str.length >= 2) { 
        result.push(parseInt(str.substring(0, 2), 16));

        str = str.substring(2, str.length);
    }
    return result;
}
  • To decode an uplink
var input = {
    bytes: parseHexString(uplinkPayloadString),
    fPort: 18 
}

var result = driver.decodeUplink(input)
  • To decode a downlink
var input = {
    bytes: parseHexString(downlinkPayloadString),
}
var result = driver.decodeDownlink(input)
  • To encode a downlink
/*
input is the "data" object without "payload" as presented in the downlink example files
for example
{
    "downMessageType": "DEBUG_COMMAND",
    "ackToken": 2,
    "debugCommandType": "RESET"
}
*/
var result = driver.encodeDownlink(input).bytes

To update this package:

  1. Clone this repo: https://github.com/actility/device-catalog
  2. Go to ./vendors/abeeway/drivers/asset-tracker_v4. I suggest duplicating the folder somewhere safe and isolated in order to avoid any potential external file dependencies when testing
  3. Change the package.json's "name" property from "asset-tracker" to "abeeway-asset-tracker-driver-v4" and its "main" property from "./main.js" to "./src/index.js", make sure the version property is up-to-date (NPM will not accept the same package version twice)
  4. In the .npmignore file, remove "src", so it's uploaded with the npm package
  5. Create a README.md file and copy-paste the raw contents from this README file
  6. Run npm link in the asset-tracker_v4 folder
  7. Test that all the functions are correctly exported by creating a local tmp project, running npm link abeeway-asset-tracker-driver-v4 in it and running your JS test file (example: node ./tmp/index.js) to see if all exported functions are available
  8. Publish as an unscoped package onto npmjs (refer to the official npmjs documentation: https://docs.npmjs.com/creating-and-publishing-unscoped-public-packages)
  9. Test that everything works as expected with the published package
  10. Discard all changes (if on the main branch)
4.0.1

11 months ago

4.0.0

1 year ago