sort keypad codes
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user