Basic example - using netrunr-gapi-async JS SDK to capture Bluetooth advertisement
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Basic Nodejs example of using Axiomware's netrunr-gapi-async Javascript SDK to scan for advertisements

Program to illustrate Netrunr API functions. The program will perform the following functions: 1) connect to your account, 2) list all gateways associated with this account, 3) connect to the first gateway in the list, 4) open a network connection, 5) get version information from the gateway, 6) initiate advertisement scan and print(to screen) key information from the advertisement packets, 7) Step 6 is repeated until user ends the program by using CTRL-C.

This example uses promises and async/await functionality present in Nodejs version 8.+.

SDK, Documentation and examples


  • Netrunr B24C gateway
  • Axiomware cloud account. See the Netrunr quick start guide on creating an account.
  • Nodejs (see for download and installation instructions)
    • Nodejs version 8.x.x is required due to the use of promises/async/await
  • NPM (Node package manager - part of Nodejs)
  • Windows, MacOS or Linux computer with access to internet
  • One or more Bluetooth LE devices that are advertising.


Clone the repo

git clone

or download as zip file to a local directory and unzip.

Install all module dependencies by running the following command inside the directory

npm install

Optional customization before running the program

You can make the following changes to customize the behavior:

  • Change advertisement scan period.
  • Change scan mode to active or passive.
//User configuration
var userConfig = {           
    'scanPeriod': 1,    // seconds of advertising scan
    'scanMode': 1,      // 1-> active, 0-> passive
  • Change the content of information printed on the screen by modifying axAdvExtractData() function.
function axAdvExtractData(advItem) {
    advObj = {
        ts: dateTime(advItem.tss + 1e-6 * advItem.tsus),    //Time stamp
        did: addrDisplaySwapEndianness(advItem.did),        //BLE address
        dt: advItem.dtype,                                  // Adress type
        ev: advItem.ev,                                     //adv packet type
        rssi: advItem.rssi,                                 //adv packet RSSI in dBm
        name: axParseAdvGetName(advItem.adv, advItem.rsp),  //BLE device name
        //adv1: advItem.adv,       //payload of adv packet - uncomment to print on screen
        //rsp1: advItem.rsp,       //payload of rsp packet - uncomment to print on screen
    return advObj;


Run the nodejs application:

node appAdvScannerAsync.js

To exit the program, use:


Error conditions

  • If the program is not able to login, check your credentials.
  • If the gateway is not listed in your account, it may not have been successfully provisioned. See the Netrunr quick start guide for provisioning the gateway.
  • Not able to get version information of the gateway. Check if gateway is powered ON and has access to internet. Also, check if firewall is blocking internet access.


In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.