Nuki BLE ESP32
Loading...
Searching...
No Matches
NukiLock::NukiLock Class Reference

#include <NukiLock.h>

+ Inheritance diagram for NukiLock::NukiLock:
+ Collaboration diagram for NukiLock::NukiLock:

Public Member Functions

 NukiLock (const std::string &deviceName, const uint32_t deviceId)
 
Nuki::CmdResult addTimeControlEntry (NewTimeControlEntry newTimecontrolEntry)
 Sends a new time(d) control entry via BLE to the lock. This entry is independant of keypad or authorization entries, it will execute the defined action at the defined time in the newTimeControlEntry.
 
Nuki::CmdResult disableAutoUnlock (const bool disable)
 Gets the current advanced config from the lock, updates the disable autounlock parameter and sends the new advanced config to the lock via BLE.
 
Nuki::CmdResult disableNightModeAutoUnlock (const bool disable)
 Gets the current config from the lock, updates the night mode auto unlock parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult enableAutoBatteryTypeDetection (const bool enable)
 Gets the current advanced config from the lock, updates the enable battery type detection parameter and sends the new advanced config to the lock via BLE.
 
Nuki::CmdResult enableAutoLock (const bool enable)
 Gets the current advanced config from the lock, updates the enable autolock parameter and sends the new advanced config to the lock via BLE.
 
Nuki::CmdResult enableAutoUnlatch (const bool enable)
 Gets the current config from the lock, updates the auto unlatch parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult enableAutoUpdate (const bool enable)
 Gets the current advanced config from the lock, updates the enable auto update parameter and sends the new advanced config to the lock via BLE (Updating the firmware requires the Nuki app. CAUTION: updating FW could cause breaking changes)
 
Nuki::CmdResult enableButton (const bool enable)
 Gets the current config from the lock, updates the enable button parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult enableDetachedCylinder (const bool enable)
 Gets the current config from the lock, updates the detached cylinder parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult enableDst (const bool enable)
 Gets the current config from the lock, updates the dst parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult enableImmediateAutoLock (const bool enable)
 Gets the current advanced config from the lock, updates the enable immediate autolock parameter and sends the new advanced config to the lock via BLE.
 
Nuki::CmdResult enableLedFlash (const bool enable)
 Gets the current config from the lock, updates the whether or not the flashing LED should be enabled to signal an unlocked door. And sends the new config to the lock via BLE.
 
Nuki::CmdResult enableNightMode (const bool enable)
 Gets the current config from the lock, updates the night mode parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult enableNightModeAutoLock (const bool enable)
 Gets the current config from the lock, updates the night mode auto lock parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult enableNightModeImmediateLockOnStart (const bool enable)
 Gets the current config from the lock, updates the night mode immediate lock on start parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult enablePairing (const bool enable)
 Sets the lock ability to pair with other devices (can be used to prevent unauthorized pairing) Gets the current config from the lock, updates the pairing parameter and sends the new config to the lock via BLE (CAUTION: if pairing is set to false and credentials are deleted a factory reset of the lock needs to be performed before pairing is possible again)
 
Nuki::CmdResult enableSingleLock (const bool enable)
 Gets the current config from the lock, updates the LED brightness parameter and sends the new config to the lock via BLE.
 
uint8_t getBatteryPerc ()
 Returns battery charge percentage state parsed from the battery state byte (battery critical byte)
 
const ErrorCode getLastError () const
 Get the Last Error code received from the lock.
 
void getLogEntries (std::list< LogEntry > *requestedLogEntries)
 Get the Log Entries stored on the esp. Only available after executing retreiveLogEntries.
 
void getTimeControlEntries (std::list< TimeControlEntry > *timeControlEntries)
 Get the time control entries stored on the esp (after executing retrieveTimeControlEntries())
 
bool isBatteryCharging ()
 Returns battery charging state parsed from the battery state byte (battery critical byte)
 
bool isBatteryCritical ()
 Returns battery critical state parsed from the battery state byte (battery critical byte)
 
bool isKeypadBatteryCritical ()
 Returns keypad battery critical state in case this is supported.
 
Nuki::CmdResult keypadAction (KeypadActionSource source, uint32_t code, KeypadAction keypadAction)
 Send a keypad action entry to the lock via BLE.
 
