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.

请教CC2541修改char1,char2问题



在工程SimpleBLEPeripheral中,修改char1为notify&indicate,char2改为write,删除char3-5,用lightblue查看时,发现characteristic 2 user description后面出现9行FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF,这是什么原因呢?

想问一下,可以这样修改char1和char2吗?

  • 请问是什么样的应用场景 需要notification和indication要同时打开呢?

  • 现有双模产品是同时打开notification和indication,在调试单模时没注意到就这样设置了,改成只有notify也是同样的情况

  • 注意参考char4的配置,需要加一个config的值。

  • simpleGATTprofile.c文件

    static gattCharCfg_t simpleProfileChar1Config[GATT_MAX_NUM_CONN];

    static gattAttribute_t simpleProfileAttrTbl[SERVAPP_NUM_ATTR_SUPPORTED] =
    {
    ...
    // Characteristic 1 configuration
    {
    { ATT_BT_UUID_SIZE, clientCharCfgUUID },
    GATT_PERMIT_READ | GATT_PERMIT_WRITE,
    0,
    (uint8 *)simpleProfileChar1Config
    },
    ...
    }

    bStatus_t SimpleProfile_AddService( uint32 services )
    {
    ...
    // Initialize Client Characteristic Configuration attributes
    GATTServApp_InitCharCfg( INVALID_CONNHANDLE, simpleProfileChar1Config );
    ...
    }

    bStatus_t SimpleProfile_SetParameter( uint8 param, uint8 len, void *value )
    {
    bStatus_t ret = SUCCESS;
    switch ( param )
    {

    case SIMPLEPROFILE_CHAR1:
    if ( len == sizeof ( uint8 ) )
    {
    simpleProfileChar1 = *((uint8*)value);

    // See if Notification has been enabled
    GATTServApp_ProcessCharCfg( simpleProfileChar1Config, &simpleProfileChar1, FALSE,
    simpleProfileAttrTbl, GATT_NUM_ATTRS( simpleProfileAttrTbl ),
    INVALID_TASK_ID );
    }
    else
    {
    ret = bleInvalidRange;
    }
    break;
    ...
    }

    static void simpleProfile_HandleConnStatusCB( uint16 connHandle, uint8 changeType )
    {
    // Make sure this is not loopback connection
    if ( connHandle != LOOPBACK_CONNHANDLE )
    {
    // Reset Client Char Config if connection has dropped
    if ( ( changeType == LINKDB_STATUS_UPDATE_REMOVED ) ||
    ( ( changeType == LINKDB_STATUS_UPDATE_STATEFLAGS ) &&
    ( !linkDB_Up( connHandle ) ) ) )
    {
    GATTServApp_InitCharCfg( connHandle, simpleProfileChar1Config );
    }
    }
    }

    以上是关于char1,是参考char4来改的。char1与char2调换设置,lightblue查看char2还是出现9行UUID显示