Skip to content

Commit

Permalink
astyle jeeps included files (#1219)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsteven4 authored Nov 15, 2023
1 parent 66fa37e commit ad23c57
Show file tree
Hide file tree
Showing 10 changed files with 375 additions and 375 deletions.
26 changes: 13 additions & 13 deletions jeeps/gps.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extern char gps_categories[16][17];
struct GPS_Packet {
US type{0};
uint32_t n{0};
UC data[MAX_GPS_PACKET_SIZE]{};
UC data[MAX_GPS_PACKET_SIZE] {};
};


Expand Down Expand Up @@ -154,16 +154,16 @@ typedef struct GPS_SWay {
* Forerunner/Edge Lap data.
*/
typedef struct GPS_SLap {
uint32_t index; /* unique index in device or -1 */
uint32_t index; /* unique index in device or -1 */
time_t start_time;
uint32_t total_time; /* Hundredths of a second */
uint32_t total_time; /* Hundredths of a second */
float total_distance; /* In meters */
double begin_lat;
double begin_lon;
double end_lat;
double end_lon;
int16_t calories;
uint32_t track_index; /* ref to track or -1 */
int16_t calories;
uint32_t track_index; /* ref to track or -1 */
float max_speed; /* In meters per second */
unsigned char avg_heart_rate; /* In beats-per-minute, 0 if invalid */
unsigned char max_heart_rate; /* In beats-per-minute, 0 if invalid */
Expand All @@ -179,17 +179,17 @@ typedef struct GPS_SLap {


typedef struct GPS_SCourse {
uint32_t index; /* Unique among courses on device */
uint32_t index; /* Unique among courses on device */
char course_name[16]; /* Null-terminated unique course name */
uint32_t track_index; /* Index of the associated track
uint32_t track_index; /* Index of the associated track
* Must be 0xFFFFFFFF if there is none*/
} GPS_OCourse, *GPS_PCourse;


typedef struct GPS_SCourse_Lap {
uint32_t course_index; /* Index of associated course */
uint32_t lap_index; /* This lap's index in the course */
uint32_t total_time; /* In hundredths of a second */
uint32_t course_index; /* Index of associated course */
uint32_t lap_index; /* This lap's index in the course */
uint32_t total_time; /* In hundredths of a second */
float total_dist; /* [m] */
double begin_lat; /* Starting position of the lap */
double begin_lon; /* Invalid if lat,lon are 0x7FFFFFFF.*/
Expand Down Expand Up @@ -225,9 +225,9 @@ typedef struct GPS_SCourse_Point {
} GPS_OCourse_Point, *GPS_PCourse_Point;

typedef struct GPS_SCourse_Limits {
int32_t max_courses;
int32_t max_course_laps;
int32_t max_course_pnt;
int32_t max_courses;
int32_t max_course_laps;
int32_t max_course_pnt;
int32_t max_course_trk_pnt;
} GPS_OCourse_Limits, *GPS_PCourse_Limits;

Expand Down
114 changes: 57 additions & 57 deletions jeeps/gpsapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,94 +22,94 @@ int32_t GPS_A301_Send(const char* port, GPS_PTrack* trk, int32_t n, int protoid,
gpsdevh* fd);

int32_t GPS_D300_Get(GPS_PTrack* trk, int32_t entries, gpsdevh* h);
void GPS_D300b_Get(GPS_PTrack* trk, UC* data);
void GPS_D301b_Get(GPS_PTrack* trk, UC* data);
void GPS_D302b_Get(GPS_PTrack* trk, UC* data);
void GPS_D303b_Get(GPS_PTrack* trk, UC* data); /*D304*/
void GPS_D310_Get(GPS_PTrack* trk, UC* s);
void GPS_D311_Get(GPS_PTrack* trk, UC* s);
void GPS_D300_Send(UC* data, GPS_PTrack trk, int32_t* len);
void GPS_D301_Send(UC* data, GPS_PTrack trk, int32_t* len, int type);
void GPS_D303_Send(UC* data, GPS_PTrack trk, int32_t* len, int protoid);
void GPS_D310_Send(UC* data, GPS_PTrack trk, int32_t* len);
void GPS_D311_Send(UC* data, GPS_PTrack trk, int32_t* len);
void GPS_D300b_Get(GPS_PTrack* trk, UC* data);
void GPS_D301b_Get(GPS_PTrack* trk, UC* data);
void GPS_D302b_Get(GPS_PTrack* trk, UC* data);
void GPS_D303b_Get(GPS_PTrack* trk, UC* data); /*D304*/
void GPS_D310_Get(GPS_PTrack* trk, UC* s);
void GPS_D311_Get(GPS_PTrack* trk, UC* s);
void GPS_D300_Send(UC* data, GPS_PTrack trk, int32_t* len);
void GPS_D301_Send(UC* data, GPS_PTrack trk, int32_t* len, int type);
void GPS_D303_Send(UC* data, GPS_PTrack trk, int32_t* len, int protoid);
void GPS_D310_Send(UC* data, GPS_PTrack trk, int32_t* len);
void GPS_D311_Send(UC* data, GPS_PTrack trk, int32_t* len);

int32_t GPS_A400_Get(const char* port, GPS_PWay** way);
int32_t GPS_A400_Send(const char* port, GPS_PWay* way, int32_t n);

int32_t GPS_A500_Get(const char* port, GPS_PAlmanac** alm);
int32_t GPS_A500_Send(const char* port, GPS_PAlmanac* alm, int32_t n);

time_t GPS_A600_Get(const char* port);
time_t GPS_D600_Get(const GPS_Packet& packet);
time_t GPS_A600_Get(const char* port);
time_t GPS_D600_Get(const GPS_Packet& packet);
int32_t GPS_A600_Send(const char* port, time_t Time);
void GPS_D600_Send(GPS_Packet& packet, time_t Time);
void GPS_D600_Send(GPS_Packet& packet, time_t Time);

int32_t GPS_A700_Get(const char* port, double* lat, double* lon);
int32_t GPS_A700_Send(const char* port, double lat, double lon);
void GPS_D700_Get(const GPS_Packet& packet, double* lat, double* lon);
void GPS_D700_Send(GPS_Packet& packet, double lat, double lon);
void GPS_D700_Get(const GPS_Packet& packet, double* lat, double* lon);
void GPS_D700_Send(GPS_Packet& packet, double lat, double lon);

int32_t GPS_A800_On(const char* port, gpsdevh** fd);
int32_t GPS_A800_Off(const char* port, gpsdevh** fd);
int32_t GPS_A800_Get(gpsdevh** fd, GPS_PPvt_Data* packet);
void GPS_D800_Get(const GPS_Packet& packet, GPS_PPvt_Data* pvt);
void GPS_D800_Get(const GPS_Packet& packet, GPS_PPvt_Data* pvt);

int32_t GPS_A906_Get(const char* port, GPS_PLap** lap, pcb_fn cb);
void GPS_D1011b_Get(GPS_PLap* Lap,UC* data); /*D906 D1001 D1015*/
void GPS_D1011b_Get(GPS_PLap* Lap,UC* data); /*D906 D1001 D1015*/

int32_t GPS_A1006_Get(const char* port, GPS_PCourse** crs, pcb_fn cb);
int32_t GPS_A1006_Send(const char* port, GPS_PCourse* crs, int32_t n_crs,
gpsdevh* fd);
void GPS_D1006_Get(GPS_PCourse* crs, UC* p);
void GPS_D1006_Send(UC* data, GPS_PCourse crs, int32_t* len);
void GPS_D1006_Get(GPS_PCourse* crs, UC* p);
void GPS_D1006_Send(UC* data, GPS_PCourse crs, int32_t* len);

int32_t GPS_A1007_Get(const char* port, GPS_PCourse_Lap** clp, pcb_fn cb);
int32_t GPS_A1007_Send(const char* port, GPS_PCourse_Lap* clp, int32_t n_clp,
gpsdevh* fd);
void GPS_D1007_Get(GPS_PCourse_Lap* clp, UC* p);
void GPS_D1007_Send(UC* data, GPS_PCourse_Lap clp, int32_t* len);
void GPS_D1007_Get(GPS_PCourse_Lap* clp, UC* p);
void GPS_D1007_Send(UC* data, GPS_PCourse_Lap clp, int32_t* len);

int32_t GPS_A1008_Get(const char* port, GPS_PCourse_Point** cpt, pcb_fn cb);
int32_t GPS_A1008_Send(const char* port, GPS_PCourse_Point* cpt, int32_t n_cpt,
gpsdevh* fd);
void GPS_D1012_Get(GPS_PCourse_Point* cpt, UC* p);
void GPS_D1012_Send(UC* data, GPS_PCourse_Point cpt, int32_t* len);
void GPS_D1012_Get(GPS_PCourse_Point* cpt, UC* p);
void GPS_D1012_Send(UC* data, GPS_PCourse_Point cpt, int32_t* len);

int32_t GPS_A1009_Get(const char* port, GPS_PCourse_Limits limits);
void GPS_D1013_Get(GPS_PCourse_Limits limits, UC* p);

/* Unhandled documented protocols, as of:
Garmin Device Interface Specification, May 19, 2006, Drawing Number: 001-00063-00 Rev. C
A650 FlightBook Transfer Protocol
A1000 Run Transfer Protocol
Capability A1000: D1009
D1000 D1010
A1002 Workout Transfer Protocol
Capability A1002: D1008
D1002
Capability A1003: D1003
A1004 Fitness User Profile Transfer Protocol
Capability A1004: D1004
A1005 Workout Limits Transfer Protocol
Capability A1005: D1005
*/
/* Unimplemented and Undocumented, as listed from the following device/sw:
GF305 3.70
Capability A601: D601
Capability A801: D801
Capability A902:
Capability A903:
Capability A907: D907 D908 D909 D910
Capability A918: D918
Capability A1013: D1014
*/

const char* Get_Pkt_Type(US p, US d0, const char** xinfo);

void GPS_Prepare_Track_For_Device(GPS_PTrack** trk, int32_t* n);
void GPS_D1013_Get(GPS_PCourse_Limits limits, UC* p);

/* Unhandled documented protocols, as of:
Garmin Device Interface Specification, May 19, 2006, Drawing Number: 001-00063-00 Rev. C
A650 FlightBook Transfer Protocol
A1000 Run Transfer Protocol
Capability A1000: D1009
D1000 D1010
A1002 Workout Transfer Protocol
Capability A1002: D1008
D1002
Capability A1003: D1003
A1004 Fitness User Profile Transfer Protocol
Capability A1004: D1004
A1005 Workout Limits Transfer Protocol
Capability A1005: D1005
*/
/* Unimplemented and Undocumented, as listed from the following device/sw:
GF305 3.70
Capability A601: D601
Capability A801: D801
Capability A902:
Capability A903:
Capability A907: D907 D908 D909 D910
Capability A918: D918
Capability A1013: D1014
*/

const char* Get_Pkt_Type(US p, US d0, const char** xinfo);

void GPS_Prepare_Track_For_Device(GPS_PTrack** trk, int32_t* n);
int32_t GPS_Set_Baud_Rate(const char* port, int br);

#endif // JEEPS_GPSAPP_H_INCLUDED_
4 changes: 2 additions & 2 deletions jeeps/gpscom.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

int32_t GPS_Command_Off(const char* port);

time_t GPS_Command_Get_Time(const char* port);
time_t GPS_Command_Get_Time(const char* port);
int32_t GPS_Command_Send_Time(const char* port, time_t Time);

int32_t GPS_Command_Get_Position(const char* port, double* lat, double* lon);
Expand Down Expand Up @@ -38,7 +38,7 @@ int32_t GPS_Command_Send_Course(const char* port, GPS_PCourse* crs, GPS_PCourse_
GPS_PTrack* trk, GPS_PCourse_Point* cpt,
int32_t n_crs, int32_t n_clp, int32_t n_trk, int32_t n_cpt);
int32_t GPS_Command_Send_Track_As_Course(const char* port, GPS_PTrack* trk, int32_t n_trk,
GPS_PWay* wpt, int32_t n_wpt, int eraset);
GPS_PWay* wpt, int32_t n_wpt, int eraset);

int32_t GPS_Command_Get_Workout(const char* port, void** lap, int (*cb)(int, GPS_SWay**));
int32_t GPS_Command_Get_Fitness_User_Profile(const char* port, void** lap, int (*cb)(int, GPS_SWay**));
Expand Down
44 changes: 22 additions & 22 deletions jeeps/gpsdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#ifndef JEEPS_GPSDEVICE_H_INCLUDED_
#define JEEPS_GPSDEVICE_H_INCLUDED_

typedef struct gpsdevh gpsdevh;
typedef struct gpsdevh gpsdevh;

#include "jeeps/gps.h"

Expand All @@ -36,28 +36,28 @@ int32_t GPS_Device_Wait(gpsdevh* fd);
int32_t GPS_Device_Flush(gpsdevh* fd);
int32_t GPS_Device_Read(int32_t ignored, void* ibuf, int size);
int32_t GPS_Device_Write(int32_t ignored, const void* obuf, int size);
void GPS_Device_Error(char* hdr, ...);
void GPS_Device_Error(char* hdr, ...);
int32_t GPS_Write_Packet(gpsdevh* fd, const GPS_Packet& packet);
bool GPS_Send_Ack(gpsdevh* fd, GPS_Packet* tra, GPS_Packet* rec);
bool GPS_Send_Ack(gpsdevh* fd, GPS_Packet* tra, GPS_Packet* rec);
int32_t GPS_Packet_Read(gpsdevh* fd, GPS_Packet* packet);
bool GPS_Get_Ack(gpsdevh* fd, GPS_Packet* tra, GPS_Packet* rec);

using gps_device_op = int32_t (*)(gpsdevh*);
using gps_device_op5 = int32_t (*)(const char*, gpsdevh** fd);
using gps_device_op10 = bool (*)(gpsdevh* fd, GPS_Packet* tra, GPS_Packet* rec);
using gps_device_op12 = int32_t (*)(gpsdevh* fd, const GPS_Packet& packet);
using gps_device_op13 = int32_t (*)(gpsdevh* fd, GPS_Packet* packet);

typedef struct {
gps_device_op5 Device_On;
gps_device_op Device_Off;
gps_device_op Device_Chars_Ready;
gps_device_op Device_Wait;
gps_device_op Device_Flush;
gps_device_op10 Send_Ack;
gps_device_op10 Get_Ack;
gps_device_op13 Read_Packet;
gps_device_op12 Write_Packet;
} gps_device_ops;
bool GPS_Get_Ack(gpsdevh* fd, GPS_Packet* tra, GPS_Packet* rec);

using gps_device_op = int32_t (*)(gpsdevh*);
using gps_device_op5 = int32_t (*)(const char*, gpsdevh** fd);
using gps_device_op10 = bool (*)(gpsdevh* fd, GPS_Packet* tra, GPS_Packet* rec);
using gps_device_op12 = int32_t (*)(gpsdevh* fd, const GPS_Packet& packet);
using gps_device_op13 = int32_t (*)(gpsdevh* fd, GPS_Packet* packet);

typedef struct {
gps_device_op5 Device_On;
gps_device_op Device_Off;
gps_device_op Device_Chars_Ready;
gps_device_op Device_Wait;
gps_device_op Device_Flush;
gps_device_op10 Send_Ack;
gps_device_op10 Get_Ack;
gps_device_op13 Read_Packet;
gps_device_op12 Write_Packet;
} gps_device_ops;

#endif /* JEEPS_GPSDEVICE_H_INCLUDED_ */
10 changes: 5 additions & 5 deletions jeeps/gpsfmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#include <cstdio>
#include <ctime>

void GPS_Fmt_Print_Time(time_t Time, FILE* outf);
void GPS_Fmt_Print_Position(double lat, double lon, FILE* outf);
void GPS_Fmt_Print_Pvt(GPS_PPvt_Data pvt, FILE* outf);
void GPS_Fmt_Print_Almanac(GPS_PAlmanac* alm, int32_t n, FILE* outf);
void GPS_Fmt_Print_Track(GPS_PTrack* trk, int32_t n, FILE* outf);
void GPS_Fmt_Print_Time(time_t Time, FILE* outf);
void GPS_Fmt_Print_Position(double lat, double lon, FILE* outf);
void GPS_Fmt_Print_Pvt(GPS_PPvt_Data pvt, FILE* outf);
void GPS_Fmt_Print_Almanac(GPS_PAlmanac* alm, int32_t n, FILE* outf);
void GPS_Fmt_Print_Track(GPS_PTrack* trk, int32_t n, FILE* outf);
int32_t GPS_Fmt_Print_Waypoint(GPS_PWay* way, int32_t n, FILE* outf);
int32_t GPS_Fmt_Print_Proximity(GPS_PWay* way, int32_t n, FILE* outf);
int32_t GPS_Fmt_Print_Route(GPS_PWay* way, int32_t n, FILE* outf);
Expand Down
32 changes: 16 additions & 16 deletions jeeps/gpsmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ constexpr double GPS_FLTMIN = 1.75494351E-38;
constexpr double GPS_FLTMAX = 3.402823466E+38;

#include "jeeps/gps.h"
GPS_PPvt_Data GPS_Pvt_New();
void GPS_Pvt_Del(GPS_PPvt_Data* thys);
GPS_PAlmanac GPS_Almanac_New();
void GPS_Almanac_Del(GPS_PAlmanac* thys);
GPS_PTrack GPS_Track_New();
void GPS_Track_Del(GPS_PTrack* thys);
GPS_PWay GPS_Way_New();
void GPS_Way_Del(GPS_PWay* thys);
GPS_PLap GPS_Lap_New();
void GPS_Lap_Del(GPS_PLap* thys);
GPS_PCourse GPS_Course_New();
void GPS_Course_Del(GPS_PCourse* thys);
GPS_PCourse_Lap GPS_Course_Lap_New();
void GPS_Course_Lap_Del(GPS_PCourse_Lap* thys);
GPS_PCourse_Point GPS_Course_Point_New();
void GPS_Course_Point_Del(GPS_PCourse_Point* thys);
GPS_PPvt_Data GPS_Pvt_New();
void GPS_Pvt_Del(GPS_PPvt_Data* thys);
GPS_PAlmanac GPS_Almanac_New();
void GPS_Almanac_Del(GPS_PAlmanac* thys);
GPS_PTrack GPS_Track_New();
void GPS_Track_Del(GPS_PTrack* thys);
GPS_PWay GPS_Way_New();
void GPS_Way_Del(GPS_PWay* thys);
GPS_PLap GPS_Lap_New();
void GPS_Lap_Del(GPS_PLap* thys);
GPS_PCourse GPS_Course_New();
void GPS_Course_Del(GPS_PCourse* thys);
GPS_PCourse_Lap GPS_Course_Lap_New();
void GPS_Course_Lap_Del(GPS_PCourse_Lap* thys);
GPS_PCourse_Point GPS_Course_Point_New();
void GPS_Course_Point_Del(GPS_PCourse_Point* thys);

#endif // JEEPS_GPSMEM_H_INCLUDED_
Loading

0 comments on commit ad23c57

Please sign in to comment.