Nuki::CmdResult lockAction (const LockAction lockAction, const uint32_t nukiAppId=1, const uint8_t flags=0, const char *nameSuffix=nullptr, const uint8_t nameSuffixLen=0)
 Sends lock action cmd via BLE to the lock.
 
virtual void logErrorCode (uint8_t errorCode) override
 
bool pairingEnabled ()
 Gets the lock current config wrt pairing with other devices.
 
Nuki::CmdResult removeTimeControlEntry (uint8_t entryId)
 Deletes a time(d) control entry via BLE to the lock. (see addTimeControlEntry())
 
Nuki::CmdResult requestAdvancedConfig (AdvancedConfig *retrievedAdvancedConfig)
 Requests advanced config from Lock via BLE.
 
Nuki::CmdResult requestBatteryReport (BatteryReport *retrievedBatteryReport)
 Requests battery status from Lock via BLE.
 
Nuki::CmdResult requestConfig (Config *retrievedConfig)
 Requests config from Lock via BLE.
 
Nuki::CmdResult requestKeyTurnerState (KeyTurnerState *retrievedKeyTurnerState)
 Requests keyturner state from Lock via BLE.
 
void retrieveKeyTunerState (KeyTurnerState *retrievedKeyTurnerState)
 Gets the last keyturner state stored on the esp.
 
Nuki::CmdResult retrieveLogEntries (const uint32_t startIndex, const uint16_t count, const uint8_t sortOrder, const bool totalCount)
 Request the lock via BLE to send the log entries.
 
Nuki::CmdResult retrieveTimeControlEntries ()
 Request the lock via BLE to send the existing time control entries.
 
Nuki::CmdResult setAdvertisingMode (const AdvertisingMode mode)
 Gets the current config from the lock, updates the advertising frequency parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult setAutoLockTimeOut (const uint8_t timeout)
 Gets the current config from the lock, updates the auto lock timeout parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult setBatteryType (const BatteryType type)
 Gets the current advanced config from the lock, updates the battery type parameter and sends the new advanced config to the lock via BLE.
 
Nuki::CmdResult setDoubleButtonPressAction (const ButtonPressAction action)
 Gets the current advanced config from the lock, updates the double button press action parameter and sends the new advanced config to the lock via BLE.
 
Nuki::CmdResult setFobAction (const uint8_t fobActionNr, const uint8_t fobAction)
 Gets the current config from the lock, updates the given fob action parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult setLatitude (const float degrees)
 Gets the current config from the lock, updates the latitude parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult setLedBrightness (const uint8_t level)
 Gets the current config from the lock, updates the LED brightness parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult setLockedPositionOffsetDegrees (const int16_t degrees)
 Gets the current config from the lock, updates the locked position offset degrees parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult setLockNgoTimeout (const uint8_t timeout)
 Gets the current config from the lock, updates the lock n go timeout parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult setLongitude (const float degrees)
 Gets the current config from the lock, updates the longitude parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult setName (const std::string &name)
 Gets the current config from the lock, updates the name parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult setNightModeEndTime (unsigned char endtime[2])
 Gets the current config from the lock, updates the night mode end time parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult setNightModeStartTime (unsigned char starttime[2])
 Gets the current config from the lock, updates the night mode start time parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult setSingleButtonPressAction (const ButtonPressAction action)
 Gets the current advanced config from the lock, updates the single button press action parameter and sends the new advanced config to the lock via BLE.
 
Nuki::CmdResult setSingleLockedPositionOffsetDegrees (const int16_t degrees)
 Gets the current config from the lock, updates the single locked position offset degrees parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult setTimeZoneId (const TimeZoneId timeZoneId)
 Gets the current config from the lock, updates the timezone id parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult setTimeZoneOffset (const int16_t minutes)
 Gets the current config from the lock, updates the timezone offset parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult setUnlatchDuration (const uint8_t duration)
 Gets the current config from the lock, updates the unlatch duration parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult setUnlockedPositionOffsetDegrees (const int16_t degrees)
 Gets the current config from the lock, updates the unlocked position offset degrees parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult setUnlockedToLockedTransitionOffsetDegrees (const int16_t degrees)
 Gets the current config from the lock, updates the unlocked to locked transition offset degrees parameter and sends the new config to the lock via BLE.
 
