Mobil_surveillance_system 1
GPS.h
Go to the documentation of this file.
00001 #ifndef GPS_H_
00002 #define GPS_H_
00003 
00005 
00012 #include "Bitmanip.h"           // due to: the bit manipulations macros
00013 #include "UART1.h"              // due to: serial communications functions
00014 #include "Time.h"               // due to: the software rtc
00015 #include "Dinamic_Array.h"      // due to: dinamic array
00016 #include "GPSpacket.h"          // due to: tGPSInfoArray types and it's functions           
00017 #include "Ports.h"              // due to: Ports_setPort2Pin function
00018 
00019 //*****************************************************************************
00020 //
00021 // Types and definitions
00022 //
00023 //*****************************************************************************
00024 
00025 
00026 #ifndef DEFINE_TBOOLEAN                 // define unsigned char as tBoolean in only that case when it hasn't been defined yet somewhere else in the scope
00027 
00029 typedef unsigned char tBoolean;         // use as bool
00030 #define DEFINE_TBOOLEAN
00031 
00032 #endif                                  // DEFINE_TBOOLEAN
00033 
00034 
00035 // number of the attempts to send one command to the gps module
00036 #define ATTEMPT_NUMBER 5
00037 
00038 // size of the buffer that contians the response of the gps module
00039 #define GPS_RESPONSE_BUFFER_SIZE  1024
00040 
00041 // maximum size of one nmea sentence
00042 #define PACKET_SIZE 80
00043 
00044 
00046 typedef enum{
00047     
00048     GPS_Uninizialized = 0,
00049     GPS_SendCommand,
00050     GPS_CommandSent,
00051     GPS_StarWaitingForTheAnswer,
00052     GPS_WaitingForTheAnswer,
00053     GPS_InitError,
00054     GPS_Inizialized
00055     
00056 }tGPS_state;
00057 
00058 
00060 typedef enum{
00061     
00062     NMEA_NODATA = 0,                // No data. Packet not available.
00063     NMEA_UNKNOWN,                   // Packet received but is not known.
00064     NMEA_GPGGA,                     // Global Positinoning System fix data 
00065     NMEA_GPGLL,                     // Geographic position - latitude/longitude
00066     NMEA_GPGSA,                     // GNSS DOP and Active Satellites
00067     NMEA_GPGSV,                     // GNSS Satellites in view
00068     NMEA_GPRMC,                     // Recomended Minimum Specific GNSS Data
00069     NMEA_GPVTG,                     // Course Over Ground and Ground Speed
00070     NMEA_ACK,                       // ACK response from the gps module
00071     NMEA_NACK                       // NACK response from the gps module
00072     
00073 }tNMEA_messages;
00074 
00075 
00077 typedef void (*tpfGPSHttpPostCallbackFunction) (char*, char*, char*, char*, unsigned int);
00078 
00079 
00080 //*****************************************************************************
00081 //
00082 // Function declarations
00083 //
00084 //*****************************************************************************
00085 
00086 
00090 void GPS_executeGPS(void);
00091 
00092 
00096 void GPS_initGPS(void);
00097 
00098 
00103 void GPS_appendResponse(const char* pcResponse);
00104 
00105 
00109 void GPS_setupGPS(void);
00110 
00111 
00116 tBoolean GPS_isCommandSent(void);
00117 
00118 
00123 tBoolean GPS_isResponseBufferFull(void);
00124 
00125 
00130 void GPS_setDeadline(unsigned int uiDeadline);
00131 
00132 
00137 tBoolean GPS_isDeadlinePassed(void);
00138 
00139 
00144 void GPS_setState(tGPS_state newState);
00145 
00146 
00151 void GPS_setNextState(tGPS_state newState);
00152 
00153 
00158 tGPS_state GPS_getGPSstate(void);
00159 
00160 
00165 void GPS_setGPShttpPostCallbackFunction(tpfGPSHttpPostCallbackFunction pfCallbackGPRShttpPost);
00166 
00167 
00172 void GPS_addCommand(const unsigned char* pcCommand);
00173 
00174 
00178 void GPS_goToNextCommand(void);
00179 
00180 
00185 tBoolean GPS_isCommandAvaiable(void);
00186 
00187 
00191 void GPS_clearResponseBuffer(void);
00192 
00193 
00198 void GPS_clearGPSInfoPacket(tGPSInfo* pGPSInfoPacket);
00199 
00200 
00204 void GPS_sendCommand(void);
00205 
00206 
00210 void GPS_processCommand(void);
00211 
00212 
00218 tNMEA_messages GPS_NMEAProcess(char* cpNmeaPacket);
00219 
00220 
00226 void GPS_ProcessGPGGA(const char* pcFoundPacket, tGPSInfo* pGPSInfoPacket);
00227 
00228 
00229 #endif /*GPS_H_*/
 All Data Structures Files Functions Variables Typedefs Enumerations Defines