Skip to content

kabbi/ble-mesh

Repository files navigation

ble-mesh

This is VERY EXPERIMENTAL, WORK IN PROGRESS implementation of BLE Mesh v1.0 specification on top of noble library, allowing it to work on PCs, Macs and Raspberry PIs.

Try it now (if you have provisioned mesh network):

cp ./keychain.json.example ./keychain.json
vi ./keychain.json # Add your mesh keys here
DEBUG=app:* npm run blink 0x0001 # Specify the target device with Generic OnOff model here
# Voila, the blink should commence

Working features:

  • basic mesh crypto
  • handling segmented incoming messages
  • sending and receiving generic on-off messages

TODO:

  • node provisioning (it's easier to do that with mobile app anyway)
  • handling segmented outgoing messages
  • figure out seq numbers saving and restoring
  • better api for high-level mesh operations
  • web bluetooth support and demo app
  • node and element discovery

Development

This project is using flow for static type checking and jest to ensure everything works as expected. Run npm test -- --watch anytime you want to change something.

I was mostly using Nordic nRF Mesh app to provision and test my devices, and to capture network packet dump to test my implementation. Thank you, Nordic team!

Interesting code places:

  • src/layers/*.js - low-level mesh network layers implementation, handling binary parsing, security, etc.
  • src/layers-e2e.test.js - example of end-to-end usage: message sending and receiving
  • src/models/*.js - model message definitions, add your vendor and sig models here
  • src/utils/mesh-crypto.js - main crypto implementation
  • src/packets.js - base packet structure definitions
  • decrypt.js - simple tool to decrypt received messages, useful for debugging

ToDo:

  • move some things between layers
  • network discovery
  • proxy control

Releases

No releases published

Packages

No packages published