Nuki::CmdResult updateTimeControlEntry (TimeControlEntry TimeControlEntry)
 Sends an updated time(d) control entry via BLE to the lock. (see addTimeControlEntry())
 
- Public Member Functions inherited from Nuki::NukiBle
 NukiBle (const std::string &deviceName, const uint32_t deviceId, const NimBLEUUID pairingServiceUUID, const NimBLEUUID deviceServiceUUID, const NimBLEUUID gdioUUID, const NimBLEUUID userDataUUID, const std::string preferencedId)
 
virtual ~NukiBle ()
 
Nuki::CmdResult addAuthorizationEntry (NewAuthorizationEntry newAuthorizationEntry)
 Sends a new authorization entry to the lock via BLE.
 
Nuki::CmdResult addKeypadEntry (NewKeypadEntry newKeypadEntry)
 Send a new keypad entry to the lock via BLE.
 
Nuki::CmdResult deleteAuthorizationEntry (const uint32_t id)
 Deletes the authorization entry from the lock.
 
CmdResult deleteKeypadEntry (uint16_t id)
 Delete a Keypad Entry.
 
void getAuthorizationEntries (std::list< AuthorizationEntry > *requestedAuthorizationEntries)
 Get the Authorization Entries stored on the esp (after executing retreiveAuthorizationEntries)
 
const BLEAddress getBleAddress () const
 Returns the BLE address of the device if paired.
 
void getKeypadEntries (std::list< KeypadEntry > *requestedKeyPadEntries)
 Get the Keypad Entries stored on the esp (after executing retreieveLogKeypadEntries)
 
uint16_t getKeypadEntryCount ()
 Returns the keypad entry count. Only available after executing retreiveKeypadEntries.
 
unsigned long getLastHeartbeat ()
 Returns the timestamp (millis) of the last received BLE beacon from the lock.
 
unsigned long getLastReceivedBeaconTs () const
 Returns the timestamp in milliseconds when the last ble beacon has been received from the device.
 
uint16_t getLogEntryCount ()
 Returns the log entry count. Only available after executing retreiveLogEntries.
 
void getMacAddress (char *macAddress)
 Gets the ble mac address of the paired lock stored on the esp.
 
int getRssi () const
 Returns the RSSI of the last received ble beacon broadcast.
 
uint16_t getSecurityPincode ()
 Gets the pincode stored on the esp. This pincode is used for sending/setting config via BLE to the lock by other methods and needs to be the same pincode as stored in the lock.
 
void initialize ()
 Initializes stored preferences based on the devicename passed in the constructor, creates the BLE client, sets the BLE callback and checks if the lock is paired (if credentials are stored in preferences)
 
const bool isPairedWithLock () const
 Returns pairing state (if credentials are stored or not)
 
Nuki::PairingResult pairNuki (AuthorizationIdType idType=AuthorizationIdType::Bridge)
 Checks if credentials are stored in preferences, if not initiate pairing.
 
void registerBleScanner (BleScanner::Publisher *bleScanner)
 Registers the BLE scanner to be used for scanning for advertisements from the lock. BleScanner::Publisher is defined in dependent library https://github.com/I-Connect/BleScanner.git.
 
Nuki::CmdResult requestCalibration ()
 Sends an calibration (mechanical) request to the lock via BLE.
 
Nuki::CmdResult requestReboot ()
 Sends an reboot request to the lock via BLE.
 
Nuki::CmdResult retrieveAuthorizationEntries (const uint16_t offset, const uint16_t count)
 Request the lock via BLE to send the existing authorizationentries.
 
Nuki::CmdResult retrieveKeypadEntries (const uint16_t offset, const uint16_t count)
 Request the lock via BLE to send the existing keypad entries.
 
bool saveSecurityPincode (const uint16_t pinCode)
 Saves the pincode on the esp. This pincode is used for sending/setting config via BLE to the lock by other methods and needs to be the same pincode as stored in the lock.
 
void setConnectRetries (uint8_t retries)
 Set the BLE Connect number of retries.
 
