NLPairingCodeUtils

Summary

Inheritance

Inherits from: NSObject

Public static functions

isValidPairingCode:(NSString *pairingCode)
virtual BOOL
Determine if a Nest pairing code is valid.
kryptoniteDeviceIdToPairingCode:(uint64_t deviceId)
virtual NSString *
Generates a Kryptonite pairing code string given a Nevis device id.
kryptonitePairingCodeToDeviceId:(NSString *pairingCode)
virtual uint64_t
Returns the device ID encoded in Kryptonite pairing code.
nevisDeviceIdToPairingCode:(uint64_t deviceId)
virtual NSString *
Generates a Nevis pairing code string given a Nevis device id.
nevisPairingCodeToDeviceId:(NSString *pairingCode)
virtual uint64_t
Returns the device ID encoded in Nevis pairing code.
normalizePairingCode:(NSString *pairingCode)
virtual NSString *
Normalize the characters in a pairing code string.

Public static functions

isValidPairingCode:

virtual BOOL isValidPairingCode:(
  NSString *pairingCode
)

Determine if a Nest pairing code is valid.

Details
Parameters
[in] pairingCode
The pairing code string to be checked.
Returns
TRUE if the supplied pairing code is valid.

kryptoniteDeviceIdToPairingCode:

virtual NSString * kryptoniteDeviceIdToPairingCode:(
  uint64_t deviceId
)

Generates a Kryptonite pairing code string given a Nevis device id.

Details
Parameters
[in] deviceId
A Kryptonite device id.
Returns
A pairing code string, or nil if the supplied device id is out of range.

kryptonitePairingCodeToDeviceId:

virtual uint64_t kryptonitePairingCodeToDeviceId:(
  NSString *pairingCode
)

Returns the device ID encoded in Kryptonite pairing code.

Details
Parameters
[in] pairingCode
A string containing a Kryptonite pairing code.
Returns
A Nevis device id, or 0 if the supplied pairing code was invalid.

nevisDeviceIdToPairingCode:

virtual NSString * nevisDeviceIdToPairingCode:(
  uint64_t deviceId
)

Generates a Nevis pairing code string given a Nevis device id.

Details
Parameters
[in] deviceId
A Nevis device id.
Returns
A pairing code string, or nil if the supplied device id is out of range.

nevisPairingCodeToDeviceId:

virtual uint64_t nevisPairingCodeToDeviceId:(
  NSString *pairingCode
)

Returns the device ID encoded in Nevis pairing code.

Details
Parameters
[in] pairingCode
A string containing a Nevis pairing code.
Returns
A Nevis device id, or 0 if the supplied pairing code was invalid.

normalizePairingCode:

virtual NSString * normalizePairingCode:(
  NSString *pairingCode
)

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.

If the pairing code contains invalid characters, other than those listed above, the function returns nil.

Details
Parameters
[in] pairingCode
The pairing code string to be normalized.
Returns
The normalized pairing code.