PS5 Barcode scanner
Loading...
Searching...
No Matches
gps.c File Reference
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include "lib.h"
#include "gps.h"
#include "menu.h"
#include "main.h"
#include "utils.h"
Include dependency graph for gps.c:

Macros

#define MAX_TIME_OFFSET   60UL
 
#define MAX_FIX_TIMEOUT   30UL
 
#define MAX_UPDATE_TIMEOUT   30UL
 
#define AUTOPOWERDOWN_TIME    (3 * 60)
 
#define MAX_BUF   300
 
#define DATE   10
 
#define TIME   8
 
#define SECS_PER_HOUR   (60UL * 60UL)
 
#define SECS_PER_DAY   (60UL * 60UL * 24UL)
 
#define DAYS_PER_YEAR   (31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31)
 
#define BREAD_CRUMB_TRAIL_TIME   15
 
#define GPS_IDLE_STATE   0
 
#define GPS_READING_RECORD_STATE   1
 
#define GPS_READING_CHECKSUM_STATE   2
 
#define GPS_END_OF_RECORD_STATE   3
 

Functions

int checksum (const char *string)
 Calculates the NMEA183 checksum.
 
int get_gps_pos_date_time (const char *string, char *pszLatitude, char *longitude, char *time, char *date)
 Get the latitude, longitude and GPS date/time from the NMEA183 RMC (Recommended Minimum Specific GPS data) sentence.
 
unsigned long _time (void)
 Converts current date and time to system time value.
 
unsigned long _mktime (struct time *t, struct date *d)
 converts current system time to timae and date structures.
 
void GPSStart (void)
 Inititalizes the GPS system.
 
void GPSService (void)
 GPS radio polling service.
 
void CalculateAlternateGPSFormat (void)
 
void ConvertNMEAToAlternateFormats (char *pszNMEA, char *pszDD, char *pszDMS, int fLong)
 Calculates and converts the coordinates from NMEA reading.
 
void getDateTime (unsigned long ulTime, struct time *t, struct date *d)
 Converts a system time value to a time and date structure.
 
void GPSUpdateTestDisplay (void)
 Displays the GPS coordinates in their current format for the GPS test.
 
void ResetBreadCrumbTimer (void)
 Resets or disables the GPS breadcrumb timer.
 
void ServiceBreadCrumbTimer (void)
 
void GPSSaveBreadCrumb (void)
 Saves breadcrumb.
 

Variables

int g_BreadCrumbTime
 
int g_BreadCrumbFlag
 
unsigned long g_NextBreadCrumb
 
char g_gpsDate [DATE+1]
 
char g_gpsTime [TIME+1]
 
unsigned long last_fix
 
unsigned char g_fSuspendConversion
 
char g_Latitude [LATITUDE_DMS+1]
 
char g_Longitude [LONGITUDE_DMS+1]
 
char g_LatitudeRaw [LATITUDE_DMS+1]
 
char g_LongitudeRaw [LONGITUDE_DMS+1]
 
char g_LatitudeDD [LATITUDE_DMS+1]
 
char g_LongitudeDD [LONGITUDE_DMS+1]
 
char g_LongitudeDMS [LONGITUDE_DMS+2]
 
char g_LatitudeDMS [LATITUDE_DMS+1]
 
const char g_EmptyLatitude [] = "0000.0000X"
 
const char g_EmptyLongitude [] = "00000.0000X"
 
int g_GPS_breadcrumbTimer
 
int g_GPS_Test_Mode
 
const char g_pszGPSBreadCrumb [] = "GPS Bread Crumb"
 
int g_nBreadCrumbIndex
 
unsigned long g_nGPSStandbyTimeout
 
long gps_data_format
 
long time_zone_offset
 
long time_zone_change
 
unsigned int timer []
 
int g_util_timeout
 
int gpsReadState
 
int gpsCharCount
 
int g_gpsfix
 
char gpsString [MAX_BUF+1]
 
char gpsLastString [MAX_BUF+1]
 
int g_gpsOptions
 
char GPSBuffer [100]
 
gps currentFix
 
const unsigned short int month_len []
 

Macro Definition Documentation

◆ AUTOPOWERDOWN_TIME

#define AUTOPOWERDOWN_TIME    (3 * 60)

◆ BREAD_CRUMB_TRAIL_TIME

#define BREAD_CRUMB_TRAIL_TIME   15

◆ DATE

#define DATE   10

◆ DAYS_PER_YEAR

#define DAYS_PER_YEAR   (31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31)

◆ GPS_END_OF_RECORD_STATE

#define GPS_END_OF_RECORD_STATE   3

◆ GPS_IDLE_STATE

#define GPS_IDLE_STATE   0

◆ GPS_READING_CHECKSUM_STATE

#define GPS_READING_CHECKSUM_STATE   2

◆ GPS_READING_RECORD_STATE

#define GPS_READING_RECORD_STATE   1

◆ MAX_BUF

#define MAX_BUF   300

◆ MAX_FIX_TIMEOUT