void setConnectTimeout (uint8_t timeout)
 Set the BLE Connect Timeout in seconds.
 
void setDisconnectTimeout (uint32_t timeoutMs)
 Set the BLE Disconnect Timeout, if longer than ~20 sec the lock will disconnect by itself if there is no BLE communication.
 
void setEventHandler (Nuki::SmartlockEventHandler *handler)
 Set the Event Handler object.
 
void setPower (esp_power_level_t powerLevel)
 the transmission power.
 
Nuki::CmdResult setSecurityPin (const uint16_t newSecurityPin)
 Send the new pincode command to the lock via BLE (this command uses the earlier by saveSecurityPincode() stored pincode which needs to be the same as the pincode stored in the lock)
 
void unPairNuki ()
 Delete stored credentials.
 
Nuki::CmdResult updateAuthorizationEntry (UpdatedAuthorizationEntry updatedAuthorizationEntry)
 Sends an updated authorization entry to the lock via BLE.
 
void updateConnectionState ()
 checks the time past after last connect/communication sent, if the time past > timeout it will disconnect the BLE connection with the lock so that lock will start sending advertisements.
 
Nuki::CmdResult updateKeypadEntry (UpdatedKeypadEntry updatedKeyPadEntry)
 Send an updated keypad entry to the lock via BLE.
 
Nuki::CmdResult updateTime (TimeValue time)
 Sends the time to be set to the lock via BLE.
 
Nuki::CmdResult verifySecurityPin ()
 Send the verify pincode command via BLE to the lock. This command uses the earlier by saveSecurityPincode() stored pincode.
 

Protected Member Functions

void handleReturnMessage (Command returnCode, unsigned char *data, uint16_t dataLen) override
 
- Protected Member Functions inherited from Nuki::NukiBle
template<typename TDeviceAction >
Nuki::CmdResult cmdChallAccStateMachine (const TDeviceAction action)
 
template<typename TDeviceAction >
Nuki::CmdResult cmdChallStateMachine (const TDeviceAction action, const bool sendPinCode=false)
 
template<typename TDeviceAction >
Nuki::CmdResult cmdStateMachine (const TDeviceAction action)
 
bool connectBle (const BLEAddress bleAddress, bool pairing)
 
template<typename TDeviceAction >
Nuki::CmdResult executeAction (const TDeviceAction action)
 
void extendDisconnectTimeout ()
 

Additional Inherited Members

- Protected Attributes inherited from Nuki::NukiBle
uint8_t errorCode = 0
 
Command lastMsgCodeReceived = Command::Empty
 

Constructor & Destructor Documentation

◆ NukiLock()

NukiLock::NukiLock::NukiLock ( const std::string & deviceName,
const uint32_t deviceId )

Member Function Documentation

◆ addTimeControlEntry()

Nuki::CmdResult NukiLock::NukiLock::addTimeControlEntry ( NewTimeControlEntry newTimecontrolEntry)

Sends a new time(d) control entry via BLE to the lock. This entry is independant of keypad or authorization entries, it will execute the defined action at the defined time in the newTimeControlEntry.

Parameters
newTimecontrolEntryNuki api based datatype to send
+ Here is the call graph for this function:

◆ disableAutoUnlock()

Nuki::CmdResult NukiLock::NukiLock::disableAutoUnlock ( const bool disable)

Gets the current advanced config from the lock, updates the disable autounlock parameter and sends the new advanced config to the lock via BLE.

Parameters
disabletrue if auto unlock should be disabled in general.

◆ disableNightModeAutoUnlock()

Nuki::CmdResult NukiLock::NukiLock::disableNightModeAutoUnlock ( const bool disable)

Gets the current config from the lock, updates the night mode auto unlock parameter and sends the new config to the lock via BLE.

Parameters
disabletrue if night mode auto unlock disabled

◆ enableAutoBatteryTypeDetection()

Nuki::CmdResult NukiLock::NukiLock::enableAutoBatteryTypeDetection ( const bool enable)

Gets the current advanced config from the lock, updates the enable battery type detection parameter and sends the new advanced config to the lock via BLE.

Parameters
enabletrue if the automatic detection of the battery type is enabled

◆ enableAutoLock()

Nuki::CmdResult NukiLock::NukiLock::enableAutoLock ( const bool enable)

