微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI蓝牙设计交流 > CC2640 - 送GATT notification msg 2字元會error

CC2640 - 送GATT notification msg 2字元會error

时间:10-02 整理:3721RD 点击:

您好

我想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() //&noti, noti.pValue have data "ab"

    --> gattIndNoti() //msg->pIndNoti->handleValueNoti.pValue = "ab"

    --> sendWaitMatchCS()// 無法往下追了

是否有idea??

SIMPLEPROFILE_CHAR6 你自己加的吧? 他的value指向的是一个数组吗?

您好

是的,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()

上一篇:CC2640 OAD失败问题
下一篇:IOS ancs服务

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top