SELKIELogger  1.0.0
N2KConnection.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 SELKIELoggerN2K_Connection
22 #define SELKIELoggerN2K_Connection
23 
24 #include <stdbool.h>
25 
26 #include "N2KTypes.h"
27 #include "SELKIELoggerBase.h"
28 
35 #define N2K_BUFF 1024
36 
38 int n2k_openConnection(const char *device, const int baud);
39 
41 void n2k_closeConnection(int handle);
42 
44 bool n2k_act_readMessage(int handle, n2k_act_message *out);
45 
47 bool n2k_act_readMessage_buf(int handle, n2k_act_message *out, uint8_t buf[N2K_BUFF], size_t *index, size_t *hw);
48 
49 #endif
#define N2K_BUFF
Default serial buffer allocation size.
Definition: N2KConnection.h:35
bool n2k_act_readMessage(int handle, n2k_act_message *out)
Static wrapper around n2k_readMessage_buf.
Definition: N2KConnection.c:61
void n2k_closeConnection(int handle)
Close N2K serial connection.
Definition: N2KConnection.c:46
int n2k_openConnection(const char *device, const int baud)
Open connection to an N2K serial device.
Definition: N2KConnection.c:38
bool n2k_act_readMessage_buf(int handle, n2k_act_message *out, uint8_t buf[N2K_BUFF], size_t *index, size_t *hw)
Read data from handle, and parse message if able.
Definition: N2KConnection.c:85