guh-control -> mea

This commit is contained in:
Michael Zanetti 2018-03-09 10:20:28 +01:00
parent c382d13e70
commit a7d9e081f0
310 changed files with 397 additions and 625 deletions

View File

@ -1,2 +1,2 @@
# guh-control
QtQuick guh client application
# mea
QtQuick nymea client application

View File

@ -1,7 +0,0 @@
TEMPLATE=subdirs
SUBDIRS = libguh-common guh-control
libguh-common.subdir = libguh-common
guh-control.subdir = guh-control
guh-control.depends = libguh-common

View File

@ -1,129 +0,0 @@
#include "connectionmanager.h"
#include <QState>
#include <QSettings>
ConnectionManager::ConnectionManager(QObject *parent) :
QObject(parent),
m_discovery(new UpnpDiscovery(this)),
m_interface(0),
m_websocketInterface(new WebsocketInterface(this)),
m_bluetoothInterface(new BluetoothInterface(this))
{
}
GuhInterface *ConnectionManager::interface()
{
return m_interface;
}
UpnpDiscovery *ConnectionManager::upnpDiscovery()
{
return m_discovery;
}
WebsocketInterface *ConnectionManager::websocketInterface()
{
return m_websocketInterface;
}
BluetoothInterface *ConnectionManager::bluetoothInterface()
{
return m_bluetoothInterface;
}
QString ConnectionManager::currentInterfaceName() const
{
return m_currentInterfaceName;
}
QString ConnectionManager::currentStatusMessage() const
{
return m_currentStatusMessage;
}
void ConnectionManager::setInterface(GuhInterface *interface)
{
if (m_interface) {
disconnect(m_interface, &GuhInterface::connectedChanged, this, &ConnectionManager::onConnectedChanged);
disconnect(m_interface, &GuhInterface::dataReady, this, &ConnectionManager::dataReady);
}
m_interface = interface;
connect(m_interface, &GuhInterface::connectedChanged, this, &ConnectionManager::onConnectedChanged);
connect(m_interface, &GuhInterface::dataReady, this, &ConnectionManager::dataReady);
emit interfaceChanged();
}
void ConnectionManager::setCurrentInterfaceName(const QString &name)
{
m_currentInterfaceName = name;
emit currentInterfaceNameChanged();
}
void ConnectionManager::setCurrentStatusMessage(const QString &message)
{
m_currentStatusMessage = message;
emit currentStatusMessageChanged();
}
void ConnectionManager::onConnectedChanged()
{
if (m_interface->connected())
emit connected();
else
emit disconnect();
emit connectedChanged();
}
void ConnectionManager::onConnectingState()
{
QSettings settings;
qDebug() << "Loading last connection" << settings.fileName();
settings.beginGroup("Connections");
QString url = settings.value("webSocketUrl").toString();
settings.endGroup();
if (url.isEmpty()) {
qDebug() << "No stored websocket url";
m_websocketInterface->connectionFailed();
}
m_websocketInterface->setUrl(url);
m_websocketInterface->enable();
}
void ConnectionManager::onUpnpDiscoveringState()
{
upnpDiscovery()->discover();
}
void ConnectionManager::start(const ConnectionType &connectionType)
{
switch (connectionType) {
case ConnectionTypeAuto:
setInterface(m_websocketInterface);
break;
case ConnectionTypeWebSocket:
setInterface(m_websocketInterface);
m_discovery->discover();
break;
case ConnectionTypeCloud:
break;
case ConnectionTypeBluetooth:
setInterface(m_bluetoothInterface);
break;
default:
setInterface(m_bluetoothInterface);
break;
}
}
void ConnectionManager::stop()
{
m_interface->disable();
}

View File

