Index: CloudConnect/CloudConnectController.cpp =================================================================== diff -u -rfe8875710ffd0f7ecc8df54bb5dee1be3d28212b -ra3de17abef83da8edaa4ca90b9f5091ff98cfc1e --- CloudConnect/CloudConnectController.cpp (.../CloudConnectController.cpp) (revision fe8875710ffd0f7ecc8df54bb5dee1be3d28212b) +++ CloudConnect/CloudConnectController.cpp (.../CloudConnectController.cpp) (revision a3de17abef83da8edaa4ca90b9f5091ff98cfc1e) @@ -106,8 +106,6 @@ return false; } - _appServerSocketPath = config.value("App/SocketName", "/tmp/cloudconnect.sock").toString(); - config.beginGroup(QStringLiteral("Cloud")); MqttClient::Config mqttConfig; mqttConfig.endpoint = config.value(QStringLiteral("ServerAddress"), QStringLiteral("localhost")).toString(); @@ -164,27 +162,6 @@ } /*! - * \brief CloudConnectController::listenForApp - * \details Creates the app socket server, then starts listening. - * \return true if the server bound successfully, false otherwise. - * \note Must run on the controller thread, after initThread(). - * QLocalServer ties its socket engine to the thread that calls - * listen(), and accepted client sockets are parented to that engine. - */ -bool CloudConnectController::listenForApp() -{ - // use Q_ASSERT only during object creation or thread move - Q_ASSERT_X(QThread::currentThread() == thread(), __func__, - "listenForApp() must run on the controller thread"); - - if (_appServer == nullptr) { - _appServer = QSharedPointer::create(this); - } - - return _appServer->listen(_appServerSocketPath); -} - -/*! * \brief CloudConnectController::connectToCloud * \details Starts connecting to the cloud server with the configuration loaded in loadConfig. * \return true if the attempt was started, or false if MQTT is disabled. @@ -212,12 +189,12 @@ { QStringLiteral("SendDelta"), CanAction::SendDelta }, { QStringLiteral("Drop"), CanAction::Drop }, }; - static const QHash topicMap = { - { QStringLiteral("HighPriority"), CloudConnectFrame::Topic::HighPriority }, - { QStringLiteral("NormalPriority"), CloudConnectFrame::Topic::NormalPriority }, - { QStringLiteral("DeviceLogFile"), CloudConnectFrame::Topic::DeviceLogFile }, - { QStringLiteral("TreatmentLogFile"), CloudConnectFrame::Topic::TreatmentLogFile }, - { QStringLiteral("CloudSyncLogFile"), CloudConnectFrame::Topic::CloudSyncLogFile }, + static const QHash topicMap = { + { QStringLiteral("HighPriority"), MqttTopic::HighPriority }, + { QStringLiteral("NormalPriority"), MqttTopic::NormalPriority }, + { QStringLiteral("DeviceLogFile"), MqttTopic::DeviceLogFile }, + { QStringLiteral("TreatmentLogFile"), MqttTopic::TreatmentLogFile }, + { QStringLiteral("CloudSyncLogFile"), MqttTopic::CloudSyncLogFile }, }; if (!QFile::exists(canRoutingPath)) { @@ -253,7 +230,7 @@ // TODO: uncomment the following line after testing // canRouting.action = actionMap.value(actionStr, CanAction::Drop); canRouting.action = actionMap.value(actionStr, CanAction::SendAlways); // TODO: remove after testing - canRouting.topic = topicMap.value(topicStr, CloudConnectFrame::Topic::NormalPriority); + canRouting.topic = topicMap.value(topicStr, MqttTopic::NormalPriority); if (actionStr.length() > 0 && !actionMap.contains(actionStr)) { qCWarning(logCanRouting).noquote() << QString("unknown message action \"%1\" for msgId=0x%2, defaulting to Drop") @@ -278,14 +255,14 @@ * \param topic - message class from the CAN message routing INI * \return Topic of the form {prefix}/{deviceId}/{suffix}. */ -QString CloudConnectController::mqttTopic(CloudConnectFrame::Topic topic) const +QString CloudConnectController::mqttTopic(MqttTopic topic) const { - static const QMap suffixes = { - { CloudConnectFrame::Topic::HighPriority, QStringLiteral("high") }, - { CloudConnectFrame::Topic::NormalPriority, QStringLiteral("normal") }, - { CloudConnectFrame::Topic::DeviceLogFile, QStringLiteral("log") }, - { CloudConnectFrame::Topic::TreatmentLogFile, QStringLiteral("tx_log") }, - { CloudConnectFrame::Topic::CloudSyncLogFile, QStringLiteral("cs_log") }, + static const QMap suffixes = { + { MqttTopic::HighPriority, QStringLiteral("high") }, + { MqttTopic::NormalPriority, QStringLiteral("normal") }, + { MqttTopic::DeviceLogFile, QStringLiteral("log") }, + { MqttTopic::TreatmentLogFile, QStringLiteral("tx_log") }, + { MqttTopic::CloudSyncLogFile, QStringLiteral("cs_log") }, }; // TODO: uncomment the following line after testing @@ -425,7 +402,7 @@ _msgAckAvgTime = 0; _msgRecvAvgTime = 0; // END: Mesg Stats - (void)_mqttClient.subscribe(mqttTopic(CloudConnectFrame::Topic::NormalPriority)); + (void)_mqttClient.subscribe(mqttTopic(MqttTopic::NormalPriority)); break; default: break;