mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Doxygen comments added
This commit is contained in:
parent
1a2dd19a7b
commit
3187fc84a6
@ -12,25 +12,48 @@
|
|||||||
|
|
||||||
class JsonClientConnection;
|
class JsonClientConnection;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// This class creates a TCP server which accepts connections wich can then send
|
||||||
|
/// in JSON encoded commands. This interface to Hyperion is used by hyperion-remote
|
||||||
|
/// to control the leds
|
||||||
|
///
|
||||||
class JsonServer : public QObject
|
class JsonServer : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
///
|
||||||
|
/// \brief JsonServer constructor
|
||||||
|
/// \param hyperion Hyperion instance
|
||||||
|
/// \param port port number on which to start listening for connections
|
||||||
|
///
|
||||||
JsonServer(Hyperion * hyperion, uint16_t port = 19444);
|
JsonServer(Hyperion * hyperion, uint16_t port = 19444);
|
||||||
~JsonServer();
|
~JsonServer();
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \return the port number on which this TCP listens for incoming connections
|
||||||
|
///
|
||||||
uint16_t getPort() const;
|
uint16_t getPort() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
///
|
||||||
|
/// \brief Slot which is called when a client tries to create a new connection
|
||||||
|
///
|
||||||
void newConnection();
|
void newConnection();
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Slot which is called when a client closes a connection
|
||||||
|
/// \param The Connection object which is being closed
|
||||||
|
///
|
||||||
void closedConnection(JsonClientConnection * connection);
|
void closedConnection(JsonClientConnection * connection);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/// Hyperion instance
|
||||||
Hyperion * _hyperion;
|
Hyperion * _hyperion;
|
||||||
|
|
||||||
|
/// The TCP server object
|
||||||
QTcpServer _server;
|
QTcpServer _server;
|
||||||
|
|
||||||
|
/// List with open connections
|
||||||
QSet<JsonClientConnection *> _openConnections;
|
QSet<JsonClientConnection *> _openConnections;
|
||||||
};
|
};
|
||||||
|
@ -15,29 +15,53 @@
|
|||||||
class ColorTransform
|
class ColorTransform
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/// @brief Default constructor
|
||||||
ColorTransform();
|
ColorTransform();
|
||||||
|
|
||||||
|
/// @brief Constructor
|
||||||
|
/// @param threshold
|
||||||
|
/// @param gamma
|
||||||
|
/// @param blacklevel
|
||||||
|
/// @param whitelevel
|
||||||
ColorTransform(double threshold, double gamma, double blacklevel, double whitelevel);
|
ColorTransform(double threshold, double gamma, double blacklevel, double whitelevel);
|
||||||
|
|
||||||
|
/// @brief Destructor
|
||||||
~ColorTransform();
|
~ColorTransform();
|
||||||
|
|
||||||
|
/// @return The current threshold value
|
||||||
double getThreshold() const;
|
double getThreshold() const;
|
||||||
|
|
||||||
|
/// @param threshold New threshold value
|
||||||
void setThreshold(double threshold);
|
void setThreshold(double threshold);
|
||||||
|
|
||||||
|
/// @return The current gamma value
|
||||||
double getGamma() const;
|
double getGamma() const;
|
||||||
|
|
||||||
|
/// @param gamma New gamma value
|
||||||
void setGamma(double gamma);
|
void setGamma(double gamma);
|
||||||
|
|
||||||
|
/// @return The current blacklevel value
|
||||||
double getBlacklevel() const;
|
double getBlacklevel() const;
|
||||||
|
|
||||||
|
/// @param blacklevel New blacklevel value
|
||||||
void setBlacklevel(double blacklevel);
|
void setBlacklevel(double blacklevel);
|
||||||
|
|
||||||
|
/// @return The current whitelevel value
|
||||||
double getWhitelevel() const;
|
double getWhitelevel() const;
|
||||||
|
|
||||||
|
/// @param whitelevel New whitelevel value
|
||||||
void setWhitelevel(double whitelevel);
|
void setWhitelevel(double whitelevel);
|
||||||
|
|
||||||
/// get the transformed value for the given byte value
|
/// @brief Transform the given byte value
|
||||||
|
/// @param input The input color byte
|
||||||
|
/// @return The transformed byte value
|
||||||
uint8_t transform(uint8_t input) const
|
uint8_t transform(uint8_t input) const
|
||||||
{
|
{
|
||||||
return _mapping[input];
|
return _mapping[input];
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/// @brief (re)-initilize the color mapping
|
||||||
void initializeMapping();
|
void initializeMapping();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -3,19 +3,40 @@
|
|||||||
// STL includes
|
// STL includes
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
///
|
||||||
|
/// \brief Color transformation to adjust the saturation and value of a RGB color value
|
||||||
|
///
|
||||||
class HsvTransform
|
class HsvTransform
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/// Default constructor
|
||||||
HsvTransform();
|
HsvTransform();
|
||||||
|
|
||||||
|
/// @brief Constructor
|
||||||
|
/// @param saturationGain
|
||||||
|
/// @param valueGain
|
||||||
HsvTransform(double saturationGain, double valueGain);
|
HsvTransform(double saturationGain, double valueGain);
|
||||||
|
|
||||||
|
/// Destructor
|
||||||
~HsvTransform();
|
~HsvTransform();
|
||||||
|
|
||||||
|
/// @param saturationGain New saturationGain
|
||||||
void setSaturationGain(double saturationGain);
|
void setSaturationGain(double saturationGain);
|
||||||
|
|
||||||
|
/// @return The current Saturation gain
|
||||||
double getSaturationGain() const;
|
double getSaturationGain() const;
|
||||||
|
|
||||||
|
/// @param valueGain New Value gain
|
||||||
void setValueGain(double valueGain);
|
void setValueGain(double valueGain);
|
||||||
|
|
||||||
|
/// @return The current value gain
|
||||||
double getValueGain() const;
|
double getValueGain() const;
|
||||||
|
|
||||||
|
/// @brief Apply the transform the the given RGB values.
|
||||||
|
/// @param red The red color component
|
||||||
|
/// @param green The green color component
|
||||||
|
/// @param blue The blue color component
|
||||||
|
/// @note The values are updated in place.
|
||||||
void transform(uint8_t & red, uint8_t & green, uint8_t & blue) const;
|
void transform(uint8_t & red, uint8_t & green, uint8_t & blue) const;
|
||||||
|
|
||||||
/// integer version of the conversion are faster, but a little less accurate
|
/// integer version of the conversion are faster, but a little less accurate
|
||||||
|
@ -7,30 +7,47 @@
|
|||||||
// jsoncpp includes
|
// jsoncpp includes
|
||||||
#include <json/json.h>
|
#include <json/json.h>
|
||||||
|
|
||||||
/**
|
|
||||||
* JsonSchemaChecker is a very basic implementation of json schema.
|
/// JsonSchemaChecker is a very basic implementation of json schema.
|
||||||
* The json schema definition draft can be found at
|
/// The json schema definition draft can be found at
|
||||||
* http://tools.ietf.org/html/draft-zyp-json-schema-03
|
/// http://tools.ietf.org/html/draft-zyp-json-schema-03
|
||||||
*
|
///
|
||||||
* The following keywords are supported:
|
/// The following keywords are supported:
|
||||||
* - type
|
/// - type
|
||||||
* - required
|
/// - required
|
||||||
* - properties
|
/// - properties
|
||||||
* - items
|
/// - items
|
||||||
* - enum
|
/// - enum
|
||||||
* - minimum
|
/// - minimum
|
||||||
* - maximum
|
/// - maximum
|
||||||
*/
|
/// - addtionalProperties
|
||||||
|
/// - minItems
|
||||||
|
/// - maxItems
|
||||||
|
///
|
||||||
|
/// And the non-standard:
|
||||||
|
/// - dependencies
|
||||||
class JsonSchemaChecker
|
class JsonSchemaChecker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
JsonSchemaChecker();
|
JsonSchemaChecker();
|
||||||
virtual ~JsonSchemaChecker();
|
virtual ~JsonSchemaChecker();
|
||||||
|
|
||||||
|
///
|
||||||
|
/// @param The schema to use
|
||||||
|
/// @return true upon succes
|
||||||
|
///
|
||||||
bool setSchema(const Json::Value & schema);
|
bool setSchema(const Json::Value & schema);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// @brief Validate a JSON structure
|
||||||
|
/// @param The JSON value to check
|
||||||
|
/// @return true when the arguments is valid according to the schema
|
||||||
|
///
|
||||||
bool validate(const Json::Value & value);
|
bool validate(const Json::Value & value);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// @return A list of error messages
|
||||||
|
///
|
||||||
const std::list<std::string> & getMessages() const;
|
const std::list<std::string> & getMessages() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
// Hyperion includes
|
// Hyperion includes
|
||||||
#include <hyperion/Hyperion.h>
|
#include <hyperion/Hyperion.h>
|
||||||
|
|
||||||
/// Check if XBMC is playing something. When it does not, this class will send all black data Hyperion to
|
/// This class will check if XBMC is playing something. When it does not, this class will send all black data to Hyperion.
|
||||||
/// override (grabbed) data with a lower priority
|
/// This allows grabbed screen data to be overriden while in the XBMC menus.
|
||||||
///
|
///
|
||||||
/// Note: The json TCP server needs to be enabled manually in XBMC in System/Settings/Network/Services
|
/// Note: The json TCP server needs to be enabled manually in XBMC in System/Settings/Network/Services
|
||||||
class XBMCVideoChecker : public QObject
|
class XBMCVideoChecker : public QObject
|
||||||
@ -23,13 +23,22 @@ class XBMCVideoChecker : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/// @Constructor
|
||||||
|
/// @param address Netwrok address of the XBMC instance
|
||||||
|
/// @param port Port number to use (XBMC default = 9090)
|
||||||
|
/// @param interval The interval at which XBMC is polled
|
||||||
|
/// @param hyperion The Hyperion instance
|
||||||
|
/// @param priority The priority at which to send the all black data
|
||||||
XBMCVideoChecker(const std::string & address, uint16_t port, uint64_t interval, Hyperion * hyperion, int priority);
|
XBMCVideoChecker(const std::string & address, uint16_t port, uint64_t interval, Hyperion * hyperion, int priority);
|
||||||
|
|
||||||
|
/// \brief Start polling XBMC
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
/// \brief Send a request to XBMC
|
||||||
void sendRequest();
|
void sendRequest();
|
||||||
|
|
||||||
|
/// @brief receive a reply from XBMC
|
||||||
void receiveReply();
|
void receiveReply();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -18,36 +18,83 @@
|
|||||||
|
|
||||||
class ImageProcessor;
|
class ImageProcessor;
|
||||||
|
|
||||||
|
/// @brief The Connection object created by \a JsonServer when a new connection is establshed
|
||||||
|
///
|
||||||
class JsonClientConnection : public QObject
|
class JsonClientConnection : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/// @brief Constructor
|
||||||
|
/// @param socket The Socket object for this connection
|
||||||
|
/// @param hyperion The Hyperion server
|
||||||
JsonClientConnection(QTcpSocket * socket, Hyperion * hyperion);
|
JsonClientConnection(QTcpSocket * socket, Hyperion * hyperion);
|
||||||
|
|
||||||
|
/// @brief Destructor
|
||||||
~JsonClientConnection();
|
~JsonClientConnection();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
/// @brief Signal which is emitted when the connection is being closed
|
||||||
|
/// @param connection This connection object
|
||||||
void connectionClosed(JsonClientConnection * connection);
|
void connectionClosed(JsonClientConnection * connection);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
/// @brief Slot called when new data has arrived
|
||||||
void readData();
|
void readData();
|
||||||
|
|
||||||
|
/// @brief Slot called when this connection is being closed
|
||||||
void socketClosed();
|
void socketClosed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/// @brief Handle an incoming JSON message
|
||||||
|
/// @param message the incoming message as string
|
||||||
void handleMessage(const std::string & message);
|
void handleMessage(const std::string & message);
|
||||||
|
|
||||||
|
/// @brief Handle an incoming JSON Color message
|
||||||
|
/// @param message the incoming message
|
||||||
void handleColorCommand(const Json::Value & message);
|
void handleColorCommand(const Json::Value & message);
|
||||||
|
|
||||||
|
/// @brief Handle an incoming JSON Image message
|
||||||
|
/// @param message the incoming message
|
||||||
void handleImageCommand(const Json::Value & message);
|
void handleImageCommand(const Json::Value & message);
|
||||||
|
|
||||||
|
/// @brief Handle an incoming JSON Server info message
|
||||||
|
/// @param message the incoming message
|
||||||
void handleServerInfoCommand(const Json::Value & message);
|
void handleServerInfoCommand(const Json::Value & message);
|
||||||
|
|
||||||
|
/// @brief Handle an incoming JSON Clear message
|
||||||
|
/// @param message the incoming message
|
||||||
void handleClearCommand(const Json::Value & message);
|
void handleClearCommand(const Json::Value & message);
|
||||||
|
|
||||||
|
/// @brief Handle an incoming JSON Clearall message
|
||||||
|
/// @param message the incoming message
|
||||||
void handleClearallCommand(const Json::Value & message);
|
void handleClearallCommand(const Json::Value & message);
|
||||||
|
|
||||||
|
/// @brief Handle an incoming JSON Transform message
|
||||||
|
/// @param message the incoming message
|
||||||
void handleTransformCommand(const Json::Value & message);
|
void handleTransformCommand(const Json::Value & message);
|
||||||
|
|
||||||
|
/// @brief Handle an incoming JSON message of unknown type
|
||||||
|
/// @param message the incoming message
|
||||||
void handleNotImplemented();
|
void handleNotImplemented();
|
||||||
|
|
||||||
|
/// @brief Send a message to the connected client
|
||||||
|
/// @param message The JSON message to send
|
||||||
void sendMessage(const Json::Value & message);
|
void sendMessage(const Json::Value & message);
|
||||||
|
|
||||||
|
/// @brief Send a standard reply indicating success
|
||||||
void sendSuccessReply();
|
void sendSuccessReply();
|
||||||
|
|
||||||
|
/// @brief Send an error message back to the client
|
||||||
|
/// @param error String describing the error
|
||||||
void sendErrorReply(const std::string & error);
|
void sendErrorReply(const std::string & error);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/// @brief Check if a JSON messag is valid according to a given JSON schema
|
||||||
|
/// @param message JSON message which need to be checked
|
||||||
|
/// @param schemaResource Qt esource identifier with the JSON schema
|
||||||
|
/// @param errors Output error message
|
||||||
|
/// @return true if message conforms the given JSON schema
|
||||||
bool checkJson(const Json::Value & message, const QString &schemaResource, std::string & errors);
|
bool checkJson(const Json::Value & message, const QString &schemaResource, std::string & errors);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -10,11 +10,14 @@
|
|||||||
// hyperion-remote includes
|
// hyperion-remote includes
|
||||||
#include "ColorTransformValues.h"
|
#include "ColorTransformValues.h"
|
||||||
|
|
||||||
|
/// Data parameter for a color
|
||||||
typedef vlofgren::PODParameter<QColor> ColorParameter;
|
typedef vlofgren::PODParameter<QColor> ColorParameter;
|
||||||
typedef vlofgren::PODParameter<QImage> ImageParameter;
|
|
||||||
typedef vlofgren::PODParameter<ColorTransformValues> TransformParameter;
|
|
||||||
|
|
||||||
|
/// Data parameter for an image
|
||||||
|
typedef vlofgren::PODParameter<QImage> ImageParameter;
|
||||||
|
|
||||||
|
/// Data parameter for color transform values (list of three values)
|
||||||
|
typedef vlofgren::PODParameter<ColorTransformValues> TransformParameter;
|
||||||
|
|
||||||
namespace vlofgren {
|
namespace vlofgren {
|
||||||
template<>
|
template<>
|
||||||
|
@ -19,26 +19,44 @@
|
|||||||
class JsonConnection
|
class JsonConnection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/// @brief COnstructor
|
||||||
|
/// @param address The address of the Hyperion server (for example "192.168.0.32:19444)
|
||||||
|
/// @param printJson Boolean indicating if the sent and received json is written to stdout
|
||||||
JsonConnection(const std::string & address, bool printJson);
|
JsonConnection(const std::string & address, bool printJson);
|
||||||
|
|
||||||
|
/// @brief Destructor
|
||||||
~JsonConnection();
|
~JsonConnection();
|
||||||
|
|
||||||
/// Set all leds to the specified color
|
/// @brief Set all leds to the specified color
|
||||||
|
/// @param color The color
|
||||||
|
/// @param priority The priority
|
||||||
|
/// @param duration The duration in milliseconds
|
||||||
void setColor(QColor color, int priority, int duration);
|
void setColor(QColor color, int priority, int duration);
|
||||||
|
|
||||||
/// Set the leds according to the given image (assume the image is stretched to the display size)
|
/// @brief Set the leds according to the given image (assume the image is stretched to the display size)
|
||||||
|
/// @param image The image
|
||||||
|
/// @param priority The priority
|
||||||
|
/// @param duration The duration in milliseconds
|
||||||
void setImage(QImage image, int priority, int duration);
|
void setImage(QImage image, int priority, int duration);
|
||||||
|
|
||||||
/// Retrieve a list of all occupied priority channels
|
/// @brief Retrieve a list of all occupied priority channels
|
||||||
|
/// @return String with the server info
|
||||||
QString getServerInfo();
|
QString getServerInfo();
|
||||||
|
|
||||||
/// Clear the given priority channel
|
/// @brief Clear the given priority channel
|
||||||
|
/// @param priority The priority
|
||||||
void clear(int priority);
|
void clear(int priority);
|
||||||
|
|
||||||
/// Clear all priority channels
|
/// @brief Clear all priority channels
|
||||||
void clearAll();
|
void clearAll();
|
||||||
|
|
||||||
/// Set the color transform of the leds
|
/// @brief Set the color transform of the leds
|
||||||
/// Note that providing a NULL will leave the settings on the server unchanged
|
/// @note Note that providing a NULL will leave the settings on the server unchanged
|
||||||
|
/// @param saturation The HSV saturation gain
|
||||||
|
/// @param value The HSV value gain
|
||||||
|
/// @param threshold The threshold
|
||||||
|
/// @param blacklevel The blacklevel
|
||||||
|
/// @param whitelevel The whitelevel
|
||||||
void setTransform(
|
void setTransform(
|
||||||
double * saturation,
|
double * saturation,
|
||||||
double * value,
|
double * value,
|
||||||
@ -48,9 +66,14 @@ public:
|
|||||||
ColorTransformValues * whitelevel);
|
ColorTransformValues * whitelevel);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Send a json command message and receive its reply
|
/// @brief Send a json command message and receive its reply
|
||||||
|
/// @param message The message to send
|
||||||
|
/// @return The returned reply
|
||||||
Json::Value sendMessage(const Json::Value & message);
|
Json::Value sendMessage(const Json::Value & message);
|
||||||
|
|
||||||
|
/// @brief Parse a reply message
|
||||||
|
/// @param reply The received reply
|
||||||
|
/// @return true if the reply indicates success
|
||||||
bool parseReply(const Json::Value & reply);
|
bool parseReply(const Json::Value & reply);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user