@ -1,82 +0,0 @@
#ifndef CONNECTIONMANAGER_H
#define CONNECTIONMANAGER_H
#include <QObject>
#include <QStateMachine>
#include "guhinterface.h"
#include "websocketinterface.h"
#include "bluetoothinterface.h"
#include "cloudconnection/cloudconnection.h"
#include "discovery/upnpdiscovery.h"
class ConnectionManager : public QObject
{
Q_OBJECT
Q_ENUMS(ConnectionType)
Q_PROPERTY(UpnpDiscovery *upnpDiscovery READ upnpDiscovery CONSTANT)
Q_PROPERTY(GuhInterface *interface READ interface NOTIFY interfaceChanged)
Q_PROPERTY(WebsocketInterface *websocketInterface READ websocketInterface CONSTANT)
Q_PROPERTY(BluetoothInterface *bluetoothInterface READ bluetoothInterface CONSTANT)
Q_PROPERTY(QString currentInterfaceName READ currentInterfaceName WRITE setCurrentInterfaceName NOTIFY currentInterfaceNameChanged)
Q_PROPERTY(QString currentStatusMessage READ currentStatusMessage WRITE setCurrentStatusMessage NOTIFY currentStatusMessageChanged)
public:
enum ConnectionType {
ConnectionTypeAuto,
ConnectionTypeWebSocket,
ConnectionTypeCloud,
ConnectionTypeBluetooth
};
explicit ConnectionManager(QObject *parent = 0);
GuhInterface *interface();
UpnpDiscovery *upnpDiscovery();
WebsocketInterface *websocketInterface();
BluetoothInterface *bluetoothInterface();
QString currentInterfaceName() const;
QString currentStatusMessage() const;
private:
UpnpDiscovery *m_discovery;
GuhInterface *m_interface;
WebsocketInterface *m_websocketInterface;
BluetoothInterface *m_bluetoothInterface;
QString m_currentInterfaceName;
QString m_currentStatusMessage;
void setInterface(GuhInterface *interface);
void setCurrentInterfaceName(const QString &name);
void setCurrentStatusMessage(const QString &message);
private slots:
void onConnectedChanged();
// State slots
void onConnectingState();
void onUpnpDiscoveringState();
signals:
void connectedChanged();
void dataReady(const QVariantMap &data);
void connected();
void disconnected();
void interfaceChanged();
void websocketInterfaceChanged();
void currentInterfaceNameChanged();
void currentStatusMessageChanged();
public slots:
void start(const ConnectionType &connectionType = ConnectionTypeAuto);
void stop();
};
#endif // CONNECTIONMANAGER_H

View File

@ -1,6 +1,6 @@
include(../guh-control.pri)
include(../mea.pri)
TARGET = guh-common
TARGET = nymea-common
TEMPLATE = lib
QT += network
@ -84,7 +84,7 @@ SOURCES += types/vendor.cpp \
# install header file with relative subdirectory
for(header, HEADERS) {
path = /usr/include/guh-common/$${dirname(header)}
path = /usr/include/nymea-common/$${dirname(header)}
eval(headers_$${path}.files += $${header})
eval(headers_$${path}.path = $${path})
eval(INSTALLS *= headers_$${path})

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

7
mea.pro Normal file
View File

@ -0,0 +1,7 @@
TEMPLATE=subdirs
SUBDIRS = libnymea-common mea
libnymea-common.subdir = libnymea-common
mea.subdir = mea
mea.depends = libnymea-common

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="io.guh.guhcontrol" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
<manifest package="io.guh.mea" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:icon="@drawable/icon">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop">
<intent-filter>

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -4,7 +4,7 @@
#include <QJsonParseError>
BluetoothInterface::BluetoothInterface(QObject *parent) :
GuhInterface(parent),
NymeaInterface(parent),
m_socket(0),
m_discovery(new BluetoothDiscovery(this))
{

View File

@ -4,10 +4,10 @@
#include <QObject>
#include <QBluetoothSocket>
#include "guhinterface.h"
#include "nymeainterface.h"
#include "discovery/bluetoothdiscovery.h"
class BluetoothInterface : public GuhInterface
class BluetoothInterface : public NymeaInterface
{
Q_OBJECT
Q_PROPERTY(BluetoothDiscovery *discovery READ discovery CONSTANT)

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,7 +2,7 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control *
* This file is part of mea *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *

View File

@ -2,19 +2,19 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control. *
* This file is part of mea. *
* *
* guh-control is free software: you can redistribute it and/or modify *
* mea is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, version 3 of the License. *
* *
* guh-control is distributed in the hope that it will be useful, *
* mea is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with guh-control. If not, see <http://www.gnu.org/licenses/>. *
* along with mea. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

View File

@ -2,19 +2,19 @@
* *
* Copyright (C) 2017 Simon Stuerz <simon.stuerz@guh.io> *
* *
* This file is part of guh-control. *
* This file is part of mea. *
* *
* guh-control is free software: you can redistribute it and/or modify *
* mea is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, version 3 of the License. *
* *
* guh-control is distributed in the hope that it will be useful, *
* mea is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with guh-control. If not, see <http://www.gnu.org/licenses/>. *
* along with mea. If not, see <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

Some files were not shown because too many files have changed in this diff Show More