您好
我想cc2640走BT透過SimpleProfile_SetParameter()送data到pc tool讀取,
但我發現當送2個字元時會失敗,而其它長度的值都成功,以下測試說明:
SimpleProfile_SetParameter(SIMPLEPROFILE_CHAR6, 1, "a"); // pc端能正常讀到"a"
SimpleProfile_SetParameter(SIMPLEPROFILE_CHAR6, 2, "ab"); // pc端讀不到
SimpleProfile_SetParameter(SIMPLEPROFILE_CHAR6, 3, "abc"); // pc端正常讀到"abc"
SimpleProfile_SetParameter(SIMPLEPROFILE_CHAR6, 4, "abcd"); // pc端正常讀到"abcd"
一路往下追:
–> GATTServApp_ProcessCharCfg() //simpleProfileChar6 have data "ab"
–> gattServApp_SendNotiInd() //pAttr->pValue have data "ab"
–> GATT_Notification() //¬i, noti.pValue have data "ab"
–> gattIndNoti() //msg->pIndNoti->handleValueNoti.pValue = "ab"
–> sendWaitMatchCS()// 無法往下追了
是否有idea??
Yue TANG:
SIMPLEPROFILE_CHAR6 你自己加的吧? 他的value指向的是一个数组吗?
kuo austin:
回复 Yue TANG:
您好
是的,simpleProfileChar6[20] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
SIMPLEPROFILE_CHAR6_LEN = 20;
SimpleProfile_SetParameter(SIMPLEPROFILE_CHAR6, 2, "ab");會跑以下case
static gattCharCfg_t *simpleProfileChar6Config;
bStatus_t SimpleProfile_SetParameter( uint8 param, uint8 len, void *value )
{
case SIMPLEPROFILE_CHAR6: if ( len <= SIMPLEPROFILE_CHAR6_LEN ) //len = 上面function帶的2 { notiChar6Len = len; VOID memcpy( simpleProfileChar6, value, len );
// See if Notification has been enabled GATTServApp_ProcessCharCfg( simpleProfileChar6Config, simpleProfileChar6, FALSE, simpleProfileAttrTbl, GATT_NUM_ATTRS( simpleProfileAttrTbl ), INVALID_TASK_ID, simpleProfile_ReadAttrCB ); }
}
搞不懂為何只有兩字元會失敗,也比較過送1字元/兩字元/三字元皆有送下去gattIndNoti()