当前位置: 首页>>代码示例>>Python>>正文


Python MOD.secCounter方法代码示例

本文整理汇总了Python中MOD.secCounter方法的典型用法代码示例。如果您正苦于以下问题:Python MOD.secCounter方法的具体用法?Python MOD.secCounter怎么用?Python MOD.secCounter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MOD的用法示例。


在下文中一共展示了MOD.secCounter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: receiveReponse

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import secCounter [as 别名]
def receiveReponse ( ):

    timeout = MOD.secCounter() + 10

    str = ""
    length = ""
    newlinepos = 0

    while ( MOD.secCounter() < timeout ):

        newlinepos = str.find("\n\r")

        if ( (newlinepos != -1) and not length ):

            newlinepos = newlinepos + 2
            pos = str.find("Content-Length:") + 15

            while ( str[pos] != '\n' ):
                length = "%s%s" % (length, str[pos])
                pos = pos + 1

            length = int(length) + newlinepos

        else:
            MOD.sleep(5)
            str = str + MDM.receive(1)

        if ( length and len(str) >= length ):
            return str[newlinepos:(newlinepos+length)]

    return 0
开发者ID:leongersen,项目名称:afstuderen,代码行数:33,代码来源:Module.py

示例2: sendATData

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import secCounter [as 别名]
 def sendATData(self, atcom, atres, trys = 1, timeout = 1, csd = 1):
     mdm_timeout = int(self.config.get('TIMEOUT_MDM'))
     s = MDM.receive(mdm_timeout)
     result = -2
     while(1):
         if(csd):
             self.tryCSD()
         if(self.config.get('DEBUG_AT') == '1'):
             self.debug.send('DATA AT OUT: ' + atcom)
         s = ''
         MDM.send(atcom, mdm_timeout)
         timer = MOD.secCounter() + timeout
         while(1):
             s = s + MDM.receive(mdm_timeout)
             if(s.find(atres) != -1):
                 result = 0
                 break
             if(s.find('ERROR') != -1):
                 result = -1
                 break
             if(MOD.secCounter() > timer):
                 break
         if(self.config.get('DEBUG_AT') == '1'):
             self.debug.send('DATA AT IN: ' + s[2:])
         trys = trys - 1
         if((trys <= 0) or (result == 0)):
             break
         MOD.sleep(15)
     return (result, s)
开发者ID:suhvm,项目名称:wrx100_telit_gprs_python,代码行数:31,代码来源:gsm.py

示例3: GetData

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import secCounter [as 别名]
def GetData(TIMEOUT_DWNLD):
    SER.send('Ready to wait for response\r')
    timeout = MOD.secCounter() + TIMEOUT_DWNLD
    timer = timeout - MOD.secCounter()
    HTML_UC_END = '</RESPONSE>'
    HTML_LC_END = '</response>'
    data = ''
    mesg = ''
    while ((data.find('NO CARRIER') == -1) and (timer >0) ):
        SER.send('...Downloading\r')
        datatmp = MDM.receive(5)
        data = data + datatmp
        timer = timeout - MOD.secCounter()
        wd.feed()

    if(data.find('HTTP/1.1 200') == -1):
        mesg = 'Update server ERROR: ' + data[0:12]
        SER.send(mesg)
        SER.send('\r')
        SER.send(data)
        SER.send('\r')
        data = -1

    else:
        mesg = 'Update server SUCCEFULL: ' + data[0:12]
        SER.send(mesg)
        SER.send('\r')

    Log.appendLog(mesg)        
    return data
开发者ID:gabrielventosa,项目名称:avl_so,代码行数:32,代码来源:Chat.py

