sort keypad codes

This commit is contained in:
technyon
2022-08-12 23:50:50 +02:00
parent d1b8b5377f
commit 8c53e93e9d

View File

@@ -254,6 +254,8 @@ void NukiWrapper::updateKeypad()
std::list<NukiLock::KeypadEntry> entries;
_nukiLock.getKeypadEntries(&entries);
entries.sort([](const NukiLock::KeypadEntry& a, const NukiLock::KeypadEntry& b) { return a.codeId < b.codeId; });
uint keypadCount = entries.size();
if(keypadCount > _maxKeypadCodeCount)
{
@@ -367,7 +369,7 @@ void NukiWrapper::onKeypadCommandReceived(const char *command, const uint &id, c
bool idExists = std::find(_keypadCodeIds.begin(), _keypadCodeIds.end(), id) != _keypadCodeIds.end();
int codeInt = code.toInt();
bool codeValid = codeInt > 100000 && (code.indexOf('0') == -1);
bool codeValid = codeInt > 100000 && codeInt < 1000000 && (code.indexOf('0') == -1);
NukiLock::CmdResult result = (NukiLock::CmdResult)-1;
if(strcmp(command, "add") == 0)