abeeway-asset-tracker-driver
v3.8.6
Published
abeeway asset tracker AT2 js driver
Readme
Abeeway Asset Tracker Driver Package
Description
The IoT Flow Abeeway Asset Tracker driver 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-driverThen:
Import the module
var driver = require("abeeway-asset-tracker-driver");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:
- Clone this repo: https://github.com/actility/device-catalog
- Go to
./vendors/abeeway/drivers/asset-tracker. I suggest duplicating the folder somewhere safe and isolated to avoid any potential external file dependencies when testing. - Change the
package.jsonfile:- Update the
"name"property to"abeeway-asset-tracker-driver". - Update the
"main"property to"./src/index.js". - Ensure the
"version"property is up-to-date (NPM will not accept the same package version twice).
- Update the
- In the
.npmignorefile, remove"src"so it's uploaded with the npm package. - Create a
README.mdfile and copy-paste the raw contents from this README file. - Run
npm linkin theasset-trackerfolder. - Test that all the functions are correctly exported:
- Create a local temporary project.
- Run
npm link abeeway-asset-tracker-driverin it. - Run your JavaScript test file (example:
node ./tmp/index.js) to see if all exported functions are available.
- Publish as an unscoped package onto npmjs (refer to the official npmjs documentation: https://docs.npmjs.com/creating-and-publishing-unscoped-public-packages).
- Test that everything works as expected with the published package.
- Discard all changes (if on the main branch).
