This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Notifications - help needed

Hi,

I'm having problems getting notifications working. My configuration is:

Central: iOS 8.4 on iPhone 6, Peripheral: custom hardware based on the CC2541F256 and simpleProfile reference design. Stack is 1.4.1.4308

I have analysed the code supporting SIMPLEPROFILE_CHAR4 in the simpleProfile codebase and also the Battery profile. I have focused on getting my code equal to the simpleProfile since the Battery profile does it slightly differently from the TI recommended way. However, I still cannot get it working.

The characteristic that I want notifications for is configured thus:

// ETBB_Profile Peripheral Status Characteristic Properties
static uint8 etbbProfilePeripheralStatusCharacProps = GATT_PROP_READ | GATT_PROP_NOTIFY;

// ETBB_Profile Peripheral Status Characteristic Value
static uint8 etbbProfilePeripheralStatusCharac = PERIPHERAL_STATUS_INITIAL_STATE;

// ETBB_Profile Peripheral Status Characteristic Client Configuration
static gattCharCfg_t *etbbProfilePeripheralStatusCharacConfig;

// ETBB_Profile Peripheral Status Characteristic User Description
static uint8 etbbProfilePeripheralStatusCharacUserDesc[18] = "Peripheral status\0";

and the attribute table entry looks like this:

static gattAttribute_t etbbProfileAttrTbl[ETBB_NUM_ATTR_SUPPORTED] = 
{
....

    // Declaration
    { 
      { ATT_BT_UUID_SIZE, characterUUID },
      GATT_PERMIT_READ, 
      0,
      &etbbProfilePeripheralStatusCharacProps
    },

      // Value
      { 
        { ATT_BT_UUID_SIZE, etbbProfilePeripheralStatusCharacUUID },
        GATT_PERMIT_READ | GATT_PERMIT_WRITE, 
        0, 
        &etbbProfilePeripheralStatusCharac
      },

      // Configuration
      { 
        { ATT_BT_UUID_SIZE, clientCharCfgUUID },
        GATT_PERMIT_READ | GATT_PERMIT_WRITE, 
        0, 
        (uint8 *)&etbbProfilePeripheralStatusCharacConfig
      },

      // User Description
      { 
        { ATT_BT_UUID_SIZE, charUserDescUUID },
        GATT_PERMIT_READ, 
        0, 
        etbbProfilePeripheralStatusCharacUserDesc
      },      

....

When I subscribe for notifications for this characteristic from iOS, the following code is not hit:
static bStatus_t etbbProfile_WriteAttrCB

....

      case GATT_CLIENT_CHAR_CFG_UUID:
        status = GATTServApp_ProcessCCCWriteReq( connHandle, pAttr, pValue, len,
                                                 offset, GATT_CLIENT_CFG_NOTIFY );
        break;

Should it be?

When the peripheral updates this characteristic via etbbProfile_setParameter, this line of code is hit:

    case ETBBPROFILE_PERIPHERAL_STATUS_CHARAC:
      if ( len == sizeof ( uint8 ) ) 
      {
        etbbProfilePeripheralStatusCharac = *((uint8*)value);
        
        // See if Notification has been enabled
        GATTServApp_ProcessCharCfg( etbbProfilePeripheralStatusCharacConfig, &etbbProfilePeripheralStatusCharac, FALSE,
                                    etbbProfileAttrTbl, GATT_NUM_ATTRS( etbbProfileAttrTbl ),
                                    INVALID_TASK_ID, etbbProfile_ReadAttrCB );

      }

but etbbProfilePeripheralStatusCharacConfig is 0x00 when it should be 0x01

Who should be setting this? My assumption was that it gets set by the client (iOS in my case) when it subscribes for notifications. Does this need to be set by the peripheral during initialization?

Kind regards,

ac