src/cloud.c
bool cloud_sessionSendRecvAll(CLOUD_SESSION_T *s, uint32_t timeoutSec)
{
   bool complete = false;

   switch(s->status)
   {
      case CLOUD_SESSION_IDLE:
      {
         // Should not be here if we are idle
         break;
      }
      case CLOUD_SESSION_CONNECT_PENDING:
      {
         cloud_sessionConnect(s);
         break;
      }
      case CLOUD_SESSION_CONNECT_SUCCESS:
      case CLOUD_SESSION_SEND_PENDING:
      {
         cloud_sessionSend(s);
         break;
      }
      case CLOUD_SESSION_SEND_SUCCESS:
      case CLOUD_SESSION_RECV_PENDING:
      {
         cloud_sessionRecv(s);
         break;
      }
      case CLOUD_SESSION_FAILED:
      {
         /* Do nothing, the function that indicated the failure */
         break;
      }
   }
   /*
    * A second check is used here to catch success results after the above
    * routines are called. Because it will take some time for the rhapsody
    * state machine to come back around, we speed it up by checking for
    * success status right after the above function calls.
    */
   if (CLOUD_SESSION_RECV_SUCCESS == s->status)
   {
      complete = true;
   }
   else if (CLOUD_SESSION_RECV_PENDING == s->status && s->recvComplete)
   {
      utils_sysLog(LOG_DEBUG, "%s>> receive not successful\n", s->name);
      complete = true;
   }
   else if (timeoutSec > 0)
   {
      if (utils_isTimerExpired(s->transStart, timeoutSec))
      {
         s->timeout = true;
         utils_sysLog(LOG_INFO, "%s>> current session timed out\n", s->name);
      }
   }

   return complete;
}
//!
//! This function processes a send operation and wait for a receive from the
//! server.
//!
//! Note1: Prior to calling this function, a call to cloud_sessionSend()
//!        must have been done to set the socket status to either send in
//!        progress or send complete.
//! Note2: If the socket has been configured as non-blocking, this function
//!        needs to be called continuously until true is returned.
//!
//! @param[in] *s pointer to a Cloud session structure object.
//! @param[in] timeoutSec  The number of timeout seconds, (0 = no timeout)
//!

This function processes a send operation and wait for a receive from the
server.

Prior to calling this function, a call to cloud_sessionSend()
must have been done to set the socket status to either send in
progress or send complete.
Note2: If the socket has been configured as non-blocking, this function
needs to be called continuously until true is returned.
This function processes a send operation and wait for a receive from the server . Prior to calling this function a call to cloud_sessionSend () must have been done to set the socket status to either send in progress or send complete . Note2 : If the socket has been configured as non - blocking this function needs to be called continuously until true is returned .
bool cloud_sessionSendRecvAll(CLOUD_SESSION_T *s, uint32_t timeoutSec)
{
   bool complete = false;
   switch(s->status)
   {
      case CLOUD_SESSION_IDLE:
      {
         break;
      }
      case CLOUD_SESSION_CONNECT_PENDING:
      {
         cloud_sessionConnect(s);
         break;
      }
      case CLOUD_SESSION_CONNECT_SUCCESS:
      case CLOUD_SESSION_SEND_PENDING:
      {
         cloud_sessionSend(s);
         break;
      }
      case CLOUD_SESSION_SEND_SUCCESS:
      case CLOUD_SESSION_RECV_PENDING:
      {
         cloud_sessionRecv(s);
         break;
      }
      case CLOUD_SESSION_FAILED:
      {
         break;
      }
   }
   if (CLOUD_SESSION_RECV_SUCCESS == s->status)
   {
      complete = true;
   }
   else if (CLOUD_SESSION_RECV_PENDING == s->status && s->recvComplete)
   {
      utils_sysLog(LOG_DEBUG, "%s>> receive not successful\n", s->name);
      complete = true;
   }
   else if (timeoutSec > 0)
   {
      if (utils_isTimerExpired(s->transStart, timeoutSec))
      {
         s->timeout = true;
         utils_sysLog(LOG_INFO, "%s>> current session timed out\n", s->name);
      }
   }
   return complete;
}
bool cloud_sessionSendRecvAll ( CLOUD_SESSION_T * s , uint32_t timeoutSec ) { bool complete = false ; switch ( s -> status ) { case CLOUD_SESSION_IDLE : { break ; } case CLOUD_SESSION_CONNECT_PENDING : { cloud_sessionConnect ( s ) ; break ; } case CLOUD_SESSION_CONNECT_SUCCESS : case CLOUD_SESSION_SEND_PENDING : { cloud_sessionSend ( s ) ; break ; } case CLOUD_SESSION_SEND_SUCCESS : case CLOUD_SESSION_RECV_PENDING : { cloud_sessionRecv ( s ) ; break ; } case CLOUD_SESSION_FAILED : { break ; } } if ( CLOUD_SESSION_RECV_SUCCESS == s -> status ) { complete = true ; } else if ( CLOUD_SESSION_RECV_PENDING == s -> status && s -> recvComplete ) { utils_sysLog ( LOG_DEBUG , " \n " , s -> name ) ; complete = true ; } else if ( timeoutSec > 0 ) { if ( utils_isTimerExpired ( s -> transStart , timeoutSec ) ) { s -> timeout = true ; utils_sysLog ( LOG_INFO , " \n " , s -> name ) ; } } return complete ; }
This function processes a send operation and wait for a receive from the
server.
This function processes a send operation and wait for a receive from the server .
// Should not be here if we are idle
 /* Do nothing, the function that indicated the failure */ /*
    * A second check is used here to catch success results after the above
    * routines are called. Because it will take some time for the rhapsody
    * state machine to come back around, we speed it up by checking for
    * success status right after the above function calls.
    */