noble / bleno

A Node.js module for implementing BLE (Bluetooth Low Energy) peripherals
MIT License
2.12k stars 447 forks source link

Ability to create a characteristic/descriptor with a specific handle #385

Open tautology0 opened 6 years ago

tautology0 commented 6 years ago

One of the most flexible use cases for bleno is replicating other BLE devices to understand how apps talk to them.

As many (especially the cheaper ones) don't necessarily follow the standards, there may be gaps in the handle range, or even handles outside services that contain data.

Could we have an extra attribute for Characteristic and Descriptor of "handle", which would place the characteristic/descriptor into that handle?

don commented 6 years ago

That's an interesting use case. It could probably work if the user specified all of the handles or none of the handles. You also need a way to talk care of descriptors like 0x2902 that get automatically added.

I suggest that you fork the repo and see if you can make it work. setServices is probably a good place to start looking at code.