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


Python MOD.sleep方法代码示例

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


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

示例1: configSMS

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

    try:

        #Enable TEXT format for SMS Message
        res = sendAtCmd('AT+CMGF=1' ,properties.CMD_TERMINATOR,0,5)
        res = sendAtCmd('AT+CNMI=2,1' ,properties.CMD_TERMINATOR,0,5)

        #SIM status control - to avoid the 'sim busy' error
        print 'SIM Verification Cycle'
        SIM_status = sendAtCmd('AT+CPBS?' ,properties.CMD_TERMINATOR,0,5)

        if SIM_status.find("+CPBS")<0:
            print 'SIM busy! Please wait!\n'

        while SIM_status.find("+CPBS:")< 0 :
            SIM_status = sendAtCmd('AT+CPBS?' ,properties.CMD_TERMINATOR,0,5)
            MOD.sleep(2)
        print 'SIM Ready'

    except:
        print 'Script encountered an exception.'
        print 'Exception Type: ' + str(sys.exc_type)
        print 'MODULE -> ATC'
        print 'METHOD -> configSMS()'

    return
开发者ID:jacobhartsoch,项目名称:janus_http_gateway,代码行数:29,代码来源:ATC.py

示例2: wait4SIMReady

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

    #SIM status control - to avoid the 'sim busy' error
    # The following sequence loops forever until SIM card is ready for use

    try:

        res = ATC.sendAtCmd("AT#SIMDET?",ATC.properties.CMD_TERMINATOR,0,2)             #query Sim detection style
        if (res.find("#SIMDET: 2")< 0):
            res = ATC.sendAtCmd('AT#SIMDET=2',ATC.properties.CMD_TERMINATOR,0,2)        #Ensure detection is automatic via SIMIN and not forced
            res = ATC.sendAtCmd('AT&P0',ATC.properties.CMD_TERMINATOR,0,2)              #Save Profile
            res = ATC.sendAtCmd('AT&W0',ATC.properties.CMD_TERMINATOR,0,2)              #Save Settings        

        print 'SIM Verification Cycle'
        SIM_status = ATC.sendAtCmd('AT+CPBS?' ,ATC.properties.CMD_TERMINATOR,0,5)       #We aren't using AT+CPIN? because there are too many possible answers
                                                                                        #This lets us know that the SIM is at least inserted
        if SIM_status.find("+CPBS")<0:
            print 'SIM busy! Please wait!\n'

        while SIM_status.find("+CPBS:")< 0 :
            SIM_status = ATC.sendAtCmd('AT+CPBS?' ,ATC.properties.CMD_TERMINATOR,0,5)
            MOD.sleep(2)
        print 'SIM Ready'

    except:
        printException("wait4SIMReady()")

    return
开发者ID:JanusRC,项目名称:Python,代码行数:30,代码来源:NETWORK.py

示例3: waitRegister

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import sleep [as 别名]
def waitRegister():
    while(1):
        RX_API.resetWDT()
        r, d = sendAT('AT+CREG?', '+CREG: 0,1')
        if(r == 0):
            break
        MOD.sleep(20)
开发者ID:teleofis,项目名称:Locker,代码行数:9,代码来源:gsm.py

