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


Python SER.set_speed方法代码示例

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


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

示例1: init

# 需要导入模块: import SER [as 别名]
# 或者: from SER import set_speed [as 别名]
def init(speed,format):
    # This function initializes the SER interface, you MUST initialize the interface or no data will be usable in or out of the DTE interface.

    try:


        #Init Serial Port Settings
        res = SER.set_speed(speed,format)
        if (res == -1):
            return(-1)

    except:
        printException("init_parameters(" + speed + "," + format + ")")
        return(-1)

    return (0)
开发者ID:JanusRC,项目名称:Python,代码行数:18,代码来源:JANUS_SER.py

示例2: init

# 需要导入模块: import SER [as 别名]
# 或者: from SER import set_speed [as 别名]
def init (speed,format):

    # Method return value:
    #   -2 = Unknown error occurred
    #   -1 = Exception occurred
    #    0 = Finished w/o error

    tmpReturn = -1

    try:

        #Init Serial Port Settings
        res = SER.set_speed(speed,format)
        if not(res == 1):
            return -2

    except:
        printException("init()")
        tmpReturn = -1

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

示例3: init_parameters

# 需要导入模块: import SER [as 别名]
# 或者: from SER import set_speed [as 别名]
def init_parameters (speed,format):

    try:

        ## ########################################################################################################      
        ## Take control of UART_SEL input
        ## Warning don't externaly drive the UART_SEL input via 50-PIN header when controlling via this script!!!!
        ## ########################################################################################################

        #MUX SELECT, GPIO 20 configured as Output, value is Set to '1'
        #DB9 connected to SER MODULE
        GPIO.setIOdir(20,1,1)

        #Init Serial Port Settings
        res = SER.set_speed(speed,format)

    except:
        print 'Script encountered an exception.'
        print 'Exception Type: ' + str(sys.exc_type)
        print 'MODULE -> GSM864QP_SER'
        print 'METHOD -> init_parameters(' + speed + ',' + format + ')'

    return (res)
开发者ID:jacobhartsoch,项目名称:janus_http_gateway,代码行数:25,代码来源:GSM864QP_SER.py

示例4: init

# 需要导入模块: import SER [as 别名]
# 或者: from SER import set_speed [as 别名]
def init(speed,format):
    # This function initializes the SER interface, you MUST initialize the interface or no data will be usable in or out of the DTE interface.

    try:

        rtnList = [-1,-1]    #[return status,return data]
        # return status:
        #   -2:    Timeout
        #   -1:    Exception occurred
        #    0:    No errors occurred, no return data
        #    1:    No errors occurred, return data

        #Init Serial Port Settings
        rtnList[0] = mySER.set_speed(speed,format)
        if (rtnList[0] == -1):
            return rtnList

        rtnList[0] = 0   

    except:
        print sys.exc_info()
        rtnList[0] = -1

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

示例5: __init__

# 需要导入模块: import SER [as 别名]
# 或者: from SER import set_speed [as 别名]
	def __init__(self):
		SER.set_speed('115200','8N1')
开发者ID:predat0r,项目名称:GSM,代码行数:4,代码来源:p.py

示例6:

# 需要导入模块: import SER [as 别名]
# 或者: from SER import set_speed [as 别名]
import GPS
import MOD
import SER
import GPIO

# Set serial BAUD rate
SER.set_speed('115200')

SER.send('Start custom imports\n')

import Module
SER.send('Imported Module\n')

Module.CPUclock(3) # Clock to 104Mhz
SER.send('Ramped up CPU\n')

import Config
SER.send('Imported Config\n')

import Gauge
SER.send('Imported Gauge\n')

import Storage
SER.send('Imported Storage\n')

SER.send('Done importing\n')

IMEI = Module.ATcommand('AT+CGSN').split('\r\n')[1]
URL = '/%s/track' % IMEI
SER.send('IMEI: %s\n' % IMEI)
开发者ID:leongersen,项目名称:afstuderen,代码行数:32,代码来源:Main.py

示例7: __init__

# 需要导入模块: import SER [as 别名]
# 或者: from SER import set_speed [as 别名]
# at your option) any later version.                                   	#
#                                                                      	#
# This program is distributed in the hope that it will be useful,      	#
# but WITHOUT ANY WARRANTY; without even the implied warranty of       	#
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        	#
# GNU General Public License for more details.                         	#
#                                                                      	#
# You should have received a copy of the GNU General Public License    	#
# with this program.  If not, see <http://www.gnu.org/licenses/>.      	#
#########################################################################


import SER
import sys


class serialStdOut:
    def __init__(self, desc):
        self.desc = desc
        self.term = "\r"

    def write(self, s):
        SER.send(self.desc + s.rstrip() + self.term)


SER.set_speed("115200", "8N1")
# enable these lines on the telit, but not on the mac
# sys.stdout = serialStdOut("")
# sys.stderr = serialStdOut("stderr: ")
print "stdout initialized"
开发者ID:GROUNDLAB,项目名称:Telit-Loader,代码行数:32,代码来源:sout.py

示例8: Mainloop

# 需要导入模块: import SER [as 别名]
# 或者: from SER import set_speed [as 别名]
def Mainloop():
	MAX_ERRORS = 3
	UPDATE_TIME = 3600
	TIMEOUT_CMD = 500

	wd.feed()
	
	res = SER.set_speed('9600')
	imei = utils.getimei()
	time = Log.uptime()
	smsmsg = time + ' Starting Unit: ' + imei
	res = MDM.receive(20)
	res = scmd.sendCmd('AT+CMGF', '1', 50)
	res = 1
	
	if(res != 1):
		Log.ReportError('Error Sending Init MSG')
	else:
		msg= 'Starting Unit:' + imei
		Log.appendLog(msg)
		printdbg.printSER(msg)
		

	res = scmd.sendCmd('at+cfun','5',10)
	serv_data = -1
	
	while 1:	
		hname = gprs.gethname()
		printdbg.printSER(hname)
		NUpdate = timers.timer(0)
		NUpdate.start(3)
		print "Ready to start main loop"
		Mto = timers.timer(0)
		Mto.start(120)
		while 1:
			wd.feed()
			printdbg.printSER("Doing GPS")
			data =gpsinfo.gpsData() 
			if data == -1:
				errmsg = "GPS Error"
				printdbg.printSER("GPS ERROR")
				#Log.ReportError(errmsg)
###############################################################################
###########STATIC UPDATE ROUTINE###############################################
###############################################################################
			try:
				if (NUpdate.isexpired() and data != -1):
					print "ready to static update"
					Log.ReportError('Doing timeout Update')
					data["dyn"] = "0"
					Chronos.set_LockFlag()
					res = gprs.updateloop(hname,data,MAX_ERRORS)
					gp = gprs.disGPRS()
					NUpdate.start(3600)
					if res == -1:
						break
					serv_data = data
			except (Exception, StandardError, SystemError, RuntimeError):
				msg = 'Expception in Static Update: '
				Log.appendLog(msg)
				print "exception in static update"

###############################################################################
############END OF STATIC UPDATE ROUTINE#######################################
###############################################################################				
				
			data = gpsinfo.gpsData()
			if data == -1:
				errmsg = "GPS Error"
				#Log.ReportError(errmsg)
###############################################################################
###############DYNAMIC UPDATE ROUTINE##########################################
###############################################################################
			try:
				if serv_data != -1 and data!= -1 and \
				    utils.dist(serv_data["latitud"],data["latitud"],serv_data["longitud"],data["longitud"]) > 5000:
					Log.ReportError('Dynamic Routine Update')
					data["dyn"] = "1"
					res = gprs.updateloop(hname,data,MAX_ERRORS)
					if res == -1:
						Log.ReportError('Error in updateloop')
						break
					serv_data = data
					NUpdate.start(300)

			except (Exception, StandardError, SystemError, RuntimeError):
				msg = 'Expception in Dynamic Update '
				Log.appendLog(msg)
				print "exception in dynamic update"
				
##############################################################################
##############END OF DYNAMIC UPDATE ROUTINE###################################
##############################################################################
##############################################################################
##############Start revision of wireless alert##		
			try:
				SER.send('SWICHT_LED\r')
				if(Chronos.check_PannicFlag() == 1):
					print 'Doing Pannic Update'
					data["dyn"] = "2"
#.........这里部分代码省略.........
开发者ID:gabrielventosa,项目名称:avl_so,代码行数:103,代码来源:AVL.py

示例9: while

# 需要导入模块: import SER [as 别名]
# 或者: from SER import set_speed [as 别名]
 frase=frase.replace(',',"%2C")
 frase=frase.replace('(',"%28")
 frase=frase.replace(')',"%29")
 return frase

try:
    MOD.watchdogEnable(1000)
    salir_prog=0
    #activar SMS AT RUN para telefonos que empiecen por +34:
    res=enviarAT('at+cmgf=1',20,'+CMGF: 1')
    res=enviarAT('at#smsmode=1',30,'OK')
    res=enviarAT('at#smsatwl=0,1,0',"+34*",20,'OK')
    res=enviarAT('at#smsatruncfg=3,1,5',20,'OK')
    res=enviarAT('at#smsatrun=1',30,'OK')
    while (salir_prog==0):
     res = SER.set_speed('9600')
     if (debug==1):
      res=SER.send('\rIniciando programa\r')
     GPIO.setSLED(0, 10, 10)
     linea=GetLineaDesdeSerial(60*20)
     GPIO.setSLED(1, 10, 10)
     IniciarModem()
     GPIO.setSLED(3, 5, 5)
     envio_ok=EnviarDatosMET(CodificarParaGET(linea))
     res=enviarAT('at',10,'OK')
     if (envio_ok==1):
      MOD.watchdogReset()
      if (debug==1):
       res=enviarAT('at#gdatavol=1',10,'#GDATAVOL:')
     if (envio_ok!=1):
      salir_prog=1
开发者ID:jamusategui,项目名称:zjj,代码行数:33,代码来源:3004conSMSATRUN.py

示例10: Main

# 需要导入模块: import SER [as 别名]
# 或者: from SER import set_speed [as 别名]
def Main(FILE_NAME):
	
	res = SER.set_speed('115200')
	res = MDM.send('AT+CMEE=2\r',0)
	SER.send('Starting Update Script')
	SER.send('\r')
	res = MDM.receive(TIMEOUT_MINIMUM)
	IMEI = getimei()
	
	# check for SIM registration on a network 
	#res = MDM.send('AT+COPS\r',0)
	#res = MDM.receive(TIMEOUT_REG)
	#while ( res.find(',') == -1):
	#	res = MDM.send('AT+COPS\r',0)
	#	res = MDM.receive(TIMEOUT_REG)


	# wait until SIM is registered
	#while ( res.find(',') == -1):
	#	res = MDM.send('AT+COPS\r',0)
	#	res = MDM.receive(TIMEOUT_REG)

	#################################################
	#############Set user and password###############
	res = MDM.send('AT#USERID="',0)
	res = MDM.send(USERID,0)
	res = MDM.send('"\r',0)
	res = MDM.receive(TIMEOUT_MINIMUM)
	res = MDM.send('AT#PASSW="',0)
	res = MDM.send(PASSWD,0)
	res = MDM.send('"\r',0)
	res = MDM.receive(TIMEOUT_MINIMUM)
	############# define the PDP context #############
	##########################################
	res = MDM.send('AT+CGDCONT=1,"IP","',0)
	res = MDM.send(APN,0)
	res = MDM.send('"\r',0)
	res = MDM.receive(TIMEOUT_CXT)
	res = res.find ('OK')
	if (res == -1):
		print 'Error setting PDP context'
		SER.send('Error setting PDP context')
		SER.send('\r')
		return -1
	else:
		res = ' '
		while (res.find('#SGACT:')== -1 and res.find('already activated') == -1):
			SER.send('Opening WEB connection\r\n')
			res = MDM.send('AT#SGACT=1,1\r',0)
			res = MDM.receive(2*TIMEOUT_CONNECT)
			SER.send(res)
		res = MDM.send('AT#SD=1,0,80,"',0)
		res = MDM.send(HTML_ADDR,0)
		res = MDM.send('"\r',0)
	############# open the connection with the internet host
		timer = MOD.secCounter()
		timeout = MOD.secCounter() + TIMEOUT_CONNECT
		res = MDM.receive(TIMEOUT_MINIMUM)
		res = res.find('CONNECT')
	############# wait for connect ############
		while ((res == -1)and (timer > 0) ):
			res = MDM.receive(TIMEOUT_MINIMUM)
			res = res.find('CONNECT')
			timer = timeout - MOD.secCounter()
		if ( res != -1 ):
			print 'CONNECTED'
			SER.send('CONNECTED')
			SER.send('\r')
			
	############# send the command of getting data
			res = MDM.send('GET ',0)
			res = MDM.send(SCRIPT,0)
			res = MDM.send('?device=',0)
			res = MDM.send(IMEI,0)
			res = MDM.send('&file=',0)
			res = MDM.send(FILE_NAME,0)
			res = MDM.send(' HTTP/1.0\r\n',0)
			res = MDM.send('Host: ',0)
			res = MDM.send(HTML_ADDR,0)
			res = MDM.send('\r\n',0)
			res = MDM.send('\r\n\r\n\r\n\r\n',0)
			data = ' '
	############ get data
			print 'GETTING DATA'
			SER.send('GETTING DATA')
			SER.send('\r')

			response = -1			
			data = GetData(FILE_NAME)
			if (data!= -1):
				SER.send('DOWNLOAD COMPLETE --- SAVING DATA')
				SER.send('\r')
				print 'DOWNLOAD COMPLETE --- SAVING DATA'
				f = open(FILE_NAME, 'w')
				f.write(data)
				f.close()
				response = 1
			else:
				print 'ERROR GETTING DATA'
				SER.send('ERROR GETTING DATA')
#.........这里部分代码省略.........
开发者ID:gabrielventosa,项目名称:avl_so,代码行数:103,代码来源:FTPupdate.py

示例11: init

# 需要导入模块: import SER [as 别名]
# 或者: from SER import set_speed [as 别名]
 def init(self):
     a = SER.set_speed(self.config.get('SER_SP'), self.config.get('SER_OD'))
     if(a != 1):
         raise Exception, 'ERROR, Serial.init() failed'
     self.debug.send('Serial.init() passed OK')
     return
开发者ID:ABBARS,项目名称:wrx100_telit_gprs_python,代码行数:8,代码来源:serial.py

示例12: get_new_log_filename

# 需要导入模块: import SER [as 别名]
# 或者: from SER import set_speed [as 别名]
    except Exception, err:
        SER.send("Erro ao iniciar o modulo: %s\n"%err)
        
def get_new_log_filename():
    # Get the gps string
    gps_string = GPS.getActualPosition()

    gps_split_message = gps_string.split(',')

    if is_valid_message(gps_split_message) and int(gps_split_message[7].split('.')[0]) > SPEED_LOWER_LIMIT :
        return "%s.log"%gps_split_message[0].split('.')[0]

    return ''        
    
if __name__ == "__main__":
    SER.set_speed("115200")
    SER.send("Iniciando cliente Lap Timer em %d\n"%MOD.secCounter())
    
    # Watchdog set to 20 seconds
    MOD.watchdogEnable(WATCHDOG_TIMEOUT) 
    
    # Open the log file
    gps_log_file = None
    
    init()
        
    log_filename = ''
    
    while(log_filename == ''):
        log_filename = get_new_log_filename()
        if log_filename == '':
开发者ID:edhana,项目名称:PythonLaptimer,代码行数:33,代码来源:main.py

示例13: __init__

# 需要导入模块: import SER [as 别名]
# 或者: from SER import set_speed [as 别名]
 def __init__(self):
     SER.set_speed("9600")
开发者ID:teleofis,项目名称:RX608SimSwitcher,代码行数:4,代码来源:watchdog.py

示例14:

# 需要导入模块: import SER [as 别名]
# 或者: from SER import set_speed [as 别名]
import GPS
import SER
import MDM
import MOD

SER.set_speed('9600')
while 1:
	SER.send('hello world!')
	MOD.sleep(30)

开发者ID:Aktan,项目名称:Telit-Loader,代码行数:11,代码来源:WORKINGTEST.py

示例15:

# 需要导入模块: import SER [as 别名]
# 或者: from SER import set_speed [as 别名]
import MOD      # Use build in module
import SER      # Use serial
import CONFIG   # Configurations
import FUNC     # Functions

conf = CONFIG.config

# settings ---------------------------------
# 0 flow control OFF
res = MDM.send('AT&K0\r', 0) 
res = MDM.receive(10)

# Konfiguration laden ---------------------------------------------------
res = CONFIG.initConfig()

SER.set_speed(conf['COM'],'8N1')
a = SER.send('\r\n***************************************************************************')
a = SER.send('\r\n*        Start Terminal Connection -  Triptec Service                    *')
a = SER.send('\r\n***************************************************************************\r\n')
a = SER.send('\r\n- wait for connection to network ----------------\r\n')
r = FUNC.openGPRS(conf['PIN_SIM'],conf['APN'],conf['GPRS_USER'],conf['GPRS_PASS']) #openGPRS(P,A,GU,GP)
a = FUNC.setGPIO(CONFIG.statLED,1)
a = SER.send('\r\n\r\n- wait for data input ----------------\r\n')

# start Schleife --------------------------------------------------------
while 1:
    a = FUNC.setGPIO(CONFIG.statLED,0)
    MOD.sleep(10)
    a = FUNC.setGPIO(CONFIG.statLED,1)
    MOD.sleep(10)
    b = SER.send('\r\nYou have 10 seconds to put something in.\r\n')
开发者ID:ehwest,项目名称:unapy,代码行数:33,代码来源:telittest.py


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