This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Can I combine beacon code and HID keyboard code?

I need an application that always advertise the beacon information, such as RSSI and Major and Minor value. At the same time I would like to transmit HID keyboard code. Is it possible to combine these two code? I read somewhere that beacon information is just same as advertising information in a specific format. So if I modify advertising part of HID code, do I get what I want?

Thanks

  • Yes, it is an option to modify adv. data to conform with iBeacon (or do you want something else?) format. HID keyboard is connection based Service so you just need to make sure that device which should use it connects to that advertisement. If you want to advertise even when there is a connection then you can by starting another Peripheral role. Just note that strictly speaking iBeacon should be non-connectable advertisement which would of course break the functionality of HID keyboard. However it works even if you keep the AD flags signalling that Broadcaster is connectable (meaning it can become Peripheral once some Central device issues CONNECT_REQ).

    You can also solve it differently: latest BLE stacks (Nordic as well as open source variants) support multiple concurrent roles so you can use one Broadcaster role with non-connectable iBeacon packets and second with HID keyboard. On some versions of stack it might require little bit of fiddling but should be possible (mainly if you don't care that iBeacon packets will be connectable).

Related