BLE GATT Client Service on ODIN W2

Dev Board: C099-F9P Application Board
Modue: Odin W2
MbedOS Version: 5.13.5

Hi there,

I’m very new to Mbed OS (only started a months ago), I was trying to utilise the BLE functionality provided in the Odin module to read/write BYTE ARRAY values into an nRF51 ( GATT Server peripheral) based device.

So far I managed to successfully connect and write BYTE ARRAYs to a specific UUID in the peripheral device using my phone and an APP called nRF Master Control Panel App (Android).

I want to be able to do the same thing from the ODIN module and find a very simple code to handle it.
So far I’ve looked into all the BLE examples provided in the ARM/Mbed-OS github page, however they’re way too overcomplicated and they can’t provide me with what I need. The closest example to my issue would be the GATT Client example (I’ve tried looking into the LEDBlinker and LED examples but I’m not able to modify the peripheral’s code). See more for Examples

Hence, I was wondering if there’s an easier method to achieve what I want…

What I want:

  • The board to search for the peripheral and connect to it.
  • The board will then read the peripheral’s Services (I need the Fitness Machine Service) and retrieve the UUIDs.
  • The board will then modify a specific UUID value and send it over to the peripheral to reflect it.

Unfortunately, none of the examples have a well commented flow through showing how the BLE API pieces together… hence, it’s very difficult to understand what exactly is going on (for someone new to MbedOS).

Thank you

I see no one responded to your question.

Did you have any success?

Reviewing what you want, I would say that the LEDBlinker would be your best bet.

Now this example only connects to a peripheral device if the local name matches - see function:
void onAdvertisingReport(const ble::AdvertisingReportEvent &event)

This might not be ideal for your purposes. So, you could try one of the following - this code snippet checks for service UUID’s advertised (it also includes some code for COMPLETE_LIST_16BIT_SERVICE_IDS, which is probably what you’re after):

        if (field.type == ble::adv_data_type_t::INCOMPLETE_LIST_16BIT_SERVICE_IDS) {
            serial.printf("INCOMPLETE_16BIT_SERVIDS FOUND...\r\n");
        else if (field.type == ble::adv_data_type_t::COMPLETE_LIST_16BIT_SERVICE_IDS) {
            serial.printf("COMPLETE_16BIT_SERVIDS FOUND...\r\n");
            if ((field.value.size() > 1) && (field.value.size() < 256)) {
                for (uint8_t xx = 0; xx < field.value.size(); xx +=2) {
                    serial.printf(" - Service UUID: 0x%02X%02X ", field.value[xx+1], field.value[xx]);
        else if (field.type == ble::adv_data_type_t::INCOMPLETE_LIST_128BIT_SERVICE_IDS) {
            serial.printf("INCOMPLETE_128BIT_SERVIDS FOUND...\r\n");
        else if (field.type == ble::adv_data_type_t::COMPLETE_LIST_128BIT_SERVICE_IDS) {
            serial.printf("COMPLETE_128BIT_SERVIDS FOUND...\r\n");

Then the void trigger_toggled_write(const GattReadCallbackParams *response) { ... } has the write function, so just amended that.