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

RE: GATT profile : value updation

Hi,

We are working with the nrf51822 on mBed platform

We have created the following profile under deviceinformationservices

in main.c

uint8_t DataCounter = 100; 

in void bleInitComplete(BLE::InitializationCompleteCallbackContext *params)

  deviceInfo = new DeviceInformationService(ble, "ARM", "Model1", "SN1", "hw-rev1", "fw-rev1", "soft-rev1","ON");

in while loop

    DataCounter++;
    if (DataCounter == 175) { 
        DataCounter = 100;
        }            
deviceInfo->updateDataRate(DataCounter);

in deviceinformationsevices.h

in the constructor added the following
 uint8_t DataCounter  = NULL   
 valueBytes(DataCounter),
        emailStringCharacteristic(GattCharacteristic::UUID_EMAIL_ADDRESS,
                                              &DataCounter,
                                             (DataCounter != NULL) ? sizeof(DataCounter) : 0, /* Min length */
                                             (DataCounter != NULL) ? sizeof(DataCounter) : 0, /* Max length */
                                           GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ )
     GattCharacteristic *charTable[] = {&emailStringCharacteristic}; //Added Idris here

class function
    void updateDataRate(uint8_t DataCounter) {
        valueBytes.updateDataRate(DataCounter);
        ble.gattServer().write(emailStringCharacteristic.getValueHandle(), valueBytes.getPointer(), valueBytes.getNumValueBytes());
    }

private:
    BLE                &ble;
    GattCharacteristic  emailStringCharacteristic;

We are unable to update the data with the above updates kindly help us with the same.

Thanks and regards. Siddharth

Parents Reply Children
No Data
Related