Tracks GPS coordinates of an asset. Uses: GPS GSM Accelerometer mbed
Dependencies: mbed MODSERIAL ADXL345 MODGPS
Diff: SecurityMechanism.cpp
- Revision:
- 0:4415987ca08f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SecurityMechanism.cpp Fri May 04 14:11:45 2012 +0000 @@ -0,0 +1,39 @@ +#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); +} \ No newline at end of file