示例4: receiveReponse

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import sleep [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

示例5: sendATData

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import sleep [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

示例6: checkCon

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import sleep [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

示例7: eraseSector

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import sleep [as 别名]
def eraseSector ( sector_address ):
	addr = mbytewrap(sector_address, 0x00)
	msg = '\x20%s' % addr

	writeEnable()
	writ = SPIobj.readwrite(msg)
	MOD.sleep(3) # Stay within safeties for sector erase (abs.max 450ms)
	return writ
开发者ID:leongersen,项目名称:afstuderen,代码行数:10,代码来源:Interface.py

示例8: delAll

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

    res = MDM.send("AT+CMGF=1\r", 0)
    res = MDM.receive(3)
    res = MDM.send("AT+CNMI=2,1\r", 0)
    res = MDM.receive(3)
    if res.find("OK") != -1:
        print "OK for AT+CNMI=2,1"
    else:
        print "ERROR for AT+CNMI=2,1"

    # SIM status control - to avoid the 'sim busy' error
    print "SIM Verification Cycle"
    a = MDM.send("AT+CPBS?\r", 0)
    SIM_status = MDM.receive(10)
    if SIM_status.find("+CPBS") < 0:
        print "SIM busy! Please wait!\n"
    while SIM_status.find("+CPBS:") < 0:
        a = MDM.send("AT+CPBS?\r", 0)
        SIM_status = MDM.receive(10)
        MOD.sleep(2)
    print "SIM Ready"

    # receive the list of all sms
    MDM.send('AT+CMGL="ALL"\r', 0)
    smslist = ""
    MemSMS = MDM.receive(20)
    smslist = MemSMS
    while MemSMS != "":
        MemSMS = MDM.receive(20)
        smslist = smslist + MemSMS

    # listsms = MemSMS.splitlines()
    listsms = smslist.split("\n")
    listIndex = []  # the list of index to delete
    for string in listsms:
        if string.find("+CMGL:") != -1:  # find the index of each sms
            start = string.find(":")
            end = string.find(",")
            myindex = string[(start + 1) : end]
            myindex = myindex.strip()
            listIndex.append(myindex)
        print string

    if listIndex == []:
        print "No SMS in SIM"

    # delete all sms
    for index in listIndex:
        print "Deleting sms index: " + index
        MDM.send("AT+CMGD=", 0)
        MDM.send(index, 0)
        MDM.send("\r", 0)
        res = MDM.receive(20)
        res = res.replace("\r\n", " ")
        print res

    return 1
开发者ID:gabrielventosa,项目名称:avl_so,代码行数:60,代码来源:DelSMS.py

示例9: feed

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import sleep [as 别名]
def feed():
    b = GPIO.setIOvalue(11, 0)
    b = GPIO.setIOvalue(12, 0)
    MOD.sleep(10)
    b = GPIO.setIOvalue(11, 1)
    b = GPIO.setIOvalue(12, 1)
    msg = "Reseting External Watchdog"
    # Log.appendLog(msg)
    return 1
开发者ID:gabrielventosa,项目名称:avl_so,代码行数:11,代码来源:wd.py

示例10: reboot

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import sleep [as 别名]
def reboot():
# This method does return a response.  After the AT#REBOOT command executes the GSM module will
# reset and the script will restart depending on the #STARTMODESCR settings.

    MOD.sleep(15)                                               #required to halt Python thread and allow NVM Flash to update
    print "Rebooting Terminus!"
    sendAtCmd('AT#REBOOT',properties.CMD_TERMINATOR,0,20)

    return
开发者ID:JanusRC,项目名称:Python,代码行数:11,代码来源:ATC.py

示例11: checkNetwork

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import sleep [as 别名]
def checkNetwork():
    MOD.sleep(20)
    REC_TIME = 200
    for _ in range(10):
        MDM.send("AT+CREG?\r",0)
        res = MDM.receive(REC_TIME)
        if (res.find('0,1')!=-1): return 1
        else: MOD.sleep(50)
    return 0
开发者ID:predat0r,项目名称:GSM,代码行数:11,代码来源:intExp.py

示例12: iterateCmd

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import sleep [as 别名]
def iterateCmd(comando, parametro, TIMEOUT_CMD, numCheck):
	while( numCheck >= 0):
		numCheck = numCheck -1
		res = sendCmd(comando, parametro, TIMEOUT_CMD)
		if(res.find('OK') != -1):
			return 1
		MOD.sleep(TIMEOUT_CMD)
		if(numCheck == 0):
			return -1
开发者ID:gabrielventosa,项目名称:avl_so,代码行数:11,代码来源:scmd.py

示例13: sendEscapeSequence

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import sleep [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

示例14: check_network

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import sleep [as 别名]
def check_network():
    MOD.sleep(20)
    for _ in range(10):
        MDM.send("AT+CREG?\r",0)
        res = MDM.receive(200)
        print 'check registration'
        if res.find('0,1') != -1:
            print 'registration ok'
            return 1
        else: MOD.sleep(50)
    return 0
开发者ID:predat0r,项目名称:GSM,代码行数:13,代码来源:main.py

示例15: iterateHTTPCmd

# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import sleep [as 别名]
def iterateHTTPCmd(comando, parametro, TIMEOUT_CMD, numCheck):
    while( numCheck >= 0):
        numCheck = numCheck - 1
        res  = Helper.sendCmd(comando, parametro, TIMEOUT_CMD)
        SER.send(res + ' ' + comando + '=' + parametro)
        if(res.find('CONNECT') != -1) :
            return 1
        MOD.sleep(TIMEOUT_CMD)
        if(numCheck == 0):
            SER.send(res + ' ' + comando + '=' + parametro)
            return -1
开发者ID:MrZANE42,项目名称:car-tracker,代码行数:13,代码来源:RHandler.py


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