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.')
def rebootCounterProcessing(delta): global REBOOT_COUNTER global CALENDAR if((delta < 0) or (delta > 100)): delta = 5 REBOOT_COUNTER = REBOOT_COUNTER + delta SER.send('Current reboot counter: %d\r' % REBOOT_COUNTER) if(REBOOT_COUNTER > int(CFG.get('REBOOTPERIOD'))): SER.send('Terminal reboot.\r') if(int(CFG.get('ALIVESMS')) > 0): CALENDAR = CALENDAR + 1 calendar.writeCalendar(CALENDAR) MOD.sleep(30) gsm.reboot()