2013-08-11 21:49:11 +02:00
|
|
|
#pragma once
|
|
|
|
|
2013-08-13 20:10:19 +02:00
|
|
|
// stl includes
|
2013-08-11 21:49:11 +02:00
|
|
|
#include <string>
|
|
|
|
|
2013-08-13 20:10:19 +02:00
|
|
|
// Qt includes
|
2013-08-11 21:49:11 +02:00
|
|
|
#include <QColor>
|
|
|
|
#include <QImage>
|
2013-08-13 19:31:56 +02:00
|
|
|
#include <QTcpSocket>
|
2013-08-11 21:49:11 +02:00
|
|
|
|
2013-08-13 20:10:19 +02:00
|
|
|
// jsoncpp includes
|
2013-08-11 21:49:11 +02:00
|
|
|
#include <json/json.h>
|
|
|
|
|
2013-08-13 20:10:19 +02:00
|
|
|
// hyperion-remote includes
|
2013-08-13 19:45:17 +02:00
|
|
|
#include "ColorTransformValues.h"
|
2013-08-13 19:31:56 +02:00
|
|
|
|
2013-08-13 20:10:19 +02:00
|
|
|
/// Connection class to setup an connection to the hyperion server and execute commands
|
2013-08-11 21:49:11 +02:00
|
|
|
class Connection
|
|
|
|
{
|
|
|
|
public:
|
2013-08-13 20:10:19 +02:00
|
|
|
Connection(const std::string & address, bool printJson);
|
|
|
|
~Connection();
|
2013-08-11 21:49:11 +02:00
|
|
|
|
2013-08-13 20:10:19 +02:00
|
|
|
/// Set all leds to the specified color
|
|
|
|
bool setColor(QColor color, int priority, int duration);
|
|
|
|
|
|
|
|
/// Set the leds according to the given image (assume the image is stretched to the display size)
|
|
|
|
bool setImage(QImage image, int priority, int duration);
|
|
|
|
|
|
|
|
/// Retrieve a list of all occupied priority channels
|
|
|
|
bool listPriorities();
|
|
|
|
|
|
|
|
/// Clear the given priority channel
|
|
|
|
bool clear(int priority);
|
|
|
|
|
|
|
|
/// Clear all priority channels
|
|
|
|
bool clearAll();
|
|
|
|
|
|
|
|
/// Set the color transform of the leds
|
|
|
|
/// Note that providing a NULL will leave the settings on the server unchanged
|
|
|
|
bool setTransform(ColorTransformValues * threshold, ColorTransformValues * gamma, ColorTransformValues * blacklevel, ColorTransformValues * whitelevel);
|
2013-08-11 21:49:11 +02:00
|
|
|
|
|
|
|
private:
|
2013-08-13 20:10:19 +02:00
|
|
|
/// Send a json command message and receive its reply
|
|
|
|
Json::Value sendMessage(const Json::Value & message);
|
2013-08-11 21:49:11 +02:00
|
|
|
|
|
|
|
private:
|
2013-08-13 20:10:19 +02:00
|
|
|
bool _printJson;
|
2013-08-13 19:31:56 +02:00
|
|
|
|
2013-08-13 20:10:19 +02:00
|
|
|
QTcpSocket _socket;
|
2013-08-11 21:49:11 +02:00
|
|
|
};
|