{"id":22859964,"url":"https://github.com/reelyactive/barnowl-hci","last_synced_at":"2025-04-30T17:46:27.788Z","repository":{"id":57144284,"uuid":"145709887","full_name":"reelyactive/barnowl-hci","owner":"reelyactive","description":"Collect ambient advertising packets from the Bluetooth Host Controller Interface (HCI) for real-time location and sensing.  We believe in an open Internet of Things.","archived":false,"fork":false,"pushed_at":"2025-03-22T14:47:43.000Z","size":268,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-30T18:34:22.435Z","etag":null,"topics":["barnowl","bluetooth-hci","bluetooth-hci-socket","bluetooth-low-energy","pareto-anywhere","raddec","raspberry-pi","raspberry-pi-bluetooth","rtls"],"latest_commit_sha":null,"homepage":"https://reelyactive.github.io/diy/pareto-anywhere-pi/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reelyactive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-22T13:02:30.000Z","updated_at":"2025-03-22T14:47:47.000Z","dependencies_parsed_at":"2024-04-03T16:47:48.265Z","dependency_job_id":"60116cab-5b58-4571-8143-b405481e2bda","html_url":"https://github.com/reelyactive/barnowl-hci","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reelyactive%2Fbarnowl-hci","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reelyactive%2Fbarnowl-hci/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reelyactive%2Fbarnowl-hci/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reelyactive%2Fbarnowl-hci/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reelyactive","download_url":"https://codeload.github.com/reelyactive/barnowl-hci/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251754239,"owners_count":21638482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["barnowl","bluetooth-hci","bluetooth-hci-socket","bluetooth-low-energy","pareto-anywhere","raddec","raspberry-pi","raspberry-pi-bluetooth","rtls"],"created_at":"2024-12-13T09:08:32.218Z","updated_at":"2025-04-30T17:46:27.770Z","avatar_url":"https://github.com/reelyactive.png","language":"JavaScript","funding_links":["https://www.buymeacoffee.com/stoprocent"],"categories":[],"sub_categories":[],"readme":"barnowl-hci\n===========\n\n__barnowl-hci__ converts the decodings of _any_ ambient Bluetooth Low Energy devices from a local Bluetooth Host Controller Interface (HCI) into standard developer-friendly JSON that is vendor/technology/application-agnostic.\n\n![Overview of barnowl-hci](https://reelyactive.github.io/barnowl-hci/images/overview.png)\n\n__barnowl-hci__ is a lightweight [Node.js package](https://www.npmjs.com/package/barnowl-hci) that can run on resource-constrained edge devices.  It can [forward data](#pareto-anywhere-integration) to reelyActive's [Pareto Anywhere](https://www.reelyactive.com/pareto/anywhere/) open source middleware suite, and can just as easily be run standalone behind a [barnowl](https://github.com/reelyactive/barnowl) instance, as detailed in the code examples below.\n\n\nQuick Start\n-----------\n\nClone this repository and install package dependencies with `npm install`.  If installation fails on your system, validate [these installation requirements](#installation-requirements).\n\nThen from the root folder run at any time:\n\n    npm start\n\nIf you observe a permissions error (ex: EPERM), either [assign the necessary privileges](#assigning-privileges) (recommended) or run as root (_not_ recommended).  __barnowl-hci__ will set the local Bluetooth radio to scan and print any processed [raddec](https://github.com/reelyactive/raddec) data to the console.\n\n\nHello barnowl-hci!\n------------------\n\nThe following code will listen to _simulated_ hardware and output packets to the console:\n\n```javascript\nconst BarnowlHci = require('barnowl-hci');\n\nlet barnowl = new BarnowlHci();\n\nbarnowl.addListener(BarnowlHci.TestListener, {});\n\nbarnowl.on(\"raddec\", function(raddec) {\n  console.log(raddec);\n});\n\nbarnowl.on(\"infrastructureMessage\", function(message) {\n  console.log(message);\n});\n```\n\nAs output you should see a stream of [raddec](https://github.com/reelyactive/raddec/) objects similar to the following:\n\n```javascript\n{\n  transmitterId: \"001122334455\",\n  transmitterIdType: 2,\n  rssiSignature: [\n    {\n      receiverId: \"000000000000\",\n      receiverIdType: 2,\n      rssi: -69,\n      numberOfDecodings: 1\n    }\n  ],\n  packets: [ '421655daba50e1fe0201050c097265656c79416374697665' ],\n  timestamp: 1547693457133\n}\n```\n\nRegardless of the underlying RF protocol and hardware, the [raddec](https://github.com/reelyactive/raddec/) specifies _what_ (transmitterId) is _where_ (receiverId \u0026 rssi), as well as _how_ (packets) and _when_ (timestamp).\n\n\nIs that owl you can do?\n-----------------------\n\nWhile __barnowl-hci__ may suffice standalone for simple real-time applications, its functionality can be greatly extended with the following software packages:\n- [advlib](https://github.com/reelyactive/advlib) to decode the individual packets from hexadecimal strings into JSON\n- [barnowl](https://github.com/reelyactive/barnowl) to combine parallel streams of RF decoding data in a technology-and-vendor-agnostic way\n\nThese packages and more are bundled together as the [Pareto Anywhere](https://www.reelyactive.com/pareto/anywhere) open source middleware suite, which includes several __barnowl-x__ listeners.\n\n\nSupported Listener Interfaces\n-----------------------------\n\nThe following listener interfaces are supported.\n\n### Socket\n\nListen on a local Bluetooth HCI interface.  Check the [bluetooth-hci-socket](https://www.npmjs.com/package/@abandonware/bluetooth-hci-socket) package for prerequisites specific to the target platform.  Note that not all platforms are supported.  It may be required to grant additional user privileges, or else run as super user (at your own risk).\n\n```javascript\nlet options = { enableActiveScanning: false,\n                scanIntervalMilliseconds: 10,\n                scanWindowMilliseconds: 10 };\nbarnowl.addListener(BarnowlHci.SocketListener, options);\n```\n\nThe default options are shown above.  Note that, according to the Bluetooth Core Specification:\n- valid interval \u0026 window durations are in the range of 2.5ms to 10.24s\n- the window duration cannot exceed the interval duration\n\n### Test\n\nProvides a steady stream of simulated reel packets for testing purposes.\n\n```javascript\nbarnowl.addListener(BarnowlHci.TestListener, {});\n```\n\n\nPareto Anywhere Integration\n---------------------------\n\n__barnowl-hci__ includes a script to forward data to a local [Pareto Anywhere](https://www.reelyactive.com/pareto/anywhere/) instance as UDP raddecs with target localhost:50001.  Start this script with the command:\n\n    npm run forwarder\n\nSee our [Run Pareto Anywhere on a Raspberry Pi](https://reelyactive.github.io/diy/pareto-anywhere-pi/#step02) and [Run Pareto Anywhere on a PC](https://reelyactive.github.io/diy/pareto-anywhere-pc/#step02) tutorials for instructions on how to run __barnowl-hci__ as a systemd service on boot on a Raspberry Pi or PC, respectively.\n\nTo instead forward UDP raddecs to a _remote_ Pareto Anywhere instance, start this script with the command:\n\n    npm run forwarder xxx.xxx.xxx.xxx\n\nwhere xxx.xxx.xxx.xxx is the IP address of the remote instance.\n\n\nAssigning Privileges\n--------------------\n\nIf required, assign the necessary privileges for Node.js to initiate a HCI scan on the given OS with the command:\n\n    npm run privileges\n\nOn Linux systems (such as the Raspberry Pi) this will run the following command to grant __cap_net_raw__ privileges so that _any_ Linux user may start a scan.\n\n    sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)\n\n\nInstallation Requirements\n-------------------------\n\n__barnowl-hci__ depends on the [bluetooth-hci-socket](https://www.npmjs.com/package/@stoprocent/bluetooth-hci-socket) package which _does not_ support all operating systems.  If your OS _is_ supported but a precompiled binary does not exist, npm will attempt to compile the binary using [node-gyp](https://www.npmjs.com/package/node-gyp) (which may need to be installed).\n\nOn Ubuntu/Debian Linux distributions, if node-gyp throws errors during installation, the _make_ and _g++_ prerequisites for compilation may need to first be installed with `sudo apt install make` and `sudo apt install build-essential` respectively.\n\n\nProject History\n---------------\n\n__barnowl-hci__ is based on the __bluetooth-hci-socket__ package which has been forked and maintained by various members of the open source community since 2015.  The initial versions of __barnowl-hci__ were based on Sandeep Mistry's original [bluetooth-hci-socket](https://www.npmjs.com/package/bluetooth-hci-socket).  The [@abandonware/bluetooth-hci-socket](https://www.npmjs.com/package/@abandonware/bluetooth-hci-socket) fork, which was adopted in 2019, can be found in the [release-0.3 branch](https://github.com/reelyactive/barnowl-hci/tree/release-0.3/).  And the [@stoprocent/bluetooth-hci-socket](https://www.npmjs.com/package/@stoprocent/bluetooth-hci-socket) fork, actively maintained at the time of writing, is currently used.\n\n\nAcknowledgements\n----------------\n\n__barnowl-hci__ is based on the [@stoprocent/bluetooth-hci-socket](https://www.npmjs.com/package/@stoprocent/bluetooth-hci-socket) open source Node.js package whose maintainer we invite you to consider supporting at [buymeacoffee.com/stoprocent](https://www.buymeacoffee.com/stoprocent).\n\n\nContributing\n------------\n\nDiscover [how to contribute](CONTRIBUTING.md) to this open source project which upholds a standard [code of conduct](CODE_OF_CONDUCT.md).\n\n\nSecurity\n--------\n\nConsult our [security policy](SECURITY.md) for best practices using this open source software and to report vulnerabilities.\n\n\nLicense\n-------\n\nMIT License\n\nCopyright (c) 2018-2025 [reelyActive](https://www.reelyactive.com)\n\nPermission 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:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR \nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, \nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE \nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER \nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, \nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN \nTHE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freelyactive%2Fbarnowl-hci","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freelyactive%2Fbarnowl-hci","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freelyactive%2Fbarnowl-hci/lists"}