Nuki BLE ESP32
Loading...
Searching...
No Matches
Nuki Namespace Reference

Classes

class  NukiBle
 
class  SmartlockEventHandler
 

Enumerations

enum class  AdvertisingMode : uint8_t { Automatic = 0x00 , Normal = 0x01 , Slow = 0x02 , Slowest = 0x03 }
 
enum class  AuthorizationIdType : uint8_t { App = 0 , Bridge = 1 , Fob = 2 , Keypad = 3 }
 
enum class  BatteryType : uint8_t { Alkali = 0x00 , Accumulators = 0x01 , Lithium = 0x02 }
 
enum  CmdResult : uint8_t {
  Success = 1 , Failed = 2 , TimeOut = 3 , Working = 4 ,
  NotPaired = 5 , Lock_Busy = 6 , Error = 99
}
 
enum class  Command : uint16_t {
  Empty = 0x0000 , RequestData = 0x0001 , PublicKey = 0x0003 , Challenge = 0x0004 ,
  AuthorizationAuthenticator = 0x0005 , AuthorizationData = 0x0006 , AuthorizationId = 0x0007 , RemoveUserAuthorization = 0x0008 ,
  RequestAuthorizationEntries = 0x0009 , AuthorizationEntry = 0x000A , AuthorizationDatInvite = 0x000B , KeyturnerStates = 0x000C ,
  LockAction = 0x000D , Status = 0x000E , MostRecentCommand = 0x000F , OpeningsClosingsSummary = 0x0010 ,
  BatteryReport = 0x0011 , ErrorReport = 0x0012 , SetConfig = 0x0013 , RequestConfig = 0x0014 ,
  Config = 0x0015 , SetSecurityPin = 0x0019 , RequestCalibration = 0x001A , RequestReboot = 0x001D ,
  AuthorizationIdConfirmation = 0x001E , AuthorizationIdInvite = 0x001F , VerifySecurityPin = 0x0020 , UpdateTime = 0x0021 ,
  UpdateAuthorization = 0x0025 , AuthorizationEntryCount = 0x0027 , StartBusSignalRecording = 0x002F , RequestLogEntries = 0x0031 ,
  LogEntry = 0x0032 , LogEntryCount = 0x0033 , EnableLogging = 0x0034 , SetAdvancedConfig = 0x0035 ,
  RequestAdvancedConfig = 0x0036 , AdvancedConfig = 0x0037 , AddTimeControlEntry = 0x0039 , TimeControlEntryId = 0x003A ,
  RemoveTimeControlEntry = 0x003B , RequestTimeControlEntries = 0x003C , TimeControlEntryCount = 0x003D , TimeControlEntry = 0x003E ,
  UpdateTimeControlEntry = 0x003F , AddKeypadCode = 0x0041 , KeypadCodeId = 0x0042 , RequestKeypadCodes = 0x0043 ,
  KeypadCodeCount = 0x0044 , KeypadCode = 0x0045 , UpdateKeypadCode = 0x0046 , RemoveKeypadCode = 0x0047 ,
  KeypadAction = 0x0048 , ContinuousModeAction = 0x0057 , SimpleLockAction = 0x0100
}
 
enum class  CommandState {
  Idle = 0 , CmdReceived = 1 , ChallengeSent = 2 , ChallengeRespReceived = 3 ,
  CmdSent = 4 , CmdAccepted = 5 , TimeOut = 6
}
 
enum class  CommandStatus : uint8_t { Complete = 0x00 , Accepted = 0x01 }
 
enum class  CommandType { Command = 0 , CommandWithChallenge = 1 , CommandWithChallengeAndAccept = 2 , CommandWithChallengeAndPin = 3 }
 
enum class  DoorSensorState : uint8_t {
  Unavailable = 0x00 , Deactivated = 0x01 , DoorClosed = 0x02 , DoorOpened = 0x03 ,
  DoorStateUnknown = 0x04 , Calibrating = 0x05
}
 
enum class  EventType { KeyTurnerStatusUpdated }
 
enum class  PairingResult : uint8_t { Pairing , Success , Timeout }
 
enum class  PairingState {
  InitPairing = 0 , ReqRemPubKey = 1 , RecRemPubKey = 2 , SendPubKey = 3 ,
  GenKeyPair = 4 , CalculateAuth = 5 , SendAuth = 6 , SendAuthData = 7 ,
  SendAuthIdConf = 8 , RecStatus = 9 , Success = 10 , Timeout = 99
}
 
