Browse Subversion Repository
Contents of /connection/SerialCtrl.h
Parent Directory
| Revision Log
Revision 191 -
( show annotations)
( download)
( as text)
Fri Jan 4 02:49:36 2008 UTC
(16 years, 3 months ago)
by satofumi
File MIME type: text/x-chdr
File size: 1005 byte(s)
using namespace beego
| 1 |
#ifndef SERIAL_CTRL_H |
| 2 |
#define SERIAL_CTRL_H |
| 3 |
|
| 4 |
/*! |
| 5 |
\file |
| 6 |
\brief シリアル接続 |
| 7 |
|
| 8 |
\author Satofumi KAMIMURA |
| 9 |
|
| 10 |
$Id$ |
| 11 |
*/ |
| 12 |
|
| 13 |
#include "ConnectionInterface.h" |
| 14 |
#include <memory> |
| 15 |
#include <string> |
| 16 |
|
| 17 |
|
| 18 |
namespace beego { |
| 19 |
/*! |
| 20 |
\brief シリアル通信ハンドラ |
| 21 |
*/ |
| 22 |
class SerialCtrl : public ConnectionInterface { |
| 23 |
SerialCtrl(const SerialCtrl& rhs); |
| 24 |
SerialCtrl& operator = (const SerialCtrl& rhs); |
| 25 |
|
| 26 |
struct pImpl; |
| 27 |
const std::auto_ptr<pImpl> pimpl; |
| 28 |
|
| 29 |
public: |
| 30 |
enum { NoTimeout = -1 }; |
| 31 |
|
| 32 |
SerialCtrl(void); |
| 33 |
~SerialCtrl(void); |
| 34 |
|
| 35 |
const char* what(void); |
| 36 |
bool connect(const char* device, long baudrate); |
| 37 |
void disconnect(void); |
| 38 |
bool isConnected(void); |
| 39 |
bool changeBaudrate(long baudrate); |
| 40 |
int send(const char* data, int size); |
| 41 |
int recv(char* data, int size, int timeout); |
| 42 |
int getLine(std::string& data, int timeout); |
| 43 |
int size(int timeout = 0); |
| 44 |
void clear(void); |
| 45 |
void skip(int timeout = NoTimeout); |
| 46 |
void flush(void); |
| 47 |
}; |
| 48 |
}; |
| 49 |
|
| 50 |
#endif /* !SERIAL_CTRL_H */ |
|