大家好、在这里 、我已经声明了这种情况、以便发现180秒、但我希望减少到60秒、这是可能的? 请帮帮我
#define DEFAULT_DISCOVELOAD_MODE GAP_ADTYPE_FLAGS_LIMITED (180秒)
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.
您好、Yikai、
非常感谢你耐心的答复,我对此有两点怀疑
1) 1)#define SBP_Periode_EVT 0x0004。 在该0x0004中、考虑什么?
2) 2)#define SBP_PERIOD_EVT_PERIOD 5000.在这个5000中、在执行期间被视为5秒、我是否正确?
3) Util_constructClock (&periodicClock、SimpleBLEPeripheral_clockHandler、SBP_PERIOD_EVT_PERIOD、0、false、SBP_PERIOD_EVT); 这个0被视为一个时钟周期、被视为一个单次触发定时器。 我们为什么将其视为零? 您能解释一下吗
事件使用位标志、因此它可以是0x0001、0x0002、0x0004、……
2.是的,你是对的。
3.您可以参阅以下有关 Util_constructClock 原型中 clockPeriod 参数的注释。
/*********
*@fn Util_constructClock
*
*@简要 初始化 TIRTOS 时钟实例。
*
*@param pClock -指向时钟实例结构的指针。
*@param clockCB -时钟过期时的回调函数。
*@param clockDuration -时钟计时器的寿命、以毫秒为单位
*@param clockPeriod -如果设置为0以外的值、则为第一个值
* 过期时间由时钟持续时间决定。 全部
* 后续的费用使用 clockPeriod 值。
*@param startFlag - true 立即启动,false 等待。
*@param arg -传递给回调函数的参数。
*
*@return Clock_handle -时钟实例的句柄。
*
Clock_handle Util_constructClock (Clock_Structt *pClock、
Clock_funcPtr clockCB、
uint32_t 时钟持续时间、
uint32_t clockPeriod、
uint8_t startFlag、
阿尔格阿尔格)
[引用 user="santhosh prem"]我怀疑是否可以在不 发生周期性事件的情况下显示0x03?
我已经为您提供了相关代码。 再次来到这里。 我已经在 CC2650 LP 对此进行了测试、并且工作正常
/********* *@fn SimplePeripheral_processCharValueChangeEvt * *@简要处理暂挂的简单配置文件特征值更改 * 事件。 * *@param paramID -已更改值的参数 ID。 * *@返回无。 */ static void SimplePeripheral_processCharValueChangeEvt (uint8_t paramID) { uint8_t newValue; switch (paramID) { SIMPLEPROFILE_CHAR1案例: SimpleProfile_GetParameter (SIMPLEPROFILE_CHAR1、newValue); Display_Print1 (dispHandle、4、0、"Char 1:%d"、(uint16_t) newValue); 中断; SIMPLEPROFILE_CHAR3案例: SimpleProfile_GetParameter (SIMPLEPROFILE_CHAR3、newValue); SimpleProfile_SetParameter (SIMPLEPROFILE_CHAR4、sizeof (uint8_t)、 newValue); Display_Print1 (dispHandle、4、0、"Char 3:%d"、(uint16_t) newValue); 中断; 默认值: //不应该到达这里! 中断; } /********* *@fn SimplePeripheral_performPeriodicTask * *@brief 会执行周期性应用任务。 此函数被调用 * 每5秒(SBP_PERIOD_EVT_PERIOD)。 在此示例中、 * SimpleGATTProfile *中第三个特征的值 服务从配置文件中检索、然后复制到 *中 第四个特征的值。 * *@param 无。 * *@返回无。 // static void SimplePeripheral_performPeriodicTask (void) { #ifndef Feature_OAD_ONCHIP #if 0 uint8_t valueToCopy; //如果 (SimpleProfile_GetParameter (SIMPLEPROFILE_CHAR3、&valueToCopy)= Success、则调用以检索配置文件中第三个特征的值 //调用以设置配置文件中第四个特征的值。 //请注意,如果已收到第四个特征的通知 // GATT 客户端设备启用,然后将发送通知 //每次调用此函数。 SimpleProfile_SetParameter (SIMPLEPROFILE_CHAR4、sizeof (uint8_t)、 valueToCopy); } #endif #endif //!Feature_OAD_ONCHIP }
您好、Yikai、
感谢您的回复、
if (事件和 SBP_Periode_EVT)
{
/Events &=~SBP_Periode_EVT;
Util_startClock (周期时钟);
//执行周期性应用任务
SimpleBLEPeripheral_performPeriodicTask();
}
当我们使用 LED 连接进行 nrf i 测试时、此条件在连接器件时在 LED 上持续流动。 但 我需要的是、即使我连接了器件、它也不应进入函数。 当我按下通知时、它应该转到 if condition 函数、它是可能的(中断)
您好、santhosh、
在 simple_peripheral.c 中、执行以下修改。 在执行这些更改后、刷写程序。 启用特征通知4. 然后写入特性3。 特征4将有1条通知。 只需先执行此操作。
静态空 SimpleBLEPeripheral_processCharValueChangeEvt (uint8_t paramID) { #ifndef Feature_OAD_ONCHIP uint8_t newValue; switch (paramID) { SIMPLEPROFILE_CHAR1案例: SimpleProfile_GetParameter (SIMPLEPROFILE_CHAR1、newValue); Display_Print1 (dispHandle、4、0、"Char 1:%d"、(uint16_t) newValue); 中断; SIMPLEPROFILE_CHAR3案例: SimpleProfile_GetParameter (SIMPLEPROFILE_CHAR3、newValue); SimpleProfile_SetParameter (SIMPLEPROFILE_CHAR4、sizeof (uint8_t)、 newValue); Display_Print1 (dispHandle、4、0、"Char 3:%d"、(uint16_t) newValue); 中断; 默认值: //不应该到达这里! break; } #endif //!feature_OAD_ONCHIP } /********* *@fn SimpleBLEPeripheral_performPeriodicTask * *@brief 会执行周期性应用任务。 此函数被调用 * 每5秒(SBP_PERIOD_EVT_PERIOD)。 在此示例中、 * SimpleGATTProfile *中第三个特征的值 服务从配置文件中检索、然后复制到 *中 第四个特征的值。 * *@param 无。 * *@返回无。 // 静态空 SimpleBLEPeripheral_performPeriodicTask (void) { #ifndef Feature_OAD_ONCHIP #if 0 uint8_t valueToCopy; //如果 (SimpleProfile_GetParameter (SIMPLEPROFILE_CHAR3、valueToCopy = )、则调用以检索配置文件中第三个特征的值 //调用以设置配置文件中第四个特征的值。 //请注意,如果已收到第四个特征的通知 // GATT 客户端设备启用,然后将发送通知 //每次调用此函数。 SimpleProfile_SetParameter (SIMPLEPROFILE_CHAR4、sizeof (uint8_t)、 valueToCopy); } #endif #endif //!Feature_OAD_ONCHIP }
您好、santhosh、
当您按下"启用通知按钮"时、它将仅启用通知。 此外、在特性4处不会出现任何输出。
每当您调用以下代码时、特征4处都会输出。
SimpleProfile_SetParameter (SIMPLEPROFILE_CHAR4、sizeof (uint8_t)、
newValue);
根据我向您共享的代码片段、当您使用应用程序写入特征3时、会发生写入特征4的情况。 您可以自行验证这一点 ,方法是在 SIMPLEPROFILE_CHAR3:的情况下放置一个断点。 在执行此操作之前、请将 Compiler Optimization (编译器优化)设置为 off (关闭)或0。
静态空 SimpleBLEPeripheral_processCharValueChangeEvt (uint8_t paramID) { #ifndef Feature_OAD_ONCHIP uint8_t newValue; switch (paramID) { SIMPLEPROFILE_CHAR1案例: SimpleProfile_GetParameter (SIMPLEPROFILE_CHAR1、newValue); Display_Print1 (dispHandle、4、0、"Char 1:%d"、(uint16_t) newValue); 中断; SIMPLEPROFILE_CHAR3案例: SimpleProfile_GetParameter (SIMPLEPROFILE_CHAR3、newValue); SimpleProfile_SetParameter (SIMPLEPROFILE_CHAR4、sizeof (uint8_t)、 newValue); Display_Print1 (dispHandle、4、0、"Char 3:%d"、(uint16_t) newValue); 中断; 默认值: //不应该到达这里! break; } #endif //!feature_OAD_ONCHIP }
从上面的代码片段中可以看到 ,SimpleBLEPeripheral_performPeriodicTask()的内容处于#if 0状态,这意味着它不会执行,所以请忘记这一点。
-kel
您好!
谢谢你、Kim 和 Markel、感谢你的解释、我从中得到了一些想法。
案例 GATT_CLIENT_CHAR_CFG_UUID:
状态= GATTServApp_ProcessCCCWriteReq (connHandle、pAttr、pValue、len、
offset、GATT_CLIENT_CFG_NOTIY);
uint8_t valueToCopy;
if (SimpleProfile_GetParameter (SIMPLEPROFILE_CHAR3、&valueToCopy)==成功)//if (SimpleProfile_GetParameter (SIMPLEPROFILE_CHAR3、&valueToCopy)==成功)
{
SimpleProfile_SetParameter (SIMPLEPROFILE_CHAR4、sizeof (uint8_t)、
&valueToCopy);
}