完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
脚本:
设计是探测探头。如果没有探头的缺席,进入睡眠/低功耗模式和重复6秒 如果存在探头,则启用BLE定时器1秒。 第一次进入1秒定时器回调。Abort Low Pwer模式。 测量探头,使广告等pairign等 问题:我们不结婚登记甚至打电话回去blecm_app_evt_link_up孤单 但所有其他事件回调(blecm_app_evt_link_up和blecm_app_evt_adv_timeout)被称为回正确。 注意:尝试执行而不调用 bleprofile_enteringdisclowpowermode(dev_lpm_disc_low_power_modes_sleep);和 bleprofile_abortingdisclowpowermode(dev_lpm_disc_low_power_modes_sleep); 代码中 然后,在这种情况下,所有3个注册的APP事件都被调用。 -------------------------------------------------------------------------------------------------------------- 代码: 关于创建() { …… Bropelixi-IIT(BrPrulixPY-CFG); BrPrulixGPIOIIT(BrPrulixGPIOOH-PY-CFG); . …… //注册连接和连接向下处理程序。 bleprofile_regappevthandler(blecm_app_evt_link_down,cookp_connection_down); bleprofile_regappevthandler(blecm_app_evt_link_up,cookp_connection_up); bleprofile_regappevthandler(blecm_app_evt_adv_timeout,cookp_advertisement_stopped); …… //低功耗模式初始化 DEVLPMIN(); DevLPM.ReavestRoopPosiple查询(CoppLLPMPQualiable,0); bleprofile_enteringdisclowpowermode(dev_lpm_disc_low_power_modes_sleep); } cookp_lpm_queriable(lowpowermodepolltype UInt32类型,UInt32语境) { 如果(!)CPH-LPY-BABLT){ 如果(CoppPyBePixChk()){ BLYTrace0(“LPQ NO”); CujpReGyTimeR(); 返回0; } 否则{ BLYTrace0(“LPQ是”); 返回1000000×6; } } 返回0; } 空TimeReCB() { 如果(!){CP/LPY-BABLT){/*如果在唤醒时检测到探针*/ CPL LPY-BABLT=TRUE; bleprofile_abortingdisclowpowermode(dev_lpm_disc_low_power_modes_sleep); } …… } Burst PrimeLyFCFG { / *。fine_timer_interval = * / 500 / / / / cookp_fine_timer,MS注意:尝试与不好定时器,同样的结果 /*.Debug tAdv**/HythununToDeTyx可发现, / *。button_adv_toggle = * /零/配对按钮使地切换(如果)或(如果总是0) /*.HiqununtTyAdvayTime= */32,//插槽 /*.LoWiununtTyAdvayTeals= */1024,//插槽 /*.HythununTrdAdvIdTime= */10,//秒 /*.LoWiununtTo.AdvIdTime= *// 20,//秒 /*.HixIdTytAdvayStult**/0,//秒 /*.LoWiMixTytAdvayStult**/0,//秒 /*.HealIdTrimeAdvIdTime= */0,//秒 /*.LoWiDrimtAdvayl持续时间=*/ 0,//秒 / *。local_name = * / cookp_device_name,/ / [ local_name_len_max ]; / * * / bit16_to_8。COD =(cookp_device_appearence),0x00,/ / [ cod_len ]; / *。版本= * /“1”/ / [ version_len ]; / *。encr_required = * / 0 / /(security_enabled | security_request),/ /数据加密和设备发送的每个连接的安全要求 / *。disc_required = * / 0 / /如果1确认后,断开 / *。test_enable = * / 0 / /测试模式时启用1 / * * /。tx_power_level = 0x04,/ / DBM / *。con_idle_timeout = * / 0 / /二0 & gt;没有超时 / *。powersave_timeout = * / 0 / /二0 & gt;没有超时 / *。HDL = * / { cookp_main_char_handle,0x00 0x00 0x00 0x00 },,,,/ / [ handle_num_max ]; / *。服务= * / { cookp_main_service_uuid,0x00 0x00 0x00 0x00 },,, / *。茶= */ { cookp_main_char_uuid,0x00 0x00 0x00 0x00 },,, / *。findme_locator_enable = * / 0 / /如果1找我定位是使 / *。findme_alert_level = * /零/警戒级别的找我 / *。client_grouptype_enable = * / 0 / / 1 grouptype读可 / *。linkloss_button_enable = * / 0 / / 1 linkloss按钮启用 / *。pathloss_check_interval = * / 0 / /二 / *。alert_interval = * / 0 / /间隔的警报 / *。high_alert_num = * / 0,提醒每个区间/数量 / *。mild_alert_num = * / 0,提醒每个区间/数量 / *。status_led_enable = * / 0 / /如果1状态LED的使 / *。status_led_interval = * / 0 / /二 / *。status_led_con_blink = * / 0 / /眨眼Num连接 / *。status_led_dir_adv_blink = * / 0 / /眨眼NUM DIR ADV / *。status_led_un_adv_blink = * / 0 / /眨眼数undir ADV / *。led_on_ms = * / 0 / / LED MS眨眼持续时间 / *。led_off_ms = * / 0 / / LED闪烁关闭时间在MS / *。buz_on_ms = * / 0 / /蜂鸣器持续在MS / *。button_power_timeout = * / 0 /秒 / *。button_client_timeout = * / 0 /秒 / *。button_discover_timeout = * / 0 /秒 / *。button_filter_timeout = * /零/秒 FiuFuff-UrARTHARLBACK-STORY / *。button_uart_timeout = * / 15 /秒 第二节 }; 以上来自于百度翻译 以下为原文 Scenario: Design is to detect probe. If no probe absent, enter Sleep/Low Power Mode for 6 seconds and repeat If probe is present, then Enable BLE Timer for 1sec. On first entry to 1 sec timer call back. Abort Low Pwer mode. Measure probe, enable ADVertisement and wait for pairign etc. Issue: We do not get registered even call back for BLECM_APP_EVT_LINK_UP alone But all other event callback (BLECM_APP_EVT_LINK_UP and BLECM_APP_EVT_ADV_TIMEOUT ) are called back properly. Note: Tried executing without calling bleprofile_enteringDiscLowPowerMode(DEV_LPM_DISC_LOW_POWER_MODES_SLEEP); and bleprofile_abortingDiscLowPowerMode(DEV_LPM_DISC_LOW_POWER_MODES_SLEEP); in code Then, in this case all 3 registered app event are called. -------------------------------------------------------------------------------------------------------------- Code: On create() { ................. bleprofile_Init(bleprofile_p_cfg); bleprofile_GPIOInit(bleprofile_gpio_p_cfg); . ....... // register connection up and connection down handler. bleprofile_regAppEvtHandler(BLECM_APP_EVT_LINK_DOWN, cookp_connection_down); bleprofile_regAppEvtHandler(BLECM_APP_EVT_LINK_UP, cookp_connection_up); bleprofile_regAppEvtHandler(BLECM_APP_EVT_ADV_TIMEOUT, cookp_advertisement_stopped); ............. // Low powe mode initialize devlpm_init(); devlpm_registerForLowPowerQueries(cookp_lpm_queriable, 0); bleprofile_enteringDiscLowPowerMode(DEV_LPM_DISC_LOW_POWER_MODES_SLEEP); } UINT32 cookp_lpm_queriable(LowPowerModePollType type, UINT32 context) { if(!cp_lp_abort){ if(cookp_probe_chk()){ ble_trace0("LPQ No"); cookp_reg_timer(); return 0; } else { ble_trace0("LPQ yes"); return 1000000 * 6; } } return 0; } void timer_cb() { if(!cp_lp_abort){ /* if probe detected on wake up */ cp_lp_abort = TRUE; bleprofile_abortingDiscLowPowerMode(DEV_LPM_DISC_LOW_POWER_MODES_SLEEP); } .................. } const BLE_PROFILE_CFG cookp_cfg = { /*.fine_timer_interval =*/ 500, //COOKP_FINE_TIMER, // ms Note: tried with and without Fine timer , same result /*.default_adv =*/ HIGH_UNDIRECTED_DISCOVERABLE, /*.button_adv_toggle =*/ 0, // pairing button make adv toggle (if 1) or always on (if 0) /*.high_undirect_adv_interval =*/ 32, // slots /*.low_undirect_adv_interval =*/ 1024, // slots /*.high_undirect_adv_duration =*/ 10, // seconds /*.low_undirect_adv_duration =*/ 20, // seconds /*.high_direct_adv_interval =*/ 0, // seconds /*.low_direct_adv_interval =*/ 0, // seconds /*.high_direct_adv_duration =*/ 0, // seconds /*.low_direct_adv_duration =*/ 0, // seconds /*.local_name =*/ COOKP_DEVICE_NAME, // [LOCAL_NAME_LEN_MAX]; /*.cod =*/ BIT16_TO_8(COOKP_DEVICE_APPEARENCE),0x00, // [COD_LEN]; /*.ver =*/ "1.00", // [VERSION_LEN]; /*.encr_required =*/ 0, //(SECURITY_ENABLED | SECURITY_REQUEST), // data encrypted and device sends security request on every connection /*.disc_required =*/ 0, // if 1, disconnection after confirmation /*.test_enable =*/ 0, // TEST MODE is enabled when 1 /*.tx_power_level =*/ 0x04, // dbm /*.con_idle_timeout =*/ 0, // second 0-> no timeout /*.powersave_timeout =*/ 0, // second 0-> no timeout /*.hdl =*/ {COOKP_MAIN_CHAR_HANDLE, 0x00, 0x00, 0x00, 0x00}, // [HANDLE_NUM_MAX]; /*.serv =*/ {COOKP_MAIN_SERVICE_UUID, 0x00, 0x00, 0x00, 0x00}, /*.cha =*/ {COOKP_MAIN_CHAR_UUID, 0x00, 0x00, 0x00, 0x00}, /*.findme_locator_enable =*/ 0, // if 1 Find me locator is enable /*.findme_alert_level =*/ 0, // alert level of find me /*.client_grouptype_enable =*/ 0, // if 1 grouptype read can be used /*.linkloss_button_enable =*/ 0, // if 1 linkloss button is enable /*.pathloss_check_interval =*/ 0, // second /*.alert_interval =*/ 0, // interval of alert /*.high_alert_num =*/ 0, // number of alert for each interval /*.mild_alert_num =*/ 0, // number of alert for each interval /*.status_led_enable =*/ 0, // if 1 status LED is enable /*.status_led_interval =*/ 0, // second /*.status_led_con_blink =*/ 0, // blink num of connection /*.status_led_dir_adv_blink =*/ 0, // blink num of dir adv /*.status_led_un_adv_blink =*/ 0, // blink num of undir adv /*.led_on_ms =*/ 0, // led blink on duration in ms /*.led_off_ms =*/ 0, // led blink off duration in ms /*.buz_on_ms =*/ 0, // buzzer on duration in ms /*.button_power_timeout =*/ 0, // seconds /*.button_client_timeout =*/ 0, // seconds /*.button_discover_timeout =*/ 0, // seconds /*.button_filter_timeout =*/ 0, // seconds #ifdef BLE_UART_LOOPBACK_TRACE /*.button_uart_timeout =*/ 15, // seconds #endif }; |
|
相关推荐
1个回答
|
|
在连接上/下处理程序之后,包括以下内容:
BLePrimeRigaPaveTHANDELL(BelcMyAppEvtEngEngultIHIOFOF,(BelcMyNo.PARAMAMO-FUNC)CoppPixEngulySHIDOFF; BLePrimyReaPaveTeHuldLB(BelcMyAppEvtApBuffTIN HIDOOFF,(Belcmi-Noi-PARAMAM-FUNC)CoppPaBabtTyHiFiOf; 然后, 空隙库珀 { /不做任何事 } 无效的库克 { /不做任何事 } 如果有帮助,请告诉我。 以上来自于百度翻译 以下为原文 After the connection up/down handlers, include the following: bleprofile_regAppEvtHandler(BLECM_APP_EVT_ENTERING_HIDOFF,(BLECM_NO_PARAM_FUNC)cookp_enter_hidoff); bleprofile_regAppEvtHandler(BLECM_APP_EVT_ABORTING_HIDOFF,(BLECM_NO_PARAM_FUNC)cookp_abort_hidoff); Then, void cookp_enter_hidoff(void) { // Do nothing } void cookp_abort_hidoff(void) { // Do nothing } Let me know if it helps. |
|
|
|
只有小组成员才能发言,加入小组>>
752个成员聚集在这个小组
加入小组2073 浏览 1 评论
1828 浏览 1 评论
3642 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1764 浏览 6 评论
1515 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
513浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
364浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
413浏览 2评论
360浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
865浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-27 15:33 , Processed in 1.236765 second(s), Total 77, Slave 60 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号