barnowl-reel
v0.2.1
Published
Collect ambient Bluetooth Low Energy packets from reelyActive reelceivers for real-time location and sensing. We believe in an open Internet of Things.
Downloads
61
Maintainers
Readme
barnowl-reel
barnowl-reel converts RF decodings from reelyActive reels into software-developer-friendly JSON: a real-time stream of raddec objects which facilitate any and all of the following applications:
- RFID: what is present, based on the device identifier?
- RTLS: where is it relative to the receiving devices?
- M2M: how is its status, based on any payload included in the packet?
barnowl-reel is a lightweight Node.js package that can run on resource-constrained edge devices as well as on powerful cloud servers and anything in between. It is typically run behind a barnowl instance which is included in the Pareto Anywhere open source middleware suite.
Installation
npm install barnowl-reel
Hello barnowl-reel!
The following code will listen to simulated hardware and output packets to the console:
const BarnowlReel = require('barnowl-reel');
let barnowl = new BarnowlReel();
barnowl.addListener(BarnowlReel.TestListener, {});
barnowl.on("raddec", function(raddec) {
console.log(raddec);
});
barnowl.on("infrastructureMessage", function(message) {
console.log(message);
});
As output you should see a stream of raddec objects similar to the following:
{
transmitterId: "fee150bada55",
transmitterIdType: 3,
rssiSignature: [
{
receiverId: "001bc50940810000",
receiverIdType: 1,
rssi: -83,
numberOfDecodings: 1
},
{
receiverId: "001bc50940810001",
receiverIdType: 1,
rssi: -91,
numberOfDecodings: 1
}
],
packets: [ '421655daba50e1fe0201050c097265656c79416374697665' ],
timestamp: 1547693457133
}
Regardless of the underlying RF protocol and hardware, the raddec specifies what (transmitterId) is where (receiverId & rssi), as well as how (packets) and when (timestamp).
Is that owl you can do?
While barnowl-reel may suffice standalone for simple real-time applications, its functionality can be greatly extended with the following software packages:
- advlib to decode the individual packets from hexadecimal strings into JSON
- barnowl to combine parallel streams of RF decoding data in a technology-and-vendor-agnostic way
These packages and more are bundled together as the Pareto Anywhere open source middleware suite, which includes several barnowl-x listeners.
Supported Listener Interfaces
The following listener interfaces are supported.
UDP
barnowl.addListener(BarnowlReel.UdpListener, { path: '0.0.0.0:50000' });
Serial
Manually install the serialport package, taking care to first meet any prerequisites for the target platform:
npm install serialport
barnowl.addListener(BarnowlReel.SerialListener, { path: 'auto' });
Note that barnowl-reel v0.2 is adapted to work with serialport v10.x. If errors are encountered, try forcing an install of serialport 10 with npm install [email protected]
On Ubuntu, it may be necessary to add the user to the dialout group in order to have the necessary permissions to access the device, which can be accomplished with the command sudo usermod -a -G dialout $USER
and made to take effect by logging out and back in to the user account.
Event
Listen for reel data as an EventEmitter's "data" events. Either Buffer or hexadecimal string data is accepted.
barnowl.addListener(BarnowlReel.EventListener,
{ path: eventEmitterInstance });
Test
Provides a steady stream of simulated reel packets for testing purposes.
barnowl.addListener(BarnowlReel.TestListener, {});
Pareto Anywhere Integration
barnowl-reel includes a script to forward serial/USB data to a local Pareto Anywhere instance as UDP raddecs with target localhost:50001. Manually install the serialport dependency with npm install serialport
and then start this script with the command:
npm run serial-forwarder
Supported Decoding Options
Each listener interface supports decodingOptions with the following properties:
| Property | Default | Description | |:----------------|:--------|:------------------------------------| | maxReelLength | 254 | Ignore packets that (spuriously) exceed the given reel length | | minPacketLength | 0 | Ignore radio packets with less than the given number of bytes length | | maxPacketLength | 255 | Ignore radio packets with more than the given number of bytes length |
For example, the decoding options for a UDP listener expecting a single reelceiver and BLE packets would be specified as follows:
let options = { maxReelLength: 1, minPacketLength: 8, maxPacketLength: 39 };
barnowl.addListener(BarnowlReel.UdpListener,
{ path: '0.0.0.0:50000', decodingOptions: options });
In most cases, explicit decodingOptions are not required. In cases where the reel serial data stream is susceptible to corruption, explicit decodingOptions can limit occurrences of spurious/missed packets.
Contributing
Discover how to contribute to this open source project which upholds a standard code of conduct.
Security
Consult our security policy for best practices using this open source software and to report vulnerabilities.
License
MIT License
Copyright (c) 2014-2022 reelyActive
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.