def isConnectNeeded():
     global DeviceClientInstance
     
     try:
         intervalBetweenConnects = DeviceClientInstance.clientConfig.connection.reconnect_interval
     except:
         logger.info("No connect interval available, defaulting to 60s")
         intervalBetweenConnects = 60000 # 60 seconds, if it can't read a value
     
     if TimeConstants.dateIntervalExceeded(DeviceClientInstance.getLastStatusApiTime(), intervalBetweenConnects):
         return True
     else:
         return False
Esempio n. 2
0
    def isConnectNeeded():
        global DeviceClientInstance

        try:
            intervalBetweenConnects = DeviceClientInstance.clientConfig.connection.reconnect_interval
        except:
            logger.info("No connect interval available, defaulting to 60s")
            intervalBetweenConnects = 60000  # 60 seconds, if it can't read a value

        if TimeConstants.dateIntervalExceeded(
                DeviceClientInstance.getLastStatusApiTime(),
                intervalBetweenConnects):
            return True
        else:
            return False
 def isRotationNeeded():
     global DeviceClientInstance
     
     logging = DeviceClientInstance.clientConfig.logging
     if ( logging == None):
         return False
     rotationInterval = logging.rotation  # interval in MS
     
     props = SystemWriter.readLogProperties()
     if props.has_key(ClientURISettings.WIFI_TRANSFER_PROP):
         wifiLogName = props[ClientURISettings.WIFI_TRANSFER_PROP]
     else:
         props = SystemWriter.writeLogProperties(props, False)
         wifiLogName = props[ClientURISettings.WIFI_TRANSFER_PROP]
         
     # wifi_bluegiga_B88D1200CFE2_-1_2012-03-27.12-04-41.log
     lastRotationDateStr = wifiLogName.split("_")[-1].replace(".log", "")
     lastRotationDate = TimeConstants.dateParseCronDate(lastRotationDateStr)
     if TimeConstants.dateIntervalExceeded(lastRotationDate, rotationInterval):
         return True
     else:
         return False
Esempio n. 4
0
    def isRotationNeeded():
        global DeviceClientInstance

        logging = DeviceClientInstance.clientConfig.logging
        if (logging == None):
            return False
        rotationInterval = logging.rotation  # interval in MS

        props = SystemWriter.readLogProperties()
        if props.has_key(ClientURISettings.WIFI_TRANSFER_PROP):
            wifiLogName = props[ClientURISettings.WIFI_TRANSFER_PROP]
        else:
            props = SystemWriter.writeLogProperties(props, False)
            wifiLogName = props[ClientURISettings.WIFI_TRANSFER_PROP]

        # wifi_bluegiga_B88D1200CFE2_-1_2012-03-27.12-04-41.log
        lastRotationDateStr = wifiLogName.split("_")[-1].replace(".log", "")
        lastRotationDate = TimeConstants.dateParseCronDate(lastRotationDateStr)
        if TimeConstants.dateIntervalExceeded(lastRotationDate,
                                              rotationInterval):
            return True
        else:
            return False