CogniBoost/sw/libCogniBoost/cbLibDev.c
static int cbDeviceRead(cbHnd_T hnd, byte_t buf[], size_t count, uint_t usec)
{
  ssize_t         n;

  LOGDIAG5CALL(_TINT(hnd->m_fd), _TPTR(buf), _TUINT(count), _TUINT(usec));

  n = SerDevRead(hnd->m_fd, buf, count, usec);

  if( n < 0 )
  {
    CB_LOG_SYSERROR(hnd, CB_LIB_ECODE_READ, "SerDevRead().");
    return -CB_LIB_ECODE_READ;
  }

  else if( (size_t)n != count )
  {
    CB_LOG_ERROR(hnd, CB_LIB_ECODE_TIMEDOUT, "SerDevRead().");
  }

  LOGDIAG4("%s(): Device %d: %zd bytes read.", LOGFUNCNAME, hnd->m_fd, n);

  return (int)n;
}
/*!
 * \brief Read bytes from CogniBoost device.
 *
 *  Read up to <em>count</em> bytes into <em>buf</em> from the connection.
 *  This call is non-blocking if the timeout value <em>usec</em> is greater than
 *  zero. Otherwise the read can block indefinitely.
 *
 *  Note that on return the bytes read can be less than <em>count</em>.
 *
 * \param hnd       CogniBoost device handle.
 * \param [out] buf Destination buffer.
 * \param count     Number of bytes to read.
 * \param usec      Timeout in microseconds.\n
 *                  If <em>usec</em> \h_gt 0, an upper timeout limit is placed
 *                  on the read.
 *                  If <em>usec</em> == 0, then the read will block indefinitely
 *                  until <em>count</em> bytes are read or an I/O error has
 *                  ocurred.
 *
 * \return
 * On success, returns \h_ge 0 number of bytes read.\n
 * On error, returns \h_lt 0 error code.
 */
\brief Read bytes from CogniBoost device.
Read up to count bytes into buf from the connection.
This call is non-blocking if the timeout value usec is greater than
zero. Otherwise the read can block indefinitely.

Note that on return the bytes read can be less than count.

\param hnd       CogniBoost device handle.
\param [out] buf Destination buffer.
\param count     Number of bytes to read.
\param usec      Timeout in microseconds.\n
If usec \h_gt 0, an upper timeout limit is placed
on the read.
If usec == 0, then the read will block indefinitely
until count bytes are read or an I/O error has
ocurred.

\return
On success, returns \h_ge 0 number of bytes read.\n
On error, returns \h_lt 0 error code.
\ brief Read bytes from CogniBoost device . Read up to count bytes into buf from the connection . This call is non - blocking if the timeout value usec is greater than zero . Otherwise the read can block indefinitely . Note that on return the bytes read can be less than count . \ param hnd CogniBoost device handle . \ param [ out ] buf Destination buffer . \ param count Number of bytes to read . \ param usec Timeout in microseconds . \ n If usec \ h_gt 0 an upper timeout limit is placed on the read . If usec == 0 then the read will block indefinitely until count bytes are read or an I / O error has ocurred . \ return On success returns \ h_ge 0 number of bytes read . \ n On error returns \ h_lt 0 error code .
static int cbDeviceRead(cbHnd_T hnd, byte_t buf[], size_t count, uint_t usec)
{
  ssize_t         n;
  LOGDIAG5CALL(_TINT(hnd->m_fd), _TPTR(buf), _TUINT(count), _TUINT(usec));
  n = SerDevRead(hnd->m_fd, buf, count, usec);
  if( n < 0 )
  {
    CB_LOG_SYSERROR(hnd, CB_LIB_ECODE_READ, "SerDevRead().");
    return -CB_LIB_ECODE_READ;
  }
  else if( (size_t)n != count )
  {
    CB_LOG_ERROR(hnd, CB_LIB_ECODE_TIMEDOUT, "SerDevRead().");
  }
  LOGDIAG4("%s(): Device %d: %zd bytes read.", LOGFUNCNAME, hnd->m_fd, n);
  return (int)n;
}
static int cbDeviceRead ( cbHnd_T hnd , byte_t buf [ ] , size_t count , uint_t usec ) { ssize_t n ; LOGDIAG5CALL ( _TINT ( hnd -> m_fd ) , _TPTR ( buf ) , _TUINT ( count ) , _TUINT ( usec ) ) ; n = SerDevRead ( hnd -> m_fd , buf , count , usec ) ; if ( n < 0 ) { CB_LOG_SYSERROR ( hnd , CB_LIB_ECODE_READ , " " ) ; return - CB_LIB_ECODE_READ ; } else if ( ( size_t ) n != count ) { CB_LOG_ERROR ( hnd , CB_LIB_ECODE_TIMEDOUT , " " ) ; } LOGDIAG4 ( " " , LOGFUNCNAME , hnd -> m_fd , n ) ; return ( int ) n ; }
\brief Read bytes from CogniBoost device.
\ brief Read bytes from CogniBoost device .