enum class  TimeZoneId : uint16_t {
  Africa_Cairo = 0 , Africa_Lagos = 1 , Africa_Maputo = 2 , Africa_Nairobi = 3 ,
  America_Anchorage = 4 , America_Argentina_Buenos_Aires = 5 , America_Chicago = 6 , America_Denver = 7 ,
  America_Halifax = 8 , America_Los_Angeles = 9 , America_Manaus = 10 , America_Mexico_City = 11 ,
  America_New_York = 12 , America_Phoenix = 13 , America_Regina = 14 , America_Santiago = 15 ,
  America_Sao_Paulo = 16 , America_St_Johns = 17 , Asia_Bangkok = 18 , Asia_Dubai = 19 ,
  Asia_Hong_Kong = 20 , Asia_Jerusalem = 21 , Asia_Karachi = 22 , Asia_Kathmandu = 23 ,
  Asia_Kolkata = 24 , Asia_Riyadh = 25 , Asia_Seoul = 26 , Asia_Shanghai = 27 ,
  Asia_Tehran = 28 , Asia_Tokyo = 29 , Asia_Yangon = 30 , Australia_Adelaide = 31 ,
  Australia_Brisbane = 32 , Australia_Darwin = 33 , Australia_Hobart = 34 , Australia_Perth = 35 ,
  Australia_Sydney = 36 , Europe_Berlin = 37 , Europe_Helsinki = 38 , Europe_Istanbul = 39 ,
  Europe_London = 40 , Europe_Moscow = 41 , Pacific_Auckland = 42 , Pacific_Guam = 43 ,
  Pacific_Honolulu = 44 , Pacific_Pago_Pago = 45 , None = 65535
}
 

Functions

struct __attribute__ ((packed)) NewKeypadEntry
 
unsigned int calculateCrc (uint8_t *data, uint8_t start, uint16_t length)
 
unsigned int calculateCrc (uint8_t data[], uint8_t start, uint16_t length)
 
bool compareCharArray (unsigned char *a, unsigned char *b, uint8_t len)
 
bool crcValid (uint8_t *pData, uint16_t length)
 
int decode (unsigned char *output, unsigned char *input, unsigned long long len, unsigned char *nonce, unsigned char *keyS)
 
int encode (unsigned char *output, unsigned char *input, unsigned long long len, unsigned char *nonce, unsigned char *keyS)
 
void generateNonce (unsigned char *hexArray, uint8_t nrOfBytes)
 
template<std::size_t N>
uint8_t getWeekdaysIntFromBitset (const std::bitset< N > bits)
 Translate a bitset<N> into Nuki weekdays int.
 
bool isCharArrayEmpty (unsigned char *array, uint16_t len)
 
bool isCharArrayNotEmpty (unsigned char *array, uint16_t len)
 
void printBuffer (const byte *buff, const uint8_t size, const boolean asChars, const char *header)
 

Variables

const char AUTH_ID_STORE_NAME [] = "authorizationId"
 
const char BLE_ADDRESS_STORE_NAME [] = "bleAddress"
 
const char * NUKI_SEMAPHORE_OWNER = "Nuki"
 
const char SECRET_KEY_STORE_NAME [] = "secretKeyK"
 
const char SECURITY_PINCODE_STORE_NAME [] = "securityPinCode"
 

Enumeration Type Documentation

◆ AdvertisingMode

enum class Nuki::AdvertisingMode : uint8_t
strong
Enumerator
Automatic 
Normal 
Slow 
Slowest 

◆ AuthorizationIdType

enum class Nuki::AuthorizationIdType : uint8_t
strong
Enumerator
App 
Bridge 
Fob 
Keypad 

◆ BatteryType

enum class Nuki::BatteryType : uint8_t
strong
Enumerator
Alkali 
Accumulators 
Lithium 

◆ CmdResult

enum Nuki::CmdResult : uint8_t
Enumerator
Success 
Failed 
TimeOut 
Working 
NotPaired 
Lock_Busy 
Error 

◆ Command

enum class Nuki::Command : uint16_t
strong
Enumerator
Empty 
RequestData 
PublicKey 
Challenge 
AuthorizationAuthenticator 
AuthorizationData 
AuthorizationId 
RemoveUserAuthorization 
RequestAuthorizationEntries 
AuthorizationEntry 
AuthorizationDatInvite 
KeyturnerStates 
LockAction 
Status 
MostRecentCommand 
OpeningsClosingsSummary 
BatteryReport 
ErrorReport 
SetConfig 
RequestConfig 
Config 
SetSecurityPin 
RequestCalibration 
RequestReboot 
AuthorizationIdConfirmation 
AuthorizationIdInvite 
VerifySecurityPin 
UpdateTime 
UpdateAuthorization 
AuthorizationEntryCount 
StartBusSignalRecording 
RequestLogEntries 
LogEntry 
LogEntryCount 
EnableLogging 
SetAdvancedConfig 
RequestAdvancedConfig 
AdvancedConfig 
AddTimeControlEntry 
TimeControlEntryId 
RemoveTimeControlEntry 
RequestTimeControlEntries 
TimeControlEntryCount 
TimeControlEntry 
UpdateTimeControlEntry 
AddKeypadCode 
KeypadCodeId 
RequestKeypadCodes 
KeypadCodeCount 
KeypadCode 
UpdateKeypadCode 
RemoveKeypadCode 
KeypadAction 
ContinuousModeAction 
SimpleLockAction 

◆ CommandState

enum class Nuki::CommandState
strong
Enumerator
Idle 
CmdReceived 
ChallengeSent 
ChallengeRespReceived 
CmdSent 
CmdAccepted 
TimeOut 

◆ CommandStatus

