你好
1:修改了SimpleProfile_SetParameter,里面给数组赋值和写了长度,但是仍然是只收到1个字节,需要修改协议哪里呢?
2:read和notify有什么区别呢?
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.
首先,感谢您这么快回复!非常感谢!
1:是的,现在修改了2个地方
simpleBLEPeripheral.c中,修改函数static void performPeriodicTask( void )中,
SimpleProfile_SetParameter( SIMPLEPROFILE_CHAR4, 0x05, &valueToCopy);
在,simpleGATTprofile.c里面修改
bStatus_t SimpleProfile_SetParameter( uint8 param, uint8 len, void *value )
....
case SIMPLEPROFILE_CHAR4:
if ( len ==0x05 )
{
simpleProfileChar4 = *((uint8*)value);
VOID osal_memcpy( simpleProfileChar4, value,0x05 );
}
break;
................................
修改这2处后,还是不能收到发出的数据,在characteristics 4改过后,在characteristics 2,3都试过了,应该还需要修改什么地方吧?
2:请问在read中,例如手机发起请求,以SimpleBLEPeripheral为蓝本,通过characteristics 1,发送1个字节给 cc2540,然后cc2540收到后,怎么发给手机呢,直接发送吗?还是要遵循什么协议呢?
谢谢
楼主,
1.你要把 static uint8 simpleProfileChar4 = 0;改成一个数组,如
static uint8 simpleProfileChar4[10];
2.修改属性表static gattAttribute_t simpleProfileAttrTbl[]=
{
// Characteristic Value 4
{
{ ATT_BT_UUID_SIZE, simpleProfilechar4UUID },
0,
0,
simpleProfileChar4 //用数组名
},
}
3.修改特征值属性static uint8 simpleProfileChar4Props = GATT_PROP_NOTIFY;//原始属性只有Notify,而不可读写。
static uint8 simpleProfileChar4Props = GATT_PROP_NOTIFY|GATT_PROP_READ | GATT_PROP_WRITE;
4.修改特征值写回调函数simpleProfile_WriteAttrCB及读回调函数simpleProfile_ReadAttrCB。这个可以参照Char1
OK,祝你成功!