move methods from network classes into helper classes
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "hal/wdt_hal.h"
|
#include "hal/wdt_hal.h"
|
||||||
|
#include "util/NukiHelper.h"
|
||||||
|
|
||||||
extern bool forceEnableWebServer;
|
extern bool forceEnableWebServer;
|
||||||
extern const uint8_t x509_crt_imported_bundle_bin_start[] asm("_binary_x509_crt_bundle_start");
|
extern const uint8_t x509_crt_imported_bundle_bin_start[] asm("_binary_x509_crt_bundle_start");
|
||||||
@@ -877,13 +878,13 @@ void NukiNetworkLock::publishConfig(const NukiLock::Config &config)
|
|||||||
json["dstMode"] = config.dstMode;
|
json["dstMode"] = config.dstMode;
|
||||||
json["hasFob"] = config.hasFob;
|
json["hasFob"] = config.hasFob;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
fobActionToString(config.fobAction1, str);
|
NukiHelper::fobActionToString(config.fobAction1, str);
|
||||||
json["fobAction1"] = str;
|
json["fobAction1"] = str;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
fobActionToString(config.fobAction2, str);
|
NukiHelper::fobActionToString(config.fobAction2, str);
|
||||||
json["fobAction2"] = str;
|
json["fobAction2"] = str;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
fobActionToString(config.fobAction3, str);
|
NukiHelper::fobActionToString(config.fobAction3, str);
|
||||||
json["fobAction3"] = str;
|
json["fobAction3"] = str;
|
||||||
json["singleLock"] = config.singleLock;
|
json["singleLock"] = config.singleLock;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
@@ -894,7 +895,7 @@ void NukiNetworkLock::publishConfig(const NukiLock::Config &config)
|
|||||||
json["firmwareVersion"] = std::to_string(config.firmwareVersion[0]) + "." + std::to_string(config.firmwareVersion[1]) + "." + std::to_string(config.firmwareVersion[2]);
|
json["firmwareVersion"] = std::to_string(config.firmwareVersion[0]) + "." + std::to_string(config.firmwareVersion[1]) + "." + std::to_string(config.firmwareVersion[2]);
|
||||||
json["hardwareRevision"] = std::to_string(config.hardwareRevision[0]) + "." + std::to_string(config.hardwareRevision[1]);
|
json["hardwareRevision"] = std::to_string(config.hardwareRevision[0]) + "." + std::to_string(config.hardwareRevision[1]);
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
homeKitStatusToString(config.homeKitStatus, str);
|
NukiHelper::homeKitStatusToString(config.homeKitStatus, str);
|
||||||
json["homeKitStatus"] = str;
|
json["homeKitStatus"] = str;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
_network->timeZoneIdToString(config.timeZoneId, str);
|
_network->timeZoneIdToString(config.timeZoneId, str);
|
||||||
@@ -937,10 +938,10 @@ void NukiNetworkLock::publishAdvancedConfig(const NukiLock::AdvancedConfig &conf
|
|||||||
json["unlockedToLockedTransitionOffsetDegrees"] = config.unlockedToLockedTransitionOffsetDegrees;
|
json["unlockedToLockedTransitionOffsetDegrees"] = config.unlockedToLockedTransitionOffsetDegrees;
|
||||||
json["lockNgoTimeout"] = config.lockNgoTimeout;
|
json["lockNgoTimeout"] = config.lockNgoTimeout;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
buttonPressActionToString(config.singleButtonPressAction, str);
|
NukiHelper::buttonPressActionToString(config.singleButtonPressAction, str);
|
||||||
json["singleButtonPressAction"] = str;
|
json["singleButtonPressAction"] = str;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
buttonPressActionToString(config.doubleButtonPressAction, str);
|
NukiHelper::buttonPressActionToString(config.doubleButtonPressAction, str);
|
||||||
json["doubleButtonPressAction"] = str;
|
json["doubleButtonPressAction"] = str;
|
||||||
json["detachedCylinder"] = config.detachedCylinder;
|
json["detachedCylinder"] = config.detachedCylinder;
|
||||||
|
|
||||||
@@ -966,7 +967,7 @@ void NukiNetworkLock::publishAdvancedConfig(const NukiLock::AdvancedConfig &conf
|
|||||||
if (_isUltra)
|
if (_isUltra)
|
||||||
{
|
{
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
motorSpeedToString(config.motorSpeed, str);
|
NukiHelper::motorSpeedToString(config.motorSpeed, str);
|
||||||
json["motorSpeed"] = str;
|
json["motorSpeed"] = str;
|
||||||
json["enableSlowSpeedDuringNightMode"] = config.enableSlowSpeedDuringNightMode;
|
json["enableSlowSpeedDuringNightMode"] = config.enableSlowSpeedDuringNightMode;
|
||||||
}
|
}
|
||||||
@@ -1666,102 +1667,6 @@ void NukiNetworkLock::setupHASS(int type, uint32_t nukiId, char* nukiName, const
|
|||||||
_network->setupHASS(type, nukiId, nukiName, firmwareVersion, hardwareVersion, hasDoorSensor, hasKeypad);
|
_network->setupHASS(type, nukiId, nukiName, firmwareVersion, hardwareVersion, hasDoorSensor, hasKeypad);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NukiNetworkLock::buttonPressActionToString(const NukiLock::ButtonPressAction btnPressAction, char* str)
|
|
||||||
{
|
|
||||||
switch (btnPressAction)
|
|
||||||
{
|
|
||||||
case NukiLock::ButtonPressAction::NoAction:
|
|
||||||
strcpy(str, "No Action");
|
|
||||||
break;
|
|
||||||
case NukiLock::ButtonPressAction::Intelligent:
|
|
||||||
strcpy(str, "Intelligent");
|
|
||||||
break;
|
|
||||||
case NukiLock::ButtonPressAction::Unlock:
|
|
||||||
strcpy(str, "Unlock");
|
|
||||||
break;
|
|
||||||
case NukiLock::ButtonPressAction::Lock:
|
|
||||||
strcpy(str, "Lock");
|
|
||||||
break;
|
|
||||||
case NukiLock::ButtonPressAction::Unlatch:
|
|
||||||
strcpy(str, "Unlatch");
|
|
||||||
break;
|
|
||||||
case NukiLock::ButtonPressAction::LockNgo:
|
|
||||||
strcpy(str, "Lock n Go");
|
|
||||||
break;
|
|
||||||
case NukiLock::ButtonPressAction::ShowStatus:
|
|
||||||
strcpy(str, "Show Status");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
strcpy(str, "undefined");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void NukiNetworkLock::motorSpeedToString(const NukiLock::MotorSpeed speed, char* str)
|
|
||||||
{
|
|
||||||
switch (speed)
|
|
||||||
{
|
|
||||||
case NukiLock::MotorSpeed::Standard:
|
|
||||||
strcpy(str, "Standard");
|
|
||||||
break;
|
|
||||||
case NukiLock::MotorSpeed::Insane:
|
|
||||||
strcpy(str, "Insane");
|
|
||||||
break;
|
|
||||||
case NukiLock::MotorSpeed::Gentle:
|
|
||||||
strcpy(str, "Gentle");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
strcpy(str, "undefined");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void NukiNetworkLock::homeKitStatusToString(const int hkstatus, char* str)
|
|
||||||
{
|
|
||||||
switch (hkstatus)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
strcpy(str, "Not Available");
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
strcpy(str, "Disabled");
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
strcpy(str, "Enabled");
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
strcpy(str, "Enabled & Paired");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
strcpy(str, "undefined");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void NukiNetworkLock::fobActionToString(const int fobact, char* str)
|
|
||||||
{
|
|
||||||
switch (fobact)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
strcpy(str, "No Action");
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
strcpy(str, "Unlock");
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
strcpy(str, "Lock");
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
strcpy(str, "Lock n Go");
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
strcpy(str, "Intelligent");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
strcpy(str, "undefined");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const uint32_t NukiNetworkLock::getAuthId() const
|
const uint32_t NukiNetworkLock::getAuthId() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -67,10 +67,6 @@ private:
|
|||||||
const bool comparePrefixedPath(const char* fullPath, const char* subPath);
|
const bool comparePrefixedPath(const char* fullPath, const char* subPath);
|
||||||
|
|
||||||
void publishKeypadEntry(const String topic, NukiLock::KeypadEntry entry);
|
void publishKeypadEntry(const String topic, NukiLock::KeypadEntry entry);
|
||||||
void buttonPressActionToString(const NukiLock::ButtonPressAction btnPressAction, char* str);
|
|
||||||
void motorSpeedToString(const NukiLock::MotorSpeed speed, char* str);
|
|
||||||
void homeKitStatusToString(const int hkstatus, char* str);
|
|
||||||
void fobActionToString(const int fobact, char* str);
|
|
||||||
|
|
||||||
void (*_officialUpdateReceivedCallback)(const char* path, const char* value) = nullptr;
|
void (*_officialUpdateReceivedCallback)(const char* path, const char* value) = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
#include "hal/wdt_hal.h"
|
#include "hal/wdt_hal.h"
|
||||||
|
#include "util/NukiOpenerHelper.h"
|
||||||
|
|
||||||
NukiNetworkOpener::NukiNetworkOpener(NukiNetwork* network, Preferences* preferences, char* buffer, size_t bufferSize)
|
NukiNetworkOpener::NukiNetworkOpener(NukiNetwork* network, Preferences* preferences, char* buffer, size_t bufferSize)
|
||||||
: _preferences(preferences),
|
: _preferences(preferences),
|
||||||
@@ -771,7 +772,7 @@ void NukiNetworkOpener::publishConfig(const NukiOpener::Config &config)
|
|||||||
//json["latitude"] = config.latitude;
|
//json["latitude"] = config.latitude;
|
||||||
//json["longitude"] = config.longitude;
|
//json["longitude"] = config.longitude;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
capabilitiesToString(config.capabilities, str);
|
NukiOpenerHelper::capabilitiesToString(config.capabilities, str);
|
||||||
json["capabilities"] = str;
|
json["capabilities"] = str;
|
||||||
json["pairingEnabled"] = config.pairingEnabled;
|
json["pairingEnabled"] = config.pairingEnabled;
|
||||||
json["buttonEnabled"] = config.buttonEnabled;
|
json["buttonEnabled"] = config.buttonEnabled;
|
||||||
@@ -781,16 +782,16 @@ void NukiNetworkOpener::publishConfig(const NukiOpener::Config &config)
|
|||||||
json["dstMode"] = config.dstMode;
|
json["dstMode"] = config.dstMode;
|
||||||
json["hasFob"] = config.hasFob;
|
json["hasFob"] = config.hasFob;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
fobActionToString(config.fobAction1, str);
|
NukiOpenerHelper::fobActionToString(config.fobAction1, str);
|
||||||
json["fobAction1"] = str;
|
json["fobAction1"] = str;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
fobActionToString(config.fobAction2, str);
|
NukiOpenerHelper::fobActionToString(config.fobAction2, str);
|
||||||
json["fobAction2"] = str;
|
json["fobAction2"] = str;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
fobActionToString(config.fobAction3, str);
|
NukiOpenerHelper::fobActionToString(config.fobAction3, str);
|
||||||
json["fobAction3"] = str;
|
json["fobAction3"] = str;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
operatingModeToString(config.operatingMode, str);
|
NukiOpenerHelper::operatingModeToString(config.operatingMode, str);
|
||||||
json["operatingMode"] = str;
|
json["operatingMode"] = str;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
_network->advertisingModeToString(config.advertisingMode, str);
|
_network->advertisingModeToString(config.advertisingMode, str);
|
||||||
@@ -831,28 +832,28 @@ void NukiNetworkOpener::publishAdvancedConfig(const NukiOpener::AdvancedConfig &
|
|||||||
json["disableRtoAfterRing"] = config.disableRtoAfterRing;
|
json["disableRtoAfterRing"] = config.disableRtoAfterRing;
|
||||||
json["rtoTimeout"] = config.rtoTimeout;
|
json["rtoTimeout"] = config.rtoTimeout;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
doorbellSuppressionToString(config.doorbellSuppression, str);
|
NukiOpenerHelper::doorbellSuppressionToString(config.doorbellSuppression, str);
|
||||||
json["doorbellSuppression"] = str;
|
json["doorbellSuppression"] = str;
|
||||||
json["doorbellSuppressionDuration"] = config.doorbellSuppressionDuration;
|
json["doorbellSuppressionDuration"] = config.doorbellSuppressionDuration;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
soundToString(config.soundRing, str);
|
NukiOpenerHelper::soundToString(config.soundRing, str);
|
||||||
json["soundRing"] = str;
|
json["soundRing"] = str;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
soundToString(config.soundOpen, str);
|
NukiOpenerHelper::soundToString(config.soundOpen, str);
|
||||||
json["soundOpen"] = str;
|
json["soundOpen"] = str;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
soundToString(config.soundRto, str);
|
NukiOpenerHelper::soundToString(config.soundRto, str);
|
||||||
json["soundRto"] = str;
|
json["soundRto"] = str;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
soundToString(config.soundCm, str);
|
NukiOpenerHelper::soundToString(config.soundCm, str);
|
||||||
json["soundCm"] = str;
|
json["soundCm"] = str;
|
||||||
json["soundConfirmation"] = config.soundConfirmation;
|
json["soundConfirmation"] = config.soundConfirmation;
|
||||||
json["soundLevel"] = config.soundLevel;
|
json["soundLevel"] = config.soundLevel;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
buttonPressActionToString(config.singleButtonPressAction, str);
|
NukiOpenerHelper::buttonPressActionToString(config.singleButtonPressAction, str);
|
||||||
json["singleButtonPressAction"] = str;
|
json["singleButtonPressAction"] = str;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
buttonPressActionToString(config.doubleButtonPressAction, str);
|
NukiOpenerHelper::buttonPressActionToString(config.doubleButtonPressAction, str);
|
||||||
json["doubleButtonPressAction"] = str;
|
json["doubleButtonPressAction"] = str;
|
||||||
memset(str, 0, sizeof(str));
|
memset(str, 0, sizeof(str));
|
||||||
_network->batteryTypeToString(config.batteryType, str);
|
_network->batteryTypeToString(config.batteryType, str);
|
||||||
@@ -1541,199 +1542,4 @@ uint8_t NukiNetworkOpener::queryCommands()
|
|||||||
void NukiNetworkOpener::setupHASS(int type, uint32_t nukiId, char* nukiName, const char* firmwareVersion, const char* hardwareVersion, bool hasDoorSensor, bool hasKeypad)
|
void NukiNetworkOpener::setupHASS(int type, uint32_t nukiId, char* nukiName, const char* firmwareVersion, const char* hardwareVersion, bool hasDoorSensor, bool hasKeypad)
|
||||||
{
|
{
|
||||||
_network->setupHASS(type, nukiId, nukiName, firmwareVersion, hardwareVersion, hasDoorSensor, hasKeypad);
|
_network->setupHASS(type, nukiId, nukiName, firmwareVersion, hardwareVersion, hasDoorSensor, hasKeypad);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NukiNetworkOpener::buttonPressActionToString(const NukiOpener::ButtonPressAction btnPressAction, char* str)
|
|
||||||
{
|
|
||||||
switch (btnPressAction)
|
|
||||||
{
|
|
||||||
case NukiOpener::ButtonPressAction::NoAction:
|
|
||||||
strcpy(str, "No Action");
|
|
||||||
break;
|
|
||||||
case NukiOpener::ButtonPressAction::ToggleRTO:
|
|
||||||
strcpy(str, "Toggle RTO");
|
|
||||||
break;
|
|
||||||
case NukiOpener::ButtonPressAction::ActivateRTO:
|
|
||||||
strcpy(str, "Activate RTO");
|
|
||||||
break;
|
|
||||||
case NukiOpener::ButtonPressAction::DeactivateRTO:
|
|
||||||
strcpy(str, "Deactivate RTO");
|
|
||||||
break;
|
|
||||||
case NukiOpener::ButtonPressAction::ToggleCM:
|
|
||||||
strcpy(str, "Toggle CM");
|
|
||||||
break;
|
|
||||||
case NukiOpener::ButtonPressAction::ActivateCM:
|
|
||||||
strcpy(str, "Activate CM");
|
|
||||||
break;
|
|
||||||
case NukiOpener::ButtonPressAction::DectivateCM:
|
|
||||||
strcpy(str, "Deactivate CM");
|
|
||||||
break;
|
|
||||||
case NukiOpener::ButtonPressAction::Open:
|
|
||||||
strcpy(str, "Open");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
strcpy(str, "undefined");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void NukiNetworkOpener::fobActionToString(const int fobact, char* str)
|
|
||||||
{
|
|
||||||
switch (fobact)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
strcpy(str, "No Action");
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
strcpy(str, "Toggle RTO");
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
strcpy(str, "Activate RTO");
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
strcpy(str, "Deactivate RTO");
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
strcpy(str, "Open");
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
strcpy(str, "Ring");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
strcpy(str, "undefined");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void NukiNetworkOpener::capabilitiesToString(const int capabilities, char* str)
|
|
||||||
{
|
|
||||||
switch (capabilities)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
strcpy(str, "Door opener");
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
strcpy(str, "Both");
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
strcpy(str, "RTO");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
strcpy(str, "undefined");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void NukiNetworkOpener::operatingModeToString(const int opmode, char* str)
|
|
||||||
{
|
|
||||||
switch (opmode)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
strcpy(str, "Generic door opener");
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
strcpy(str, "Analogue intercom");
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
strcpy(str, "Digital intercom");
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
strcpy(str, "Siedle");
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
strcpy(str, "TCS");
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
strcpy(str, "Bticino");
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
strcpy(str, "Siedle HTS");
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
strcpy(str, "STR");
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
strcpy(str, "Ritto");
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
strcpy(str, "Fermax");
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
strcpy(str, "Comelit");
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
strcpy(str, "Urmet BiBus");
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
strcpy(str, "Urmet 2Voice");
|
|
||||||
break;
|
|
||||||
case 13:
|
|
||||||
strcpy(str, "Golmar");
|
|
||||||
break;
|
|
||||||
case 14:
|
|
||||||
strcpy(str, "SKS");
|
|
||||||
break;
|
|
||||||
case 15:
|
|
||||||
strcpy(str, "Spare");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
strcpy(str, "undefined");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void NukiNetworkOpener::doorbellSuppressionToString(const int dbsupr, char* str)
|
|
||||||
{
|
|
||||||
switch (dbsupr)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
strcpy(str, "Off");
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
strcpy(str, "CM");
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
strcpy(str, "RTO");
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
strcpy(str, "CM & RTO");
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
strcpy(str, "Ring");
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
strcpy(str, "CM & Ring");
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
strcpy(str, "RTO & Ring");
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
strcpy(str, "CM & RTO & Ring");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
strcpy(str, "undefined");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void NukiNetworkOpener::soundToString(const int sound, char* str)
|
|
||||||
{
|
|
||||||
switch (sound)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
strcpy(str, "No Sound");
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
strcpy(str, "Sound 1");
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
strcpy(str, "Sound 2");
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
strcpy(str, "Sound 3");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
strcpy(str, "undefined");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -60,12 +60,6 @@ private:
|
|||||||
|
|
||||||
void buildMqttPath(const char* path, char* outPath);
|
void buildMqttPath(const char* path, char* outPath);
|
||||||
void subscribe(const char* path);
|
void subscribe(const char* path);
|
||||||
void buttonPressActionToString(const NukiOpener::ButtonPressAction btnPressAction, char* str);
|
|
||||||
void fobActionToString(const int fobact, char* str);
|
|
||||||
void operatingModeToString(const int opmode, char* str);
|
|
||||||
void doorbellSuppressionToString(const int dbsupr, char* str);
|
|
||||||
void soundToString(const int sound, char* str);
|
|
||||||
void capabilitiesToString(const int capabilities, char* str);
|
|
||||||
|
|
||||||
String concat(String a, String b);
|
String concat(String a, String b);
|
||||||
|
|
||||||
|
|||||||
@@ -349,6 +349,104 @@ const NukiLock::MotorSpeed NukiHelper::motorSpeedToEnum(const char* str)
|
|||||||
return (NukiLock::MotorSpeed)0xff;
|
return (NukiLock::MotorSpeed)0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NukiHelper::buttonPressActionToString(const NukiLock::ButtonPressAction btnPressAction, char* str)
|
||||||
|
{
|
||||||
|
switch (btnPressAction)
|
||||||
|
{
|
||||||
|
case NukiLock::ButtonPressAction::NoAction:
|
||||||
|
strcpy(str, "No Action");
|
||||||
|
break;
|
||||||
|
case NukiLock::ButtonPressAction::Intelligent:
|
||||||
|
strcpy(str, "Intelligent");
|
||||||
|
break;
|
||||||
|
case NukiLock::ButtonPressAction::Unlock:
|
||||||
|
strcpy(str, "Unlock");
|
||||||
|
break;
|
||||||
|
case NukiLock::ButtonPressAction::Lock:
|
||||||
|
strcpy(str, "Lock");
|
||||||
|
break;
|
||||||
|
case NukiLock::ButtonPressAction::Unlatch:
|
||||||
|
strcpy(str, "Unlatch");
|
||||||
|
break;
|
||||||
|
case NukiLock::ButtonPressAction::LockNgo:
|
||||||
|
strcpy(str, "Lock n Go");
|
||||||
|
break;
|
||||||
|
case NukiLock::ButtonPressAction::ShowStatus:
|
||||||
|
strcpy(str, "Show Status");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
strcpy(str, "undefined");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NukiHelper::motorSpeedToString(const NukiLock::MotorSpeed speed, char* str)
|
||||||
|
{
|
||||||
|
switch (speed)
|
||||||
|
{
|
||||||
|
case NukiLock::MotorSpeed::Standard:
|
||||||
|
strcpy(str, "Standard");
|
||||||
|
break;
|
||||||
|
case NukiLock::MotorSpeed::Insane:
|
||||||
|
strcpy(str, "Insane");
|
||||||
|
break;
|
||||||
|
case NukiLock::MotorSpeed::Gentle:
|
||||||
|
strcpy(str, "Gentle");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
strcpy(str, "undefined");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NukiHelper::homeKitStatusToString(const int hkstatus, char* str)
|
||||||
|
{
|
||||||
|
switch (hkstatus)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
strcpy(str, "Not Available");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
strcpy(str, "Disabled");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
strcpy(str, "Enabled");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
strcpy(str, "Enabled & Paired");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
strcpy(str, "undefined");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NukiHelper::fobActionToString(const int fobact, char* str)
|
||||||
|
{
|
||||||
|
switch (fobact)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
strcpy(str, "No Action");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
strcpy(str, "Unlock");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
strcpy(str, "Lock");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
strcpy(str, "Lock n Go");
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
strcpy(str, "Intelligent");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
strcpy(str, "undefined");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void NukiHelper::printCommandResult(Nuki::CmdResult result)
|
void NukiHelper::printCommandResult(Nuki::CmdResult result)
|
||||||
{
|
{
|
||||||
char resultStr[15];
|
char resultStr[15];
|
||||||
|
|||||||
@@ -14,5 +14,10 @@ public:
|
|||||||
static const Nuki::BatteryType batteryTypeToEnum(const char* str);
|
static const Nuki::BatteryType batteryTypeToEnum(const char* str);
|
||||||
static const NukiLock::MotorSpeed motorSpeedToEnum(const char* str);
|
static const NukiLock::MotorSpeed motorSpeedToEnum(const char* str);
|
||||||
|
|
||||||
|
static void buttonPressActionToString(const NukiLock::ButtonPressAction btnPressAction, char* str);
|
||||||
|
static void motorSpeedToString(const NukiLock::MotorSpeed speed, char* str);
|
||||||
|
static void homeKitStatusToString(const int hkstatus, char* str);
|
||||||
|
static void fobActionToString(const int fobact, char* str);
|
||||||
|
|
||||||
static void printCommandResult(Nuki::CmdResult result);
|
static void printCommandResult(Nuki::CmdResult result);
|
||||||
};
|
};
|
||||||
@@ -271,6 +271,202 @@ const Nuki::BatteryType NukiOpenerHelper::batteryTypeToEnum(const char* str)
|
|||||||
return (Nuki::BatteryType)0xff;
|
return (Nuki::BatteryType)0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NukiOpenerHelper::buttonPressActionToString(const NukiOpener::ButtonPressAction btnPressAction, char* str)
|
||||||
|
{
|
||||||
|
switch (btnPressAction)
|
||||||
|
{
|
||||||
|
case NukiOpener::ButtonPressAction::NoAction:
|
||||||
|
strcpy(str, "No Action");
|
||||||
|
break;
|
||||||
|
case NukiOpener::ButtonPressAction::ToggleRTO:
|
||||||
|
strcpy(str, "Toggle RTO");
|
||||||
|
break;
|
||||||
|
case NukiOpener::ButtonPressAction::ActivateRTO:
|
||||||
|
strcpy(str, "Activate RTO");
|
||||||
|
break;
|
||||||
|
case NukiOpener::ButtonPressAction::DeactivateRTO:
|
||||||
|
strcpy(str, "Deactivate RTO");
|
||||||
|
break;
|
||||||
|
case NukiOpener::ButtonPressAction::ToggleCM:
|
||||||
|
strcpy(str, "Toggle CM");
|
||||||
|
break;
|
||||||
|
case NukiOpener::ButtonPressAction::ActivateCM:
|
||||||
|
strcpy(str, "Activate CM");
|
||||||
|
break;
|
||||||
|
case NukiOpener::ButtonPressAction::DectivateCM:
|
||||||
|
strcpy(str, "Deactivate CM");
|
||||||
|
break;
|
||||||
|
case NukiOpener::ButtonPressAction::Open:
|
||||||
|
strcpy(str, "Open");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
strcpy(str, "undefined");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NukiOpenerHelper::fobActionToString(const int fobact, char* str)
|
||||||
|
{
|
||||||
|
switch (fobact)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
strcpy(str, "No Action");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
strcpy(str, "Toggle RTO");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
strcpy(str, "Activate RTO");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
strcpy(str, "Deactivate RTO");
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
strcpy(str, "Open");
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
strcpy(str, "Ring");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
strcpy(str, "undefined");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NukiOpenerHelper::capabilitiesToString(const int capabilities, char* str)
|
||||||
|
{
|
||||||
|
switch (capabilities)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
strcpy(str, "Door opener");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
strcpy(str, "Both");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
strcpy(str, "RTO");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
strcpy(str, "undefined");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NukiOpenerHelper::operatingModeToString(const int opmode, char* str)
|
||||||
|
{
|
||||||
|
switch (opmode)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
strcpy(str, "Generic door opener");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
strcpy(str, "Analogue intercom");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
strcpy(str, "Digital intercom");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
strcpy(str, "Siedle");
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
strcpy(str, "TCS");
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
strcpy(str, "Bticino");
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
strcpy(str, "Siedle HTS");
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
strcpy(str, "STR");
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
strcpy(str, "Ritto");
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
strcpy(str, "Fermax");
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
strcpy(str, "Comelit");
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
strcpy(str, "Urmet BiBus");
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
strcpy(str, "Urmet 2Voice");
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
strcpy(str, "Golmar");
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
strcpy(str, "SKS");
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
strcpy(str, "Spare");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
strcpy(str, "undefined");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NukiOpenerHelper::doorbellSuppressionToString(const int dbsupr, char* str)
|
||||||
|
{
|
||||||
|
switch (dbsupr)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
strcpy(str, "Off");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
strcpy(str, "CM");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
strcpy(str, "RTO");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
strcpy(str, "CM & RTO");
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
strcpy(str, "Ring");
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
strcpy(str, "CM & Ring");
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
strcpy(str, "RTO & Ring");
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
strcpy(str, "CM & RTO & Ring");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
strcpy(str, "undefined");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NukiOpenerHelper::soundToString(const int sound, char* str)
|
||||||
|
{
|
||||||
|
switch (sound)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
strcpy(str, "No Sound");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
strcpy(str, "Sound 1");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
strcpy(str, "Sound 2");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
strcpy(str, "Sound 3");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
strcpy(str, "undefined");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void NukiOpenerHelper::printCommandResult(Nuki::CmdResult result)
|
void NukiOpenerHelper::printCommandResult(Nuki::CmdResult result)
|
||||||
{
|
{
|
||||||
char resultStr[15];
|
char resultStr[15];
|
||||||
|
|||||||
@@ -13,5 +13,12 @@ public:
|
|||||||
static const NukiOpener::ButtonPressAction buttonPressActionToEnum(const char* str);
|
static const NukiOpener::ButtonPressAction buttonPressActionToEnum(const char* str);
|
||||||
static const Nuki::BatteryType batteryTypeToEnum(const char* str);
|
static const Nuki::BatteryType batteryTypeToEnum(const char* str);
|
||||||
|
|
||||||
|
static void buttonPressActionToString(const NukiOpener::ButtonPressAction btnPressAction, char* str);
|
||||||
|
static void fobActionToString(const int fobact, char* str);
|
||||||
|
static void operatingModeToString(const int opmode, char* str);
|
||||||
|
static void doorbellSuppressionToString(const int dbsupr, char* str);
|
||||||
|
static void soundToString(const int sound, char* str);
|
||||||
|
static void capabilitiesToString(const int capabilities, char* str);
|
||||||
|
|
||||||
static void printCommandResult(Nuki::CmdResult result);
|
static void printCommandResult(Nuki::CmdResult result);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user