StdPJ/Core/Src/APP/BSP/ug96/ug96.c
/**
  * @brief  Join a PDP Access point.
  * @param  Obj: pointer to module handle
  * @param  ContextID : range is 1-20 (max three can be connected simultaneously)
  * @retval Operation Status.
  */
@brief  Join a PDP Access point.
@param  Obj: pointer to module handle
@param  ContextID : range is 1-20 (max three can be connected simultaneously)
@retval Operation Status.
@brief Join a PDP Access point . @param Obj : pointer to module handle @param ContextID : range is 1 - 20 ( max three can be connected simultaneously ) @retval Operation Status .
UG96_Return_t  UG96_Activate(Ug96Object_t *Obj, uint8_t ContextID)
{
  UG96_Return_t ret = UG96_RETURN_ERROR;
  if (Obj->APContextState[ContextID-1] == UG96_AP_CONFIGURED)
  {
    if (Obj->APsActive <3 )
    {
      snprintf(CmdString, 24,"AT+QIACT=%d\r\n", ContextID);
      ret = (UG96_Return_t) AT_ExecuteCommand(Obj, UG96_TOUT_150000, (uint8_t *)CmdString, RET_OK | RET_ERROR);
      if(ret == UG96_RETURN_OK)
      {
         Obj->APContextState[ContextID-1] = UG96_AP_ACVTIVATED;
         Obj->APsActive++;
      }
    }
  }
#ifdef UG96_DBG
  printf("                UG96_Activate() PDP Access point, ret value: %d \n", ret);
#endif
  return ret;
}
UG96_Return_t UG96_Activate ( Ug96Object_t * Obj , uint8_t ContextID ) { UG96_Return_t ret = UG96_RETURN_ERROR ; if ( Obj -> APContextState [ ContextID - 1 ] == UG96_AP_CONFIGURED ) { if ( Obj -> APsActive < 3 ) { snprintf ( CmdString , 24 , " \r \n " , ContextID ) ; ret = ( UG96_Return_t ) AT_ExecuteCommand ( Obj , UG96_TOUT_150000 , ( uint8_t * ) CmdString , RET_OK | RET_ERROR ) ; if ( ret == UG96_RETURN_OK ) { Obj -> APContextState [ ContextID - 1 ] = UG96_AP_ACVTIVATED ; Obj -> APsActive ++ ; } } } #ifdef UG96_DBG printf ( " \n " , ret ) ; #endif return ret ; }
@brief  Join a PDP Access point.
@brief Join a PDP Access point .