Gets the current advanced config from the lock, updates the enable autolock parameter and sends the new advanced config to the lock via BLE.

Parameters
enabletrue if auto lock should be enabled in general.

◆ enableAutoUnlatch()

Nuki::CmdResult NukiLock::NukiLock::enableAutoUnlatch ( const bool enable)

Gets the current config from the lock, updates the auto unlatch parameter and sends the new config to the lock via BLE.

Parameters
enabletrue if auto unlatch should be enabled in general.

◆ enableAutoUpdate()

Nuki::CmdResult NukiLock::NukiLock::enableAutoUpdate ( const bool enable)

Gets the current advanced config from the lock, updates the enable auto update parameter and sends the new advanced config to the lock via BLE (Updating the firmware requires the Nuki app. CAUTION: updating FW could cause breaking changes)

Parameters
enabletrue if automatic firmware updates should be enabled

◆ enableButton()

Nuki::CmdResult NukiLock::NukiLock::enableButton ( const bool enable)

Gets the current config from the lock, updates the enable button parameter and sends the new config to the lock via BLE.

Parameters
enabletrue if button enabled

◆ enableDetachedCylinder()

Nuki::CmdResult NukiLock::NukiLock::enableDetachedCylinder ( const bool enable)

Gets the current config from the lock, updates the detached cylinder parameter and sends the new config to the lock via BLE.

Parameters
enabletrue if detached cylinder enabled (Flag that indicates that the inner side of the used cylinder is detached from the outer side and therefore the Smart Lock won’t recognize if someone operates the door by using a key)

◆ enableDst()

Nuki::CmdResult NukiLock::NukiLock::enableDst ( const bool enable)

Gets the current config from the lock, updates the dst parameter and sends the new config to the lock via BLE.

Parameters
enableThe desired daylight saving time mode. false disabled, true european

◆ enableImmediateAutoLock()

Nuki::CmdResult NukiLock::NukiLock::enableImmediateAutoLock ( const bool enable)

Gets the current advanced config from the lock, updates the enable immediate autolock parameter and sends the new advanced config to the lock via BLE.

Parameters
enabletrue if auto lock should be performed immediately after the door has been closed (requires active door sensor)

◆ enableLedFlash()

Nuki::CmdResult NukiLock::NukiLock::enableLedFlash ( const bool enable)

Gets the current config from the lock, updates the whether or not the flashing LED should be enabled to signal an unlocked door. And sends the new config to the lock via BLE.

Parameters
enabletrue if led enabled

◆ enableNightMode()

Nuki::CmdResult NukiLock::NukiLock::enableNightMode ( const bool enable)

Gets the current config from the lock, updates the night mode parameter and sends the new config to the lock via BLE.

Parameters
enabletrue if night mode enabled

◆ enableNightModeAutoLock()

Nuki::CmdResult NukiLock::NukiLock::enableNightModeAutoLock ( const bool enable)

Gets the current config from the lock, updates the night mode auto lock parameter and sends the new config to the lock via BLE.

Parameters
enabletrue if night mode auto lock enabled

◆ enableNightModeImmediateLockOnStart()

Nuki::CmdResult NukiLock::NukiLock::enableNightModeImmediateLockOnStart ( const bool enable)

Gets the current config from the lock, updates the night mode immediate lock on start parameter and sends the new config to the lock via BLE.

Parameters
enabletrue if night mode immediate lock on start enabled

◆ enablePairing()

Nuki::CmdResult NukiLock::NukiLock::enablePairing ( const bool enable)

Sets the lock ability to pair with other devices (can be used to prevent unauthorized pairing) Gets the current config from the lock, updates the pairing parameter and sends the new config to the lock via BLE (CAUTION: if pairing is set to false and credentials are deleted a factory reset of the lock needs to be performed before pairing is possible again)

Parameters
enabletrue if allowed to pair with other devices

◆ enableSingleLock()

Nuki::CmdResult NukiLock::NukiLock::enableSingleLock ( const bool enable)

Gets the current config from the lock, updates the LED brightness parameter and sends the new config to the lock via BLE.

Parameters
enabletrue if only a single lock should be performed

◆ getBatteryPerc()

