国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發(fā)設計 > 正文

cc2640官方demo更新連接參數(shù)service-CCservice

2019-11-09 17:46:18
字體:
來源:轉載
供稿:網(wǎng)友

背景

cc2640項目需要添加oad功能,為了降低功耗,默認連接參數(shù)設置的比較大,這將導致oad時間過長,此時需要在oad之前先更新一組較小的連接參數(shù),提高oad的速度。

更新連接參數(shù)的api

/******************************************************************** * @fn GAPRole_SendUpdateParam * * @brief Update the parameters of an existing connection * * @param minConnInterval - the new min connection interval * @param maxConnInterval - the new max connection interval * @param latency - the new slave latency * @param connTimeout - the new timeout value * @param handleFailure - what to do if the update does not occur. * Method may choose to terminate connection, try again, * or take no action * * @return SUCCESS, bleNotConnected, or bleInvalidRange */bStatus_t GAPRole_SendUpdateParam(uint16_t minConnInterval, uint16_t maxConnInterval, uint16_t latency, uint16_t connTimeout, uint8_t handleFailure)

移植官方ccservice的回調函數(shù)

/********************************************************************* * @fn ccChangeCB * * @brief Callback from Connection Control indicating a value change * * @param paramID - parameter ID of the value that was changed. * * @return none */static void ccChangeCB( uint8 paramID ){ // CCSERVICE_CHAR1: read & notify only // CCSERVICE_CHAR: requested connection parameters if (paramID == CCSERVICE_CHAR2) { uint8_t buf[CCSERVICE_CHAR2_LEN]; // Get new connection parameters CcService_getParameter( CCSERVICE_CHAR2, buf); // Update connection parameters GAPRole_SendUpdateParam( BUILD_UINT16(buf[0],buf[1]), BUILD_UINT16(buf[2],buf[3]), // minConnInterval, maxConnInterval BUILD_UINT16(buf[4],buf[5]), BUILD_UINT16(buf[6],buf[7]), // slaveLatency, timeoutMultiplier GAPROLE_TERMINATE_LINK); } // CCSERVICE_CHAR3: Disconnect request else if (paramID == CCSERVICE_CHAR3) { // Any change in the value will terminate the connection GAPRole_TerminateConnection(); }}

更新現(xiàn)象

測試發(fā)現(xiàn)按照官方demo這樣直接更新連接參數(shù),會導致斷開連接,細查發(fā)現(xiàn)是會導致死機

解決方法

分析導致死機可能是跟ti-rtos有關,沒有細查死機原因,解決這個死機問題,只需要將更新連接參數(shù)的接口放到其它地方執(zhí)行,而不能在回調函數(shù)里面直接執(zhí)行。

參考方法:使用定時器任務


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 嘉禾县| 扶风县| 大田县| 天等县| 女性| 阿合奇县| 黎城县| 广南县| 富裕县| 方城县| 海林市| 哈尔滨市| 荣成市| 永胜县| 靖江市| 巢湖市| 军事| 同德县| 河源市| 紫金县| 读书| 中江县| 读书| 磐石市| 威海市| 衡阳县| 嘉善县| 马鞍山市| 许昌市| 肃北| 固安县| 绥化市| 抚远县| 石河子市| 盐池县| 宜都市| 钦州市| 外汇| 淳化县| 永州市| 随州市|