Tset 1,0 //Initializes counter to be off Ontimer 1,"@Count()" // will run only when timer 1 is turned on Onchange "counter","@Offline_Reboot()" // will check the status of coutner ONVPN "@WANCHECK()" FUNCTION WANCHECK() I% = GETSYS PRG, "Evtinfo" Print I% If I% = 1 Then //only starts the timer if it's showing the device offline Tset 1,0 // Turns Timer off Print "device Online reboot timer off" Else Tset 1,1 // starts the timer Print "Device offline starting reboot timer" Endif Endfn Function Offline_Reboot() If counter@ > 600 Then // if the device hasn't come on after 600 seconds it reboots Tset 1,0 // Turns Timer off counter@ = 0 // resets the counter //SETSYS PRG, "MDMRST", 1 // Performs the modem reboot only when the counter hits 600 Reboot //full system reboot Print "rebooting" Endif ENDFN Function Count() counter@ = counter@ + 1 // will keep incrementing each second Endfn