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


Python SER类代码示例

本文整理汇总了Python中SER的典型用法代码示例。如果您正苦于以下问题:Python SER类的具体用法?Python SER怎么用?Python SER使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: sendData

def sendData(PIN,PO,HO,A,GU,GP,data,ll):
    b = SER.send('\r\nIn sendData...sending\r\n' + data + '\r\n')
    b = SER.send('\r\nHO=\r\n')
    b = SER.send(HO)
    b = SER.send('\r\npO=\r\n')
    b = SER.send(PO)
    b = SER.send('\r\n')
    a = openGPRS(PIN,A,GU,GP)
    a = openSD(HO)
    res = MDM2.send('POST /' + PO + ' HTTP/1.1 Connection: close\r\n', 0)
    res = MDM2.send('HOST: ' + HO + '\r\n', 0)
    res = MDM2.send('User-Agent: Terminal Connect\r\n', 0)
    res = MDM2.send('Content-Type: application/x-www-form-urlencoded\r\n', 0)
    res = MDM2.send('Content-Length: '+ str(ll) +'\r\n\r\n', 0)
    res = MDM2.send(data, 0)
    res = MDM2.send('\r\n\r\n', 0)
    cnt = 20
    res = MDM2.receive(20)
    a = SER.send('\r\nResponse from server ------------------------\r\n')
    while ( (res.find('EOT') == -1) and (cnt > 0) ):
        a = SER.send(res)
        res = MDM2.receive(20)
        cnt = cnt - 1
    a = SER.send(res)
    res = closeCon()
    a = SER.send('\r\nend -----------------------------------------\r\n')
    return res
开发者ID:ehwest,项目名称:unapy,代码行数:27,代码来源:telittest.py

示例2: ProcessSBMCommand

def ProcessSBMCommand():
	while(1):
		PrintDebug("SBS Command Process")
		#PrintDebug("Waiting for command")
		# COMMAND_START = 0
		# COMMAND_END = 1
		#if(len(GlobalVaria.UartData) > DATA_LEN):
		#PrintDebug("Data is more than the defined limit")
		#PrintDebug("Wiating on seriel port")
		GlobalVaria.UartData = GlobalVaria.UartData + SER.read()
		PrintDebug(GlobalVaria.UartData)
		startIndex = GlobalVaria.UartData.find('\x02')
		endIndex = GlobalVaria.UartData.find('\x03')
		PrintDebug("Start Index:" + str(startIndex))
		PrintDebug("end Index:" + str(endIndex))
		if(startIndex != -1 and  endIndex!= -1):
			GlobalVaria.SBMBuffer = GlobalVaria.UartData[startIndex:endIndex+1]
			PrintDebug("Command: " + GlobalVaria.SBMBuffer)
			SER.send('\x02')
			FindSbmCmnd(GlobalVaria.SBMBuffer[1])
			GlobalVaria.UartData = GlobalVaria.UartData[endIndex+1:]
			PrintDebug("Remaining:" + GlobalVaria.UartData)
		else:
			SER.send('\0x03')
			break
开发者ID:pkondalu,项目名称:telit-code,代码行数:25,代码来源:SBMMain.py

示例3: transmitMessage

def transmitMessage ( message ):

	# If the socket is not open, we'll dial.
	if Module.socketIsSuspended() == 0:

		SER.send('Dail socket, state is: %s\n' % Module.ATcommand('AT#SS=1'))

		if Module.socketDail( Config.API ) == 0:
			SER.send('Failed to open a socket\n')
			return 0

	elif Module.socketResume() == 0:
		SER.send('Failed socket resume\n')

	response = Module.makeRequest(URL, ('[%s]' % message))

	if ( response == 0 ):
		SER.send('Request failed\n')
	else:
		updateSettings(response)

	if ( Module.sendEscapeSequence() == 0 ):
		SER.send('Failed to escape, not in command mode\n')

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

示例4: WriteUploadDataToFile

def WriteUploadDataToFile():
	PrintDebug("Writting Data to File")
	InfileHandler = -1
	GlobalVaria.sbmInFileLength1 = 0
	GlobalVaria.SBMBuffer = GlobalVaria.SBMBuffer[2:-1]
	GlobalVaria.SBMBuffer = GlobalVaria.SBMBuffer + '\0'
	GlobalVaria.sbmInFileLength1 = FileSize(GlobalVaria.SBM_DATA_INFILE1)
	if(GlobalVaria.sbmInFileLength1 > 49000):
		if((FileCheck(GlobalVaria.SBM_DATA_INFILE2)== -1) and (FileCheck(GlobalVaria.SBM_DATA_OUTFILE)== 1)):
			rename(GlobalVaria.SBM_DATA_INFILE1,GlobalVaria.SBM_DATA_INFILE2)
			GlobalVaria.sbmInFileLength1 = 0
			GlobalVaria.sbmInFileLength2 = FileSize(GlobalVaria.SBM_DATA_INFILE2)
		else:
			GlobalVaria.InFileLenExceededflag = '1';
			SER.send('\0x02')
			return
	try:
		InfileHandler = open(GlobalVaria.SBM_DATA_INFILE1,'a')
	except IOError:
		SER.send('\x03')
		return 0
	InfileHandler.write(GlobalVaria.SBMBuffer)
	writeedlen = len(GlobalVaria.SBMBuffer)
	GlobalVaria.sbmInFileLength1 = FileSize(GlobalVaria.SBM_DATA_INFILE1)
	GlobalVaria.sbmInFileLength2 = 0
	InfileHandler.close()
	InfileHandler = -1
	PrintDebug("Writting Complated")
