API
 
Loading...
Searching...
No Matches
netSerial.hpp
Go to the documentation of this file.
1/** \file netSerial.hpp
2 * \brief Managing a connection to a serial device over a network socket.
3 * \author Jared R. Males (jaredmales@gmail.com)
4 *
5 * This code is taken from the LBTAO/MagAO supervisor source code, modifications
6 * mainly for c++.
7 *
8 * \ingroup tty_files
9 */
10
11#ifndef tty_netSerial_hpp
12#define tty_netSerial_hpp
13
14#define NETSERIAL_E_NOERROR (0)
15#define NETSERIAL_E_NETWORK (-50000)
16#define NETSERIAL_E_CONNECT (-50010)
17#define NETSERIAL_E_COMM (-50020)
18
19namespace MagAOX
20{
21namespace tty
22{
23
24/// Manage a connectio to a serial device over a network
25/**
26 *
27 * \todo document this, including methods
28 * \todo add errors to ttyErrors
29 */
31{
32
33protected:
34 int m_sockfd {-1};
35
36public:
37
38 int serialInit( const char *address,
39 int port
40 );
41
42 int serialClose(void);
43
44 int serialOut( const char *buf,
45 int len
46 );
47
48 int serialIn( char *buf,
49 int len,
50 int timeout
51 );
52
53 int serialInString( char *buf,
54 int len,
55 int timeout,
56 char terminator
57 );
58
59 int serialInString2( char *buf,
60 int len,
61 int timeout,
62 char *terminator
63 );
64
65 int getSocketFD(void);
66
67};
68
69
70
71} // namespace tty
72} // namespace MagAOX
73
74#endif // netSerial_hpp
Definition dm.hpp:24
Manage a connectio to a serial device over a network.
Definition netSerial.hpp:31
int serialIn(char *buf, int len, int timeout)
Definition netSerial.cpp:94
int serialOut(const char *buf, int len)
Definition netSerial.cpp:72
int serialInString2(char *buf, int len, int timeout, char *terminator)
int serialInString(char *buf, int len, int timeout, char terminator)
int serialInit(const char *address, int port)
Definition netSerial.cpp:34