Tracks GPS coordinates of an asset. Uses: GPS GSM Accelerometer mbed
Dependencies: mbed MODSERIAL ADXL345 MODGPS
SecurityMechanism.cpp
- Committer:
- gsulc
- Date:
- 2012-05-04
- Revision:
- 0:4415987ca08f
File content as of revision 0:4415987ca08f:
#include "SecurityMechanism.h" #include "GPS.h" #include "sms.h" #include <string> extern Serial pc; extern GPS gps; extern DigitalOut gps_on; extern DigitalOut gps_xstandby; extern bool command_sent; extern bool movement_detected; extern string phoneNumber; /*void process_command (string command) { }//*/ /*void alert () { }//*/ void send_location () { //if gps off, turn it on if(gps_on == 0) { pc.printf("Turning on GPS\r\n"); gps_on = 1; gps_xstandby = 1; //wait to turn on wait(45); } //send coordinates char link[64]; gps.latitude(); gps.longitude(); sprintf(link, "%s", "http://maps.google.com/maps?daddr="); sprintf(link, "%s%.4f,%.4f", link, gps.latitude(), gps.longitude()); //pc.printf("%s\r\n", link); send_SMS(phoneNumber, link); }