国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 新平| 门源| 柘城县| 攀枝花市| 建德市| 久治县| 集安市| 上栗县| 丰镇市| 商河县| 凤山市| 开化县| 福鼎市| 什邡市| 新余市| 拉孜县| 达孜县| 崇州市| 钟山县| 江门市| 民勤县| 临西县| 龙门县| 双城市| 郓城县| 五指山市| 体育| 凌源市| 大港区| 双柏县| 阿坝县| 高青县| 镇宁| 常宁市| 冷水江市| 塔河县| 高安市| 化州市| 重庆市| 乌什县| 武川县|