abeeway-asset-tracker-driver-v3
v3.0.2
Published
abeeway asset tracker AT3 js driver
Downloads
8
Readme
Abeeway Asset Tracker Driver V3 Package
Description
The IoT Flow Abeeway Asset Tracker driver V3 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-v3
Then:
//import the module
var driver = require("abeeway-asset-tracker-driver-v3");
//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-3. I suggest duplicating the folder somewhere safe and isolated in order to avoid any potential external file dependencies when testing
- Change the package.json's "name" property to "abeeway-asset-tracker-driver-v3" and its "main" property to "./src/index.js", make sure the version property is up-to-date (NPM will not accept the same package version twice)
- In the .npmignore file, remove "src", so it's uploaded with the npm package
- Create a README.md file and copy-paste the raw contents from this README file
- Run npm link in the asset-tracker-3 folder
- Test that all the functions are correctly exported by creating a local tmp project, running npm link abeeway-asset-tracker-driver-v3 in it and running your JS 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)