示例4: checkCon

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import secCounter [as 别名]
def checkCon(pin):
    a = SER.send('DEBUG: Now in checkCon...\r\n')
    #print '\r\ncheckCon PIN:',pin
    res = MDM2.send('AT+CREG?\r',0)
    res = MDM2.receive(30)
    b = SER.send('DEBUG: following is result from AT+CREG?\r\n')
    c = SER.send(res);
    if ( (res.find('0,1') > -1)  or (res.find('0,5')  > -1 ) ):
        return 1

    ret = ''
    ret = setPin(pin)
    if ( ret != 1 ):
        GPIO.setIOdir(19,1,1)
        return -1 

    timer = MOD.secCounter() + 120
    while ( (res.find('0,1') == -1)  and  (res.find('0,5')  == -1 ) ):
        res = MDM2.send('AT+CREG?\r',0)
        res = MDM2.receive(20)
        b = SER.send('DEBUG: following is result from AT+CREG?\r\n')
        c = SER.send(res);
        if ( MOD.secCounter() > timer ):
            return -1
        MOD.sleep(50)
    MOD.sleep(20)
    return 1 
开发者ID:ehwest,项目名称:unapy,代码行数:29,代码来源:telittest.py

示例5: setPin

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import secCounter [as 别名]
def setPin(pin):
    rr = ''
    tt = MOD.secCounter() + 30
    while ( rr.find('READY') == -1):
        rr = MDM2.send('AT+CPIN?\r',0)                   # CPIN Status
        rr = MDM2.receive(5)
        if ( rr.find('SIM PIN') != -1 ):
            bb = MDM2.send('AT+CPIN=' + pin + '\r',0)    # set PIN
            MOD.sleep(10)                                # wait 1sec
        if ( MOD.secCounter() > tt ):
            return -1 
        MOD.sleep(10)
    return 1
开发者ID:ehwest,项目名称:unapy,代码行数:15,代码来源:telittest.py

示例6: openSD

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import secCounter [as 别名]
def openSD(H):
    res = MDM2.send('AT#SD=1,0,80,' + H +',0\r', 0)
    timer = MOD.secCounter() + 30
    while (MOD.secCounter() < timer):
        res = MDM2.receive(10)
        a = SER.send('\r\nDEBUG: Back in openGPRS just did AT#SD=1,0,80....\r\n')
        a = SER.send(H)
        a = SER.send(res)
        if ((res.find('CONNECT') >= 0) ):
            timer = timer - 100
	    b = SER.send('\r\nsuccessfull connect, returning from openSD\r\n')
            return 1
        MOD.sleep(10)
    return -1
开发者ID:ehwest,项目名称:unapy,代码行数:16,代码来源:telittest.py

示例7: sendAT

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import secCounter [as 别名]
def sendAT(request, response, timeout = 2):
    MDM.send(request + '\r', 2)
    result = -2
    data = ''
    timer = MOD.secCounter() + timeout
    while(MOD.secCounter() < timer):
        rcv = MDM.read()
        if(len(rcv) > 0):
            data = data + rcv
            if(data.find(response) != -1):
                result = 0
                break
            if(data.find('ERROR') != -1):
                result = -1
                break
    return (result, data)
开发者ID:teleofis,项目名称:Watchdog,代码行数:18,代码来源:main.py

示例8: sendAT

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import secCounter [as 别名]
def sendAT(request, response="OK", timeout=3):
    MDM.send(request + "\r", 2)
    result = -2
    data = ""
    timer = MOD.secCounter() + timeout
    while MOD.secCounter() < timer:
        rcv = MDM.read()
        if len(rcv) > 0:
            data = data + rcv
            if data.find(response) != -1:
                result = 0
                break
            if data.find("ERROR") != -1:
                result = -1
                break
    return (result, data)
开发者ID:teleofis,项目名称:RX608SimSwitcher,代码行数:18,代码来源:watchdog.py

