芯片:CC2640R2F
工程:SimplePeripheral
SDK: simplelink_cc2640r2_sdk_2_20_00_49
说明:在学习蓝牙,仿照SimplePeripheral里面的CHAR4仿写了一个数组,利用BTool+HostTest联调查看效果,发现如下图:
如红框中所示,Uuid Description显示为Unknow,我在调试过程中曾经忘记修改simpleProfileAttrTbl,将其中属性表value部分误写为simpleProfilechar4UUID,发现这样错误着写反而功能正常,我改回simpleProfilechar6UUID之后反而不正常了,所有参数都不能读,会报错。simpleProfileAttrTbl如下:
static gattAttribute_t simpleProfileAttrTbl[SERVAPP_NUM_ATTR_SUPPORTED] = {// Simple Profile Service{{ ATT_BT_UUID_SIZE, primaryServiceUUID }, /* type */GATT_PERMIT_READ,/* permissions */0,/* handle */(uint8 *)&simpleProfileService/* pValue */},// Characteristic 1 Declaration{{ ATT_BT_UUID_SIZE, characterUUID },GATT_PERMIT_READ,0,&simpleProfileChar1Props},// Characteristic Value 1{{ ATT_BT_UUID_SIZE, simpleProfilechar1UUID },GATT_PERMIT_READ | GATT_PERMIT_WRITE,0,&simpleProfileChar1},// Characteristic 1 User Description{{ ATT_BT_UUID_SIZE, charUserDescUUID },GATT_PERMIT_READ,0,simpleProfileChar1UserDesp},// Characteristic 2 Declaration{{ ATT_BT_UUID_SIZE, characterUUID },GATT_PERMIT_READ,0,&simpleProfileChar2Props},// Characteristic Value 2{{ ATT_BT_UUID_SIZE, simpleProfilechar2UUID },GATT_PERMIT_READ,0,&simpleProfileChar2},// Characteristic 2 User Description{{ ATT_BT_UUID_SIZE, charUserDescUUID },GATT_PERMIT_READ,0,simpleProfileChar2UserDesp},// Characteristic 3 Declaration{{ ATT_BT_UUID_SIZE, characterUUID },GATT_PERMIT_READ,0,&simpleProfileChar3Props},// Characteristic Value 3{{ ATT_BT_UUID_SIZE, simpleProfilechar3UUID },GATT_PERMIT_WRITE,0,&simpleProfileChar3},// Characteristic 3 User Description{{ ATT_BT_UUID_SIZE, charUserDescUUID },GATT_PERMIT_READ,0,simpleProfileChar3UserDesp},// Characteristic 4 Declaration{{ ATT_BT_UUID_SIZE, characterUUID },GATT_PERMIT_READ,0,&simpleProfileChar4Props},// Characteristic Value 4{{ ATT_BT_UUID_SIZE, simpleProfilechar4UUID },0,0,&simpleProfileChar4},// Characteristic 4 configuration{{ ATT_BT_UUID_SIZE, clientCharCfgUUID },GATT_PERMIT_READ | GATT_PERMIT_WRITE,0,(uint8 *)&simpleProfileChar4Config},// Characteristic 4 User Description{{ ATT_BT_UUID_SIZE, charUserDescUUID },GATT_PERMIT_READ,0,simpleProfileChar4UserDesp},// Characteristic 5 Declaration{{ ATT_BT_UUID_SIZE, characterUUID },GATT_PERMIT_READ,0,&simpleProfileChar5Props},// Characteristic Value 5{{ ATT_BT_UUID_SIZE, simpleProfilechar5UUID },GATT_PERMIT_AUTHEN_READ,0,simpleProfileChar5},// Characteristic 5 User Description{{ ATT_BT_UUID_SIZE, charUserDescUUID },GATT_PERMIT_READ,0,simpleProfileChar5UserDesp},// Characteristic 6 Declaration{{ ATT_BT_UUID_SIZE, characterUUID },GATT_PERMIT_READ,0,&simpleProfileChar6Props},// Characteristic Value 6{{ ATT_BT_UUID_SIZE, simpleProfilechar6UUID },GATT_PERMIT_READ | GATT_PERMIT_WRITE,0,simpleProfileChar6},// Characteristic 6 configuration{{ ATT_BT_UUID_SIZE, clientCharCfgUUID },GATT_PERMIT_READ | GATT_PERMIT_WRITE,0,(uint8 *)&simpleProfileChar6Config},// Characteristic 6 User Description{{ ATT_BT_UUID_SIZE, charUserDescUUID },GATT_PERMIT_READ,0,simpleProfileChar6UserDesp}, };
在线等大神指点。
z z46:
这个是BTool尝试读取数据时报的错
z z46:
回复 z z46:
找到问题了,我声明的static uint8 simpleProfileChar6[SIMPLEPROFILE_CHAR6_LEN] = {0};,长度为40Bytes,如果改为20就没问题了,但是改到30也不行,是GATT层不允许传递长度超过一定阈值的数据吗?请问这个阈值可以修改吗?在哪里修改?
z z46:
回复 Susan Yang:
是的,这正是我想找的!谢谢大神~~!!
以及,我现在用的调试工程是simpleperipheral+hosttest组合,请问这个组合里面client应该是hosttest吧?(我看那个链接里面说修改MAX_MTU必须由client发起)