Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

advlib

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

advlib

Open source, protocol-agnostic library for decoding ambient wireless packets. We believe in an open Internet of Things.

  • 1.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
147
increased by234.09%
Maintainers
1
Weekly downloads
 
Created
Source

advlib

advlib is a library for decoding ambient wireless packets into web-standard JSON with a vendor/technology/application-agnostic set of properties.

Overview of advlib

advlib 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 included in reelyActive's Pareto Anywhere open source middleware suite with its complementary processor and interpreter modules.

Processor modules

advlib is protocol-agnostic and currently supports the following processor modules:

  • advlib-ble for Bluetooth Low Energy
  • advlib-epc-tds for RAIN RFID (Electronic Product Code Tag Data Standard)
  • advlib-esp for the EnOcean Wireless Standard (via the EnOcean Serial Protocol)

Interpreter modules

advlib currently supports the following interpreter module:

Hello advlib!

For example, process several raw packets received from a beacon by selecting Bluetooth Low Energy as the processor (advlib-ble) and including any relevant processor and interpreter libraries.

const advlib = require('advlib');

const PROCESSORS = [
    { processor: require('advlib-ble'),
      libraries: [ require('advlib-ble-services'),
                   require('advlib-ble-manufacturers') ],
      options: { ignoreProtocolOverhead: true } }
];
const INTERPRETERS = [ require('advlib-interoperable') ];

let packets = [
    'c21d04acbe55daba16096164766c6962206279207265656c79416374697665',
    'c21904acbe55daba1216aafe10fc017265656c7961637469766507',
    'c21804acbe55daba1116aafe20000c4815200000004500000258'
];
let processedPackets = advlib.process(packets, PROCESSORS, INTERPRETERS);
console.log(processedPackets);

Paste the code above into a decoder.js file. From the same folder, install package dependencies with the commands npm install advlib, npm install advlib-ble, ..., npm install advlib-interoperable. Then run the code with the command node decoder.js and observe the packets combined, in order of precedence, into a single JSON:

{ name: "advlib by reelyActive",
  txPower: -4,
  uri: "https://www.reelyactive.com",
  batteryVoltage: 3.144,
  temperature: 21.125,
  txCount: 69,
  uptime: 60000 }

Standard Properties

advlib observes the following standard properties to represent the information extracted from ambient data packets. New standard properties are added whenever new data cannot be effectively represented using the existing properties. Once established, a standard property should not change (unless otherwise noted).

PropertyTypeNotes
accelerationArray of Number[ x, y, z ] In g
amperageNumberIn amps
amperagesArray of NumberIn amps
angleOfRotationNumberIn degrees
appearanceStringFrom Bluetooth
batteryPercentageNumber0 to 100 (%)
batteryVoltageNumberIn volts
deviceIdsArray of String
distanceNumberIn m
elevationNumberIn m
headingNumberIn degrees
heartRateNumberIn beats per minute
illuminanceNumberIn lx
interactionDigestArray of Object
isButtonPressedArray of Boolean
isContactDetectedArray of Boolean
isLiquidDetectedArray of Boolean
isMotionDetectedArray of Boolean
magneticFieldArray of Number[ x, y, z ] In G
nameString
nearestArray of Object
positionArray of Number[ lon, lat, ele ]
pressureNumberIn Pa
pressuresArray of NumberIn Pa
relativeHumidityNumber0 to 100 (%)
relayObjectSee note below
speedNumberIn m/s
temperatureNumberIn Celcius
temperaturesArray of NumberIn Celcius
txCountNumber
txPowerNumberIn dBm
uptimeNumberIn milliseconds
uriString
uuidsArray of String
versionStringFormat pending
voltageNumberIn volts
voltagesArray of NumberIn volts

Properties are intended to be as flat as possible to facilitate data manipulation, especially with respect to database schemas. One exception is the relay property which encapsulates ambient data intended for external processing by a third party. A relay Object has only one mandatory property, type, which is a String identifying the third party, and may also include any number of third-party-specific properties.

Some properties have a singular and plural form where the latter is to represent multiple properties of the same type from a single device (ex: sensor beacon with multiple temperature probes). In this case, the length of the Array is expected to correspond to the number of such instances supported by the device, with Array elements represented as null in the absence of a value.

See the reelyActive Developer's Cheatsheet for more details about the standard properties above which are considered to be dynamic ambient (dynamb) data.

advlib logo

What's in a name?

The name advlib, which is derived from "advertising library", sounds like ad-lib, hinting at the fact that decoding ambient data is often improvised, especially when little or no documentation is available!

The function of advlib is not unlike the Babel fish in Hitchiker's Guide to the Galaxy: "if you stick a Babel fish in your ear you can instantly understand anything said to you in any form of language." Hence, the Babel fish would make an obvious choice of mascot.

Why then did we choose the cuneiform symbol 𒄩 (KU6) as the advlib mascot? Something's fishy...

Let's ad-lib shall we? The Babel fish is likely a reference to the Tower of Babel which itself is a parable meant to explain why the world's peoples speak different languages. The tower may well have existed in ancient Babylon where the Sumerian/Akkadian languages were spoken. Cuneiform, the earliest known writing system, was originally developed to write the Sumerian language. And 𒄩 is the Sumerian cuneiform symbol for fish. So 𒄩 can arguably be decoded as Babel fish: the obvious choice of mascot indeed!

Does that seem like a completely implausable decoding of a cryptic message? Well that's exactly what advlib development often seemed like over the years!

Project History

The advlib project began in 2015 and was published in a scientific paper entitled Low-Power Wireless Advertising Software Library for Distributed M2M and Contextual IoT presented at the 2nd IEEE World Forum on Internet of Things (WF-IoT) in Milan, Italy that same year.

In 2020, advlib was redesigned and updated to v1.x which is modular, more efficient, protocol-agnostic and better supports the broad range of use cases that have emerged since its initial conception. The previous version remains available in the release-0.1 branch and as advlib@0.1.4 on npm.

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) 2015-2023 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.

Keywords

FAQs

Package last updated on 17 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc