本文整理汇总了Python中MOD.watchdogEnable方法的典型用法代码示例。如果您正苦于以下问题:Python MOD.watchdogEnable方法的具体用法?Python MOD.watchdogEnable怎么用?Python MOD.watchdogEnable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MOD
的用法示例。
在下文中一共展示了MOD.watchdogEnable方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import watchdogEnable [as 别名]
def main():
try:
# Set Global Watchdog timeout in Seconds
MOD.watchdogEnable(300)
#######################################
## Initialization
#######################################
rtnList = [-1,-1] #[return status,return data]
# return status:
# -1: Exception occurred
# 0: No errors occurred, no return data
# 1: No errors occurred, return data
# 2: Error occurred
#Initialize the serial interface @ 115200, we must do this or nothing comes out the serial port
rtnList = mySER.init("115200",'8N1')
if (rtnList[0] == -1):
return
mySER.sendUART("Beginning the serial bridge program. \r\n\r\n")
# Set Global Watchdog timeout in Seconds
#MOD.watchdogEnable(300)
#Get configuration from demo.conf file, transpose into new local myApp class
myApp = conf.conf('/sys','demo.conf')
if myApp.CONF_STATUS != 0:
mySER.sendUART("Demo configuration error: " + str(myApp.CONF_STATUS))
return rtnList
mySER.sendUART("Configuration Loaded.\r\n")
rtnList = myIO.init()
if (rtnList[0] == -1) or (rtnList[0] == -2) or rtnList[1] == "ERROR": raise UserWarning
mySER.sendUART("\r\nInitializing Network Setup. \r\n")
#Set Network specific settings, wait for SIM card to be ready
rtnList = NETWORK.initNetwork(myApp.ENS)
if (rtnList[0] == -1) or (rtnList[0] == -2): raise UserWarning
#Initialize SOCKET communications
rtnList = SOCKET.init('1',myApp.APN)
if (rtnList[0] == -1) or (rtnList[0] == -2): raise UserWarning
mySER.sendUART("Network Setup Initialized. \r\n\r\n")
#Update Unit information
rtnList = ATC.getUnitInfo()
if (rtnList[0] == -1): raise UserWarning
# Loop forever, without this loop the script would run once and exit script mode. On reboot or power-on the script would run once more
while (1):
MOD.watchdogReset()
#######################################
## Registration
#######################################
RegCheck = 0 #Initialize check
DataCheck = 0 #Initialize Check
#What is the signal strength?
rtnList = ATC.sendAtCmd('AT+CSQ',ATC.properties.CMD_TERMINATOR,5)
if (rtnList[0] == -1) or (rtnList[0] == -2): raise UserWarning
mySER.sendUART("Signal Strength (AT+CSQ): " + rtnList[1] + "\r\n")
#Wait until module is registered to GSM Network
mySER.sendUART("Checking Modem Registration. \r\n")
rtnList = NETWORK.isRegistered(180) #Wait 180 seconds for module to obtain GSM registration
if (rtnList[0] == -1) or (rtnList[0] == -2): raise UserWarning
if (rtnList[0] == 0): #Registered successfully
RegCheck = 1
mySER.sendUART("Modem Registered. \r\n\r\n")
#Wait until module is ready for data
mySER.sendUART("Checking Data Availability. \r\n")
rtnList = NETWORK.isDataAttached(myApp.CGMM, 180) #Wait 180 seconds for module to obtain GSM registration
if (rtnList[0] == -1) or (rtnList[0] == -2): raise UserWarning
if (rtnList[0] == 0): #Registered successfully
DataCheck = 1
mySER.sendUART("Modem ready for data. \r\n\r\n")
#check for exit prompt, let's use command EXITSCR
rtnList = mySER.readUART()
if (rtnList[1].find('EXITSCR') != -1):
print '\r\nExit Command Found\r\n'
return
#######################################
## Socket Connection
#.........这里部分代码省略.........
示例2: initWatchdog
# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import watchdogEnable [as 别名]
def initWatchdog():
MOD.watchdogEnable(int(CONFIG.get('WATCHDOG_PERIOD')))
示例3: main
# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import watchdogEnable [as 别名]
def main():
try:
# Set Global Watchdog timeout in Seconds
MOD.watchdogEnable(300)
#Initialize the serial interface @ 115200, we must do this or nothing comes out the serial port
res = JANUS_SER.init("115200",'8N1')
if (res == -1):
return
JANUS_SER.sendUART("Beginning the Terminus Tracker Demo Program. \r\n\r\n")
#Initialize the configuration, returns 0 for defaults, 1 for normal.
ConfigLoad = JANUS_CONFIG.init()
#Transpose the configuration list to myApp for usage here
#We transpose only the main Config class to handle updates
if (ConfigLoad == 0):
myApp = JANUS_CONFIG.Config
JANUS_SER.sendUART("Defaults Loaded.\r\n")
elif (ConfigLoad == 1):
myApp = JANUS_CONFIG.Config
JANUS_SER.sendUART("Configuration File Loaded.\r\n")
else:
myApp = JANUS_CONFIG.Config
JANUS_SER.sendUART("Configuration ERROR. Defaults Loaded.\r\n")
#Initialize the I/O, turn on the stat LED
res = JANUS_IO.init(myApp.SLED)
if (res == -1):
return
#Read if Auto-On is active or not, 1 is active, 0 is inactive.
res = JANUS_IO.AutoONControl('READ', myApp.AUTOON)
JANUS_SER.sendUART("\r\nAuto On: " + myApp.AUTOON + "\r\n")
#If Auto-on is OFF and we want it ON, set it.
if (res == 0 and myApp.AUTOON == 'ON'):
res = JANUS_IO.AutoONControl('SET', myApp.AUTOON)
if (res == -1):
return #Errored out
elif (res == -2):
JANUS_SER.sendUART("Timed out while waiting for MCU response. \r\n")
elif (res == 1):
JANUS_SER.sendUART("Auto ON Enabled. \r\n")
#If Auto-on is ON and we want it OFF, set it.
if (res == 1 and myApp.AUTOON == 'OFF'):
res = JANUS_IO.AutoONControl('SET', myApp.AUTOON)
if (res == -1):
return #Errored out
elif (res == -2):
JANUS_SER.sendUART("Timed out while waiting for MCU response. \r\n")
elif (res == 0):
JANUS_SER.sendUART("Auto ON Disabled. \r\n")
#If Auto-on is OFF, and we have it set as OFF. Let's see what caused this wake up and report it.
#Although we can read IGN/SW directly, we check the MCU instead because they
#May not be active as this point even though the MCU caught it.
WakeupCause = ''
if (res == 0 and myApp.AUTOON == 'OFF'):
res = JANUS_IO.SW_IGN_Status()
if (res == -1):
return #Errored out
elif (res == 0):
JANUS_SER.sendUART("Wake up cause: N/O Switch \r\n")
WakeupCause = 'Switch'
elif (res == 1):
JANUS_SER.sendUART("Wake up cause: Ignition \r\n")
WakeupCause = 'Ignition'
elif (res == 2):
JANUS_SER.sendUART("Wake up cause: Both the Ignition and N/O Switch \r\n")
WakeupCause = 'Both'
elif (res == -2):
JANUS_SER.sendUART("Wake up cause: Unknown \r\n")
WakeupCause = 'Unknown'
JANUS_SER.sendUART("\r\nInitializing Module GPRS. \r\n")
#Set Network specific settings, wait for SIM card to be ready
res = NETWORK.initGsmNetwork(myApp.NETWORK,myApp.BAND)
if (res == -1):
return
#Init GPRS
GPRS.init('1',myApp.APN)
JANUS_SER.sendUART("GPRS Initialized. \r\n")
################################################################
#### BEGIN Newly Added Config Stuff
################################################################
#Initalize GPS
JANUS_SER.sendUART("\r\nInitializing Module GPS. \r\n")
res = JANUS_GPS.init(myApp.LNA)
#.........这里部分代码省略.........
示例4: minutes
# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import watchdogEnable [as 别名]
## GPRS_PASSWORD
## PASSWORD for GPRS connection - ask your network operator for setting
## If GPRS_PASSWORD is not required leave empty
myApp.GPRS_PASSWORD = ''
# Exosite -->
## CIK
## THE CIK VALUE FOR THIS DEVICE - get this value from your Exosite account
## THIS IS REQUIRED FOR SENDING DATA TO EXOSITE
myApp.CIK = ''
# <-- Exosite
#Reboot system after <entered value> secs if unable to register with a network
#Allow at least 5 minutes (300 seconds)
MOD.watchdogEnable(300)
try:
RUN_MODE = 0
test = float(RUN_MODE) #float not implemented in Telit module
except:
#Running in IDE
RUN_MODE = 1
DEBUG.CLS(RUN_MODE) #Clear screen command for VT100 terminals
DEBUG.sendMsg("GPSDemo Script has started\r\n",RUN_MODE)
#Apply Network Specific settings see myApp.xxxx assignment above
if (myApp.NETWORK == "ATT"):
#Set module to work on US ATT Network
res = ATC.sendAtCmd("AT#ENS?",ATC.properties.CMD_TERMINATOR,3,2) #query ENS setting
示例5: while
# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import watchdogEnable [as 别名]
frase=frase.replace(' ',"%20")
frase=frase.replace(':',"%3A")
frase=frase.replace('\\',"%5C")
frase=frase.replace('/',"%2F")
frase=frase.replace(';',"%3B")
frase=frase.replace('@',"%40")
frase=frase.replace('-',"%2D")
frase=frase.replace('+',"%2B")
frase=frase.replace('*',"%2A")
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()
示例6: main
# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import watchdogEnable [as 别名]
def main():
try:
# Set Global Watchdog timeout in Seconds
MOD.watchdogEnable(300)
res = JANUS_SER.init("115200",'8N1')
if (res == -1):
return
#Set Network specific settings
res = NETWORK.initGsmNetwork(myApp.NETWORK,myApp.BAND)
if (res == -1):
return
#Init GPRS
GPRS.init('1',myApp.APN)
#Inform Application that a Data Connection is not available
JANUS_SER.set_DCD(0)
# Loop forever, without this loop the script would run once and exit script mode. On reboot or power-on the script would run once more
while (1):
MOD.watchdogReset()
#Wait until module is registered to GSM Network
res = NETWORK.isGsmRegistered(180) #Wait 180 seconds for module to obtain GSM registration
if (res == -1):
return
#Wait until module is attached to GPRS
res = NETWORK.isGprsAttached(180) #Wait 180 seconds for module to obtain GPRS Attachment
if (res == -1):
return
#############################################################################################################################
## Opening Socket Connection to Server
#############################################################################################################################
res = GPRS.openSocket(myApp.IP,myApp.PORT,1,myApp.USERNAME,myApp.PASSWORD,myApp.PROTOCOL,0)
#Inform Application that a Data Connection is not available
DCD = MDM.getDCD()
if (DCD == 1):
JANUS_SER.set_DCD(1)
#Forward CONNECT Message to Serial Port
JANUS_SER.sendUART('\r\nCONNECT\r\n')
##Loop while Socket connected
while(1):
MOD.watchdogReset()
#Forward serial port data to socket connection
DCD = MDM.getDCD()
if (DCD == 1):
#Get data from serial port
res = JANUS_SER.readUART()
if (len(res)!=0):
#Forward data to open socket
res = MDM.send(res,1)
#Forward socket data to serial port
DCD = MDM.getDCD()
if (DCD == 1):
#Get data from open socket connection
res = MDM.receive(1)
if (len(res)!=0):
#Forward socket data to serial port
JANUS_SER.sendUART(res)
#When socket is closed exit loop via this path
#Will guarantee that '\r\nNO CARRIER\r\n' is sent every time
DCD = MDM.getDCD()
if (DCD == 0):
#Inform Application that a Data Connection is not available
JANUS_SER.set_DCD(0)
ATC.delaySec(1)
#Get any remaining data from closed socket connection
res = MDM.receive(1)
if (len(res)!=0):
#Forward socket data to serial port
JANUS_SER.sendUART(res)
break
except:
print "Script encountered an exception"
print "Exception Type: " + str(sys.exc_type)
print "MODULE -> TerminusS2E"
return
示例7: is_valid_message
# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import watchdogEnable [as 别名]
# 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 == '':
SER.send("Nome de arquivo de log nao criado.\n")
MOD.sleep(40)
else:
MOD.watchdogReset()
示例8: main
# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import watchdogEnable [as 别名]
def main():
try:
timerA = timers.timer(0)
timerA.start(1)
# Set Global Watchdog timeout in Seconds
MOD.watchdogEnable(300)
#Increase CPU speed at cost of increased current consumption
ATC.sendAtCmd('AT#CPUMODE=1',ATC.properties.CMD_TERMINATOR,0,5)
#Turn off GSM TX/RX
ATC.sendAtCmd('AT+CFUN=4',ATC.properties.CMD_TERMINATOR,0,5)
#Initialize MS20 Receiver
res = MS20.initGPS('9600','8N1')
if not(res == 0):
if (res == -1):
DEBUG_CF.sendMsg("MS20 Exception occurred\r\n",myApp.RUN_MODE)
elif (res == -3):
DEBUG_CF.sendMsg("NMEA Command response Checksum fail\r\n",myApp.RUN_MODE)
elif (res == -4):
DEBUG_CF.sendMsg("No NMEA Command response\r\n",myApp.RUN_MODE)
DEBUG_CF.sendMsg("Is NAVSYNC serial port connected to TRACE port via NULL MODEM cable?\r\n",myApp.RUN_MODE)
DEBUG_CF.sendMsg("For CF_EVAL_PCB001 V3.1 evaluation boards or newer => SW1, MODE1 = ON\r\n",myApp.RUN_MODE)
DEBUG_CF.sendMsg("See GSM865CF Plug-in Terminal GPS Demonstration User Guide for more info\r\n",myApp.RUN_MODE)
elif (res == -5):
DEBUG_CF.sendMsg("Incorrect NMEA command response\r\n",myApp.RUN_MODE)
elif (res > 0):
DEBUG_CF.sendMsg("MS20 Error Number: " + str(res) + "\r\n",myApp.RUN_MODE)
else:
DEBUG_CF.sendMsg("Unknown error\r\n",myApp.RUN_MODE)
MOD.sleep(40)
return
DEBUG_CF.sendMsg("MS20 Initialization Complete\r\n",myApp.RUN_MODE)
DEBUG_CF.sendMsg("GPS Application Version: " + MS20.GPSdata.APP_VER + "\r\n",myApp.RUN_MODE)
# Wait for GPS module to obtain position data
DEBUG_CF.sendMsg("Waiting for valid position",myApp.RUN_MODE)
#Poll NMEA GPGLL Sentence
if (MS20.pollNMEA('2',5) == 0): exitLoop = MS20.GPSdata.GPGLL.split(',')[6]
while(exitLoop != 'A'):
MOD.watchdogReset()
#Poll NMEA GPGLL Sentence
if (MS20.pollNMEA('2',5) == 0): exitLoop = MS20.GPSdata.GPGLL.split(',')[6]
DEBUG_CF.sendMsg(".",myApp.RUN_MODE)
DEBUG_CF.sendMsg("\r\nPosition acquired: " +str(timerA.count()) + " Seconds (Referenced to script start time)\r\n",myApp.RUN_MODE)
#Increase CPU speed during TX/RX only
ATC.sendAtCmd('AT#CPUMODE=2',ATC.properties.CMD_TERMINATOR,0,5)
#Activate Low Power mode, Turn off GSM TX/RX
ATC.sendAtCmd('AT+CFUN=5',ATC.properties.CMD_TERMINATOR,0,5)
#Set Network specific settings
res = NETWORK.initGsmNetwork(myApp.NETWORK,myApp.BAND)
if (res == -1):
return
DEBUG_CF.sendMsg("Network Initialization Complete\r\n",myApp.RUN_MODE)
#Wait for GSM Registration
DEBUG_CF.sendMsg("Waiting for GSM Registration",myApp.RUN_MODE)
#Check GSM registration
exitLoop = NETWORK.isGsmRegistered(1)
while(exitLoop != 0):
MOD.watchdogReset()
#Check GSM registration
exitLoop = NETWORK.isGsmRegistered(1)
DEBUG_CF.sendMsg(".",myApp.RUN_MODE)
DEBUG_CF.sendMsg("\r\nTerminal is registered to a GSM network\r\n",myApp.RUN_MODE)
#Init GPRS
GPRS.init('1',myApp.APN)
DEBUG_CF.sendMsg("GPRS Initialization Complete\r\n",myApp.RUN_MODE)
#Wait for GPRS attach
DEBUG_CF.sendMsg("Waiting for GPRS Attach",myApp.RUN_MODE)
#Check GPRS Attach
exitLoop = NETWORK.isGprsAttached(1)
while(exitLoop != 0):
MOD.watchdogReset()
#Check GPRS Attach
exitLoop = NETWORK.isGprsAttached(1)
DEBUG_CF.sendMsg(".",myApp.RUN_MODE)
DEBUG_CF.sendMsg("\r\nTerminal is attached to GPRS service\r\n",myApp.RUN_MODE)
#Record IMEI number
myApp.IMEI = ATC.sendAtCmd('AT+CGSN',ATC.properties.CMD_TERMINATOR,0,5)
DEBUG_CF.sendMsg("IMEI #: " + myApp.IMEI + "\r\n",myApp.RUN_MODE)
# Start timeout timer
timerB = timers.timer(0)
#.........这里部分代码省略.........
示例9: resetWatchdog
# 需要导入模块: import MOD [as 别名]
# 或者: from MOD import watchdogEnable [as 别名]
def resetWatchdog():
MOD.watchdogReset()
sendAT('AT#ENHRST=1,10')
########################################################
# Main loop
########################################################
try:
global NETWORK_WAIT_TIME
global MAIN_LOOP_PERIOD
global ACTIVE_SIM
print 'TELEOFIS RX608-L4U SIM Card Switcher'
MOD.watchdogEnable(300) # 300 sec = 5 min
initAT()
initGPIO()
print 'GPIO init OK, AT init OK'
print 'Switch to SIM1'
ACTIVE_SIM = 1
disableSIM()
turnOnSim1()
enableSIM()
timer = MOD.secCounter() + NETWORK_WAIT_TIME
while(1):
resetWatchdog()