示例9: setup

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import secCounter [as 别名]
def setup ( ):
	initSettings()

	VOLT = Gauge.getBatteryVoltage()
	SER.send('Voltage: %s\n' % VOLT)

	# Don't start the network on a missing/near-empty battery
	if VOLT > 2500:
		initNetworkRelated()

	SER.send('Starting storage initialization at: %s\n' % MOD.secCounter())
	sector = Storage.initialize()
	SER.send('End at: %s. Sector: %s\n' % (MOD.secCounter(), sector))

	Module.CPUclock(0) # Clock back to default (@26Mhz)
	SER.send('CPU back down\n')
开发者ID:leongersen,项目名称:afstuderen,代码行数:18,代码来源:Main.py

示例10: isrunning

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import secCounter [as 别名]
 def isrunning(self):
   if self.running == 1:
     timeNow = MOD.secCounter()
     if timeNow > self.expirationTime:
       self.running = 0
       self.expired = 1
     else:
       self.expired = 0
   return self.running
开发者ID:JanusRC,项目名称:Python,代码行数:11,代码来源:timers.py

示例11: start

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import secCounter [as 别名]
 def start(self, seconds):
   self.startTime = MOD.secCounter()
   self.expirationTime = self.startTime + seconds
   if seconds != 0:
     self.running = 1
     self.expired = 0
   else:
     self.running = 0
     self.expired = 0
开发者ID:JanusRC,项目名称:Python,代码行数:11,代码来源:timers.py

示例12: receive

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import secCounter [as 别名]
def receive(timeout = 2):
    """Получить ответ от процессора

    Args:
        timeout: Время ожидания ответа в сек
    Returns:
        Сырые принятые данные
    """
    data = ''
    timer = MOD.secCounter() + timeout
    while(1):
        rcv = SER2.read()
        if(len(rcv) > 0):
            data = data + rcv
            if(data.endswith('\r') or data.endswith('\n')):
                return data
        if(MOD.secCounter() > timer):
            return ''
开发者ID:teleofis,项目名称:Locker,代码行数:20,代码来源:RX_API.py

示例13: send

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import secCounter [as 别名]
 def send(self, msg):
     message = str(MOD.secCounter()) + ' # ' + msg + '\r\n'
     max_len = int(self.config.get('TCP_MAX_LENGTH'))
     print message
     if (self.config.get('DEBUG_SER') == '1'):
         SER.send(message)
     if (self.config.get('DEBUG_TCP') == '1'):
         if((len(self.tcpLogBuffer) + len(message)) < max_len):
             self.tcpLogBuffer = self.tcpLogBuffer + message
开发者ID:AnaCaffe,项目名称:wrx100_old,代码行数:11,代码来源:debug.py

示例14: GetLineaDesdeSerial

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import secCounter [as 别名]
def GetLineaDesdeSerial(timeout_seg):
 global debug
 data=""
 nueva_data=""
 nueva_linea=0
 timeout=MOD.secCounter()+timeout_seg
 if (debug==1):
  SER.send("\r\nin Esperando linea desde serial")
 while ((nueva_linea==0) and (MOD.secCounter())):
  nueva_data = SER.read()
  data=data+str(nueva_data)
  if ((data.find('\n')!=-1) or (data.find('\r')!=-1)):
   data=data.replace('\n'," ")
   data=data.replace('\r'," ")
   nueva_linea=1
   if (debug==1):
    SER.send("\r\nin Nueva linea obtenida")
   return data
 return data
开发者ID:jamusategui,项目名称:zjj,代码行数:21,代码来源:3004conSMSATRUN.py

示例15: sendEscapeSequence

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import secCounter [as 别名]
def sendEscapeSequence ( ):

    # Module doesn't care if it isn't in data mode
    # Must sleep AT LEAST  1 sec before and after escape sequence
    MOD.sleep(12)
    MDM.send("+++", 5)
    MOD.sleep(12)

    timeout = MOD.secCounter() + 5
    return _target(["OK"], timeout) != 0
开发者ID:leongersen,项目名称:afstuderen,代码行数:12,代码来源:Module.py


注:本文中的MOD.secCounter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。