SELKIELogger  1.0.0
GPSSerial.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 Swansea University
3  *
4  * This file is part of the SELKIELogger suite of tools.
5  *
6  * SELKIELogger is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the Free
8  * Software Foundation, either version 3 of the License, or (at your option)
9  * any later version.
10  *
11  * SELKIELogger is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this SELKIELogger product.
18  * If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef SELKIELoggerGPS_Serial
22 #define SELKIELoggerGPS_Serial
23 
30 #include "GPSTypes.h"
31 #include "SELKIELoggerBase.h"
32 
39 #define UBX_SERIAL_BUFF 4096
40 
42 int ubx_openConnection(const char *port, const int initialBaud);
43 
45 void ubx_closeConnection(int handle);
46 
48 bool ubx_readMessage(int handle, ubx_message *out);
49 
51 bool ubx_readMessage_buf(int handle, ubx_message *out, uint8_t buf[UBX_SERIAL_BUFF], int *index, int *hw);
52 
54 bool ubx_waitForMessage(const int handle, const uint8_t msgClass, const uint8_t msgID, const int maxDelay,
55  ubx_message *out);
56 
58 bool ubx_writeMessage(int handle, const ubx_message *out);
60 #endif
bool ubx_waitForMessage(const int handle, const uint8_t msgClass, const uint8_t msgID, const int maxDelay, ubx_message *out)
Read (and discard) messages until required message seen or timeout reached.
Definition: GPSSerial.c:276
bool ubx_writeMessage(int handle, const ubx_message *out)
Send message to attached device.
Definition: GPSSerial.c:298
bool ubx_readMessage_buf(int handle, ubx_message *out, uint8_t buf[UBX_SERIAL_BUFF], int *index, int *hw)
Read data from handle, and parse message if able.
Definition: GPSSerial.c:158
bool ubx_readMessage(int handle, ubx_message *out)
Static wrapper around ubx_readMessage_buf()
Definition: GPSSerial.c:125
#define UBX_SERIAL_BUFF
Serial buffer size.
Definition: GPSSerial.h:39
int ubx_openConnection(const char *port, const int initialBaud)
Set up a connection to a UBlox module on a given port.
Definition: GPSSerial.c:51
void ubx_closeConnection(int handle)
Close a connection opened with ubx_openConnection()
Definition: GPSSerial.c:111
Internal representation of a UBX message.
Definition: GPSTypes.h:80