forked from machinekoder/mbus-windows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmbus-serial.h
43 lines (31 loc) · 1.15 KB
/
mbus-serial.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//------------------------------------------------------------------------------
// Copyright (C) 2011, Robert Johansson, Raditex AB
// All rights reserved.
//
// FreeSCADA
// http://www.FreeSCADA.com
//
//------------------------------------------------------------------------------
/**
* @file mbus-serial.h
*
* @brief Functions and data structures for sending M-Bus data via RS232.
*
*/
#ifndef MBUS_SERIAL_H
#define MBUS_SERIAL_H
#include <termios.h>
#include <mbus/mbus.h>
typedef struct _mbus_serial_handle {
char *device;
int fd;
struct termios t;
} mbus_serial_handle;
mbus_serial_handle *mbus_serial_connect(char *device);
int mbus_serial_disconnect(mbus_serial_handle *handle);
int mbus_serial_send_frame(mbus_serial_handle *handle, mbus_frame *frame);
int mbus_serial_recv_frame(mbus_serial_handle *handle, mbus_frame *frame);
int mbus_serial_set_baudrate(mbus_serial_handle *handle, int baudrate);
int mbus_serial_set_timeout(mbus_serial_handle *handle, int timeout);
#endif /* MBUS_SERIAL_H */