This class represents an interface for developing a handler for the JSON-RPC API. More...
Header: | #include <JsonHandler> |
Inherits: | |
Inherited By: | nymeaserver::ActionHandler, nymeaserver::ConfigurationHandler, nymeaserver::DeviceHandler, nymeaserver::EventHandler, nymeaserver::JsonRPCServer, nymeaserver::LoggingHandler, nymeaserver::NetworkManagerHandler, nymeaserver::RulesHandler, and nymeaserver::StateHandler |
JsonHandler(QObject * parent = nullptr) | |
bool | hasMethod(const QString & methodName) |
QVariantMap | introspect(QMetaMethod::MethodType type) |
virtual QString | name() const = 0 |
QPair<bool, QString> | validateParams(const QString & methodName, const QVariantMap & params) |
QPair<bool, QString> | validateReturns(const QString & methodName, const QVariantMap & returns) |
void | asyncReply(int id, const QVariantMap & params) |
JsonReply * | createAsyncReply(const QString & method) const |
JsonReply * | createReply(const QVariantMap & data) const |
void | setDescription(const QString & methodName, const QString & description) |
void | setParams(const QString & methodName, const QVariantMap & params) |
void | setReturns(const QString & methodName, const QVariantMap & returns) |
QVariantMap | statusToReply(DeviceManager::DeviceError status) const |
QVariantMap | statusToReply(RuleEngine::RuleError status) const |
QVariantMap | statusToReply(Logging::LoggingError status) const |
QVariantMap | statusToReply(NymeaConfiguration::ConfigurationError status) const |
QVariantMap | statusToReply(NetworkManager::NetworkManagerError status) const |
QVariantMap | statusToReply(TagsStorage::TagError status) const |
This class represents an interface for developing a handler for the JSON-RPC API.
See also JsonRPCServer and JsonReply.
Constructs a new JsonHandler with the given parent.
[signal]
void JsonHandler::asyncReply(int id, const QVariantMap & params)This signal will be emitted when a reply with the given id and params is finished.
[protected]
JsonReply * JsonHandler::createAsyncReply(const QString & method) constReturns the pointer to an asynchronous new JsonReply with the given method.
[protected]
JsonReply * JsonHandler::createReply(const QVariantMap & data) constReturns the pointer to a new JsonReply with the given data.
Returns true if this JsonHandler has a method with the given methodName.
Returns a map with all supported methods, notifications and types for the given meta type.
[pure virtual]
QString JsonHandler::name() constPure virtual method for a JSON RPC handler. Returns the namespace of the handler.
[protected]
void JsonHandler::setDescription(const QString & methodName, const QString & description)Sets the description of the method with the given methodName.
[protected]
void JsonHandler::setParams(const QString & methodName, const QVariantMap & params)Sets the params of the method with the given methodName.
[protected]
void JsonHandler::setReturns(const QString & methodName, const QVariantMap & returns)Sets the returns of the method with the given methodName.
[protected]
QVariantMap JsonHandler::statusToReply(DeviceManager::DeviceError status) constReturns the formated error map for the given status.
See also DeviceManager::DeviceError.
[protected]
QVariantMap JsonHandler::statusToReply(RuleEngine::RuleError status) constReturns the formated error map for the given status.
See also RuleEngine::RuleError.
[protected]
QVariantMap JsonHandler::statusToReply(Logging::LoggingError status) constReturns the formated error map for the given status.
See also Logging::LoggingError.
[protected]
QVariantMap JsonHandler::statusToReply(NymeaConfiguration::ConfigurationError status) constReturns the formated error map for the given status.
[protected]
QVariantMap JsonHandler::statusToReply(NetworkManager::NetworkManagerError status) constReturns the formated error map for the given status.
[protected]
QVariantMap JsonHandler::statusToReply(TagsStorage::TagError status) constReturns the formated error map for the given status.
Validates the given params for the given methodName. Returns the error string and false if the params are not valid.
Validates the given returns for the given methodName. Returns the error string and false if the params are not valid.