nl:: PairingCode
Summary
Enumerations |
|
---|---|
@353
|
enum |
@354
|
enum |
@355
|
enum |
@356{
|
enum |
Functions |
|
---|---|
GeneratePairingCode(uint8_t pairingCodeLen, char *outBuf)
|
Generate a random pairing code.
|
IntToPairingCode(uint64_t val, uint8_t pairingCodeLen, char *outBuf)
|
Encode an integer value as a Weave pairing code.
|
IntToPairingCodeChar(int val)
|
char
Convert an integer value in the range 0..31 to its corresponding Weave pairing code character.
|
IsValidPairingCodeChar(char ch)
|
bool
Returns true if a supplied character is a valid Weave pairing code character.
|
KryptoniteDeviceIdToPairingCode(uint64_t deviceId, char *pairingCodeBuf, size_t pairingCodeBufSize)
|
Generates a Kryptonite pairing code string given a Kryptonite device id.
|
KryptonitePairingCodeToDeviceId(const char *pairingCode, uint64_t & deviceId)
|
Returns the device ID encoded in Kryptonite pairing code.
|
NevisDeviceIdToPairingCode(uint64_t deviceId, char *pairingCodeBuf, size_t pairingCodeBufSize)
|
Generates a Nevis pairing code string given a Nevis device id.
|
NevisPairingCodeToDeviceId(const char *pairingCode, uint64_t & deviceId)
|
Returns the device ID encoded in Nevis pairing code.
|
NormalizePairingCode(char *pairingCode, size_t & pairingCodeLen)
|
void
Normalize the characters in a pairing code string.
|
PairingCodeCharToInt(char ch)
|
int
Convert a Weave pairing code character to an integer value in the range 0..31.
|
PairingCodeToInt(const char *pairingCode, size_t pairingCodeLen, uint64_t & val)
|
Decode a Weave pairing code as an integer value.
|
VerifyPairingCode(const char *pairingCode, size_t pairingCodeLen)
|
Verify a Weave pairing code against its check character.
|
Enumerations
@353
@353
@354
@354
@355
@355
@356
@356
Functions
GeneratePairingCode
WEAVE_ERROR GeneratePairingCode( uint8_t pairingCodeLen, char *outBuf )
Generate a random pairing code.
The function generates a random Weave pairing code string with a specified length. value, encoded as a big-endian, base-32 numeral, plus a trailing Verhoeff check character. The generated string has a fixed length specified by the pairingCodeLen parameter. The string is padded on the left with zeros as necessary to meet this length.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Return Values |
|
IntToPairingCode
WEAVE_ERROR IntToPairingCode( uint64_t val, uint8_t pairingCodeLen, char *outBuf )
Encode an integer value as a Weave pairing code.
The function generates a Weave pairing code string consisting of a supplied unsigned integer value, encoded as a big-endian, base-32 numeral, plus a trailing Verhoeff check character. The generated string has a fixed length specified by the pairingCodeLen parameter. The string is padded on the left with zeros as necessary to meet this length.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Return Values |
|
IntToPairingCodeChar
char IntToPairingCodeChar( int val )
Convert an integer value in the range 0..31 to its corresponding Weave pairing code character.
Note that this function always produces upper-case characters.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The pairing code character that corresponds to the specified integer value, or 0 if the integer value is out of range.
|
IsValidPairingCodeChar
bool IsValidPairingCodeChar( char ch )
Returns true if a supplied character is a valid Weave pairing code character.
Note that this function is case-insensitive.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
True if a supplied character is a valid Weave pairing code character.
|
KryptoniteDeviceIdToPairingCode
WEAVE_ERROR KryptoniteDeviceIdToPairingCode( uint64_t deviceId, char *pairingCodeBuf, size_t pairingCodeBufSize )
Generates a Kryptonite pairing code string given a Kryptonite device id.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Return Values |
|
KryptonitePairingCodeToDeviceId
WEAVE_ERROR KryptonitePairingCodeToDeviceId( const char *pairingCode, uint64_t & deviceId )
Returns the device ID encoded in Kryptonite pairing code.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Return Values |
|
NevisDeviceIdToPairingCode
WEAVE_ERROR NevisDeviceIdToPairingCode( uint64_t deviceId, char *pairingCodeBuf, size_t pairingCodeBufSize )
Generates a Nevis pairing code string given a Nevis device id.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Return Values |
|
NevisPairingCodeToDeviceId
WEAVE_ERROR NevisPairingCodeToDeviceId( const char *pairingCode, uint64_t & deviceId )
Returns the device ID encoded in Nevis pairing code.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Return Values |
|
NormalizePairingCode
void NormalizePairingCode( char *pairingCode, size_t & pairingCodeLen )
Normalize the characters in a pairing code string.
This function converts all alphabetic characters to upper-case, maps the illegal characters 'I', 'O', 'Q' and 'Z' to '1', '0', '0' and '2', respectively, and removes all other non-pairing code characters from the given string.
The input string is not required to be NULL terminated, however if it is the output will be NULL terminated as well.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
PairingCodeCharToInt
int PairingCodeCharToInt( char ch )
Convert a Weave pairing code character to an integer value in the range 0..31.
Note that this function is case-insensitive.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
An integer value corresponding to the specified pairing code character, or -1 if ch is not a valid character.
|
PairingCodeToInt
WEAVE_ERROR PairingCodeToInt( const char *pairingCode, size_t pairingCodeLen, uint64_t & val )
Decode a Weave pairing code as an integer value.
The function parses the initial characters of a Weave pairing code string as a big-endian, base-32 numeral and returns the resultant value as an unsigned integer. The input string can be any length >= 2 so long as the decoded integer fits within a uint64_t.
No attempt is made to verify the Verhoeff check character (see VerifyPairingCode()).
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Return Values |
|
VerifyPairingCode
WEAVE_ERROR VerifyPairingCode( const char *pairingCode, size_t pairingCodeLen )
Verify a Weave pairing code against its check character.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Return Values |
|