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

首頁 > 學院 > 開發設計 > 正文

cc2640官方demo更新連接參數service-CCservice

2019-11-09 18:46:19
字體:
來源:轉載
供稿:網友

背景

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

更新連接參數的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的回調函數

/********************************************************************* * @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(); }}

更新現象

測試發現按照官方demo這樣直接更新連接參數,會導致斷開連接,細查發現是會導致死機

解決方法

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

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


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 鸡东县| 葵青区| 钦州市| 永丰县| 南宫市| 北辰区| 遵义市| 扶风县| 广宁县| 镇江市| 化德县| 安仁县| 南华县| 司法| 济阳县| 同仁县| 沙田区| 新疆| 惠安县| 章丘市| 奎屯市| 临洮县| 金沙县| 岳阳市| 济阳县| 边坝县| 腾冲县| 长岛县| 和硕县| 乾安县| 安吉县| 三亚市| 赣州市| 惠安县| 化隆| 湘潭市| 仁怀市| 邯郸县| 清丰县| 龙州县| 德江县|