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

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

包含有关 Weave 设备的描述性信息。

摘要

构造函数和析构函数

WeaveDeviceDescriptor(void)

公共类型

@180{
  kMaxSerialNumberLength = 32,
  kMaxPairingCodeLength = 16,
  kMaxRendezvousWiFiESSID = 32,
  kMaxSoftwareVersionLength = WEAVE_CONFIG_MAX_SOFTWARE_VERSION_LENGTH
}
枚举
定义某些属性的最大长度。
@181{
  kFeature_HomeAlarmLinkCapable = 0x00000001,
  kFeature_LinePowered = 0x00000002
}
枚举
用于指示特定设备功能的功能标志。
@182{
  kFlag_IsRendezvousWiFiESSIDSuffix = 0x01
}
枚举
标志字段定义。

公共属性

Day
uint8_t
设备制造商的日期(0 = 不存在)
DeviceFeatures
uint32_t
表示是否支持特定设备功能的位字段。
DeviceId
uint64_t
Weave 设备 ID(0 = 不存在)
FabricId
uint64_t
设备所属的 Weave 织物的 ID(0 = 不存在)
Flags
uint8_t
该位字段包含有关设备的其他信息。
ManufacturingDate
struct nl::Weave::Profiles::DeviceDescription::WeaveDeviceDescriptor::@183
Month
uint8_t
设备制造商的月份(1 = 1 月)
PairingCode[kMaxPairingCodeLength+1]
char
设备配对码(NUL 终止,长度为 0 = 不存在)
PairingCompatibilityVersionMajor
uint16_t
主要设备配对软件兼容性版本。
PairingCompatibilityVersionMinor
uint16_t
次要设备配对软件兼容性版本。
Primary802154MACAddress[8]
uint8_t
主要 802.15.4 接口的 MAC 地址(大端字节序,全零 = 不存在)
PrimaryWiFiMACAddress[6]
uint8_t
主要 Wi-Fi 接口的 MAC 地址(大端字节序,全零 = 不存在)
ProductId
uint16_t
设备产品代码(0 = 不存在)
ProductRevision
uint16_t
设备产品修订版(0 = 不存在)
RendezvousWiFiESSID[kMaxRendezvousWiFiESSID+1]
char
设备 Wi-Fi 匹配网络的 ESSID(NUL 已终止,长度为 0 = 不存在)
SerialNumber[kMaxSerialNumberLength+1]
char
设备的序列号(以 NUL 终止,长度为 0 = 不存在)
SoftwareVersion[kMaxSoftwareVersionLength+1]
char
活动软件版本(以 NUL 终止,长度为 0 = 不存在)
VendorId
uint16_t
设备供应商代码(0 = 不存在)
Year
uint16_t
设备制造商的年份(有效范围 2001 - 2099)

公共函数

Clear(void)
void
清除设备说明。

公共静态函数

Decode(const uint8_t *data, uint32_t dataLen, WeaveDeviceDescriptor & outDesc)
将提供的数据缓冲区的内容解码为 Weave 设备描述符对象。
DecodeTLV(const uint8_t *data, uint32_t dataLen, WeaveDeviceDescriptor & outDesc)
将提供的 TLV 数据缓冲区的内容解码为 Weave 设备描述符对象。
DecodeTLV(nl::Weave::TLV::TLVReader & reader, WeaveDeviceDescriptor & outDesc)
使用提供的预初始化 TLVReader 对设备说明进行解码。
DecodeText(const char *data, uint32_t dataLen, WeaveDeviceDescriptor & outDesc)
将提供的文本数据缓冲区的内容解码为 Weave 设备描述符对象。
EncodeTLV(const WeaveDeviceDescriptor & desc, uint8_t *buf, uint32_t bufLen, uint32_t & outEncodedLen)
将提供的设备描述符编码为 Weave TLV,并将其写入提供的缓冲区。
EncodeTLV(const WeaveDeviceDescriptor & desc, nl::Weave::TLV::TLVWriter & writer)
使用提供的预初始化 TLVWriter 对象将提供的设备描述符编码为 Weave TLV
EncodeText(const WeaveDeviceDescriptor & desc, char *buf, uint32_t bufLen, uint32_t & outEncodedLen)
将提供的设备描述符编码为写入所提供缓冲区的文本。
IsZeroBytes(const uint8_t *buf, uint32_t len)
bool
检查指定的缓冲区是否仅包含零。

公共类型

@180

 @180

定义某些属性的最大长度。

属性
kMaxPairingCodeLength

配对码长度上限。

kMaxRendezvousWiFiESSID

Rendezvous 长度的 Wi-Fi ESSID 上限。

kMaxSerialNumberLength

序列号长度上限。

kMaxSoftwareVersionLength

软件版本长度上限。

@181

 @181

用于指示特定设备功能的功能标志。

属性
kFeature_HomeAlarmLinkCapable

表示支持连接到住宅警报面板的 Nest Protect。

kFeature_LinePowered

表示需要线路电源的设备。

@182

 @182

标志字段定义。

属性
kFlag_IsRendezvousWiFiESSIDSuffix

表示 RendezvousWiFiESSID 值是一个后缀字符串,显示在设备的 Wi-Fi 分发网络的 ESSID 末尾。

公共属性

Day

uint8_t Day

设备制造商的日期(0 = 不存在)

DeviceFeatures

uint32_t DeviceFeatures

表示是否支持特定设备功能的位字段。

DeviceId

uint64_t DeviceId

Weave 设备 ID(0 = 不存在)

FabricId

uint64_t FabricId

设备所属的 Weave 织物的 ID(0 = 不存在)

标志

uint8_t Flags

该位字段包含有关设备的其他信息。

ManufacturingDate

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

uint8_t Month

设备制造商的月份(1 = 1 月)

PairingCode

char PairingCode[kMaxPairingCodeLength+1]

设备配对码(NUL 终止,长度为 0 = 不存在)

PairingCompatibilityVersionMajor

uint16_t PairingCompatibilityVersionMajor

主要设备配对软件兼容性版本。

PairingCompatibilityVersionMinor

uint16_t PairingCompatibilityVersionMinor

次要设备配对软件兼容性版本。

Primary802154MACAddress

uint8_t Primary802154MACAddress[8]

主要 802.15.4 接口的 MAC 地址(大端字节序,全零 = 不存在)

PrimaryWiFiMACAddress

uint8_t PrimaryWiFiMACAddress[6]

主要 Wi-Fi 接口的 MAC 地址(大端字节序,全零 = 不存在)

ProductId

uint16_t ProductId

设备产品代码(0 = 不存在)

ProductRevision

uint16_t ProductRevision

设备产品修订版(0 = 不存在)

RendezvousWiFiESSID

char RendezvousWiFiESSID[kMaxRendezvousWiFiESSID+1]

设备 Wi-Fi 匹配网络的 ESSID(NUL 已终止,长度为 0 = 不存在)

SerialNumber

char SerialNumber[kMaxSerialNumberLength+1]

设备的序列号(以 NUL 终止,长度为 0 = 不存在)

SoftwareVersion

char SoftwareVersion[kMaxSoftwareVersionLength+1]

活动软件版本(以 NUL 终止,长度为 0 = 不存在)

VendorId

uint16_t VendorId

设备供应商代码(0 = 不存在)

uint16_t Year

设备制造商的年份(有效范围 2001 - 2099)

公共函数

清除

void Clear(
  void
)

清除设备说明。

WeaveDeviceDescriptor

 WeaveDeviceDescriptor(
  void
)

公共静态函数

Decode

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

将提供的数据缓冲区的内容解码为 Weave 设备描述符对象。

具体说明
参数
[in] data
指向包含文本或 TLV 编码的 Weave 设备描述符数据的缓冲区的指针。
[in] dataLen
所提供缓冲区的长度。
[out] outDesc
对要填充的设备描述符对象的引用。
返回值
WEAVE_ERROR_INVALID_DEVICE_DESCRIPTOR
如果提供的缓冲区无效。
WEAVE_NO_ERROR
成功时。
other
其他 Weave 或平台特定错误代码,表示发生错误,导致 TLV 无法解码。

DecodeTLV

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

将提供的 TLV 数据缓冲区的内容解码为 Weave 设备描述符对象。

具体说明
参数
[in] data
指向包含文本编码的 Weave 设备描述符数据的缓冲区的指针。
[in] dataLen
所提供缓冲区的长度。
[out] outDesc
对要填充的设备描述符对象的引用。
返回值
WEAVE_ERROR_WRONG_TLV_TYPE
如果不是“设备描述”,则为 TLV
WEAVE_ERROR_UNEXPECTED_TLV_ELEMENT
如果在设备说明后遇到更多 TLV 数据。
WEAVE_NO_ERROR
成功时。
other
其他 Weave 或平台特定错误代码,表示发生错误,导致 TLV 无法编码。

DecodeTLV

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

使用提供的预初始化 TLVReader 对设备说明进行解码。

具体说明
参数
[in] reader
对预初始化的 TLVReader 的引用。
[out] outDesc
对要填充的设备描述符对象的引用。
返回值
WEAVE_ERROR_INVALID_TLV_ELEMENT
如果在 TLV 数据中发现无效的设备说明信息。
WEAVE_NO_ERROR
成功时。
other
其他 Weave 或平台特定错误代码,表示发生了错误,导致 TLV 无法解码。

DecodeText

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

将提供的文本数据缓冲区的内容解码为 Weave 设备描述符对象。

具体说明
参数
[in] data
指向包含文本编码的 Weave 设备描述符数据的缓冲区的指针。
[in] dataLen
所提供缓冲区的长度。
[out] outDesc
对要填充的设备描述符对象的引用。
返回值
WEAVE_ERROR_UNSUPPORTED_DEVICE_DESCRIPTOR_VERSION
编码的数据版本不受支持。
WEAVE_ERROR_INVALID_DEVICE_DESCRIPTOR
编码数据格式不正确。
WEAVE_ERROR_INCORRECT_STATE
解码器遇到不一致状态时抛出该异常。
WEAVE_ERROR_BUFFER_TOO_SMALL
解码期间达到缓冲区末尾时。
WEAVE_NO_ERROR
成功时。

EncodeTLV

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

将提供的设备描述符编码为 Weave TLV,并将其写入提供的缓冲区。

具体说明
参数
[in] desc
指向要编码的 Weave 设备描述符的引用。
[out] buf
指向将写入编码文本的缓冲区的指针。
[in] bufLen
所提供缓冲区的长度。
[out] outEncodedLen
对长度变量的引用,该变量将被写入缓冲区的字符数所覆盖。
返回值
WEAVE_NO_ERROR
成功时。
other
其他 Weave 或平台特定错误代码,表示发生错误,导致 TLV 无法编码。

EncodeTLV

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

使用提供的预初始化 TLVWriter 对象将提供的设备描述符编码为 Weave TLV

此属性用于将设备说明添加到较大的 TLV 输出中。

具体说明
参数
[in] desc
指向要编码的 Weave 设备描述符的引用。
[in] writer
对要使用的预初始化 TLVWriter 对象的引用。
返回值
WEAVE_NO_ERROR
成功时。
other
其他 Weave 或平台特定错误代码,表示发生错误,导致 TLV 无法编码。

EncodeText

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

将提供的设备描述符编码为写入所提供缓冲区的文本。

具体说明
参数
[in] desc
指向要编码的 Weave 设备描述符的引用。
[out] buf
指向将写入编码文本的缓冲区的指针。
[in] bufLen
所提供缓冲区的长度。
[out] outEncodedLen
对长度变量的引用,该变量将被写入缓冲区的字符数所覆盖。
返回值
WEAVE_ERROR_BUFFER_TOO_SMALL
如果提供的缓冲区对于生成的文本说明来说过小。
WEAVE_ERROR_INVALID_ARGUMENT
描述符字段无效时。
WEAVE_NO_ERROR
成功时。

IsZeroBytes

bool IsZeroBytes(
  const uint8_t *buf,
  uint32_t len
)

检查指定的缓冲区是否仅包含零。

具体说明
参数
[in] buf
指向缓冲区的指针。
[in] len
缓冲区的长度。
返回值
TRUE
缓冲区仅包含零。
FALSE
缓冲区包含任何非零值。