52 _gps_position(gps_position)
61 GPS_WARN(
"MTK: Unsupported Output Mode %i", (
int)output_mode);
108 GPS_WARN(
"mtk: config write failed");
125 int ret =
read(buf,
sizeof(buf), timeout);
250 struct tm timeinfo = {};
251 uint32_t timeinfo_conversion_temp;
253 timeinfo.tm_mday = packet.
date / 10000;
254 timeinfo_conversion_temp = packet.
date - timeinfo.tm_mday * 10000;
255 timeinfo.tm_mon = (timeinfo_conversion_temp / 100) - 1;
256 timeinfo.tm_year = (timeinfo_conversion_temp - (timeinfo.tm_mon + 1) * 100) + 100;
258 timeinfo.tm_hour = (packet.
utc_time / 10000000);
259 timeinfo_conversion_temp = packet.
utc_time - timeinfo.tm_hour * 10000000;
260 timeinfo.tm_min = timeinfo_conversion_temp / 100000;
261 timeinfo_conversion_temp -= timeinfo.tm_min * 100000;
262 timeinfo.tm_sec = timeinfo_conversion_temp / 1000;
263 timeinfo_conversion_temp -= timeinfo.tm_sec * 1000;
265 timeinfo.tm_isdst = 0;
269 time_t epoch = mktime(&timeinfo);
278 ts.tv_nsec = timeinfo_conversion_temp * 1000000ULL;
int receive(unsigned timeout) override
receive & handle new data from the device
int setBaudrate(int baudrate)
set the Baudrate
int32_t longitude
Longitude in degrees * 10^7.
void handleMessage(gps_mtk_packet_t &packet)
Handle the package once it has arrived.
uint32_t ground_speed
velocity in m/s
int read(uint8_t *buf, int buf_length, int timeout)
read from device
int configure(unsigned &baudrate, OutputMode output_mode) override
configure the device
void decodeInit()
Reset the parse state machine for a fresh start.
int write(const void *buf, int buf_length)
write to the device
int32_t timestamp_time_relative
struct vehicle_gps_position_s * _gps_position
int32_t latitude
Latitude in degrees * 10^7.
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
int(* GPSCallbackPtr)(GPSCallbackType type, void *data1, int data2, void *user)
Callback function for platform-specific stuff.
#define GPS_READ_BUFFER_SIZE
buffer size for the read() call. Messages can be longer than that.
uint8_t fix_type
fix type: XXX correct for that
GPSDriverMTK(GPSCallbackPtr callback, void *callback_user, struct vehicle_gps_position_s *gps_position)
uint8_t satellites
number of satellites used
int32_t heading
heading in degrees * 10^2
uint32_t msl_altitude
MSL altitude in meters * 10^2.
uint16_t hdop
horizontal dilution of position (without unit)
int parseChar(uint8_t b, gps_mtk_packet_t &packet)
Parse the binary MTK packet.
uint8_t _rate_count_lat_lon
the structures of the binary packets
#define gps_absolute_time
Get the current time in us.
void setClock(timespec &t)
mtk_decode_state_t _decode_state
void addByteToChecksum(uint8_t)
While parsing add every byte (except the sync bytes) to the checksum.