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.

GATT Notifications at start up

I want to change the Simple GATT profile to configure an attribute which automatically send Gatt_Notifications from the beginning. Namely at the begining of the task, the notifications are enabled, without sending a command from the client to enable notifications. Any help please?

 

Thanks in advance

 

MartinR

  • Hello,

    You can put the functionality of the writeAttrCB in setAttrCB and then set this from the application code.  The Client Char Config should be persistent between connections according to the SIG specification, so you will have to be careful if this is part of an official SIG profile.  You can also just change the init value in SimpleProfile_AddService, or just ignore the CCC and send notification based on timer - but again, this may violate some portions of the spec.

    -Greg

     

  •  

    GregS thanks a lot... but i'm still in trouble. i have done the following function (below) but it doesn't work well. This function is called at begining of my task after SimpleProfile_AddService(). What am i do wrong? When I consult the charcfg from the client, its value didn't change. Thanks again...

    *********************************************************

    static gattCharCfg_t simpleProfileChar6Config[GATT_MAX_NUM_CONN];

    **********************************************************

     

    Function

    -----------------------------------

    bStatus_t simpleProfile_SetAttr_CFG_NOTIFY( )

    {

      bStatus_t status = SUCCESS;

      uint16 connHandle;

      gattAttribute_t *pAttr;

      pAttr = GATT_FindHandleUUID( 0x0000, 0xFFFF, simpleProfilechar6UUID,

                                                 ATT_BT_UUID_SIZE, &connHandle );

      status = simpleProfile_WriteCharCfg( connHandle,

                                           simpleProfileChar6Config, GATT_CLIENT_CFG_NOTIFY );

      if ( status == SUCCESS )  {

        VOID GAPBondMgr_UpdateCharCfg( connHandle, pAttr->handle,    GATT_CLIENT_CFG_NOTIFY );

      }

      return ( status );

    }