uint8_t NukiLock::NukiLock::getBatteryPerc ( )

Returns battery charge percentage state parsed from the battery state byte (battery critical byte)

Note that retrieveOpenerState() needs to be called first to retrieve the needed data

Returns
percentage

◆ getLastError()

const ErrorCode NukiLock::NukiLock::getLastError ( ) const

Get the Last Error code received from the lock.

◆ getLogEntries()

void NukiLock::NukiLock::getLogEntries ( std::list< LogEntry > * requestedLogEntries)

Get the Log Entries stored on the esp. Only available after executing retreiveLogEntries.

Parameters
requestedLogEntrieslist to store the returned log entries

◆ getTimeControlEntries()

void NukiLock::NukiLock::getTimeControlEntries ( std::list< TimeControlEntry > * timeControlEntries)

Get the time control entries stored on the esp (after executing retrieveTimeControlEntries())

Parameters
timeControlEntrieslist to store the returned time control entries

◆ handleReturnMessage()

void NukiLock::NukiLock::handleReturnMessage ( Command returnCode,
unsigned char * data,
uint16_t dataLen )
overrideprotectedvirtual

Reimplemented from Nuki::NukiBle.

+ Here is the call graph for this function:

◆ isBatteryCharging()

bool NukiLock::NukiLock::isBatteryCharging ( )

Returns battery charging state parsed from the battery state byte (battery critical byte)

Note that retrieveOpenerState() needs to be called first to retrieve the needed data

Returns
true if charging

◆ isBatteryCritical()

bool NukiLock::NukiLock::isBatteryCritical ( )

Returns battery critical state parsed from the battery state byte (battery critical byte)

Note that retrieveOpenerState() needs to be called first to retrieve the needed data

Returns
true if critical

◆ isKeypadBatteryCritical()

bool NukiLock::NukiLock::isKeypadBatteryCritical ( )

Returns keypad battery critical state in case this is supported.

Note that retrieveOpenerState() needs to be called first to retrieve the needed data

Returns
true if critical

◆ keypadAction()

Nuki::CmdResult NukiLock::NukiLock::keypadAction ( KeypadActionSource source,
uint32_t code,
KeypadAction keypadAction )

Send a keypad action entry to the lock via BLE.

Parameters
source0x00 = arrow key, 0x01 = code
codeThe code that has been entered on the keypad
keypadActionThe action to be executed

◆ lockAction()

Nuki::CmdResult NukiLock::NukiLock::lockAction ( const LockAction lockAction,
const uint32_t nukiAppId = 1,
const uint8_t flags = 0,
const char * nameSuffix = nullptr,
const uint8_t nameSuffixLen = 0 )

Sends lock action cmd via BLE to the lock.

Parameters
lockAction
nukiAppId0 = App, 1 = Bridge, 2 = Fob, 3 = Keypad
flagsoptional
nameSuffixoptional
nameSuffixLenlen of nameSuffix if used ('\0' included, maximum 19)
Returns
Nuki::CmdResult

◆ logErrorCode()

void NukiLock::NukiLock::logErrorCode ( uint8_t errorCode)
overridevirtual

Implements Nuki::NukiBle.

+ Here is the call graph for this function:

◆ pairingEnabled()

bool NukiLock::NukiLock::pairingEnabled ( )

Gets the lock current config wrt pairing with other devices.

◆ removeTimeControlEntry()

Nuki::CmdResult NukiLock::NukiLock::removeTimeControlEntry ( uint8_t entryId)

Deletes a time(d) control entry via BLE to the lock. (see addTimeControlEntry())

Parameters
entryIdThe ID to be deleted, can be retrieved via retrieveTimeControlEntries()

◆ requestAdvancedConfig()

Nuki::CmdResult NukiLock::NukiLock::requestAdvancedConfig ( AdvancedConfig * retrievedAdvancedConfig)

Requests advanced config from Lock via BLE.

Parameters
retrievedAdvancedConfigNuki api based datatype to store the retrieved advanced config

◆ requestBatteryReport()

Nuki::CmdResult NukiLock::NukiLock::requestBatteryReport ( BatteryReport * retrievedBatteryReport)

Requests battery status from Lock via BLE.

Parameters
retrievedBatteryReportNuki api based datatype to store the retrieved battery status

