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.

关于connHandle的问题



hi,各位大神:

最近我想使用Notification的方式通信,在编写程序的过程中遇到几个函数,比如:

bStatus_t GATT_Notification( uint16 connHandle, attHandleValueNoti_t *pNoti,uint8 authenticated );

uint16 GATTServApp_ReadCharCfg( uint16 connHandle, gattCharCfg_t *charCfgTbl );

bStatus_t GATT_WriteCharValue( uint16 connHandle, attWriteReq_t *pReq, uint8 taskId );

这几个函数里面都有一个参数connHandle,我一直没有搞明白这个参数到底是什么含义,应该如何获取?

如果我定义的Profile Attributes - Table如下:

static gattAttribute_t AttrTbl[SERVAPP_NUM_ATTR_SUPPORTED] =
{
      /* Service*/
    {
        { ATT_BT_UUID_SIZE, primaryServiceUUID },
        GATT_PERMIT_READ, 
        0, 
        (uint8 *)&accelService
     },      

        /* Declaration*/
    {
        { ATT_BT_UUID_SIZE, characterUUID },
        GATT_PERMIT_READ,
        0,
         &TimeCharProps
     },
     /* Value*/
     {
          { ATT_BT_UUID_SIZE, TransmitTimeUUID },
          GATT_PERMIT_READ | GATT_PERMIT_WRITE,
           0,
           (uint8 *)&DeviceTime
     },
     /* configuration*/
     {
          { ATT_BT_UUID_SIZE, clientCharCfgUUID },
         GATT_PERMIT_READ | GATT_PERMIT_WRITE,
          0,
           (uint8 *)TimeConfigCoordinates
      },

          /*  Declaration*/
      {
          { ATT_BT_UUID_SIZE, characterUUID },
         GATT_PERMIT_READ,
          0,
         &DataNOTICharProps
       },
       /*  Value*/
      {
          { ATT_BT_UUID_SIZE, TransmitMACUUID },
           0,
           0,
           (uint8 *)(&SendData)
       },
        /* configuration*/
       {
          { ATT_BT_UUID_SIZE, clientCharCfgUUID },
          GATT_PERMIT_READ | GATT_PERMIT_WRITE,
          0,
          (uint8 *)DataNOTIConfigCoordinates
        },

}

  编程时为了使能peripheral的notification来上传Data,我想在central中将我上面定义的data特性的congfiguration值写入0x0001,那么我需要调用GATT_WriteCharValue函数,此时connHandle应该是多少或者怎么得到?如果我已经使能notification,那么我在调用GATT_Notification时,这里的connHandle又应该是多少?