DEBUG.sendMsg("Connecting to network",RUN_MODE) #Wait until registered to GSM Network exitLoop = 1 while (exitLoop == 1): res = ATC.sendAtCmd('AT+CREG?',ATC.properties.CMD_TERMINATOR,0,5) DEBUG.sendMsg(".",RUN_MODE) if (res[res.rfind(',')+1:len(res)] == '5' or res[res.rfind(',')+1:len(res)] == '1'): exitLoop = 0 DEBUG.sendMsg("\r\nConnected to network\r\n",RUN_MODE) MOD.watchdogReset() #Setup SMS ATC.configSMS() #Send SMS #Uncomment if SIM card is provisioned for SMS #ATC.sendSMS("GPSDemo application is running",myApp.SMS,ATC.properties.CMD_TERMINATOR,3,180) #Init GPRS #Pass in: PDP Index, APN ATC.initGPRS('1', myApp.APN, myApp.GPRS_USERID, myApp.GPRS_PASSWORD, RUN_MODE) #Initalize CW20 Receiver DEBUG.sendMsg("Initialize CW20 GPS Module\r\n",RUN_MODE) CW20.initGPS('9600','8N1') #Update Network Information res = ATC.getNetworkInfo()