我主机用SimpleBLECentral工程,从机用BloodPressure工程,它们连接成功后我用从机Service_IMeasNotify发送数据给主机,在运行
bStatus_t Service_IMeasNotify( uint16 connHandle, attHandleValueNoti_t *pNoti, uint8 taskId )
{
uint16 value = GATTServApp_ReadCharCfg( connHandle, ServiceIMeasConfig );
// If notifications enabled
if ( value & GATT_CLIENT_CFG_NOTIFY )
{
// Set the handle
pNoti->handle = ServiceAttrTbl[SERVICE_IMEAS_VALUE_POS].handle;
// Send the Indication
return GATT_Notification( connHandle, pNoti, FALSE);
}
return bleIncorrectMode;
}这个中uint16 value = GATTServApp_ReadCharCfg( connHandle, ServiceIMeasConfig );读出value 为0;这是为什么,是还要怎样设置才可以从机端才可以用Notification发送数据给主机端?
mo mo:
回复 Yue TANG:
请问怎样发现handleOfCCCD的值,看timeapp_discovery.c看不懂,能否详细说清楚点?
Yue TANG:
回复 mo mo:
In order to enable notifications, the client device must write a value of 0x0001 to the client characteristicconfiguration descriptor for the particular characteristic. The handle for the client characteristicconfiguration descriptor immediately follows the characteristic value’s handle. Therefore, a value of0x0001 must be written to the “handle + 1”.
建议你按照《CC2540/41 Mini Development Kit User’s Guide》Document Number: SWRU270C。先做一遍,搞清楚其中的概念,剩下的只是调什么接口函数的问题了。
jeff jeff:
回复 Yue TANG:
is that each characteristic can have its own CCCD ?
in ANCS , how can i both subscribe to get callback from Notification Source and Data Source ?(https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/AppleNotificationCenterServiceSpecification/Specification/Specification.html)
e.g.
9FBF [notify characteristic ] – Notification Source22EA[notify characteristic ] – Data Source
do it means i can get CCCD from both 9FBF , 22EA ? and i can start notify both with above procedure ?
with reference to "timeapp_discover.c"
is the callback of both notify arrive at TimeAppDiscAlertNtf ?
xiaowanqiang xiaowangqiang:
回复 jeff jeff:
能把你的代码共享一下吗,好多人都卡到了这里
为啥没答案:
回复 Yue TANG:
请问writeReq.cmd = 1;代表什么意思?
甜甜的大香瓜:
可以参考我个性签名档的博客地址,《CC2541之主机端获取notify数据》