From 5be1f64faf66c29b35c61fbccd283a206e599128 Mon Sep 17 00:00:00 2001 From: Boernsman Date: Mon, 19 Oct 2020 19:05:47 +0200 Subject: [PATCH] added apiKey storage --- homeconnect/homeconnect.h | 1 - homeconnect/integrationpluginhomeconnect.cpp | 9 ++++++--- homeconnect/integrationpluginhomeconnect.h | 3 --- homeconnect/integrationpluginhomeconnect.json | 1 + 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/homeconnect/homeconnect.h b/homeconnect/homeconnect.h index 4ecefc37..bda4cec0 100644 --- a/homeconnect/homeconnect.h +++ b/homeconnect/homeconnect.h @@ -121,7 +121,6 @@ public: // DEFAULT void getHomeAppliances(); // Get all home appliances which are paired with the logged-in user account. - void getHomeAppliance(const QString &haid); //Get a specfic home appliances which are paired with the logged-in user account. // PROGRAMS void getPrograms(const QString &haId); //Get all programs of a given home appliance diff --git a/homeconnect/integrationpluginhomeconnect.cpp b/homeconnect/integrationpluginhomeconnect.cpp index ce378f7f..ed9b9670 100644 --- a/homeconnect/integrationpluginhomeconnect.cpp +++ b/homeconnect/integrationpluginhomeconnect.cpp @@ -144,8 +144,9 @@ void IntegrationPluginHomeConnect::startPairing(ThingPairingInfo *info) bool simulationMode = configValue(homeConnectPluginSimulationModeParamTypeId).toBool(); bool controlEnabled = configValue(homeConnectPluginControlEnabledParamTypeId).toBool(); - - HomeConnect *homeConnect = new HomeConnect(hardwareManager()->networkManager(), "423713AB3EDA5B44BCE6E7B3546C43DADCB27A156C681E30455250637B2213DB", "AE182EA9F1CB99416DFD62CE61BF6DCDB3BB7D4697B58D4499D3792EC9F7412D", simulationMode, this); + QByteArray clientKey = apiKeyStorage()->requestKey("homeconnect").data("clientKey"); + QByteArray clientSecret = apiKeyStorage()->requestKey("homeconnect").data("clientSecret"); + HomeConnect *homeConnect = new HomeConnect(hardwareManager()->networkManager(), clientKey, clientSecret, simulationMode, this); QString scope = "IdentifyAppliance Monitor Settings Dishwasher Washer Dryer WasherDryer Refrigerator Freezer WineCooler CoffeeMaker Hood CookProcessor"; if (controlEnabled) scope.append(" Control"); @@ -224,7 +225,9 @@ void IntegrationPluginHomeConnect::setupThing(ThingSetupInfo *info) pluginStorage()->beginGroup(thing->id().toString()); QByteArray refreshToken = pluginStorage()->value("refresh_token").toByteArray(); pluginStorage()->endGroup(); - homeConnect = new HomeConnect(hardwareManager()->networkManager(), "423713AB3EDA5B44BCE6E7B3546C43DADCB27A156C681E30455250637B2213DB", "AE182EA9F1CB99416DFD62CE61BF6DCDB3BB7D4697B58D4499D3792EC9F7412D", simulationMode, this); + QByteArray clientKey = apiKeyStorage()->requestKey("homeconnect").data("clientKey"); + QByteArray clientSecret = apiKeyStorage()->requestKey("homeconnect").data("clientSecret"); + homeConnect = new HomeConnect(hardwareManager()->networkManager(), clientKey, clientSecret, simulationMode, this); homeConnect->getAccessTokenFromRefreshToken(refreshToken); m_asyncSetup.insert(homeConnect, info); } diff --git a/homeconnect/integrationpluginhomeconnect.h b/homeconnect/integrationpluginhomeconnect.h index b167699e..a3fd92c8 100644 --- a/homeconnect/integrationpluginhomeconnect.h +++ b/homeconnect/integrationpluginhomeconnect.h @@ -91,8 +91,6 @@ private: QHash m_coffeeStrengthTypes; - HomeConnect *createHomeConnection(); - void parseKey(Thing *thing, const QString &key, const QVariant &value); void parseSettingKey(Thing *thing, const QString &key, const QVariant &value); @@ -103,7 +101,6 @@ private slots: void onReceivedHomeAppliances(const QList &appliances); void onReceivedStatusList(const QString &haId, const QHash &statusList); void onReceivedEvents(HomeConnect::EventType eventType, const QString &haId, const QList &events); - void onReceivedActiveProgram(const QString &haId, const QString &key, const QHash &options); void onReceivedSelectedProgram(const QString &haId, const QString &key, const QHash &options); void onReceivedSettings(const QString &haId, const QHash &settings); }; diff --git a/homeconnect/integrationpluginhomeconnect.json b/homeconnect/integrationpluginhomeconnect.json index e5db79b4..a2f22445 100644 --- a/homeconnect/integrationpluginhomeconnect.json +++ b/homeconnect/integrationpluginhomeconnect.json @@ -18,6 +18,7 @@ "type": "bool" } ], + "apiKeys": ["homeconnect"], "vendors": [ { "id": "43cfb7a4-402f-4315-86b5-ce095697fd13",