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.

OAD升级更新时序问题



你好:    

           我在IMAGB中的OAD PROFILE 中的函数oadImgIdentifyWrite()中启动了CONNECT INTERVAL UPDATE(详见代码红色部分)后,    

          当我从B升A时就会出现升级失败提示(请检查电量...).     我应该在什么时候开始更新CONNECT INTERVAL UPDATE??    

           是在oadHandleConnStatusCB()中吗??

           有没有人遇到同样问题??

           //我的更新CONNECT INTERVAL 代码

        static void updateConnectParam(void)

       {  

             uint8 updateConnParams = TRUE;  

            uint16 desired_min_interval = OAD_DEFAULT_DESIRED_MIN_CONN_INTERVAL;

            uint16 desired_max_interval =  OAD_DEFAULT_DESIRED_MAX_CONN_INTERVAL;

           uint16 desired_slave_latency =  OAD_DEFAULT_DESIRED_SLAVE_LATENCY;  

          uint16 desired_conn_timeout =OAD_DEFAULT_DESIRED_CONN_TIMEOUT;

           GAPRole_SetParameter( GAPROLE_MIN_CONN_INTERVAL, sizeof( uint16 ), &desired_min_interval );

         GAPRole_SetParameter( GAPROLE_MAX_CONN_INTERVAL, sizeof( uint16 ), &desired_max_interval );

          GAPRole_SetParameter( GAPROLE_SLAVE_LATENCY, sizeof( uint16 ), &desired_slave_latency );

         GAPRole_SetParameter( GAPROLE_TIMEOUT_MULTIPLIER, sizeof( uint16 ), &desired_conn_timeout );

         GAPRole_SetParameter( GAPROLE_PARAM_UPDATE_REQ, sizeof( uint8 ), &updateConnParams );

         return;

 }

 /*********************************************************************  *

@fn      oadImgIdentifyWrite  *  * @brief   Process the Image Identify Write.  

*  * @param   connHandle - connection message was received on

 * @param   pValue - pointer to data to be written  *  * @return  status

 */

static bStatus_t oadImgIdentifyWrite( uint16 connHandle, uint8 *pValue )

 {

      img_hdr_t rxHdr;  img_hdr_t ImgHdr;

     rxHdr.ver = BUILD_UINT16( pValue[0], pValue[1] );

     rxHdr.len = BUILD_UINT16( pValue[2], pValue[3] );

     (void)osal_memcpy(rxHdr.uid, pValue+4, sizeof(rxHdr.uid));

     HalFlashRead(OAD_IMG_R_PAGE, OAD_IMG_HDR_OSET, (uint8 *)&ImgHdr, sizeof(img_hdr_t));

     oadBlkTot = rxHdr.len / (OAD_BLOCK_SIZE / HAL_FLASH_WORD_SIZE);

     if ( (OAD_IMG_ID( ImgHdr.ver ) != OAD_IMG_ID( rxHdr.ver )) && // TBD: add customer criteria for initiating OAD here.    

    (  oadBlkTot <= OAD_BLOCK_MAX) &&     (oadBlkTot != 0) )

   {  

       updateConnectParam();  

      oadBlkNum = 0;   

     oadImgBlockReq(connHandle, 0);   

    }

   else

   {   

         oadImgIdentifyReq(connHandle, &ImgHdr);

  }

 return ( SUCCESS );

 }