Browse Subversion Repository
Contents of /runCtrl/TransmitCtrl.h
Parent Directory
| Revision Log
Revision 383 -
( show annotations)
( download)
( as text)
Tue Dec 11 07:55:09 2012 UTC
(11 years, 4 months ago)
by satofumi
File MIME type: text/x-chdr
File size: 1230 byte(s)
fix compile error
| 1 |
#ifndef TRANSMIT_CTRL_H |
| 2 |
#define TRANSMIT_CTRL_H |
| 3 |
|
| 4 |
/*! |
| 5 |
\file |
| 6 |
\brief 走行制御パケットの送受信 |
| 7 |
|
| 8 |
\author Satofumi KAMIMURA |
| 9 |
|
| 10 |
$Id$ |
| 11 |
*/ |
| 12 |
|
| 13 |
#include "TransmitPacket.h" |
| 14 |
#include <memory> |
| 15 |
#include <vector> |
| 16 |
#include <cstddef> |
| 17 |
|
| 18 |
namespace beego { |
| 19 |
class ConnectionInterface; |
| 20 |
|
| 21 |
/*! |
| 22 |
\brief 送受信の管理 |
| 23 |
*/ |
| 24 |
class TransmitCtrl { |
| 25 |
TransmitCtrl(void); |
| 26 |
TransmitCtrl(const TransmitCtrl& rhs); |
| 27 |
TransmitCtrl& operator = (const TransmitCtrl& rhs); |
| 28 |
|
| 29 |
struct pImpl; |
| 30 |
const std::auto_ptr<pImpl> pimpl; |
| 31 |
|
| 32 |
public: |
| 33 |
TransmitCtrl(ConnectionInterface* con, unsigned char* struct_ptr); |
| 34 |
~TransmitCtrl(void); |
| 35 |
|
| 36 |
void initPacket(char type); |
| 37 |
void addVariable(unsigned char* ptr, int byte); |
| 38 |
bool send(std::vector<unsigned char>* copy_message); |
| 39 |
bool recv(int timeout); |
| 40 |
bool sendWithRetry(std::vector<unsigned char>& last_command, |
| 41 |
size_t max_retry, int timeout); |
| 42 |
}; |
| 43 |
|
| 44 |
/*! |
| 45 |
\brief 更新用マクロ |
| 46 |
*/ |
| 47 |
#define ADD_WRITE_VARIABLE(A, B, C) \ |
| 48 |
{ B = C; A.addVariable(reinterpret_cast<unsigned char*>(&B), sizeof(B)); } |
| 49 |
|
| 50 |
/*! |
| 51 |
\brief 読み出し用マクロ |
| 52 |
*/ |
| 53 |
#define ADD_READ_VARIABLE(A, B) \ |
| 54 |
A.addVariable(reinterpret_cast<unsigned char*>(&B), sizeof(B)); |
| 55 |
}; |
| 56 |
|
| 57 |
#endif /* !TRANSMIT_CTRL_H */ |
|