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

How to write to a custom 128 UUID service using pc-ble-driver-py

I am using pc-ble-driver-py to configure an nRF52832 demo board as a BLE central device. I currently have the heart_rate_collector.py example working. However, what I would like to do now is scan for all BLE peripheral devices, collect to one arbitrarily, discover custom services and then write to a specific custom service. I'm looking for example code on how to do this.

Parents Reply
  • If you look in the documentation of the Nordic UART service, you can see that the service have the 15-bit offset UUID 0x0001, RX characteristic have 16-bit offset UUID 0x0002, and TX charactertistic have 16-bit offset UUID of 0x0003. Both the service and the two charactertistics use the same base UUID of 6E400000-B5A3-F393-E0A9-E50E24DCCA9E. You should define your charactertistics in the same way, first define the base UUID, and then define the charactertistics UUIDs using this base UUID:

    BASE_UUID          = BLEUUIDBase([0x00, 0x11, 0x00, 0x00, 0x22, 0x33, 0x44, 0x55, 
                                      0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD]);
    SERIALWRITE_UUID   = BLEUUID(0x20D0, BASE_UUID);
    SERIALNOTIFY_UUID  = BLEUUID(0x818B, BASE_UUID);
    
Children
No Data
Related