◆ requestConfig()

Nuki::CmdResult NukiLock::NukiLock::requestConfig ( Config * retrievedConfig)

Requests config from Lock via BLE.

Parameters
retrievedConfigNuki api based datatype to store the retrieved config

◆ requestKeyTurnerState()

Nuki::CmdResult NukiLock::NukiLock::requestKeyTurnerState ( KeyTurnerState * retrievedKeyTurnerState)

Requests keyturner state from Lock via BLE.

Parameters
retrievedKeyTurnerStateNuki api based datatype to store the retrieved keyturnerstate

◆ retrieveKeyTunerState()

void NukiLock::NukiLock::retrieveKeyTunerState ( KeyTurnerState * retrievedKeyTurnerState)

Gets the last keyturner state stored on the esp.

Parameters
retrievedKeyTurnerStateNuki api based datatype to store the retrieved keyturnerstate

◆ retrieveLogEntries()

Nuki::CmdResult NukiLock::NukiLock::retrieveLogEntries ( const uint32_t startIndex,
const uint16_t count,
const uint8_t sortOrder,
const bool totalCount )

Request the lock via BLE to send the log entries.

Parameters
startIndexStartindex of first log msg to be send
countThe number of log entries to be read, starting at the specified start index.
sortOrderThe desired sort order
totalCounttrue if a Log Entry Count is requested from the lock

◆ retrieveTimeControlEntries()

Nuki::CmdResult NukiLock::NukiLock::retrieveTimeControlEntries ( )

Request the lock via BLE to send the existing time control entries.

◆ setAdvertisingMode()

Nuki::CmdResult NukiLock::NukiLock::setAdvertisingMode ( const AdvertisingMode mode)

Gets the current config from the lock, updates the advertising frequency parameter and sends the new config to the lock via BLE.

Parameters
mode0x00 Automatic, 0x01 Normal, 0x02 Slow, 0x03 Slowest (~400ms till ~1s)

◆ setAutoLockTimeOut()

Nuki::CmdResult NukiLock::NukiLock::setAutoLockTimeOut ( const uint8_t timeout)

Gets the current config from the lock, updates the auto lock timeout parameter and sends the new config to the lock via BLE.

Parameters
timeoutthe desired timeout until the smart lock relocks itself after it has been unlocked

◆ setBatteryType()

Nuki::CmdResult NukiLock::NukiLock::setBatteryType ( const BatteryType type)

Gets the current advanced config from the lock, updates the battery type parameter and sends the new advanced config to the lock via BLE.

Parameters
typeThe type of the batteries present in the smart lock.

◆ setDoubleButtonPressAction()

Nuki::CmdResult NukiLock::NukiLock::setDoubleButtonPressAction ( const ButtonPressAction action)

Gets the current advanced config from the lock, updates the double button press action parameter and sends the new advanced config to the lock via BLE.

Parameters
actionthe deired action for a double button press

◆ setFobAction()

Nuki::CmdResult NukiLock::NukiLock::setFobAction ( const uint8_t fobActionNr,
const uint8_t fobAction )

Gets the current config from the lock, updates the given fob action parameter and sends the new config to the lock via BLE.

Parameters
fobActionNrthe fob action to change (1 = single press, 2 = double press, 3 = triple press)
fobActionthe desired fob action setting

◆ setLatitude()

Nuki::CmdResult NukiLock::NukiLock::setLatitude ( const float degrees)

Gets the current config from the lock, updates the latitude parameter and sends the new config to the lock via BLE.

Parameters
degreesthe desired latitude

◆ setLedBrightness()

Nuki::CmdResult NukiLock::NukiLock::setLedBrightness ( const uint8_t level)

Gets the current config from the lock, updates the LED brightness parameter and sends the new config to the lock via BLE.

Parameters
levelThe LED brightness level. Possible values are 0 to 5 0 = off, …, 5 = max

◆ setLockedPositionOffsetDegrees()

Nuki::CmdResult NukiLock::NukiLock::setLockedPositionOffsetDegrees ( const int16_t degrees)

Gets the current config from the lock, updates the locked position offset degrees parameter and sends the new config to the lock via BLE.

Parameters
degreesthe desired offset that alters the locked position

