Android activity and AndroidController class refactoring
This commit is contained in:
parent
5a5ea4a018
commit
b90fad6664
13 changed files with 296 additions and 892 deletions
|
|
@ -1,26 +1,16 @@
|
|||
#include <QDebug>
|
||||
#include <QHostAddress>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QRandomGenerator>
|
||||
#include <QTextCodec>
|
||||
#include <QTimer>
|
||||
|
||||
#include "android_vpnprotocol.h"
|
||||
|
||||
#include "platforms/android/android_controller.h"
|
||||
|
||||
|
||||
AndroidVpnProtocol::AndroidVpnProtocol(Proto protocol, const QJsonObject &configuration, QObject* parent)
|
||||
: VpnProtocol(configuration, parent),
|
||||
m_protocol(protocol)
|
||||
: VpnProtocol(configuration, parent)
|
||||
{ }
|
||||
|
||||
ErrorCode AndroidVpnProtocol::start()
|
||||
{
|
||||
AndroidController::instance()->setVpnConfig(m_rawConfig);
|
||||
return AndroidController::instance()->start();
|
||||
qDebug() << "AndroidVpnProtocol::start()";
|
||||
return AndroidController::instance()->start(m_rawConfig);
|
||||
}
|
||||
|
||||
void AndroidVpnProtocol::stop()
|
||||
|
|
@ -29,11 +19,8 @@ void AndroidVpnProtocol::stop()
|
|||
AndroidController::instance()->stop();
|
||||
}
|
||||
|
||||
void AndroidVpnProtocol::connectionDataUpdated(QString totalRx, QString totalTx, QString endpoint, QString deviceIPv4)
|
||||
void AndroidVpnProtocol::connectionDataUpdated(quint64 rxBytes, quint64 txBytes)
|
||||
{
|
||||
quint64 rxBytes = totalRx.toLongLong();
|
||||
quint64 txBytes = totalTx.toLongLong();
|
||||
|
||||
setBytesChanged(rxBytes, txBytes);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#define ANDROID_VPNPROTOCOL_H
|
||||
|
||||
#include "vpnprotocol.h"
|
||||
#include "protocols/protocols_defs.h"
|
||||
|
||||
using namespace amnezia;
|
||||
|
||||
|
|
@ -12,24 +11,14 @@ class AndroidVpnProtocol : public VpnProtocol
|
|||
|
||||
public:
|
||||
explicit AndroidVpnProtocol(Proto protocol, const QJsonObject& configuration, QObject* parent = nullptr);
|
||||
virtual ~AndroidVpnProtocol() override = default;
|
||||
~AndroidVpnProtocol() override = default;
|
||||
|
||||
ErrorCode start() override;
|
||||
void stop() override;
|
||||
|
||||
signals:
|
||||
|
||||
|
||||
public slots:
|
||||
void connectionDataUpdated(QString totalRx, QString totalTx, QString endpoint, QString deviceIPv4);
|
||||
void connectionDataUpdated(quint64 rxBytes, quint64 txBytes);
|
||||
|
||||
protected slots:
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
private:
|
||||
Proto m_protocol;
|
||||
};
|
||||
|
||||
#endif // ANDROID_VPNPROTOCOL_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue