nl::Weave::Profiles::DeviceDescription::WeaveDeviceDescriptor

#include <src/lib/profiles/device-description/DeviceDescription.h>

Contains descriptive information about a Weave device.

Summary

Constructors and Destructors

WeaveDeviceDescriptor(void)

Public types

@180{
  kMaxSerialNumberLength = 32,
  kMaxPairingCodeLength = 16,
  kMaxRendezvousWiFiESSID = 32,
  kMaxSoftwareVersionLength = WEAVE_CONFIG_MAX_SOFTWARE_VERSION_LENGTH
}
enum
Defines the maximum length of some attributes.
@181{
  kFeature_HomeAlarmLinkCapable = 0x00000001,
  kFeature_LinePowered = 0x00000002
}
enum
Feature flags indicating specific device capabilities.
@182{
  kFlag_IsRendezvousWiFiESSIDSuffix = 0x01
}
enum
Flags field definitions.

Public attributes

Day
uint8_t
Day of device manufacture (0 = not present)
DeviceFeatures
uint32_t
Bit field indicating support for specific device features.
DeviceId
uint64_t
Weave device ID (0 = not present)
FabricId
uint64_t
ID of Weave fabric to which the device belongs (0 = not present)
Flags
uint8_t
Bit field containing additional information about the device.
ManufacturingDate
struct nl::Weave::Profiles::DeviceDescription::WeaveDeviceDescriptor::@183
Month
uint8_t
Month of device manufacture (1 = January)
PairingCode[kMaxPairingCodeLength+1]
char
Device pairing code (NUL terminated, 0 length = not present)
PairingCompatibilityVersionMajor
uint16_t
Major device pairing software compatibility version.
PairingCompatibilityVersionMinor
uint16_t
Minor device pairing software compatibility version.
Primary802154MACAddress[8]
uint8_t
MAC address for primary 802.15.4 interface (big-endian, all zeros = not present)
PrimaryWiFiMACAddress[6]
uint8_t
MAC address for primary WiFi interface (big-endian, all zeros = not present)
ProductId
uint16_t
Device product code (0 = not present)
ProductRevision
uint16_t
Device product revision (0 = not present)
RendezvousWiFiESSID[kMaxRendezvousWiFiESSID+1]
char
ESSID for device WiFi rendezvous network (NUL terminated, 0 length = not present)
SerialNumber[kMaxSerialNumberLength+1]
char
Serial number of device (NUL terminated, 0 length = not present)
SoftwareVersion[kMaxSoftwareVersionLength+1]
char
Active software version (NUL terminated, 0 length = not present)
VendorId
uint16_t
Device vendor code (0 = not present)
Year
uint16_t
Year of device manufacture (valid range 2001 - 2099)

Public functions

Clear(void)
void
Clears the device description.

Public static functions

Decode(const uint8_t *data, uint32_t dataLen, WeaveDeviceDescriptor & outDesc)
Decodes the contents of the provided data buffer into a Weave Device Descriptor object.
DecodeTLV(const uint8_t *data, uint32_t dataLen, WeaveDeviceDescriptor & outDesc)
Decodes the contents of the provided TLV data buffer into a Weave Device Descriptor object.
DecodeTLV(nl::Weave::TLV::TLVReader & reader, WeaveDeviceDescriptor & outDesc)
Decodes the Device Description using the provided pre-initialized TLVReader.
DecodeText(const char *data, uint32_t dataLen, WeaveDeviceDescriptor & outDesc)
Decodes the contents of the provided text data buffer into a Weave Device Descriptor object.
EncodeTLV(const WeaveDeviceDescriptor & desc, uint8_t *buf, uint32_t bufLen, uint32_t & outEncodedLen)
Encodes the provided device descriptor as Weave TLV written to the supplied buffer.
EncodeTLV(const WeaveDeviceDescriptor & desc, nl::Weave::TLV::TLVWriter & writer)
Encodes the provided device descriptor as Weave TLV written using the provided pre-initialized TLVWriter object.
EncodeText(const WeaveDeviceDescriptor & desc, char *buf, uint32_t bufLen, uint32_t & outEncodedLen)
Encodes the provided device descriptor as text written to the supplied buffer.
IsZeroBytes(const uint8_t *buf, uint32_t len)
bool
Check if the specified buffer contains only zeros.

Public types

@180

 @180

Defines the maximum length of some attributes.

Properties
kMaxPairingCodeLength

Maximum pairing code length.

kMaxRendezvousWiFiESSID

Maximum WiFi ESSID for Rendezvous length.

kMaxSerialNumberLength

Maximum serial number length.

kMaxSoftwareVersionLength

Maximum software version length.

@181

 @181

Feature flags indicating specific device capabilities.

Properties
kFeature_HomeAlarmLinkCapable

Indicates a Nest Protect that supports connection to a home alarm panel.

kFeature_LinePowered

Indicates a device that requires line power.

@182

 @182

Flags field definitions.

Properties
kFlag_IsRendezvousWiFiESSIDSuffix

Indicates that the RendezvousWiFiESSID value is a suffix string that appears at the end of the ESSID of the device's WiFi rendezvous network.

Public attributes

Day

uint8_t Day

Day of device manufacture (0 = not present)

DeviceFeatures

uint32_t DeviceFeatures

Bit field indicating support for specific device features.

DeviceId

uint64_t DeviceId

Weave device ID (0 = not present)

FabricId

uint64_t FabricId

ID of Weave fabric to which the device belongs (0 = not present)

Flags

uint8_t Flags

Bit field containing additional information about the device.

ManufacturingDate

struct nl::Weave::Profiles::DeviceDescription::WeaveDeviceDescriptor::@183 ManufacturingDate

Month

uint8_t Month

Month of device manufacture (1 = January)

PairingCode

char PairingCode[kMaxPairingCodeLength+1]

Device pairing code (NUL terminated, 0 length = not present)

PairingCompatibilityVersionMajor

uint16_t PairingCompatibilityVersionMajor

Major device pairing software compatibility version.

PairingCompatibilityVersionMinor

uint16_t PairingCompatibilityVersionMinor

Minor device pairing software compatibility version.

Primary802154MACAddress

uint8_t Primary802154MACAddress[8]

MAC address for primary 802.15.4 interface (big-endian, all zeros = not present)

PrimaryWiFiMACAddress

uint8_t PrimaryWiFiMACAddress[6]

MAC address for primary WiFi interface (big-endian, all zeros = not present)

ProductId

uint16_t ProductId

Device product code (0 = not present)

ProductRevision

uint16_t ProductRevision

Device product revision (0 = not present)

RendezvousWiFiESSID

char RendezvousWiFiESSID[kMaxRendezvousWiFiESSID+1]

ESSID for device WiFi rendezvous network (NUL terminated, 0 length = not present)

SerialNumber

char SerialNumber[kMaxSerialNumberLength+1]

Serial number of device (NUL terminated, 0 length = not present)

SoftwareVersion

char SoftwareVersion[kMaxSoftwareVersionLength+1]

Active software version (NUL terminated, 0 length = not present)

VendorId

uint16_t VendorId

Device vendor code (0 = not present)

Year

uint16_t Year

Year of device manufacture (valid range 2001 - 2099)

Public functions

Clear

void Clear(
  void
)

Clears the device description.

WeaveDeviceDescriptor

 WeaveDeviceDescriptor(
  void
)

Public static functions

Decode

WEAVE_ERROR Decode(
  const uint8_t *data,
  uint32_t dataLen,
  WeaveDeviceDescriptor & outDesc
)

Decodes the contents of the provided data buffer into a Weave Device Descriptor object.

Details
Parameters
[in] data
A pointer to a buffer containing text or TLV encoded Weave Device Descriptor data.
[in] dataLen
The length of the provided buffer.
[out] outDesc
A reference to the Device Descriptor object to be populated.
Return Values
WEAVE_ERROR_INVALID_DEVICE_DESCRIPTOR
If the provided buffer is invalid.
WEAVE_NO_ERROR
On success.
other
Other Weave or platform-specific error codes indicating that an error occurred preventing the decoding of the TLV.

DecodeTLV

WEAVE_ERROR DecodeTLV(
  const uint8_t *data,
  uint32_t dataLen,
  WeaveDeviceDescriptor & outDesc
)

Decodes the contents of the provided TLV data buffer into a Weave Device Descriptor object.

Details
Parameters
[in] data
A pointer to a buffer containing text encoded Weave Device Descriptor data.
[in] dataLen
The length of the provided buffer.
[out] outDesc
A reference to the Device Descriptor object to be populated.
Return Values
WEAVE_ERROR_WRONG_TLV_TYPE
If this is not Device Description TLV.
WEAVE_ERROR_UNEXPECTED_TLV_ELEMENT
If more TLV data is encountered after the Device Description.
WEAVE_NO_ERROR
On success.
other
Other Weave or platform-specific error codes indicating that an error occurred preventing the encoding of the TLV.

DecodeTLV

WEAVE_ERROR DecodeTLV(
  nl::Weave::TLV::TLVReader & reader,
  WeaveDeviceDescriptor & outDesc
)

Decodes the Device Description using the provided pre-initialized TLVReader.

Details
Parameters
[in] reader
A reference to the pre-initialized TLVReader.
[out] outDesc
A reference to the Device Descriptor object to be populated.
Return Values
WEAVE_ERROR_INVALID_TLV_ELEMENT
If invalid Device Description information is found in the TLV data.
WEAVE_NO_ERROR
On success.
other
Other Weave or platform-specific error codes indicating that an error occurred that prevented the decoding of the TLV.

DecodeText

WEAVE_ERROR DecodeText(
  const char *data,
  uint32_t dataLen,
  WeaveDeviceDescriptor & outDesc
)

Decodes the contents of the provided text data buffer into a Weave Device Descriptor object.

Details
Parameters
[in] data
A pointer to a buffer containing text encoded Weave Device Descriptor data.
[in] dataLen
The length of the provided buffer.
[out] outDesc
A reference to the Device Descriptor object to be populated.
Return Values
WEAVE_ERROR_UNSUPPORTED_DEVICE_DESCRIPTOR_VERSION
If the encoded data version is unsupported.
WEAVE_ERROR_INVALID_DEVICE_DESCRIPTOR
If the encoded data is not formatted correctly.
WEAVE_ERROR_INCORRECT_STATE
If an inconsistent state is encountered by the decoder.
WEAVE_ERROR_BUFFER_TOO_SMALL
If the end of the buffer is reached during decoding.
WEAVE_NO_ERROR
On success.

EncodeTLV

WEAVE_ERROR EncodeTLV(
  const WeaveDeviceDescriptor & desc,
  uint8_t *buf,
  uint32_t bufLen,
  uint32_t & outEncodedLen
)

Encodes the provided device descriptor as Weave TLV written to the supplied buffer.

Details
Parameters
[in] desc
A reference to the Weave Device Descriptor to encode.
[out] buf
A pointer to a buffer where the encoded text will be written.
[in] bufLen
The length of the supplied buffer.
[out] outEncodedLen
A reference to the length variable that will be overwritten with the number of characters written to the buffer.
Return Values
WEAVE_NO_ERROR
On success.
other
Other Weave or platform-specific error codes indicating that an error occurred preventing the encoding of the TLV.

EncodeTLV

WEAVE_ERROR EncodeTLV(
  const WeaveDeviceDescriptor & desc,
  nl::Weave::TLV::TLVWriter & writer
)

Encodes the provided device descriptor as Weave TLV written using the provided pre-initialized TLVWriter object.

This is used to add the device description to larger TLV output.

Details
Parameters
[in] desc
A reference to the Weave Device Descriptor to encode.
[in] writer
A reference to the pre-initialized TLVWriter object to be used.
Return Values
WEAVE_NO_ERROR
On success.
other
Other Weave or platform-specific error codes indicating that an error occurred preventing the encoding of the TLV.

EncodeText

WEAVE_ERROR EncodeText(
  const WeaveDeviceDescriptor & desc,
  char *buf,
  uint32_t bufLen,
  uint32_t & outEncodedLen
)

Encodes the provided device descriptor as text written to the supplied buffer.

Details
Parameters
[in] desc
A reference to the Weave Device Descriptor to encode.
[out] buf
A pointer to a buffer where the encoded text will be written.
[in] bufLen
The length of the supplied buffer.
[out] outEncodedLen
A reference to the length variable that will be overwritten with the number of characters written to the buffer.
Return Values
WEAVE_ERROR_BUFFER_TOO_SMALL
If the supplied buffer is too small for the generated text description.
WEAVE_ERROR_INVALID_ARGUMENT
If a descriptor field is invalid.
WEAVE_NO_ERROR
On success.

IsZeroBytes

bool IsZeroBytes(
  const uint8_t *buf,
  uint32_t len
)

Check if the specified buffer contains only zeros.

Details
Parameters
[in] buf
A pointer to a buffer.
[in] len
The length of the buffer.
Return Values
TRUE
If the buffer contains only zeros.
FALSE
If the buffer contains any non-zero values.