-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Fanda Vacek
committed
Feb 25, 2024
1 parent
60cb64c
commit 53e56d5
Showing
9 changed files
with
180 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 0 additions & 46 deletions
46
quickevent/app/quickevent/plugins/Event/src/services/shvapi/dotappnode.cpp
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
quickevent/app/quickevent/plugins/Event/src/services/shvapi/dotappnode.h
This file was deleted.
Oops, something went wrong.
106 changes: 106 additions & 0 deletions
106
quickevent/app/quickevent/plugins/Event/src/services/shvapi/nodes.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#include "nodes.h" | ||
|
||
#include "../../eventplugin.h" | ||
|
||
#include <qf/qmlwidgets/framework/mainwindow.h> | ||
#include <qf/core/exception.h> | ||
#include <qf/core/log.h> | ||
|
||
#include <shv/chainpack/rpc.h> | ||
|
||
using namespace shv::chainpack; | ||
|
||
using qf::qmlwidgets::framework::getPlugin; | ||
|
||
namespace Event::services::shvapi { | ||
|
||
//========================================================= | ||
// DotAppNode | ||
//========================================================= | ||
static auto METH_NAME = "name"; | ||
|
||
const std::vector<shv::chainpack::MetaMethod> &DotAppNode::metaMethods() | ||
{ | ||
static std::vector<MetaMethod> meta_methods { | ||
{Rpc::METH_DIR, MetaMethod::Signature::RetParam, MetaMethod::Flag::None, Rpc::ROLE_BROWSE}, | ||
{Rpc::METH_LS, MetaMethod::Signature::RetParam, MetaMethod::Flag::None, Rpc::ROLE_BROWSE}, | ||
{Rpc::METH_PING, MetaMethod::Signature::RetVoid, MetaMethod::Flag::None, Rpc::ROLE_BROWSE}, | ||
{METH_NAME, MetaMethod::Signature::RetVoid, MetaMethod::Flag::IsGetter, Rpc::ROLE_BROWSE}, | ||
}; | ||
return meta_methods; | ||
} | ||
|
||
RpcValue DotAppNode::callMethod(const StringViewList &shv_path, const std::string &method, const shv::chainpack::RpcValue ¶ms, const shv::chainpack::RpcValue &user_id) | ||
{ | ||
qfLogFuncFrame() << shv_path.join('/') << method; | ||
//eyascore::utils::UserId user_id = eyascore::utils::UserId::makeUserName(QString::fromStdString(rq.userId().toMap().value("userName").toString())); | ||
if(shv_path.empty()) { | ||
if(method == Rpc::METH_PING) { | ||
return nullptr; | ||
} | ||
if(method == METH_NAME) { | ||
return "QuickEvent"; | ||
} | ||
} | ||
return Super::callMethod(shv_path, method, params, user_id); | ||
} | ||
|
||
//========================================================= | ||
// EventNode | ||
//========================================================= | ||
static auto METH_CURRENT_STAGE = "currentStage"; | ||
|
||
const std::vector<MetaMethod> &EventNode::metaMethods() | ||
{ | ||
static std::vector<MetaMethod> meta_methods { | ||
{Rpc::METH_DIR, MetaMethod::Signature::RetParam, MetaMethod::Flag::None, Rpc::ROLE_BROWSE}, | ||
{Rpc::METH_LS, MetaMethod::Signature::RetParam, MetaMethod::Flag::None, Rpc::ROLE_BROWSE}, | ||
{METH_CURRENT_STAGE, MetaMethod::Signature::RetVoid, MetaMethod::Flag::IsGetter, Rpc::ROLE_READ}, | ||
}; | ||
return meta_methods; | ||
} | ||
|
||
RpcValue EventNode::callMethod(const StringViewList &shv_path, const std::string &method, const shv::chainpack::RpcValue ¶ms, const shv::chainpack::RpcValue &user_id) | ||
{ | ||
qfLogFuncFrame() << shv_path.join('/') << method; | ||
if(shv_path.empty()) { | ||
if(method == METH_CURRENT_STAGE) { | ||
return getPlugin<EventPlugin>()->currentStageId(); | ||
} | ||
} | ||
return Super::callMethod(shv_path, method, params, user_id); | ||
} | ||
|
||
//========================================================= | ||
// StartListNode | ||
//========================================================= | ||
static auto METH_TABLE = "table"; | ||
static auto METH_RECORD = "record"; | ||
static auto METH_SET_RECORD = "setRecord"; | ||
static auto SIG_REC_CHNG = "recchng"; | ||
|
||
const std::vector<MetaMethod> &RunNode::metaMethods() | ||
{ | ||
static std::vector<MetaMethod> meta_methods { | ||
{Rpc::METH_DIR, MetaMethod::Signature::RetParam, MetaMethod::Flag::None, Rpc::ROLE_BROWSE}, | ||
{Rpc::METH_LS, MetaMethod::Signature::RetParam, MetaMethod::Flag::None, Rpc::ROLE_BROWSE}, | ||
{METH_TABLE, MetaMethod::Signature::RetVoid, MetaMethod::Flag::None, Rpc::ROLE_READ}, | ||
{METH_RECORD, MetaMethod::Signature::RetParam, MetaMethod::Flag::None, Rpc::ROLE_READ}, | ||
{METH_SET_RECORD, MetaMethod::Signature::VoidParam, MetaMethod::Flag::None, Rpc::ROLE_WRITE}, | ||
{SIG_REC_CHNG, MetaMethod::Signature::VoidParam, MetaMethod::Flag::IsSignal, Rpc::ROLE_READ}, | ||
}; | ||
return meta_methods; | ||
} | ||
|
||
RpcValue RunNode::callMethod(const StringViewList &shv_path, const std::string &method, const shv::chainpack::RpcValue ¶ms, const shv::chainpack::RpcValue &user_id) | ||
{ | ||
qfLogFuncFrame() << shv_path.join('/') << method; | ||
//eyascore::utils::UserId user_id = eyascore::utils::UserId::makeUserName(QString::fromStdString(rq.userId().toMap().value("userName").toString())); | ||
if(shv_path.empty()) { | ||
if(method == METH_TABLE) { | ||
} | ||
} | ||
return Super::callMethod(shv_path, method, params, user_id); | ||
} | ||
|
||
} |
49 changes: 49 additions & 0 deletions
49
quickevent/app/quickevent/plugins/Event/src/services/shvapi/nodes.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#pragma once | ||
|
||
#include "shvnode.h" | ||
|
||
namespace Event::services::shvapi { | ||
|
||
class DotAppNode : public shvapi::ShvNode | ||
{ | ||
Q_OBJECT | ||
|
||
using Super = shvapi::ShvNode; | ||
public: | ||
explicit DotAppNode(shv::iotqt::node::ShvNode *parent) : Super(".app", parent) {} | ||
private: | ||
//shv::chainpack::RpcValue callMethodRq(const shv::chainpack::RpcRequest &rq) override; | ||
const std::vector<shv::chainpack::MetaMethod> &metaMethods() override; | ||
shv::chainpack::RpcValue callMethod(const StringViewList &shv_path, const std::string &method, const shv::chainpack::RpcValue ¶ms, const shv::chainpack::RpcValue &user_id) override; | ||
}; | ||
|
||
class EventNode : public shvapi::ShvNode | ||
{ | ||
Q_OBJECT | ||
|
||
using Super = shvapi::ShvNode; | ||
public: | ||
explicit EventNode(shv::iotqt::node::ShvNode *parent) : Super("event", parent) {} | ||
private: | ||
const std::vector<shv::chainpack::MetaMethod> &metaMethods() override; | ||
shv::chainpack::RpcValue callMethod(const StringViewList &shv_path, const std::string &method, const shv::chainpack::RpcValue ¶ms, const shv::chainpack::RpcValue &user_id) override; | ||
}; | ||
|
||
class RunNode : public shvapi::ShvNode | ||
{ | ||
Q_OBJECT | ||
|
||
using Super = shvapi::ShvNode; | ||
public: | ||
explicit RunNode(int stage, shv::iotqt::node::ShvNode *parent) | ||
: Super("startlist", parent) | ||
, m_stage(stage) | ||
{} | ||
private: | ||
const std::vector<shv::chainpack::MetaMethod> &metaMethods() override; | ||
shv::chainpack::RpcValue callMethod(const StringViewList &shv_path, const std::string &method, const shv::chainpack::RpcValue ¶ms, const shv::chainpack::RpcValue &user_id) override; | ||
private: | ||
int m_stage; | ||
}; | ||
|
||
} |
52 changes: 0 additions & 52 deletions
52
quickevent/app/quickevent/plugins/Event/src/services/shvapi/rootnode.cpp
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
quickevent/app/quickevent/plugins/Event/src/services/shvapi/rootnode.h
This file was deleted.
Oops, something went wrong.