enum class Nuki::CommandStatus : uint8_t
strong
Enumerator
Complete 
Accepted 

◆ CommandType

enum class Nuki::CommandType
strong
Enumerator
Command 
CommandWithChallenge 
CommandWithChallengeAndAccept 
CommandWithChallengeAndPin 

◆ DoorSensorState

enum class Nuki::DoorSensorState : uint8_t
strong
Enumerator
Unavailable 
Deactivated 
DoorClosed 
DoorOpened 
DoorStateUnknown 
Calibrating 

◆ EventType

enum class Nuki::EventType
strong
Enumerator
KeyTurnerStatusUpdated 

◆ PairingResult

enum class Nuki::PairingResult : uint8_t
strong
Enumerator
Pairing 
Success 
Timeout 

◆ PairingState

enum class Nuki::PairingState
strong
Enumerator
InitPairing 
ReqRemPubKey 
RecRemPubKey 
SendPubKey 
GenKeyPair 
CalculateAuth 
SendAuth 
SendAuthData 
SendAuthIdConf 
RecStatus 
Success 
Timeout 

◆ TimeZoneId

enum class Nuki::TimeZoneId : uint16_t
strong
Enumerator
Africa_Cairo 
Africa_Lagos 
Africa_Maputo 
Africa_Nairobi 
America_Anchorage 
America_Argentina_Buenos_Aires 
America_Chicago 
America_Denver 
America_Halifax 
America_Los_Angeles 
America_Manaus 
America_Mexico_City 
America_New_York 
America_Phoenix 
America_Regina 
America_Santiago 
America_Sao_Paulo 
America_St_Johns 
Asia_Bangkok 
Asia_Dubai 
Asia_Hong_Kong 
Asia_Jerusalem 
Asia_Karachi 
Asia_Kathmandu 
Asia_Kolkata 
Asia_Riyadh 
Asia_Seoul 
Asia_Shanghai 
Asia_Tehran 
Asia_Tokyo 
Asia_Yangon 
Australia_Adelaide 
Australia_Brisbane 
Australia_Darwin 
Australia_Hobart 
Australia_Perth 
Australia_Sydney 
Europe_Berlin 
Europe_Helsinki 
Europe_Istanbul 
Europe_London 
Europe_Moscow 
Pacific_Auckland 
Pacific_Guam 
Pacific_Honolulu 
Pacific_Pago_Pago 
None 

Function Documentation

◆ __attribute__()

struct Nuki::__attribute__ ( (packed) )

◆ calculateCrc() [1/2]

unsigned int Nuki::calculateCrc ( uint8_t * data,
uint8_t start,
uint16_t length )
+ Here is the caller graph for this function:

◆ calculateCrc() [2/2]

unsigned int Nuki::calculateCrc ( uint8_t data[],
uint8_t start,
uint16_t length )

◆ compareCharArray()

bool Nuki::compareCharArray ( unsigned char * a,
unsigned char * b,
uint8_t len )

◆ crcValid()

bool Nuki::crcValid ( uint8_t * pData,
uint16_t length )
+ Here is the call graph for this function:

◆ decode()

int Nuki::decode ( unsigned char * output,
unsigned char * input,
unsigned long long len,
unsigned char * nonce,
unsigned char * keyS )

◆ encode()

int Nuki::encode ( unsigned char * output,
unsigned char * input,
unsigned long long len,
unsigned char * nonce,
unsigned char * keyS )

◆ generateNonce()

void Nuki::generateNonce ( unsigned char * hexArray,
uint8_t nrOfBytes )
+ Here is the call graph for this function:

◆ getWeekdaysIntFromBitset()

template<std::size_t N>
uint8_t Nuki::getWeekdaysIntFromBitset ( const std::bitset< N > bits)

Translate a bitset<N> into Nuki weekdays int.

Template Parameters
N
Parameters
bitsetwith bitset[0] = Monday ... bitset[7] = Sunday
Returns
uint8_t with bit6 = Monday ... bit0 = Sunday

◆ isCharArrayEmpty()

bool Nuki::isCharArrayEmpty ( unsigned char * array,
uint16_t len )

◆ isCharArrayNotEmpty()

bool Nuki::isCharArrayNotEmpty ( unsigned char * array,
uint16_t len )

◆ printBuffer()

void Nuki::printBuffer ( const byte * buff,
const uint8_t size,
const boolean asChars,
const char * header )
+ Here is the caller graph for this function:

Variable Documentation

◆ AUTH_ID_STORE_NAME

const char Nuki::AUTH_ID_STORE_NAME[] = "authorizationId"

◆ BLE_ADDRESS_STORE_NAME

const char Nuki::BLE_ADDRESS_STORE_NAME[] = "bleAddress"

◆ NUKI_SEMAPHORE_OWNER

const char* Nuki::NUKI_SEMAPHORE_OWNER = "Nuki"

◆ SECRET_KEY_STORE_NAME

const char Nuki::SECRET_KEY_STORE_NAME[] = "secretKeyK"

◆ SECURITY_PINCODE_STORE_NAME

const char Nuki::SECURITY_PINCODE_STORE_NAME[] = "securityPinCode"