Fix authName
This commit is contained in:
@@ -21,8 +21,6 @@ NetworkLock::NetworkLock(Network* network, Preferences* preferences, char* buffe
|
||||
_configTopics.push_back(mqtt_topic_config_auto_lock);
|
||||
_configTopics.push_back(mqtt_topic_config_single_lock);
|
||||
|
||||
memset(authName, 0, sizeof(authName));
|
||||
|
||||
_network->registerMqttReceiver(this);
|
||||
}
|
||||
|
||||
@@ -325,9 +323,9 @@ void NetworkLock::publishKeyTurnerState(const NukiLock::KeyTurnerState& keyTurne
|
||||
}
|
||||
}
|
||||
|
||||
json["auth_id"] = authId;
|
||||
json["auth_name"] = authName;
|
||||
|
||||
json["auth_id"] = _authId;
|
||||
json["auth_name"] = _authName;
|
||||
|
||||
serializeJson(json, _buffer, _bufferSize);
|
||||
publishString(mqtt_topic_lock_json, _buffer);
|
||||
|
||||
@@ -372,8 +370,9 @@ void NetworkLock::publishAuthorizationInfo(const std::list<NukiLock::LogEntry>&
|
||||
{
|
||||
char str[50];
|
||||
|
||||
bool authFound = false;
|
||||
memset(authName, 0, sizeof(authName));
|
||||
_authId = 0;
|
||||
_authName = "";
|
||||
_authFound = false;
|
||||
|
||||
JsonDocument json;
|
||||
|
||||
@@ -385,11 +384,11 @@ void NetworkLock::publishAuthorizationInfo(const std::list<NukiLock::LogEntry>&
|
||||
break;
|
||||
}
|
||||
--i;
|
||||
if((log.loggingType == NukiLock::LoggingType::LockAction || log.loggingType == NukiLock::LoggingType::KeypadAction) && ! authFound)
|
||||
if((log.loggingType == NukiLock::LoggingType::LockAction || log.loggingType == NukiLock::LoggingType::KeypadAction) && ! _authFound)
|
||||
{
|
||||
authFound = true;
|
||||
authId = log.authId;
|
||||
memcpy(authName, log.name, sizeof(log.name));
|
||||
_authFound = true;
|
||||
_authId = log.authId;
|
||||
_authName = (char*)log.name;
|
||||
}
|
||||
|
||||
auto entry = json.add();
|
||||
@@ -462,10 +461,10 @@ void NetworkLock::publishAuthorizationInfo(const std::list<NukiLock::LogEntry>&
|
||||
serializeJson(json, _buffer, _bufferSize);
|
||||
publishString(mqtt_topic_lock_log, _buffer);
|
||||
|
||||
if(authFound)
|
||||
if(_authFound)
|
||||
{
|
||||
publishUInt(mqtt_topic_lock_auth_id, authId);
|
||||
publishString(mqtt_topic_lock_auth_name, authName);
|
||||
publishUInt(mqtt_topic_lock_auth_id, _authId);
|
||||
publishString(mqtt_topic_lock_auth_name, _authName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user