2 Replies Latest reply on May 14, 2014 10:48 AM by dbell

    app write to GATT database not working

      My central can read the build-time value (0x11, 0x12,...) of HANDLE_PACKED_PWR_RX_RECORD from peripheral's GATT database ok, but when peripheral app writes a change to it, it does not change -- central continues to read build-time.

      system_bluetooth_profile[]..........

       

      PERIPHERAL INITS GATT VALUE AT BUILD-TIME HERE...........

       

      PRIMARY_SERVICE_UUID128 (0x0050, GENERIC_WAVORA_DEVICE_SERVICES_UUID_BROADCOM),

      // Handle 0x51: characteristic declaration

      // Handle 0x52: characteristic value (HANDLE_COMMUNICATION_ESTABLISHMENT)

      //

      // This characteristic declaration and value is used to either enable or

      // disable power to the Sink device.

      // value = 0x01 = Power is enabled to the Sink device

      // value = 0x00 = Power is disabled to the Sink device

      //

       

      // PWR TX MGR message to PWR RX or FACE to signal start of communication sessions:

      CHARACTERISTIC_UUID128_WRITABLE (0x0051, HANDLE_COMMUNICATION_ESTABLISHMENT, COMMUNICATION_ESTABLISHMENT_WRITE_CHARACTERISTIC_UUID_BROADCOM,

      LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_WRITE,

      LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_CMD | LEGATTDB_PERM_WRITE_REQ, 1),

      0x00,

       

      // PWR TX MGR message to PWR RX to read PWR RX status or write PWR RX control:

      CHARACTERISTIC_UUID128 (0x0053, HANDLE_PACKED_PWR_RX_RECORD, DEVICE_READ_STATUS_WRITE_CONTROL__CHARACTERISTIC_UUID_BROADCOM,

      LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_WRITE,

      LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_CMD | LEGATTDB_PERM_WRITE_REQ,

      sizeof( Packed_Common_Record_struct) ), // size is 20 bytes

      sizeof( Packed_Common_Record_struct) , // max size [modifiable records only] is 20 bytes

      // Build-time PWR RX status and control dummy data:

      0x11, 0x12, 0x13, 0x14, 0x21, 0x22, 0x23, 0x24, 0x31, 0x32, 0x33, 0x34, 0x41, 0x42, 0x43, 0x44, 0x51, 0x52, 0x53, 0x54,

       

       

        

      Once a second I do this:......

      PERIPHERAL CHANGES GATT VALUE ONCE A SECOND HERE.........

      // Get GATT database record that contains PWR RX packed status:

      BLEPROFILE_DB_PDU gatt_record_buffer;

      // Read record from GATT database to gatt_record_buffer:

      bleprofile_ReadHandle(HANDLE_PACKED_PWR_RX_RECORD, &gatt_record_buffer); // init PWR_RX_status_record

        

      char* ptr = (char*)&gatt_record_buffer;

      ptr[0] = 0x55;

        unsigned char* heartbeat_counter = (unsigned char*)&ptr[4];

      *heartbeat_counter += 1;

      // Copy record to GATT database:

        bleprofile_WriteHandle( HANDLE_PACKED_PWR_RX_RECORD, &gatt_record_buffer);

      BUT CENTRAL CONTINUES TO READ BUILD-TIME VALUE.