Skip to content
Snippets Groups Projects
Commit d00d13bf authored by aleksandr.ledyaev's avatar aleksandr.ledyaev
Browse files

Merge branch 'master' into features-4566

parents 74fc4fde 4fe34778
No related branches found
No related tags found
1 merge request!11Cellframe clone
......@@ -18,12 +18,16 @@ DapApplication::DapApplication(int &argc, char **argv)
qRegisterMetaType<DapNetwork::State>("DapNetwork::State");
connect(&DapServiceController::getInstance(), &DapServiceController::networksListReceived, this->networks(), &DapNetworksList::fill);
connect(&DapServiceController::getInstance(), &DapServiceController::networkStatusReceived, [this](const QVariant & a_stateJson){
networks()->setNetworkProperties(a_stateJson.toMap());
connect(&DapServiceController::getInstance(), &DapServiceController::networkStatusReceived, [this](const QVariant & a_stateMap){
networks()->setNetworkProperties(a_stateMap.toMap());
});
connect(this->networks(), &DapNetworksList::networkAdded, [](DapNetwork* network){
DapServiceController::getInstance().requestNetworkState(network->name());
DapServiceController::getInstance().requestNetworkStatus(network->name());
});
connect(&DapServiceController::getInstance(), &DapServiceController::newTargetNetworkStateReceived, [this](const QVariant & a_state){
qDebug() << "newTargetNetworkStateReceived" << a_state;
});
}
......
#include "DapServiceController.h"
#include "DapNetwork.h"
/// Standard constructor.
/// @param apParent Parent.
DapServiceController::DapServiceController(QObject *apParent)
......@@ -62,9 +64,19 @@ QString DapServiceController::getCurrentChain() const
return (m_sCurrentNetwork == "private") ? "gdb" : "plasma";
}
void DapServiceController::requestNetworkState(QString a_networkName)
void DapServiceController::requestNetworkStatus(QString a_networkName)
{
this->requestToService("DapGetNetworkStatusCommand", a_networkName);
}
void DapServiceController::changeNetworkStateToOffline(QString a_networkName)
{
this->requestToService("DapGetNetworkStatusCommand", a_networkName, "offline");
}
void DapServiceController::changeNetworkStateToOnline(QString a_networkName)
{
this->requestToService("DapGetListNetworksCommand", a_networkName);
this->requestToService("DapNetworkGoToCommand", a_networkName, "online");
}
/// Get an instance of a class.
......@@ -135,6 +147,8 @@ void DapServiceController::registerCommand()
m_transceivers.append(qMakePair(dynamic_cast<DapAbstractCommand*>(m_DAPRpcSocket->addService(new DapGetListNetworksCommand("DapGetListNetworksCommand", m_DAPRpcSocket))), QString("networksListReceived")));
// The command to get a network status
m_transceivers.append(qMakePair(dynamic_cast<DapAbstractCommand*>(m_DAPRpcSocket->addService(new DapGetNetworkStatusCommand("DapGetNetworkStatusCommand", m_DAPRpcSocket))), QString("networkStatusReceived")));
// The command to change network state
m_transceivers.append(qMakePair(dynamic_cast<DapAbstractCommand*>(m_DAPRpcSocket->addService(new DapNetworkGoToCommand("DapNetworkGoToCommand", m_DAPRpcSocket))), QString("newTargetNetworkStateReceived")));
m_transceivers.append(qMakePair(dynamic_cast<DapAbstractCommand*>(m_DAPRpcSocket->addService(new DapGetWalletAddressesCommand("DapGetWalletAddressesCommand", m_DAPRpcSocket))), QString("walletAddressesReceived")));
......
......@@ -19,6 +19,7 @@
#include "handlers/DapAddWalletCommand.h"
#include "handlers/DapGetWalletsInfoCommand.h"
#include "handlers/DapGetNetworkStatusCommand.h"
#include "handlers/DapNetworkGoToCommand.h"
#include "handlers/DapGetListNetworksCommand.h"
#include "handlers/DapExportLogCommand.h"
#include "handlers/DapGetWalletAddressesCommand.h"
......@@ -112,7 +113,9 @@ public:
Q_INVOKABLE QString getCurrentChain() const;
public slots:
void requestNetworkState(QString a_networkName);
void requestNetworkStatus(QString a_networkName);
void changeNetworkStateToOnline(QString a_networkName);
void changeNetworkStateToOffline(QString a_networkName);
signals:
/// The signal is emitted when the Brand company property changes.
......@@ -147,6 +150,7 @@ signals:
void networksListReceived(const QVariant& networkList);
void networkStatusReceived(const QVariant& networkStatus);
void newTargetNetworkStateReceived(const QVariant& targetStateString);
void walletAddressesReceived(const QVariant& walletAddresses);
......
......@@ -66,6 +66,8 @@ void DapServiceController::registerCommand()
m_pServer->addService(new DapGetListNetworksCommand("DapGetListNetworksCommand", m_pServer, CLI_PATH));
// The command to get a network status
m_pServer->addService(new DapGetNetworkStatusCommand("DapGetNetworkStatusCommand", m_pServer, CLI_PATH));
// The command to get a network status
m_pServer->addService(new DapNetworkGoToCommand("DapNetworkGoToCommand", m_pServer, CLI_PATH));
// Saving the file with the logs
m_pServer->addService(new DapExportLogCommand("DapExportLogCommand", m_pServer));
......
......@@ -30,6 +30,7 @@ typedef class DapRpcLocalServer DapUiService;
#include "handlers/DapAddWalletCommand.h"
#include "handlers/DapGetListNetworksCommand.h"
#include "handlers/DapGetNetworkStatusCommand.h"
#include "handlers/DapNetworkGoToCommand.h"
#include "handlers/DapGetWalletsInfoCommand.h"
#include "handlers/DapGetWalletAddressesCommand.h"
#include "handlers/DapExportLogCommand.h"
......
Subproject commit edd63bd392ec870bea6bc7d37708b46320529c20
Subproject commit 2d2759312365ec355e82384c3fb8ccf64ca9abfa
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment