picloud start develop
This commit is contained in:
28
utils/cloud_dispatcher/dispatcherclient.cpp
Normal file
28
utils/cloud_dispatcher/dispatcherclient.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "dispatcherclient.h"
|
||||
|
||||
|
||||
DispatcherClient::DispatcherClient(PIEthernet * eth_) {
|
||||
eth = eth_;
|
||||
eth->startThreadedRead();
|
||||
CONNECTU(eth, threadedReadEvent, this, readed);
|
||||
CONNECTU(eth, disconnected, this, disconnected);
|
||||
piCoutObj << "client connected" << eth->sendAddress();
|
||||
}
|
||||
|
||||
|
||||
DispatcherClient::~DispatcherClient() {
|
||||
}
|
||||
|
||||
|
||||
void DispatcherClient::disconnected(bool withError) {
|
||||
piCoutObj << "client disconnected" << eth->sendAddress();
|
||||
disconnectEvent(this);
|
||||
}
|
||||
|
||||
|
||||
void DispatcherClient::readed(uchar *data, int size) {
|
||||
PIByteArray ba(data, size);
|
||||
piCoutObj << "readed" << ba.toHex();
|
||||
eth->write(ba);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user