开发者ID:pkondalu,项目名称:telit-code,代码行数:28,代码来源:SBMMain.py

示例5: calendarProcessing

def calendarProcessing():
    global CALENDAR
    if(CALENDAR > (int(CFG.get('ALIVESMS')) - 1)):
        calendar.writeCalendar(0)
        CALENDAR = 0
        SER.send('Send heartbeat SMS\r')
        sendAlert('Device is alive.')
开发者ID:teleofis,项目名称:Locker,代码行数:7,代码来源:main.py

示例6: checkCon

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,代码行数:27,代码来源:telittest.py

示例7: send

 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,代码行数:9,代码来源:debug.py

示例8: ringProcessing

def ringProcessing():
    ring = gsm.checkRing()
    if(ring != ''):
        SER.send('Ringing with number: %s\r' % (ring))
        if(ring in CFG.getList('WHITE')):
            executeCommand(command.Command('OUT1', '1'))
        else:
            SER.send('Phone is not in Whitelist\r')
#         MOD.sleep(40)
        gsm.hangUp()
开发者ID:teleofis,项目名称:Locker,代码行数:10,代码来源:main.py

示例9: log

def log(m):
    t = util.timestamp()
    d = '%s: %s\r' % (t, m)
    SER.send(d)
    try:
        f = open( log_file, 'a' )
        f.write(d)
        f.close()
    except:
        return
开发者ID:jgrahamc,项目名称:gaga,代码行数:10,代码来源:logger.py

示例10: enviarAT

def enviarAT(comando,timeout,respuesta_esp):
 comando_aux=comando
 comando_aux=comando_aux.replace('\n',"(N)")
 comando_aux=comando_aux.replace('\r',"(R)")
 global debug
 if (debug==1):
  SER.send("\r\nout:"+comando_aux)
 res_envio=MDM.send(comando,20)
 res_envio=MDM.send('\r\n',20)
 respuesta=RecibirDesdeModem(timeout,respuesta_esp)
 return respuesta
开发者ID:jamusategui,项目名称:zjj,代码行数:11,代码来源:3004conSMSATRUN.py

示例11: iterateHTTPCmd

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,代码行数:11,代码来源:RHandler.py

示例12: lastIndexOf

def lastIndexOf(data,text) :
    Temp = data.find(text)
    
    SER.send(str(Temp)+'\r\n')
    
    while Temp != -1 :
        Index = Temp
        Temp = data.find(text,Temp + len(text))
        
        SER.send('Index = '+str(Index)+', Temp = '+str(Temp)+'\r\n')   
    
    return Index
开发者ID:MrZANE42,项目名称:car-tracker,代码行数:12,代码来源:RHandler.py

示例13: check_LockFlag

def check_LockFlag():
	#unlocked returns 1
	res = SER.receive(15)
	res = SER.send('GET_LOCK_FLAG\r')
	res = SER.receive(15)

	if(res.find('UNLOCKED' != -1)):
		res = 1
	# locked returns 0
	else:
		res = 0
	return res
开发者ID:gabrielventosa,项目名称:avl_so,代码行数:12,代码来源:Chronos.py

示例14: check_PannicFlag

def check_PannicFlag():
	res = SER.receive(15)
	res = SER.send('GET_PANNIC_STATUS\r')
	res = SER.receivebyte(20)

	if(res == 97):
		print 
		#nopannic returns 1
		res = 1
	#pannic returns 0
	else:	
		res = 0
	return res
开发者ID:gabrielventosa,项目名称:avl_so,代码行数:13,代码来源:Chronos.py

示例15: init

def init():
    try:
        # Init the module configuration
        command.send_at_command("AT#SELINT=2")
        
        # Set the command mode       
        command.send_at_command("AT&K0")
        
        # Configure GPS speed
        # command.send_at_command("AT$GPSS=57600")
        
    except Exception, err:
        SER.send("Erro ao iniciar o modulo: %s\n"%err)
开发者ID:edhana,项目名称:PythonLaptimer,代码行数:13,代码来源:main.py


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