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

Getting started with ble-driver-py emulating a device

Hi all,

I am trying to emulate a device with ble-driver-py. What I am looking is to have a device advertise, provide few services with respective characteristics (read, read/write notify), ideally also a custom service with custom characteristics provided.

The main idea here is having a sort of device simulator that is console / CI friendly. I have gone trough provided examples (advertise.py does advertise but does not provide any services/ characteristics and heart_rate_collector.py is central not peripheral), but have not found anything relevant.

Going trough code I've identified classes

BLECharProperties
BLECharacteristic
BLEService

and functions

ble_gatts_service_add
ble_gatts_characteristic_add
as relevant/interesting.
I would like to run it on nRF52840 DK, platform is Mac / OSX (had to recompile driver as Python paths provided in pip ble-driver were different from my system). I've already run and tested advertisement.py
Any hints/resources/documentation/examples as that would speed me up and help quite a bit.
Any idea where I can find such examples?
Best,
Bogdan
Parents
  • Hi,

    While pc-ble-driver-py does not have many examples, you should be able to leverage the fact that it is serialization of our BLE stack (SoftDevice). The bulk of the API is a direct mapping to the (BLE related parts of the) SoftDevice API, and so it is covered by the SoftDevice documentation.

    Our nRF5 SDK, for building applications running on the nRF52 SoC, includes libraries built on top of and in addition to the SoftDevice, in order to give a full set of features for building BLE applications. Most notably it adds BLE services and functionality for handling bonded devices. You can use the SDK and its libraries as reference, for your pc-ble-driver-py implementations.

    Regards,
    Terje

  • Hi Terje,
    Thank you for a fast answer. 
    Guess I'll go digging trough code for solution Slight smile

    BR,
    Bogdan

Reply Children
No Data