picloud
This commit is contained in:
@@ -24,9 +24,7 @@
|
||||
#define PICLOUDCLIENT_H
|
||||
|
||||
#include "pip_cloud_export.h"
|
||||
#include "piiodevice.h"
|
||||
|
||||
class PIEthernet;
|
||||
#include "piethernet.h"
|
||||
|
||||
|
||||
class PIP_CLOUD_EXPORT PICloudClient : public PIIODevice
|
||||
@@ -34,7 +32,7 @@ class PIP_CLOUD_EXPORT PICloudClient : public PIIODevice
|
||||
PIIODEVICE(PICloudClient)
|
||||
public:
|
||||
//!
|
||||
explicit PICloudClient();
|
||||
explicit PICloudClient(const PIString & path = PIString(), PIIODevice::DeviceMode mode = PIIODevice::ReadWrite);
|
||||
virtual ~PICloudClient();
|
||||
|
||||
protected:
|
||||
@@ -42,7 +40,10 @@ protected:
|
||||
bool closeDevice();
|
||||
|
||||
private:
|
||||
PIEthernet * eth;
|
||||
int readDevice(void * read_to, int max_size);
|
||||
int writeDevice(const void * data, int max_size);
|
||||
|
||||
PIEthernet eth;
|
||||
};
|
||||
|
||||
#endif // PICLOUDCLIENT_H
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
#include "pip_cloud_export.h"
|
||||
#include "piethernet.h"
|
||||
|
||||
class PIEthernet;
|
||||
|
||||
|
||||
class PIP_CLOUD_EXPORT PICloudServer : public PIIODevice
|
||||
{
|
||||
@@ -37,6 +35,18 @@ public:
|
||||
explicit PICloudServer(const PIString & path = PIString(), PIIODevice::DeviceMode mode = PIIODevice::ReadWrite);
|
||||
virtual ~PICloudServer();
|
||||
|
||||
class Client : public PIIODevice {
|
||||
PIIODEVICE(PICloudServer::Client)
|
||||
public:
|
||||
Client(PICloudServer * srv = nullptr);
|
||||
protected:
|
||||
bool openDevice();
|
||||
private:
|
||||
PICloudServer * server;
|
||||
};
|
||||
|
||||
EVENT1(newConnection, PICloudServer::Client * , client)
|
||||
|
||||
protected:
|
||||
bool openDevice();
|
||||
bool closeDevice();
|
||||
@@ -44,7 +54,11 @@ protected:
|
||||
int writeDevice(const void * data, int max_size);
|
||||
|
||||
private:
|
||||
EVENT_HANDLER2(void, readed, uchar * , data, int, size);
|
||||
void sendStart();
|
||||
|
||||
PIEthernet eth;
|
||||
PIVector<Client> clients;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "pip_cloud_export.h"
|
||||
#include "pistring.h"
|
||||
|
||||
|
||||
namespace PICloud {
|
||||
|
||||
enum Version {
|
||||
@@ -45,20 +46,19 @@ struct PIP_CLOUD_EXPORT Header {
|
||||
uchar type; // PICloud::HeaderType
|
||||
PIString sname; // server name
|
||||
};
|
||||
}
|
||||
|
||||
PIP_CLOUD_EXPORT PIByteArray & operator <<(PIByteArray & s, const PICloud::Header & v);
|
||||
PIP_CLOUD_EXPORT PIByteArray & operator >>(PIByteArray & s, PICloud::Header & v);
|
||||
|
||||
|
||||
class PIP_CLOUD_EXPORT PICloudTCP {
|
||||
class PIP_CLOUD_EXPORT TCP {
|
||||
public:
|
||||
//!
|
||||
PICloudTCP();
|
||||
|
||||
TCP();
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
PIP_CLOUD_EXPORT PIByteArray & operator <<(PIByteArray & s, const PICloud::Header & v);
|
||||
PIP_CLOUD_EXPORT PIByteArray & operator >>(PIByteArray & s, PICloud::Header & v);
|
||||
|
||||
#endif // PICLOUDTCP_H
|
||||
|
||||
Reference in New Issue
Block a user