Add websocket server
This commit is contained in:
parent
59b55d1868
commit
3e0ba165e8
3 changed files with 11 additions and 2 deletions
|
|
@ -72,13 +72,15 @@ PrimaryMainObject::PrimaryMainObject(QIODevice* microDevice, const QString& sett
|
|||
MainObject(parent),
|
||||
settingsPath(settingsPath),
|
||||
micro(microDevice),
|
||||
tcpServer(new TcpServer),
|
||||
tcpServer(new TcpServer(this)),
|
||||
webServer(new WebSocketServer("shinterface", this)),
|
||||
sunSensorSource(49.824972, 8.702194),
|
||||
fixedItems(µ)
|
||||
{
|
||||
//connect sensors subsystem
|
||||
connect(&globalSensors, &SensorStore::sensorChangedState, tcpServer, &TcpServer::sensorEvent);
|
||||
connect(tcpServer, &TcpServer::gotSensor, &globalSensors, &SensorStore::sensorGotState);
|
||||
connect(webServer, &WebSocketServer::gotSensor, &globalSensors, &SensorStore::sensorGotState);
|
||||
connect(&sunSensorSource, &SunSensorSource::stateChanged, &globalSensors, &SensorStore::sensorGotState);
|
||||
connect(µ, &Microcontroller::gotSensorState, &globalSensors, &SensorStore::sensorGotState);
|
||||
connect(&mqttSensorSource, &MqttSensorSource::stateChanged, &globalSensors, &SensorStore::sensorGotState);
|
||||
|
|
@ -98,7 +100,9 @@ PrimaryMainObject::PrimaryMainObject(QIODevice* microDevice, const QString& sett
|
|||
mqttSensorSource.start(mqttJson);
|
||||
|
||||
tcpServer->launch(QHostAddress(host), port);
|
||||
webServer->launch(QHostAddress(host), port+1);
|
||||
connect(&globalItems, &ItemStore::itemUpdated, tcpServer, &TcpServer::itemUpdated);
|
||||
connect(&globalItems, &ItemStore::itemUpdated, webServer, &WebSocketServer::itemUpdated);
|
||||
}
|
||||
|
||||
PrimaryMainObject::~PrimaryMainObject()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue