git-svn-id: svn://db.shs.com.ru/pip@774 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2019-04-05 20:11:43 +00:00
parent 5069bf05a7
commit 1307b25994
2 changed files with 75 additions and 2 deletions

View File

@@ -29,12 +29,20 @@
class PIIODevice;
class PIStreamPacker: public PIObject, public PIEthUtilBase {
class PIP_EXPORT PIStreamPacker: public PIObject, public PIEthUtilBase {
PIOBJECT(PIStreamPacker)
public:
//! Contructs packer and try to assign \"dev\"
PIStreamPacker(PIIODevice * dev = 0);
struct Progress {
Progress();
bool active;
int bytes_all;
int bytes_current;
double progress;
};
//! Set maximum size of single packet
void setMaxPacketSize(int max_size) {max_packet_size = max_size;}
@@ -61,6 +69,9 @@ public:
//! and \a sendRequest() event to \"dev\" \a PIIODevice::write() handler
void assignDevice(PIIODevice * dev);
Progress progressSend() const;
Progress progressReceive() const;
EVENT1(packetReceiveEvent, PIByteArray, data)
EVENT1(sendRequest, PIByteArray, data)
@@ -96,6 +107,8 @@ private:
int packet_size;
ushort packet_sign;
int max_packet_size;
Progress prog_s, prog_r;
mutable PIMutex prog_s_mutex, prog_r_mutex;
};