//~~STARTUP // Image your loved one is out till late and you want to know when their coming back. // this program will send an SMS to any number when a trip starts. // It works as follows: // 1. Send an SMS to the unit from any of the allowed numbers. (The unit might be sleeping, so a missed call might not work) // 2. When a trip starts, the unit will return an SMS to the number with updates on the trip progress //define all the allowed numbers here allowed1$ = "" allowed2$ = "" allowed3$ = "" allowed4$ = "" allowed5$ = "" //alternatively, if someone is not on the allowed list, they can send an SMS with the correct password to receive updates password$="1234" //this is the number where updates will be send to. Do not set it manually, the software will take care of it send_update_number$="" //~~TIMER // Code to execute every TIMER_INTERVAL milliseconds // e.g. to execute code every 5 seconds, type: TIMER_INTERVAL=5000 // if we've started a trip, notify number (also look at TRIP_DISTANCE to make sure we don't have a false trip if (TRIP_STATUS=1 AND TRIP_DISTANCE>250 AND send_updates_level=1) then begin updateString$="distance: "+TRIP_DISTANCE/1000+" Km. Time: "+RTC_HOUR+":"+RTC_MINUTE; sendSMS(send_update_number$,"Trip started! "+updateString$) send_updates_level=2 end // stop updates when trip stops if (TRIP_STATUS=0 AND send_updates_level=2) then begin sendSMS(send_update_number$,"Trip stopped! Time:"+RTC_HOUR+":"+RTC_MINUTE) send_updates_level=0 send_update_number$="" end //~~CALL //~~SMS // On receiving an SMS, verify if user is allowed or password is known allowed=0; // not allowed, unless proven otherwise if (SMS_MESSAGE$=password$) allowed =1; //right password, allow if (SMS_NUMBER$=allowed1$) allowed =1; //on allowed list if (SMS_NUMBER$=allowed2$) allowed =1; //on allowed list if (SMS_NUMBER$=allowed3$) allowed =1; //on allowed list if (SMS_NUMBER$=allowed4$) allowed =1; //on allowed list if (SMS_NUMBER$=allowed5$) allowed =1; //on allowed list //number is allowed, send first update! if (allowed=1) then begin send_updates_level=1 //from now will send updates. send_updates_level will be updated in Timer interrupt if (TRIP_STATUS=0) updateString$="Stopped. " else updateString$="Driving, distance: "+TRIP_DISTANCE/1000+" Km"; updateString$ = updateString$+" Current Position: "+GPS_LAT+","+GPS_LNG if (stringlength(send_update_number$)>1) sendSMS(send_update_number$,"This is you last update, we have a new master. "+updateString$) send_update_number$=SMS_NUMBER$ sendSMS(send_update_number$,"Updates activated: "+updateString$) end //~~MOVEMENT // Code to execute when detecting movement. // The movement intensity is stored in ACC_DETECT, as well as ACC_X, AXX_Y and AXX_Z //~~USSD // Code to execute when receiving a reply from a USSD string. // Reply is stored in INCOMING_USSD$ string //~~GPRS // Code to execute when receiving GPRS data. // Data is stored in INCOMING_GPRS$ string