summaryrefslogtreecommitdiff
path: root/libloragw/inc/loragw_gps.h
diff options
context:
space:
mode:
Diffstat (limited to 'libloragw/inc/loragw_gps.h')
-rw-r--r--libloragw/inc/loragw_gps.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/libloragw/inc/loragw_gps.h b/libloragw/inc/loragw_gps.h
index 8041e43..9e3aa27 100644
--- a/libloragw/inc/loragw_gps.h
+++ b/libloragw/inc/loragw_gps.h
@@ -22,7 +22,6 @@ Maintainer: Michael Coracin
/* -------------------------------------------------------------------------- */
/* --- DEPENDANCIES --------------------------------------------------------- */
-#define _GNU_SOURCE
#include <stdint.h> /* C99 types */
#include <time.h> /* time library */
#include <termios.h> /* speed_t */
@@ -31,6 +30,7 @@ Maintainer: Michael Coracin
#include <gpsdclient.h>
#include <errno.h> /* error messages */
#include <sys/stat.h>
+#include <sys/socket.h>
#include "config.h" /* library configuration options (dynamically generated) */
/* -------------------------------------------------------------------------- */
@@ -90,11 +90,10 @@ enum gps_state {
GPS_UNKNOWN,
GPS_RUNNING,
GPS_LOST,
- GPS_RETRYING
+ GPS_RECONNECTING
};
-// struct gps_data_t gpsdata;
/* -------------------------------------------------------------------------- */
/* --- PUBLIC CONSTANTS ----------------------------------------------------- */
@@ -109,25 +108,29 @@ enum gps_state {
/* --- PUBLIC FUNCTIONS PROTOTYPES ------------------------------------------ */
/**
-@brief Configure a GPS module
-
-@param tty_path path to the TTY connected to the GPS
-@param gps_familly parameter (eg. ubx6 for uBlox gen.6)
-@param target_brate target baudrate for communication (0 keeps default target baudrate)
-@param fd_ptr pointer to a variable to receive file descriptor on GPS tty
+@brief Enable GPSD
@return success if the function was able to connect and configure a GPS module
*/
-int lgw_gps_enable(char* tty_path, char* gps_familly, speed_t target_brate, int* fd_ptr, int slot);
+int lgw_gps_enable();
/**
-@brief Restore GPS serial configuration and close serial device
+@brief Disable GPSD
+@return success if the function was able to disable the gpsd connection
+*/
+int lgw_gps_disable();
-@param fd file descriptor on GPS tty
-@return success if the function was able to complete
+/**
+@brief Prepare for a blocking read
+@return 1 if we have data waiting, 0 if it timed out
*/
-int lgw_gps_disable(int fd);
+int lgw_gps_data_ready();
/**
+@brief Get data from gpsd stream
+@return size of message received
+*/
+int lgw_gps_stream(char *message, size_t len);
+/**
@brief Get updated leap seconds
@return success if the function was able to get the new leap seconds