unsigned int
CDBConnectionFactory::CalculateConnectionTimeout
(const I_DriverContext& ctx) const
{
    unsigned int timeout = 30;

    unsigned int to = GetConnectionTimeout();
    if (to != 0) {
        timeout = to;
    }
    else {
        to = ctx.GetTimeout();
        if (to != 0) {
            timeout = to;
        }
    }

    return timeout;
}
Beispiel #2
0
/** Open 
  */
int CBaseParser::StateOpen(HANDLE codi, ONDEMANDPARAM *pOndemand, BOOL *bConnected)
{
    int             nAttr;
    int nError = endiOpen(codi, (HANDLE *)&pOndemand->endi, &pOndemand->id);

    if (nError != CODIERR_NOERROR)
    {   
        XDEBUG("endiOpen Error(%d): %s\r\n", nError, codiErrorMessage(nError));
        return STATE_RETRY;
    }
               
    endiSetOption(pOndemand->endi, ENDIOPT_SEQUENCE, 1);
    gettimeofday((struct timeval *)&pOndemand->tmStart, NULL);
    
    nAttr = m_pEndDeviceList->GetSensorAttribute(&pOndemand->id);
    nError = sensorConnect(pOndemand->endi, GetConnectionTimeout(nAttr));

    if (nError != CODIERR_NOERROR)
    {
        XDEBUG("endiConnect Error(%d): %s\r\n", nError, codiErrorMessage(nError));
        return STATE_RETRY;
    }

    gettimeofday((struct timeval *)&pOndemand->tmConnect, NULL);
    gettimeofday((struct timeval *)&pOndemand->tmSend, NULL);

    *bConnected = TRUE;
    if(pOndemand->nMeteringType == METERING_TYPE_BYPASS)
    {
        return STATE_INITIALIZE;
    }
    else
    {
        return STATE_READ_NODEINFO;
    }
}
Beispiel #3
0
unsigned long CSettings::GetConnectionTimeout () const {
	return GetConnectionTimeout (DEFAULT_CONNECTION_TIMEOUT);
}