-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from janekbaraniewski/init
init3
- Loading branch information
Showing
13 changed files
with
248 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef CLIENT_H | ||
#define CLIENT_H | ||
|
||
#include "common.hpp" | ||
#include "VirtualSerialPort.h" | ||
|
||
using namespace boost::asio; | ||
using ip::tcp; | ||
using std::string; | ||
|
||
class SerialClient { | ||
public: | ||
SerialClient(const string& server_ip, unsigned short server_port, const string& vsp_name); | ||
void run(); | ||
|
||
private: | ||
io_service io_service_; | ||
tcp::socket socket_; | ||
std::array<char, 256> buffer_; | ||
VirtualSerialPort vsp_; | ||
|
||
void do_read_write(); | ||
}; | ||
|
||
|
||
#endif // CLIENT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef SERVER_H | ||
#define SERVER_H | ||
|
||
#include "common.hpp" | ||
#include "ISerialPort.h" | ||
#include "RealSerialPort.h" | ||
|
||
using namespace boost::asio; | ||
using ip::tcp; | ||
using std::string; | ||
|
||
class SerialServer { | ||
public: | ||
SerialServer(io_service& io, ISerialPort& serial, tcp::acceptor& acceptor); | ||
void run(); | ||
|
||
private: | ||
io_service& io_service_; | ||
ISerialPort& serial_; | ||
tcp::acceptor& acceptor_; | ||
tcp::socket socket_; | ||
|
||
void start_accept(); | ||
void do_read_write(); | ||
}; | ||
|
||
#endif // SERVER_H |
Oops, something went wrong.