◆ setLockNgoTimeout()

Nuki::CmdResult NukiLock::NukiLock::setLockNgoTimeout ( const uint8_t timeout)

Gets the current config from the lock, updates the lock n go timeout parameter and sends the new config to the lock via BLE.

Parameters
timeoutthe desired timeout for lock ‘n’ go

◆ setLongitude()

Nuki::CmdResult NukiLock::NukiLock::setLongitude ( const float degrees)

Gets the current config from the lock, updates the longitude parameter and sends the new config to the lock via BLE.

Parameters
degreesthe desired longitude

◆ setName()

Nuki::CmdResult NukiLock::NukiLock::setName ( const std::string & name)

Gets the current config from the lock, updates the name parameter and sends the new config to the lock via BLE.

Parameters
namemax 32 character name

◆ setNightModeEndTime()

Nuki::CmdResult NukiLock::NukiLock::setNightModeEndTime ( unsigned char endtime[2])

Gets the current config from the lock, updates the night mode end time parameter and sends the new config to the lock via BLE.

Parameters
endtimethe desired night mode end time

◆ setNightModeStartTime()

Nuki::CmdResult NukiLock::NukiLock::setNightModeStartTime ( unsigned char starttime[2])

Gets the current config from the lock, updates the night mode start time parameter and sends the new config to the lock via BLE.

Parameters
starttimethe desired night mode start time

◆ setSingleButtonPressAction()

Nuki::CmdResult NukiLock::NukiLock::setSingleButtonPressAction ( const ButtonPressAction action)

Gets the current advanced config from the lock, updates the single button press action parameter and sends the new advanced config to the lock via BLE.

Parameters
actionthe deired action for a single button press

◆ setSingleLockedPositionOffsetDegrees()

Nuki::CmdResult NukiLock::NukiLock::setSingleLockedPositionOffsetDegrees ( const int16_t degrees)

Gets the current config from the lock, updates the single locked position offset degrees parameter and sends the new config to the lock via BLE.

Parameters
degreesthe desired offset that alters the single locked position

◆ setTimeZoneId()

Nuki::CmdResult NukiLock::NukiLock::setTimeZoneId ( const TimeZoneId timeZoneId)

Gets the current config from the lock, updates the timezone id parameter and sends the new config to the lock via BLE.

Parameters
timeZoneIdThe id of the current timezone or 0xFFFF if timezones are not supported

◆ setTimeZoneOffset()

Nuki::CmdResult NukiLock::NukiLock::setTimeZoneOffset ( const int16_t minutes)

Gets the current config from the lock, updates the timezone offset parameter and sends the new config to the lock via BLE.

Parameters
minutesThe timezone offset (UTC) in minutes

◆ setUnlatchDuration()

Nuki::CmdResult NukiLock::NukiLock::setUnlatchDuration ( const uint8_t duration)

Gets the current config from the lock, updates the unlatch duration parameter and sends the new config to the lock via BLE.

Parameters
durationthe desired duration in seconds for holding the latch in unlatched position

◆ setUnlockedPositionOffsetDegrees()

Nuki::CmdResult NukiLock::NukiLock::setUnlockedPositionOffsetDegrees ( const int16_t degrees)

Gets the current config from the lock, updates the unlocked position offset degrees parameter and sends the new config to the lock via BLE.

Parameters
degreesthe desired offset that alters the unlocked position

◆ setUnlockedToLockedTransitionOffsetDegrees()

Nuki::CmdResult NukiLock::NukiLock::setUnlockedToLockedTransitionOffsetDegrees ( const int16_t degrees)

Gets the current config from the lock, updates the unlocked to locked transition offset degrees parameter and sends the new config to the lock via BLE.

Parameters
degreesthe desired offset that alters the position where transition from unlocked to locked happens

◆ updateTimeControlEntry()

Nuki::CmdResult NukiLock::NukiLock::updateTimeControlEntry ( TimeControlEntry TimeControlEntry)

Sends an updated time(d) control entry via BLE to the lock. (see addTimeControlEntry())

Parameters
TimeControlEntryNuki api based datatype to send. The ID can be retrieved via retrieveTimeControlEntries()
+ Here is the call graph for this function:

The documentation for this class was generated from the following files: