start develop picloud

This commit is contained in:
2020-08-24 13:23:31 +03:00
parent f033119a8b
commit 3965e54e38
10 changed files with 67 additions and 277 deletions

View File

@@ -17,7 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "piccloudclient.h"
#include "picloudclient.h"
PICloudClient::PICloudClient() {

View File

@@ -17,9 +17,34 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "piccloudserver.h"
#include "picloudserver.h"
#include "piethernet.h"
PICloudServer::PICloudServer() {
PICloudServer::PICloudServer(const PIString & path, PIIODevice::DeviceMode mode) : PIIODevice(path, mode) {
eth = new PIEthernet(PIEthernet::TCP_Client);
}
PICloudServer::~PICloudServer() {
}
bool PICloudServer::openDevice() {
piCout << "PICloudServer open device" << path();
bool op = eth->connect(path(), false);
if (op) {
CONNECTL(eth, disconnected, [this](bool){eth->connect(path());});
eth->startThreadedRead();
return true;
}
return false;
}
bool PICloudServer::closeDevice() {
eth->stopThreadedRead();
return eth->close();
}

View File

@@ -17,7 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "piccloudtcp.h"
#include "picloudtcp.h"
#include "picrypt.h"
const char hash_def_key[] = "_picrypt_";

View File

@@ -1,4 +1,4 @@
/*! \file piccloudclient.h
/*! \file picloudclient.h
* \brief PICloud Client
*/
/*
@@ -20,8 +20,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PICCLOUDCLIENT_H
#define PICCLOUDCLIENT_H
#ifndef PICLOUDCLIENT_H
#define PICLOUDCLIENT_H
#include "pip_cloud_export.h"
#include "piiodevice.h"
@@ -45,4 +45,4 @@ private:
PIEthernet * eth;
};
#endif // PICCLOUDCLIENT_H
#endif // PICLOUDCLIENT_H

View File

@@ -20,8 +20,8 @@
#ifndef PICLOUDMODULE_H
#define PICLOUDMODULE_H
#include "piccloudtcp.h"
#include "piccloudclient.h"
#include "piccloudserver.h"
#include "picloudtcp.h"
#include "picloudclient.h"
#include "picloudserver.h"
#endif // PICLOUDMODULE_H

View File

@@ -1,4 +1,4 @@
/*! \file piccloudserver.h
/*! \file picloudserver.h
* \brief PICloud Server
*/
/*
@@ -20,21 +20,29 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PICCLOUDSERVER_H
#define PICCLOUDSERVER_H
#ifndef PICLOUDSERVER_H
#define PICLOUDSERVER_H
#include "pip_cloud_export.h"
#include "piiodevice.h"
class PIEthernet;
class PIP_CLOUD_EXPORT PICloudServer {
class PIP_CLOUD_EXPORT PICloudServer : public PIIODevice
{
PIIODEVICE(PICloudServer)
public:
//!
explicit PICloudServer();
explicit PICloudServer(const PIString & path = PIString(), PIIODevice::DeviceMode mode = PIIODevice::ReadWrite);
virtual ~PICloudServer();
protected:
bool openDevice();
bool closeDevice();
private:
PIEthernet * eth;
};
#endif // PICCLOUDSERVER_H
#endif // PICLOUDSERVER_H

View File

@@ -1,4 +1,4 @@
/*! \file piccloudtcp.h
/*! \file picloudtcp.h
* \brief PICloud TCP transport
*/
/*
@@ -20,12 +20,13 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PICCLOUDTCP_H
#define PICCLOUDTCP_H
#ifndef PICLOUDTCP_H
#define PICLOUDTCP_H
#include "pip_cloud_export.h"
#include "pistring.h"
class PIP_CLOUD_EXPORT PICloudTCP {
public:
//!
@@ -36,4 +37,4 @@ private:
};
#endif // PICCLOUDTCP_H
#endif // PICLOUDTCP_H

View File

@@ -30,5 +30,6 @@
#include "pisystemmodule.h"
#include "pigeomodule.h"
#include "picryptmodule.h"
#include "picloudmodule.h"
#endif // PIP_H