我想完成一个ios与cc2540之间的链接以及数据传输,用了官方提供的 simpleBLEPeripheral。可是只能链接却不能传输数据,怎么修改可以?希望能详细一点,十分感谢!!!!
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.
我想完成一个ios与cc2540之间的链接以及数据传输,用了官方提供的 simpleBLEPeripheral。可是只能链接却不能传输数据,怎么修改可以?希望能详细一点,十分感谢!!!!
Hi,
请看一下simpleGATTProfile.c里面的如下结构体定义, 这是读写数据的入口. IOS写回调write的callback, 读会调用read的callback. 你可以在这个上面进行开发.
// Simple Profile Service Callbacks
CONST gattServiceCBs_t simpleProfileCBs =
{
simpleProfile_ReadAttrCB, // Read callback function pointer
simpleProfile_WriteAttrCB, // Write callback function pointer
NULL // Authorization callback function pointer
};
ios的编程明白一些,但是cc2540的程序如何修改?
是要把下面这些调用到 simpleBLEPeripheral.c里面吗?
// Simple Profile Service Callbacks
CONST gattServiceCBs_t simpleProfileCBs =
{
simpleProfile_ReadAttrCB, // Read callback function pointer
simpleProfile_WriteAttrCB, // Write callback function pointer
NULL // Authorization callback function pointer
};
官方提供的 simpleBLEPeripheral,没有看到传输用的函数,是不是要写一些串口传输的程序?
谢谢
任何通过IOS对simpleProfile 这个 service 进行的数据传递, 都会通过这两个回调函数.
根据你的具体应用, 你可以通过修改这两个函数, 或者通过这两个函数再往你的应用层传递数据.
// Simple Profile Service Callbacks
CONST gattServiceCBs_t simpleProfileCBs =
{
simpleProfile_ReadAttrCB, // Read callback function pointer
simpleProfile_WriteAttrCB, // Write callback function pointer
NULL // Authorization callback function pointer
};
这个在simpleGATTProfile.c里边找不到啊