BLE device Simulator

I just started working for a project where I need to implement simple application for custom BLE device. Basically what I would need to do, is to read characteristics values, show them in the UI and store the data in a file.

This sounds pretty easy, however, the BLE device is currently under development, and I would not be getting one for the next couple of weeks.

I’m really eager on getting started with it, and as the task for the app is really simply to find a device, connect to it and to monitor & store values from it, I got thinking that maybe I could make a simple simulator that would fake the device.

And as I do have Android device which is supporting full peripheral mode, I indeed can get it done rather easily. Basically what I need to do, is to check what kind of stuff my Polar H7 is advertising, and then simply doing the same with my own BLE advertiser.

The result project is called HeartBeatSimulator and as always, its open source project available under my GitHub repository.

Note that, if you use the examples used with my Using BLE GATT services with Windows 10, you would need to remember that Windows does use caching when pairing Bluetooth devices, thus first do remove any existing paring for the device and then do following:

  1. Do run the simulator in android device first (and let it run in background while doing pairing)
  2. Open Bluetooth settings in the android device
  3. Switch to Windows device, and open Bluetooth settings. Do enable Bluetooth if its disabled
  4. Start pairing from Windows device, and if there is multiple entries shown for the device, so pair all of them (The right BLE device would be the one that asks you to supply 6 digits ID on the android side, so remember to fill it right)
  5. After successfull paring, start the Windows application (the one that reads the values from the simulator)
  6. Search devices, and Select the simulator device to connect to it.
  7. With first time usage, the Windows device will ask permission to use the BLE simulator device, and you need to accept this.
  8. After this, the data from the simulator should be updated to the Windows app normally.

With the Foreground Example I made earlier, I did notice that for some reason the call to ReadClientCharacteristicConfigurationDescriptorAsync  inside the HeartbeatEngine does harng, thus before I get it fixed, you should simply comment out the line. Anyway, do make sure you call the WriteClientCharacteristicConfigurationDescriptorAsync, since if its not handled, the value changed event’s will not be delivered to your app.