Serial-TCP/IPbridge  1.0
serial_connection.h
Go to the documentation of this file.
1 
12 #ifndef SERIAL_CONNECTION_H
13 #define SERIAL_CONNECTION_H
14 
15 
16 
17 #include "connection.h"
18 #include "serial_config.h"
19 
26  public:
32  SerialConnection(const SerialConfig &config);
33 
37  virtual ~SerialConnection();
38 
39  // Override
40  virtual void close();
41 
42  private:
43 
44  // Override.
45  virtual std::string doReceiveMessage(Config::LengthFieldMessageLength messageLength);
46 
47  // Override.
48  virtual size_t doSendMessage(const std::string &message);
49 
50  // Disable copy ctor and assignment operator since this is
51  // a reference object
54 
55  private:
57  int _serialFd;
58 };
59 
60 #endif // #ifndef SERIAL_CONNECTION_H
61 
62 // End of file serial_connection.h
SerialConfig class - declarations.
Connection class - declarations.
virtual std::string doReceiveMessage(Config::LengthFieldMessageLength messageLength)
Receives a message.
Configuration for a TCP/IP server.
Definition: serial_config.h:30
Serial connection (via a serial port).
Definition: serial_connection.h:25
SerialConnection(const SerialConfig &config)
Constructor.
int _serialFd
File descriptor to the serial port.
Definition: serial_connection.h:57
virtual size_t doSendMessage(const std::string &message)
Sends the selected message.
virtual ~SerialConnection()
Destructor.
virtual void close()
Closes an established TCP connection.
SerialConnection & operator=(const SerialConnection &)
std::tr1::uint32_t LengthFieldMessageLength
Message length type when using length field.
Definition: config.h:49
Abstract class for all connection types.
Definition: connection.h:28