diff options
-rw-r--r-- | bluetooth/bluetooth.cpp | 15 | ||||
-rw-r--r-- | bluetooth/bluetooth.h | 12 | ||||
-rw-r--r-- | hvac/hvac.cpp | 8 | ||||
-rw-r--r-- | hvac/hvac.h | 6 | ||||
-rw-r--r-- | map/map.cpp | 12 | ||||
-rw-r--r-- | map/map.h | 8 | ||||
-rw-r--r-- | mediaplayer/mediaplayer.cpp | 12 | ||||
-rw-r--r-- | mediaplayer/mediaplayer.h | 10 | ||||
-rw-r--r-- | message.h | 5 | ||||
-rw-r--r-- | messageengine.cpp | 32 | ||||
-rw-r--r-- | navigation/navigation.cpp | 11 | ||||
-rw-r--r-- | navigation/navigation.h | 10 | ||||
-rw-r--r-- | network/network.cpp | 12 | ||||
-rw-r--r-- | network/network.h | 13 | ||||
-rw-r--r-- | pbap/pbap.cpp | 12 | ||||
-rw-r--r-- | pbap/pbap.h | 8 | ||||
-rw-r--r-- | radio/radio.cpp | 13 | ||||
-rw-r--r-- | radio/radio.h | 10 | ||||
-rw-r--r-- | signal-composer/signalcomposer.cpp | 9 | ||||
-rw-r--r-- | signal-composer/signalcomposer.h | 8 | ||||
-rw-r--r-- | telephony/telephony.cpp | 9 | ||||
-rw-r--r-- | telephony/telephony.h | 8 | ||||
-rw-r--r-- | voice-capabilities/guimetadata.cpp | 9 | ||||
-rw-r--r-- | voice-capabilities/guimetadata.h | 8 | ||||
-rw-r--r-- | voice/voice.cpp | 15 | ||||
-rw-r--r-- | voice/voice.h | 9 | ||||
-rw-r--r-- | weather/weather.cpp | 10 | ||||
-rw-r--r-- | weather/weather.h | 8 |
28 files changed, 181 insertions, 121 deletions
diff --git a/bluetooth/bluetooth.cpp b/bluetooth/bluetooth.cpp index 79cc5f1..f74d60d 100644 --- a/bluetooth/bluetooth.cpp +++ b/bluetooth/bluetooth.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 Konsulko Group + * Copyright (C) 2018-2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,11 +14,16 @@ * limitations under the License. */ +#include <QDebug> + #include "message.h" -#include "messageengine.h" -#include "bluetooth.h" #include "bluetoothmessage.h" #include "responsemessage.h" +#include "messageengine.h" +#include "bluetoothmodel.h" +#include "bluetooth.h" + + Bluetooth::Bluetooth (QUrl &url, QQmlContext *context, QObject * parent) : QObject(parent), @@ -258,7 +263,7 @@ void Bluetooth::processAdapterChangesEvent(QJsonObject data) void Bluetooth::onMessageReceived(MessageType type, Message *msg) { - if (msg->isEvent() && type == BluetoothEventMessage) { + if (msg->isEvent() && type == MessageType::BluetoothEventMessage) { BluetoothMessage *tmsg = qobject_cast<BluetoothMessage*>(msg); if (tmsg->isDeviceChangesEvent()) { @@ -269,7 +274,7 @@ void Bluetooth::onMessageReceived(MessageType type, Message *msg) emit requestConfirmationEvent(tmsg->eventData()); } - } else if (msg->isReply() && type == ResponseRequestMessage) { + } else if (msg->isReply() && type == MessageType::ResponseRequestMessage) { ResponseMessage *tmsg = qobject_cast<ResponseMessage*>(msg); if (tmsg->requestVerb() == "managed_objects") { diff --git a/bluetooth/bluetooth.h b/bluetooth/bluetooth.h index b79e0f4..815e180 100644 --- a/bluetooth/bluetooth.h +++ b/bluetooth/bluetooth.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 Konsulko Group + * Copyright (C) 2018-2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,12 +17,16 @@ #ifndef BLUETOOTH_H #define BLUETOOTH_H -#include <QDebug> #include <QObject> #include <QJsonArray> +#include <QJsonObject> +#include <QtQml/QQmlContext> -#include "messageengine.h" -#include "bluetoothmodel.h" +class BluetoothModel; +class MessageEngine; +class Message; + +enum class MessageType; class Bluetooth : public QObject { diff --git a/hvac/hvac.cpp b/hvac/hvac.cpp index 507cfeb..f9e509b 100644 --- a/hvac/hvac.cpp +++ b/hvac/hvac.cpp @@ -14,15 +14,17 @@ * limitations under the License. */ +#include <QDebug> #include <QMetaEnum> #include <QMimeDatabase> #include <QtQml/QQmlEngine> #include "message.h" -#include "messageengine.h" -#include "hvac.h" #include "hvacmessage.h" #include "responsemessage.h" +#include "messageengine.h" +#include "hvac.h" + // TODO: don't duplicate defaults from HVAC service here HVAC::HVAC (QUrl &url, QObject * parent) : @@ -75,7 +77,7 @@ void HVAC::set_temp_right_zone(int temp) void HVAC::onMessageReceived(MessageType type, Message *msg) { - if (msg->isEvent() && type == HVACEventMessage) { + if (msg->isEvent() && type == MessageType::HVACEventMessage) { HVACMessage *tmsg = qobject_cast<HVACMessage*>(msg); if (tmsg->isLanguageEvent()) { diff --git a/hvac/hvac.h b/hvac/hvac.h index 8a4ca3a..47a9e08 100644 --- a/hvac/hvac.h +++ b/hvac/hvac.h @@ -17,13 +17,15 @@ #ifndef HVAC_H #define HVAC_H -#include <QDebug> #include <QObject> #include <QJsonArray> #include <QtQml/QQmlContext> #include <QtQml/QQmlListProperty> -#include "messageengine.h" +class MessageEngine; +class Message; + +enum class MessageType; class HVAC : public QObject { diff --git a/map/map.cpp b/map/map.cpp index 38f682a..666efa1 100644 --- a/map/map.cpp +++ b/map/map.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Konsulko Group + * Copyright (C) 2019, 2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,11 +14,13 @@ * limitations under the License. */ +#include <QDebug> + #include "message.h" -#include "messageengine.h" -#include "map.h" #include "mapmessage.h" #include "responsemessage.h" +#include "messageengine.h" +#include "map.h" Map::Map (QUrl &url, QObject * parent) : QObject(parent), @@ -90,13 +92,13 @@ void Map::onDisconnected() void Map::onMessageReceived(MessageType type, Message *msg) { - if (type == MapEventMessage) { + if (type == MessageType::MapEventMessage) { MapMessage *tmsg = qobject_cast<MapMessage*>(msg); if (tmsg->isNotificationEvent()) { emit notificationEvent(tmsg->eventData().toVariantMap()); } - } else if (msg->isReply() && type == ResponseRequestMessage) { + } else if (msg->isReply() && type == MessageType::ResponseRequestMessage) { ResponseMessage *tmsg = qobject_cast<ResponseMessage*>(msg); if (tmsg->requestVerb() == "list_messages") { @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Konsulko Group + * Copyright (C) 2019, 2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,13 +17,15 @@ #ifndef MAP_H #define MAP_H -#include <QDebug> #include <QObject> #include <QJsonArray> #include <QtQml/QQmlContext> #include <QtQml/QQmlListProperty> -#include "messageengine.h" +class MessageEngine; +class Message; + +enum class MessageType; class Map : public QObject { diff --git a/mediaplayer/mediaplayer.cpp b/mediaplayer/mediaplayer.cpp index 96799dc..69b2dea 100644 --- a/mediaplayer/mediaplayer.cpp +++ b/mediaplayer/mediaplayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 Konsulko Group + * Copyright (C) 2018-2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ +#include <QDebug> + #include "message.h" +#include "mediaplayermessage.h" #include "messageengine.h" #include "mediaplayer.h" -#include "mediaplayermessage.h" + Playlist::Playlist(QVariantMap &item) { @@ -212,8 +215,9 @@ void Mediaplayer::onDisconnected() void Mediaplayer::onMessageReceived(MessageType type, Message *message) { - if (type == MediaplayerEventMessage) { - MediaplayerMessage *tmsg = qobject_cast<MediaplayerMessage*>(message); + if (type == MessageType::MediaplayerEventMessage) { + MediaplayerMessage *tmsg = + qobject_cast<MediaplayerMessage*>(message); if (tmsg->isEvent()) { if (tmsg->isPlaylistEvent()) { diff --git a/mediaplayer/mediaplayer.h b/mediaplayer/mediaplayer.h index fe49be4..f3930f4 100644 --- a/mediaplayer/mediaplayer.h +++ b/mediaplayer/mediaplayer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 Konsulko Group + * Copyright (C) 2018-2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,12 +17,14 @@ #ifndef MEDIAPLAYER_H #define MEDIAPLAYER_H -#include <QDebug> #include <QObject> - #include <QtQml/QQmlContext> #include <QtQml/QQmlListProperty> -#include "messageengine.h" + +class MessageEngine; +class Message; + +enum class MessageType; class Playlist : public QObject { @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017, 2018, 2019 Konsulko Group + * Copyright (C) 2017-2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ enum MessageId { Event = 5, }; -enum MessageType { +enum class MessageType { GenericMessage, ResponseRequestMessage, TelephonyEventMessage, @@ -52,7 +52,6 @@ class Message : public QObject { Q_OBJECT Q_ENUM(MessageId) - Q_ENUM(MessageType) public: Message(); diff --git a/messageengine.cpp b/messageengine.cpp index 9ab9aee..6f31d0f 100644 --- a/messageengine.cpp +++ b/messageengine.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Konsulko Group + * Copyright (C) 2017-2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -105,7 +105,7 @@ void MessageEngine::onTextMessageReceived(QString jsonStr) case RetErr: { auto callid = msg[1].toString().toInt(); message = new ResponseMessage(m_calls[callid]); - type = ResponseRequestMessage; + type = MessageType::ResponseRequestMessage; m_calls.remove(callid); break; } @@ -117,49 +117,49 @@ void MessageEngine::onTextMessageReceived(QString jsonStr) // parser parameter to remove API specific handling here if (api == "bluetooth-manager") { message = new BluetoothMessage; - type = BluetoothEventMessage; + type = MessageType::BluetoothEventMessage; } else if (api == "bluetooth-pbap") { message = new PbapMessage; - type = PbapEventMessage; + type = MessageType::PbapEventMessage; } else if (api == "telephony") { message = new TelephonyMessage; - type = TelephonyEventMessage; + type = MessageType::TelephonyEventMessage; } else if (api == "weather") { message = new WeatherMessage; - type = WeatherEventMessage; + type = MessageType::WeatherEventMessage; } else if (api == "mediaplayer") { message = new MediaplayerMessage; - type = MediaplayerEventMessage; + type = MessageType::MediaplayerEventMessage; } else if (api == "navigation") { message = new NavigationMessage; - type = NavigationEventMessage; + type = MessageType::NavigationEventMessage; } else if (api == "network-manager") { message = new NetworkMessage; - type = NetworkEventMessage; + type = MessageType::NetworkEventMessage; } else if (api == "radio") { message = new RadioMessage; - type = RadioEventMessage; + type = MessageType::RadioEventMessage; } else if (api == "bluetooth-map") { message = new MapMessage; - type = MapEventMessage; + type = MessageType::MapEventMessage; } else if (api == "vshl-core" ) { message = new VoiceMessage; - type = VoiceEventMessage; + type = MessageType::VoiceEventMessage; } else if (api == "vshl-capabilities" ) { // NOTE: Will need to look at event name to differentiate // capabilities if more support (e.g. navigation or // local media control) is added. message = new GuiMetadataCapabilityMessage; - type = GuiMetadataCapabilityEventMessage; + type = MessageType::GuiMetadataCapabilityEventMessage; } else if (api == "signal-composer") { message = new SignalComposerMessage; - type = SignalComposerEventMessage; + type = MessageType::SignalComposerEventMessage; } else if (api == "hvac") { message = new HVACMessage; - type = HVACEventMessage; + type = MessageType::HVACEventMessage; } else { message = new Message; - type = GenericMessage; + type = MessageType::GenericMessage; } break; } diff --git a/navigation/navigation.cpp b/navigation/navigation.cpp index 8210310..ce6b91d 100644 --- a/navigation/navigation.cpp +++ b/navigation/navigation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Konsulko Group + * Copyright (C) 2019, 2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,11 +14,14 @@ * limitations under the License. */ +#include <QDebug> + #include "message.h" -#include "messageengine.h" -#include "navigation.h" #include "navigationmessage.h" #include "responsemessage.h" +#include "messageengine.h" +#include "navigation.h" + Navigation::Navigation (QUrl &url, QObject * parent) : QObject(parent), @@ -123,7 +126,7 @@ void Navigation::onDisconnected() void Navigation::onMessageReceived(MessageType type, Message *msg) { - if (type == NavigationEventMessage) { + if (type == MessageType::NavigationEventMessage) { NavigationMessage *tmsg = qobject_cast<NavigationMessage*>(msg); if (tmsg->isPositionEvent()) { diff --git a/navigation/navigation.h b/navigation/navigation.h index 7262107..c407d0f 100644 --- a/navigation/navigation.h +++ b/navigation/navigation.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Konsulko Group + * Copyright (C) 2019, 2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,14 +17,14 @@ #ifndef NAVIGATION_H #define NAVIGATION_H -#include <QDebug> #include <QObject> #include <QJsonArray> #include <QtQml/QQmlListProperty> -#include "messageengine.h" -#include "navigationmessage.h" -#include "responsemessage.h" +class MessageEngine; +class Message; + +enum class MessageType; class Navigation : public QObject { diff --git a/network/network.cpp b/network/network.cpp index c497c29..b858206 100644 --- a/network/network.cpp +++ b/network/network.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 Konsulko Group + * Copyright (C) 2018-2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,14 +14,16 @@ * limitations under the License. */ +#include <QDebug> #include <QtQml/QQmlEngine> #include "message.h" -#include "messageengine.h" -#include "network.h" #include "networkmessage.h" #include "responsemessage.h" +#include "messageengine.h" #include "networkadapter.h" +#include "network.h" + Network::Network (QUrl &url, QQmlContext *context, QObject * parent) : QObject(parent), @@ -313,9 +315,9 @@ void Network::processReply(ResponseMessage *rmsg) void Network::onMessageReceived(MessageType type, Message *msg) { - if (msg->isEvent() && (type == NetworkEventMessage)) { + if (msg->isEvent() && (type == MessageType::NetworkEventMessage)) { processEvent(qobject_cast<NetworkMessage*>(msg)); - } else if (msg->isReply() && (type == ResponseRequestMessage)) { + } else if (msg->isReply() && (type == MessageType::ResponseRequestMessage)) { processReply(qobject_cast<ResponseMessage*>(msg)); } diff --git a/network/network.h b/network/network.h index aa83fed..ebaeb6e 100644 --- a/network/network.h +++ b/network/network.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 Konsulko Group + * Copyright (C) 2018-2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,18 +17,21 @@ #ifndef NETWORK_H #define NETWORK_H -#include <QDebug> #include <QObject> #include <QJsonArray> #include <QtQml/QQmlContext> #include <QtQml/QQmlListProperty> -#include "messageengine.h" -#include "networkmessage.h" -#include "responsemessage.h" #include "wifiadapter.h" #include "wiredadapter.h" +class MessageEngine; +class Message; +class NetworkMessage; +class ResponseMessage; + +enum class MessageType; + class Network : public QObject { Q_OBJECT diff --git a/pbap/pbap.cpp b/pbap/pbap.cpp index d525013..7b7829f 100644 --- a/pbap/pbap.cpp +++ b/pbap/pbap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 Konsulko Group + * Copyright (C) 2018-2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,15 +14,17 @@ * limitations under the License. */ +#include <QDebug> #include <QMetaEnum> #include <QMimeDatabase> #include <QtQml/QQmlEngine> #include "message.h" -#include "messageengine.h" -#include "pbap.h" #include "pbapmessage.h" #include "responsemessage.h" +#include "messageengine.h" +#include "pbap.h" + PhoneNumber::PhoneNumber(QString number, QString type) { @@ -280,7 +282,7 @@ void Pbap::onDisconnected() void Pbap::onMessageReceived(MessageType type, Message *msg) { - if (msg->isEvent() && type == PbapEventMessage) { + if (msg->isEvent() && type == MessageType::PbapEventMessage) { PbapMessage *tmsg = qobject_cast<PbapMessage*>(msg); if (tmsg->isStatusEvent()) { @@ -289,7 +291,7 @@ void Pbap::onMessageReceived(MessageType type, Message *msg) refreshContacts(-1); } } - } else if (msg->isReply() && type == ResponseRequestMessage) { + } else if (msg->isReply() && type == MessageType::ResponseRequestMessage) { ResponseMessage *tmsg = qobject_cast<ResponseMessage*>(msg); if (tmsg->requestVerb() == "contacts" || tmsg->requestVerb() == "import") { diff --git a/pbap/pbap.h b/pbap/pbap.h index 4859343..a89bf2b 100644 --- a/pbap/pbap.h +++ b/pbap/pbap.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 Konsulko Group + * Copyright (C) 2018-2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,13 +17,15 @@ #ifndef PBAP_H #define PBAP_H -#include <QDebug> #include <QObject> #include <QJsonArray> #include <QtQml/QQmlContext> #include <QtQml/QQmlListProperty> -#include "messageengine.h" +class MessageEngine; +class Message; + +enum class MessageType; class PhoneNumber : public QObject { diff --git a/radio/radio.cpp b/radio/radio.cpp index 6813d08..1627cd7 100644 --- a/radio/radio.cpp +++ b/radio/radio.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 Konsulko Group + * Copyright (C) 2018-2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,11 +14,14 @@ * limitations under the License. */ +#include <QDebug> + #include "message.h" -#include "messageengine.h" -#include "radio.h" #include "radiomessage.h" #include "responsemessage.h" +#include "messageengine.h" +#include "radio.h" + Radio::Radio (QUrl &url, QQmlContext *context, QObject * parent) : QObject(parent), @@ -200,7 +203,7 @@ void Radio::onDisconnected() void Radio::onMessageReceived(MessageType type, Message *msg) { - if (msg->isEvent() && type == RadioEventMessage) { + if (msg->isEvent() && type == MessageType::RadioEventMessage) { RadioMessage *rmsg = qobject_cast<RadioMessage*>(msg); if (rmsg->isFrequencyEvent()) { @@ -224,7 +227,7 @@ void Radio::onMessageReceived(MessageType type, Message *msg) emit playingChanged(m_playing); } } - } else if (msg->isReply() && type == ResponseRequestMessage) { + } else if (msg->isReply() && type == MessageType::ResponseRequestMessage) { ResponseMessage *rmsg = qobject_cast<ResponseMessage*>(msg); if (rmsg->requestVerb() == "frequency_range") { diff --git a/radio/radio.h b/radio/radio.h index 642c58f..9e72a5a 100644 --- a/radio/radio.h +++ b/radio/radio.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 Konsulko Group + * Copyright (C) 2018-2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,11 +17,13 @@ #ifndef RADIO_H #define RADIO_H -#include <QDebug> #include <QObject> - #include <QtQml/QQmlContext> -#include "messageengine.h" + +class MessageEngine; +class Message; + +enum class MessageType; class Radio : public QObject { diff --git a/signal-composer/signalcomposer.cpp b/signal-composer/signalcomposer.cpp index 90e6446..59395f5 100644 --- a/signal-composer/signalcomposer.cpp +++ b/signal-composer/signalcomposer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 Konsulko Group + * Copyright (C) 2018-2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ +#include <QDebug> + #include "message.h" +#include "signalcomposermessage.h" #include "messageengine.h" #include "signalcomposer.h" -#include "signalcomposermessage.h" + SignalComposer::SignalComposer (QUrl &url, QObject * parent) : QObject(parent), @@ -66,7 +69,7 @@ void SignalComposer::onDisconnected() void SignalComposer::onMessageReceived(MessageType type, Message *message) { - if (type == SignalComposerEventMessage) { + if (type == MessageType::SignalComposerEventMessage) { SignalComposerMessage *tmsg = qobject_cast<SignalComposerMessage*>(message); if (tmsg->isEvent()) { diff --git a/signal-composer/signalcomposer.h b/signal-composer/signalcomposer.h index 3a6ca25..13d26c6 100644 --- a/signal-composer/signalcomposer.h +++ b/signal-composer/signalcomposer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Konsulko Group + * Copyright (C) 2019, 2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,11 +17,13 @@ #ifndef SIGNALCOMPOSER_H #define SIGNALCOMPOSER_H -#include <QDebug> #include <QObject> #include <QJsonArray> -#include "messageengine.h" +class MessageEngine; +class Message; + +enum class MessageType; class SignalComposer : public QObject { diff --git a/telephony/telephony.cpp b/telephony/telephony.cpp index 716ded7..e0fe2bd 100644 --- a/telephony/telephony.cpp +++ b/telephony/telephony.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Konsulko Group + * Copyright (C) 2017-2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,13 @@ * limitations under the License. */ +#include <QDebug> + #include "message.h" +#include "telephonymessage.h" #include "messageengine.h" #include "telephony.h" -#include "telephonymessage.h" + Telephony::Telephony (QUrl &url, QObject * parent) : QObject(parent), @@ -88,7 +91,7 @@ void Telephony::onDisconnected() void Telephony::onMessageReceived(MessageType type, Message *message) { - if (type == TelephonyEventMessage) { + if (type == MessageType::TelephonyEventMessage) { TelephonyMessage *tmsg = qobject_cast<TelephonyMessage*>(message); if (tmsg->isEvent()) { diff --git a/telephony/telephony.h b/telephony/telephony.h index 04f55a7..097310f 100644 --- a/telephony/telephony.h +++ b/telephony/telephony.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Konsulko Group + * Copyright (C) 2017-2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,10 +17,12 @@ #ifndef TELEPHONY_H #define TELEPHONY_H -#include <QDebug> #include <QObject> -#include "messageengine.h" +class MessageEngine; +class Message; + +enum class MessageType; class Telephony : public QObject { diff --git a/voice-capabilities/guimetadata.cpp b/voice-capabilities/guimetadata.cpp index 2ab86c5..949cb58 100644 --- a/voice-capabilities/guimetadata.cpp +++ b/voice-capabilities/guimetadata.cpp @@ -14,12 +14,13 @@ * limitations under the License. */ +#include <QDebug> +#include <QJsonArray> + #include "message.h" +#include "guimetadatamessage.h" #include "messageengine.h" #include "guimetadata.h" -#include "guimetadatamessage.h" - -#include <QJsonArray> GuiMetadata::GuiMetadata(QUrl &url, QQmlContext *context, QObject * parent) : QObject(parent), @@ -329,7 +330,7 @@ void GuiMetadata::onDisconnected() void GuiMetadata::onMessageReceived(MessageType type, Message *message) { - if (type == GuiMetadataCapabilityEventMessage) { + if (type == MessageType::GuiMetadataCapabilityEventMessage) { GuiMetadataCapabilityMessage *tmsg = qobject_cast<GuiMetadataCapabilityMessage*>(message); if (tmsg->isEvent()) { if (tmsg->isGuiMetadataRenderTemplateEvent()) { diff --git a/voice-capabilities/guimetadata.h b/voice-capabilities/guimetadata.h index c4a551f..ae90cba 100644 --- a/voice-capabilities/guimetadata.h +++ b/voice-capabilities/guimetadata.h @@ -17,11 +17,13 @@ #ifndef GUIMETADATA_H #define GUIMETADATA_H -#include <QDebug> #include <QObject> - #include <QtQml/QQmlContext> -#include "messageengine.h" + +class MessageEngine; +class Message; + +enum class MessageType; class GuiMetadata : public QObject { diff --git a/voice/voice.cpp b/voice/voice.cpp index c43e0b5..3c93960 100644 --- a/voice/voice.cpp +++ b/voice/voice.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Konsulko Group + * Copyright (C) 2019, 2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,14 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +#include <QDebug> #include <QStringList> -#include "voice.h" + #include "message.h" -#include "messageengine.h" #include "responsemessage.h" #include "voicemessage.h" +#include "messageengine.h" #include "voiceagentregistry.h" +#include "voice.h" Voice::Voice (QUrl &url, QQmlContext *context, QObject *parent) : QObject(parent), @@ -181,11 +182,11 @@ void Voice::onDisconnected() void Voice::onMessageReceived(MessageType type, Message *msg) { - if (msg->isEvent() && type == VoiceEventMessage) { + if (msg->isEvent() && type == MessageType::VoiceEventMessage) { processEvent(qobject_cast<VoiceMessage*>(msg)); - } else if (msg->isReply() && (type == ResponseRequestMessage)) { + } else if (msg->isReply() && (type == MessageType::ResponseRequestMessage)) { processReply(qobject_cast<ResponseMessage*>(msg)); } else - qWarning() << "Received unknown message type:" << type; + qWarning() << "Received unknown message type:" << static_cast<double>(type); msg->deleteLater(); } diff --git a/voice/voice.h b/voice/voice.h index d4c288e..e3132be 100644 --- a/voice/voice.h +++ b/voice/voice.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Konsulko Group + * Copyright (C) 2019, 2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,16 +17,17 @@ #ifndef VOICE_H #define VOICE_H -#include <QDebug> #include <QObject> #include <QJsonArray> #include <QtQml/QQmlContext> -#include "message.h" +class VoiceAgentRegistry; class MessageEngine; +class Message; class ResponseMessage; class VoiceMessage; -class VoiceAgentRegistry; + +enum class MessageType; class Voice : public QObject { diff --git a/weather/weather.cpp b/weather/weather.cpp index c77e742..d4992d4 100644 --- a/weather/weather.cpp +++ b/weather/weather.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 Konsulko Group + * Copyright (C) 2018-2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,10 +14,14 @@ * limitations under the License. */ +#include <QDebug> +#include <QJsonArray> + #include "message.h" +#include "weathermessage.h" #include "messageengine.h" #include "weather.h" -#include "weathermessage.h" + Weather::Weather (QUrl &url, QObject * parent) : QObject(parent), @@ -52,7 +56,7 @@ void Weather::onDisconnected() void Weather::onMessageReceived(MessageType type, Message *message) { - if (type == WeatherEventMessage) { + if (type == MessageType::WeatherEventMessage) { WeatherMessage *tmsg = qobject_cast<WeatherMessage*>(message); if (tmsg->isEvent()) { diff --git a/weather/weather.h b/weather/weather.h index ffbbcc6..6d33a15 100644 --- a/weather/weather.h +++ b/weather/weather.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 Konsulko Group + * Copyright (C) 2018-2020 Konsulko Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,10 +17,12 @@ #ifndef WEATHER_H #define WEATHER_H -#include <QDebug> #include <QObject> -#include "messageengine.h" +class MessageEngine; +class Message; + +enum class MessageType; class Weather : public QObject { |