CogniBoost/sw/libCogniBoost/cbLibDev.c
static cbDevice_T *cbDeviceNew(const char *sDeviceName,
                               int         nBaudRate,
                               int         fd,
                               bool_t      bTrace)
{
  cbDevice_T     *pDevice = NEW(cbDevice_T);
  size_t          i;

  pDevice->m_sDeviceName  = new_strdup(sDeviceName);
  pDevice->m_nBaudRate    = nBaudRate;
  pDevice->m_eConnType    = cbConnTypeDirect;
  pDevice->m_fd           = fd;
  pDevice->m_bTrace       = bTrace? true: false;
  pDevice->m_uTidCounter  = 0;

  pthread_mutex_init(&(pDevice->m_mutexTrans), NULL);
      
  for(i=0; i<arraysize(pDevice->m_tblTransCache); ++i)
  {
    pDevice->m_tblTransCache[i] = NULL;
  }

  memset(&(pDevice->m_cbIds), 0, sizeof(cbIdentities_T));

  return pDevice;
}
/*!
 * \brief Create a new connected CogniBoost device data instance.
 *
 * \param sDeviceName   Serial device name.
 * \param nBaudRate     Serial baud rate.
 * \param fd            Open CogniBoost file descriptor.
 * \param bTrace        Do [not] trace messages.
 *
 * \return Returns pointer to new client on success. Else returns NULL.
 */
\brief Create a new connected CogniBoost device data instance.
\param sDeviceName   Serial device name.
\param nBaudRate     Serial baud rate.
\param fd            Open CogniBoost file descriptor.
\param bTrace        Do [not] trace messages.

\return Returns pointer to new client on success. Else returns NULL.
\ brief Create a new connected CogniBoost device data instance . \ param sDeviceName Serial device name . \ param nBaudRate Serial baud rate . \ param fd Open CogniBoost file descriptor . \ param bTrace Do [ not ] trace messages . \ return Returns pointer to new client on success . Else returns NULL .
static cbDevice_T *cbDeviceNew(const char *sDeviceName,
                               int         nBaudRate,
                               int         fd,
                               bool_t      bTrace)
{
  cbDevice_T     *pDevice = NEW(cbDevice_T);
  size_t          i;
  pDevice->m_sDeviceName  = new_strdup(sDeviceName);
  pDevice->m_nBaudRate    = nBaudRate;
  pDevice->m_eConnType    = cbConnTypeDirect;
  pDevice->m_fd           = fd;
  pDevice->m_bTrace       = bTrace? true: false;
  pDevice->m_uTidCounter  = 0;
  pthread_mutex_init(&(pDevice->m_mutexTrans), NULL);
  for(i=0; i<arraysize(pDevice->m_tblTransCache); ++i)
  {
    pDevice->m_tblTransCache[i] = NULL;
  }
  memset(&(pDevice->m_cbIds), 0, sizeof(cbIdentities_T));
  return pDevice;
}
static cbDevice_T * cbDeviceNew ( const char * sDeviceName , int nBaudRate , int fd , bool_t bTrace ) { cbDevice_T * pDevice = NEW ( cbDevice_T ) ; size_t i ; pDevice -> m_sDeviceName = new_strdup ( sDeviceName ) ; pDevice -> m_nBaudRate = nBaudRate ; pDevice -> m_eConnType = cbConnTypeDirect ; pDevice -> m_fd = fd ; pDevice -> m_bTrace = bTrace ? true : false ; pDevice -> m_uTidCounter = 0 ; pthread_mutex_init ( & ( pDevice -> m_mutexTrans ) , NULL ) ; for ( i = 0 ; i < arraysize ( pDevice -> m_tblTransCache ) ; ++ i ) { pDevice -> m_tblTransCache [ i ] = NULL ; } memset ( & ( pDevice -> m_cbIds ) , 0 , sizeof ( cbIdentities_T ) ) ; return pDevice ; }
\brief Create a new connected CogniBoost device data instance.
\ brief Create a new connected CogniBoost device data instance .