Hyelicht 2.0
Controller application for the Hyelicht shelf. Paint on the shelf with colors, turn on the fireplace mode, and more.
|
HTTP REST API binding and server for ShelfModel. More...
#include <httpserver.h>
Signals | |
void | enabledChanged () const |
The server has turned on or off. | |
void | listenAddressChanged () const |
The listen address for the server has changed. | |
void | portChanged () const |
The port the server listens on has changed. | |
void | modelChanged () |
The ShelfModel instance this server provides a HTTP REST API binding for has changed. | |
Public Member Functions | |
HttpServer (QObject *parent=nullptr) | |
Create a HTTP REST API server. | |
bool | enabled () const |
Whether the server is on or off. | |
void | setEnabled (bool enabled) |
Turn the server on or off. | |
QString | listenAddress () const |
The listen address for the server. | |
void | setListenAddress (const QString &listenAddress) |
Set the listen address for the server. | |
int | port () const |
The port the server listens on. | |
void | setPort (int port) |
Set the port the server listens on. | |
ShelfModel * | model () const |
The ShelfModel instance this server provides a HTTP REST API binding for. | |
void | setModel (ShelfModel *model) |
Set the ShelfModel instance this server provides a HTTP REST API binding for. | |
void | classBegin () override |
Implements the QQmlParserStatus interface. | |
void | componentComplete () override |
Implements the QQmlParserStatus interface. | |
Properties | |
bool | enabled |
Toggle the server on or off. | |
QString | listenAddress |
Listen address for the server. | |
int | port |
Port the server listens on. | |
ShelfModel * | model |
ShelfModel instance this server provides a HTTP REST API binding for. | |
HTTP REST API binding and server for ShelfModel.
Implements a read-write HTTP REST API binding and server around the data model and business logic of a ShelfModel instance.
The implementation makes use of the QHttpEngine library.
In the Hyelicht project, the HTTP REST API is used by the included hyelichtctl
CLI frontend utility and the diyHue integration plugin.
|
explicit |
Create a HTTP REST API server.
parent | Parent object |
bool HttpServer::enabled | ( | ) | const |
Whether the server is on or off.
|
signal |
The server has turned on or off.
QString HttpServer::listenAddress | ( | ) | const |
The listen address for the server.
|
signal |
The listen address for the server has changed.
ShelfModel * HttpServer::model | ( | ) | const |
The ShelfModel instance this server provides a HTTP REST API binding for.
|
signal |
The ShelfModel instance this server provides a HTTP REST API binding for has changed.
int HttpServer::port | ( | ) | const |
The port the server listens on.
|
signal |
void HttpServer::setEnabled | ( | bool | enabled | ) |
void HttpServer::setListenAddress | ( | const QString & | listenAddress | ) |
Set the listen address for the server.
listenAddress | Listen address. |
void HttpServer::setModel | ( | ShelfModel * | model | ) |
Set the ShelfModel instance this server provides a HTTP REST API binding for.
Needs to be set to a valid instance for the REST API to be available on the server.
model | ShelfModel instance. |
void HttpServer::setPort | ( | int | port | ) |
Set the port the server listens on.
port | Port number. |
|
readwrite |
Toggle the server on or off.
Defaults to false
.
|
readwrite |
Listen address for the server.
Defaults to 127.0.0.1
.
|
readwrite |
ShelfModel instance this server provides a HTTP REST API binding for.
Needs to be set to a valid instance for the REST API to be available on the server.
Defaults to nullptr
.
|
readwrite |