This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How shall i define Service Data in BLE Scan Response Data ?

This is the implemenatation spec for GATT server database (reader) firmware i am working on.

I have implemented advertisement packet using nRF Connect SDK latest.

Not sure how to declare 8-byte Service Data ? 

I have the 8-byte value with me.

This is how i have implemented

            uint8_t reader_serial_number[8] = some value;
            const struct bt_data service_sd[] =
            {
                BT_DATA_SVC_DATA16, 8, reader_serial_number
            };
But in the mobile app it shows like
Service Data: UUID: first two bytes (flipped bytes) and Data: Last 6 bytes correct order
Not sure what is wrong. Please explain and correct my implementation.
Thanks.
Parents Reply Children
  • Ok, i got it to work by trying various syntax

                const struct bt_data service_sd[] =
                {
                   
                    BT_DATA_BYTES(BT_DATA_SVC_DATA128, BT_UUID_SERVICE_VAL, reader_serial_number[0],
                                                                                                                                           reader_serial_number[1],
                                                                                                                                           reader_serial_number[2],
                                                                                                                                           reader_serial_number[3],
                                                                                                                                          reader_serial_number[4],
                                                                                                                                          reader_serial_number[5],
                                                                                                                                          reader_serial_number[6],
                                                                                                                                          reader_serial_number[7]),

                };
    The field 'service data' has two propoerties to fill in : UUID and Data. UUID is same as Primary Service
Related