JsonCpp to QTJson (Part 4) (#266)

* Update ActiveEffectDefinition.h

* Update EffectDefinition.h

* Update EffectEngine.h

* Update Hyperion.h

* Update LedDevice.h

* Update QJsonFactory.h

* Update QJsonSchemaChecker.h

* Update Effect.cpp

* Update Effect.h

* Update EffectEngine.cpp

* Update Hyperion.cpp

* Update JsonClientConnection.cpp

* Update JsonClientConnection.h

* Update schema-config.json

* Update LedDevice.cpp

* Update QJsonSchemaChecker.cpp

* Update hyperion-remote.cpp

* Update JsonConnection.cpp

* Update JsonConnection.h

* Update hyperiond.cpp
This commit is contained in:
Paulchen Panther
2016-10-09 22:22:17 +02:00
committed by redPanther
parent 0a142b0e7d
commit d9c2a2d91a
20 changed files with 660 additions and 468 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -7,14 +7,11 @@
#include <QByteArray>
#include <QTcpSocket>
// jsoncpp includes
#include <json/json.h>
// Hyperion includes
#include <hyperion/Hyperion.h>
// util includes
#include <utils/jsonschema/JsonSchemaChecker.h>
#include <utils/jsonschema/QJsonSchemaChecker.h>
#include <utils/Logger.h>
#include <utils/Components.h>
@@ -69,113 +66,113 @@ private:
///
/// @param message the incoming message as string
///
void handleMessage(const std::string & message);
void handleMessage(const QString & message);
///
/// Handle an incoming JSON Color message
///
/// @param message the incoming message
///
void handleColorCommand(const Json::Value & message, const std::string &command, const int tan);
void handleColorCommand(const QJsonObject & message, const QString &command, const int tan);
///
/// Handle an incoming JSON Image message
///
/// @param message the incoming message
///
void handleImageCommand(const Json::Value & message, const std::string &command, const int tan);
void handleImageCommand(const QJsonObject & message, const QString &command, const int tan);
///
/// Handle an incoming JSON Effect message
///
/// @param message the incoming message
///
void handleEffectCommand(const Json::Value & message, const std::string &command, const int tan);
void handleEffectCommand(const QJsonObject & message, const QString &command, const int tan);
///
/// Handle an incoming JSON Server info message
///
/// @param message the incoming message
///
void handleServerInfoCommand(const Json::Value & message, const std::string &command, const int tan);
void handleServerInfoCommand(const QJsonObject & message, const QString &command, const int tan);
///
/// Handle an incoming JSON Clear message
///
/// @param message the incoming message
///
void handleClearCommand(const Json::Value & message, const std::string &command, const int tan);
void handleClearCommand(const QJsonObject & message, const QString &command, const int tan);
///
/// Handle an incoming JSON Clearall message
///
/// @param message the incoming message
///
void handleClearallCommand(const Json::Value & message, const std::string &command, const int tan);
void handleClearallCommand(const QJsonObject & message, const QString &command, const int tan);
///
/// Handle an incoming JSON Transform message
///
/// @param message the incoming message
///
void handleTransformCommand(const Json::Value & message, const std::string &command, const int tan);
void handleTransformCommand(const QJsonObject & message, const QString &command, const int tan);
///
/// Handle an incoming JSON Temperature message
///
/// @param message the incoming message
///
void handleTemperatureCommand(const Json::Value & message, const std::string &command, const int tan);
void handleTemperatureCommand(const QJsonObject & message, const QString &command, const int tan);
///
/// Handle an incoming JSON Adjustment message
///
/// @param message the incoming message
///
void handleAdjustmentCommand(const Json::Value & message, const std::string &command, const int tan);
void handleAdjustmentCommand(const QJsonObject & message, const QString &command, const int tan);
///
/// Handle an incoming JSON SourceSelect message
///
/// @param message the incoming message
///
void handleSourceSelectCommand(const Json::Value & message, const std::string &command, const int tan);
void handleSourceSelectCommand(const QJsonObject & message, const QString &command, const int tan);
/// Handle an incoming JSON GetConfig message
///
/// @param message the incoming message
///
void handleConfigCommand(const Json::Value & message, const std::string &command, const int tan);
void handleConfigCommand(const QJsonObject & message, const QString &command, const int tan);
/// Handle an incoming JSON GetConfig message
///
/// @param message the incoming message
///
void handleSchemaGetCommand(const Json::Value & message, const std::string &command, const int tan);
void handleSchemaGetCommand(const QJsonObject & message, const QString &command, const int tan);
/// Handle an incoming JSON GetConfig message
///
/// @param message the incoming message
///
void handleConfigGetCommand(const Json::Value & message, const std::string &command, const int tan);
void handleConfigGetCommand(const QJsonObject & message, const QString &command, const int tan);
///
/// Handle an incoming JSON SetConfig message
///
void handleConfigSetCommand(const Json::Value & message, const std::string &command, const int tan);
void handleConfigSetCommand(const QJsonObject & message, const QString &command, const int tan);
///
/// Handle an incoming JSON Component State message
///
/// @param message the incoming message
///
void handleComponentStateCommand(const Json::Value & message, const std::string &command, const int tan);
void handleComponentStateCommand(const QJsonObject & message, const QString &command, const int tan);
/// Handle an incoming JSON Led Colors message
///
/// @param message the incoming message
///
void handleLedColorsCommand(const Json::Value & message, const std::string &command, const int tan);
void handleLedColorsCommand(const QJsonObject & message, const QString &command, const int tan);
///
/// Handle an incoming JSON message of unknown type
@@ -187,20 +184,20 @@ private:
///
/// @param message The JSON message to send
///
void sendMessage(const Json::Value & message);
void sendMessage(const Json::Value & message, QTcpSocket * socket);
void sendMessage(const QJsonObject & message);
void sendMessage(const QJsonObject & message, QTcpSocket * socket);
///
/// Send a standard reply indicating success
///
void sendSuccessReply(const std::string &command="", const int tan=0);
void sendSuccessReply(const QString &command="", const int tan=0);
///
/// Send an error message back to the client
///
/// @param error String describing the error
///
void sendErrorReply(const std::string & error, const std::string &command="", const int tan=0);
void sendErrorReply(const QString & error, const QString &command="", const int tan=0);
///
/// Do handshake for a websocket connection
@@ -215,7 +212,7 @@ private:
///
/// forward json message
///
void forwardJsonMessage(const Json::Value & message);
void forwardJsonMessage(const QJsonObject & message);
private:
///
@@ -228,7 +225,7 @@ private:
///
/// @return true if message conforms the given JSON schema
///
bool checkJson(const Json::Value & message, const QString &schemaResource, std::string & errors, bool ignoreRequired = false);
bool checkJson(const QJsonObject & message, const QString &schemaResource, QString & errors, bool ignoreRequired = false);
/// The TCP-Socket that is connected tot the Json-client
QTcpSocket * _socket;
@@ -254,6 +251,6 @@ private:
///
QTimer _timer_ledcolors;
Json::Value _streaming_leds_reply;
QJsonObject _streaming_leds_reply;
};

View File

@@ -17,12 +17,6 @@
},
"config": {
"type" : "object"
},
"create": {
"type" : "boolean"
},
"overwrite": {
"type" : "boolean"
}
},
"additionalProperties": false