#define MAX_FIX_TIMEOUT   30UL

◆ MAX_TIME_OFFSET

#define MAX_TIME_OFFSET   60UL

◆ MAX_UPDATE_TIMEOUT

#define MAX_UPDATE_TIMEOUT   30UL

◆ SECS_PER_DAY

#define SECS_PER_DAY   (60UL * 60UL * 24UL)

◆ SECS_PER_HOUR

#define SECS_PER_HOUR   (60UL * 60UL)

◆ TIME

#define TIME   8

Function Documentation

◆ _mktime()

unsigned long _mktime ( struct time * t,
struct date * d )

converts current system time to timae and date structures.

Here is the caller graph for this function:

◆ _time()

unsigned long _time ( void )

Converts current date and time to system time value.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CalculateAlternateGPSFormat()

void CalculateAlternateGPSFormat ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checksum()

int checksum ( const char * string)

Calculates the NMEA183 checksum.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ConvertNMEAToAlternateFormats()

void ConvertNMEAToAlternateFormats ( char * pszNMEA,
char * pszDD,
char * pszDMS,
int fLong )

Calculates and converts the coordinates from NMEA reading.

Here is the caller graph for this function:

◆ get_gps_pos_date_time()

int get_gps_pos_date_time ( const char * string,
char * pszLatitude,
char * longitude,
char * time,
char * date )

Get the latitude, longitude and GPS date/time from the NMEA183 RMC (Recommended Minimum Specific GPS data) sentence.

Here is the caller graph for this function:

◆ getDateTime()

void getDateTime ( unsigned long ulTime,
struct time * t,
struct date * d )

Converts a system time value to a time and date structure.

Here is the caller graph for this function:

◆ GPSSaveBreadCrumb()

void GPSSaveBreadCrumb ( void )

Saves breadcrumb.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GPSService()

void GPSService ( void )

GPS radio polling service.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GPSStart()

void GPSStart ( void )

Inititalizes the GPS system.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GPSUpdateTestDisplay()

void GPSUpdateTestDisplay ( void )

Displays the GPS coordinates in their current format for the GPS test.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ResetBreadCrumbTimer()

void ResetBreadCrumbTimer ( void )

Resets or disables the GPS breadcrumb timer.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ServiceBreadCrumbTimer()

void ServiceBreadCrumbTimer ( void )
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ currentFix

gps currentFix

◆ g_BreadCrumbFlag

int g_BreadCrumbFlag

◆ g_BreadCrumbTime

int g_BreadCrumbTime

◆ g_EmptyLatitude

const char g_EmptyLatitude[] = "0000.0000X"

◆ g_EmptyLongitude

const char g_EmptyLongitude[] = "00000.0000X"

◆ g_fSuspendConversion

unsigned char g_fSuspendConversion

◆ g_GPS_breadcrumbTimer

int g_GPS_breadcrumbTimer

◆ g_GPS_Test_Mode

int g_GPS_Test_Mode

◆ g_gpsDate

char g_gpsDate[DATE+1]

◆ g_gpsfix

int g_gpsfix

◆ g_gpsOptions

int g_gpsOptions

◆ g_gpsTime

char g_gpsTime[TIME+1]

◆ g_Latitude

char g_Latitude[LATITUDE_DMS+1]

◆ g_LatitudeDD

char g_LatitudeDD[LATITUDE_DMS+1]

◆ g_LatitudeDMS

char g_LatitudeDMS[LATITUDE_DMS+1]

◆ g_LatitudeRaw

char g_LatitudeRaw[LATITUDE_DMS+1]

◆ g_Longitude

char g_Longitude[LONGITUDE_DMS+1]

◆ g_LongitudeDD

char g_LongitudeDD[LONGITUDE_DMS+1]

◆ g_LongitudeDMS

char g_LongitudeDMS[LONGITUDE_DMS+2]

◆ g_LongitudeRaw

char g_LongitudeRaw[LONGITUDE_DMS+1]

◆ g_nBreadCrumbIndex

int g_nBreadCrumbIndex

◆ g_NextBreadCrumb

unsigned long g_NextBreadCrumb

◆ g_nGPSStandbyTimeout

unsigned long g_nGPSStandbyTimeout

◆ g_pszGPSBreadCrumb

const char g_pszGPSBreadCrumb[] = "GPS Bread Crumb"

◆ g_util_timeout

int g_util_timeout
extern

◆ gps_data_format

long gps_data_format
extern

◆ GPSBuffer

char GPSBuffer[100]

◆ gpsCharCount

int gpsCharCount

◆ gpsLastString

char gpsLastString[MAX_BUF+1]

◆ gpsReadState

int gpsReadState

◆ gpsString

char gpsString[MAX_BUF+1]

◆ last_fix

unsigned long last_fix

◆ month_len

const unsigned short int month_len[]
Initial value:
= {31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31}

◆ time_zone_change

long time_zone_change
extern

◆ time_zone_offset

long time_zone_offset
extern

◆ timer

unsigned int timer[]
extern