nl

特定于织物的 nlassert.h 替换值。

摘要

枚举

@357 枚举
@358 枚举
@359 枚举
@360 枚举
@361 枚举
SerializedFieldType{
  SerializedFieldTypeBoolean = 0x00,
  SerializedFieldTypeUInt8,
  SerializedFieldTypeUInt16,
  SerializedFieldTypeUInt32,
  SerializedFieldTypeUInt64,
  SerializedFieldTypeInt8,
  SerializedFieldTypeInt16,
  SerializedFieldTypeInt32,
  SerializedFieldTypeInt64,
  SerializedFieldTypeFloatingPoint32,
  SerializedFieldTypeFloatingPoint64,
  SerializedFieldTypeUTF8String,
  SerializedFieldTypeByteString,
  SerializedFieldTypeStructure,
  SerializedFieldTypeArray
}
枚举
使用 TLV 字段写入的 TLV 类型列表。
SerializedFieldTypeBits 枚举
SerializedFieldType 的位字段。
SerializedFieldTypeMasks 枚举
用于访问 SerializedFieldType 位的掩码。

类型定义符

Base64CharToValFunct)(uint8_t c) typedef
uint8_t(*
Base64ValToCharFunct)(uint8_t val) typedef
char(*
MemoryAllocate)(size_t size) typedef
void *(*
内存分配/释放函数指针。
MemoryFree)(void *ptr) typedef
void(*
MemoryReallocate)(void *ptr, size_t size) typedef
void *(*

变量

sASN1ErrorFormatter = { nl::Weave::ASN1::FormatASN1Error, NULL }
sElementSize = { sizeof(bool), sizeof(uint8_t), sizeof(uint16_t), sizeof(uint32_t), sizeof(uint64_t), sizeof(int8_t), sizeof(int16_t), sizeof(int32_t), sizeof(int64_t), sizeof(float), sizeof(double), sizeof(char *), sizeof(SerializedByteString), sizeof(void *), sizeof(void *) }[]
const uint8_t
sErrorFormatterList = &sWeaveErrorFormatter
const ErrorFormatter *
错误格式设置程序函数的链接列表。
sErrorStr[WEAVE_CONFIG_ERROR_STR_SIZE]
char
用于存储格式化错误字符串的静态缓冲区。
sErrorStr[1024]
char
此例程会返回一个以人类可读的 NULL 结尾的 C 字符串,该字符串描述了提供的规范与指定配置文件相关联的状态代码。
sWeaveErrorFormatter = { nl::Weave::FormatWeaveError, &sASN1ErrorFormatter }

函数

AdjustCalendarDate(uint16_t & year, uint8_t & month, uint8_t & dayOfMonth, int32_t relativeDays)
void
Base64CharToVal(uint8_t c)
uint8_t
Base64Decode(const char *in, uint16_t inLen, uint8_t *out, Base64CharToValFunct charToValFunct)
uint16_t
Base64Decode(const char *in, uint16_t inLen, uint8_t *out)
uint16_t
Base64Decode32(const char *in, uint32_t inLen, uint8_t *out, Base64CharToValFunct charToValFunct)
uint32_t
Base64Decode32(const char *in, uint32_t inLen, uint8_t *out)
uint32_t
Base64Encode(const uint8_t *in, uint16_t inLen, char *out, Base64ValToCharFunct valToCharFunct)
uint16_t
Base64Encode(const uint8_t *in, uint16_t inLen, char *out)
uint16_t
Base64Encode32(const uint8_t *in, uint32_t inLen, char *out, Base64ValToCharFunct valToCharFunct)
uint32_t
Base64Encode32(const uint8_t *in, uint32_t inLen, char *out)
uint32_t
Base64URLCharToVal(uint8_t c)
uint8_t
Base64URLDecode(const char *in, uint16_t inLen, uint8_t *out)
uint16_t
Base64URLEncode(const uint8_t *in, uint16_t inLen, char *out)
uint16_t
Base64URLValToChar(uint8_t val)
char
Base64ValToChar(uint8_t val)
char
CalendarDateToDaysSinceEpoch(uint16_t year, uint8_t month, uint8_t dayOfMonth, uint32_t & daysSinceEpoch)
bool
CalendarDateToOrdinalDate(uint16_t year, uint8_t month, uint8_t dayOfMonth, uint16_t & dayOfYear)
void
CalendarTimeToSecondsSinceEpoch(uint16_t year, uint8_t month, uint8_t dayOfMonth, uint8_t hour, uint8_t minute, uint8_t second, uint32_t & secondsSinceEpoch)
bool
ClearFlag(FlagsT & inFlags, const FlagT inFlag)
void
DateToManufacturingWeek(uint16_t year, uint8_t month, uint8_t day, uint16_t & mfgYear, uint8_t & mfgWeek)
void
DaysInMonth(uint16_t year, uint8_t month)
uint8_t
DaysSinceEpochToCalendarDate(uint32_t daysSinceEpoch, uint16_t & year, uint8_t & month, uint8_t & dayOfMonth)
void
DaysToMarch1(uint16_t year)
uint8_t
DeallocateDeserializedStructure(void *aStructureData, const SchemaFieldDescriptor *aFieldDescriptors, SerializationContext *aContext)
ErrorStr(int32_t err)
NL_DLL_EXPORT const char *
此例程会返回一个以人类可读的 NULL 结尾的 C 字符串,用于描述提供的错误。
ExtractManufacturingDateFromSerialNumber(const char *serialNum, uint16_t & year, uint8_t & month, uint8_t & day)
FindNullifiedFieldsArray(void *aStructureData, const SchemaFieldDescriptor *aSchemaDescriptor, uint8_t *& aNullifiedFields)
这是一个辅助函数,可用于查找位于 C 结构体末尾的 Null 字段数组的位置。
FindStatusReportStr(uint32_t inProfileId, uint16_t inStatusCode)
const char *
FirstWeekdayOfYear(uint16_t year)
uint8_t
FormatError(char *buf, uint16_t bufSize, const char *subsys, int32_t err, const char *desc)
void
生成一个以人类可读的 NULL 结尾的 C 字符串,该字符串描述了提供的错误。
GetArrayElementSize(uint32_t & aOutSize, const FieldDescriptor *aFieldPtr, SerializedFieldType aType)
GetFlag(const FlagsT & inFlags, const FlagT inFlag)
bool
IsBase34NoIOChar(char ch)
bool
IsLeapYear(uint16_t year)
bool
IsValidFieldType(SerializedFieldType aType)
bool
IsValidSerialNumber(const char *serialNum)
bool
LogEvent(TEvent *aEvent)
nl::Weave::Profiles::DataManagement::event_id_t
LogEvent(TEvent *aEvent, const nl::Weave::Profiles::DataManagement::EventOptions & aOptions)
nl::Weave::Profiles::DataManagement::event_id_t
ManufacturingWeekToDate(uint16_t mfgYear, uint8_t mfgWeek, uint16_t & year, uint8_t & month, uint8_t & day)
void
MarchBasedDayOfYearToMonth(uint16_t dayOfYear)
uint8_t
MarchBasedMonthToDayOfYear(uint8_t month)
uint16_t
NullifyAllEventFields(TEvent *aEvent)
void
OrdinalDateToCalendarDate(uint16_t year, uint16_t dayOfYear, uint8_t & month, uint8_t & dayOfMonth)
void
ReadDataForType(TLVReader & aReader, void *aStructureData, const FieldDescriptor *& aFieldPtr, SerializedFieldType aType, bool aInArray, SerializationContext *aContext)
读取器函数,用于根据结构数据从 TLV 读取特定条目。
ReadNullableDataForType(TLVReader & aReader, void *aStructureData, const FieldDescriptor *& aFieldPtr, SerializedFieldType aType, bool & aIsNullified, SerializationContext *aContext)
读取函数,用于在从 TLV 读取数据之前检查数据是否可以为 null/是否为空。
RegisterErrorFormatter(ErrorFormatter *errFormatter)
NL_DLL_EXPORT void
将新的错误格式设置函数添加到错误格式设置的全局列表中。
SecondsSinceEpochToCalendarTime(uint32_t secondsSinceEpoch, uint16_t & year, uint8_t & month, uint8_t & dayOfMonth, uint8_t & hour, uint8_t & minute, uint8_t & second)
void
SerializedDataToTLVWriter(TLVWriter & aWriter, void *aStructureData, const SchemaFieldDescriptor *aFieldDescriptors)
用于将数据结构转换为 TLV 结构的写入器函数。
SerializedDataToTLVWriterHelper(TLVWriter & aWriter, uint8_t aDataTag, void *aAppData)
将容器化 SerializedDataToTLVWriter 的封装容器函数。
SetFlag(FlagsT & inFlags, const FlagT inFlag)
void
SetFlag(FlagsT & inFlags, const FlagT inFlag, const bool inValue)
void
StatusReportStr(uint32_t profileId, uint16_t statusCode)
const char *
TLVReaderToDeserializedData(nl::Weave::TLV::TLVReader & aReader, void *aStructureData, const SchemaFieldDescriptor *aFieldDescriptors, SerializationContext *aContext)
用于将 TLV 转换为 C 结构体的读取器函数。
TLVReaderToDeserializedDataHelper(nl::Weave::TLV::TLVReader & aReader, uint8_t aDataTag, void *aAppData, SerializationContext *aContext)
用于反序列化单个 TLV 数据元素的辅助函数。
WriteArrayData(TLVWriter & aWriter, void *aStructureData, const FieldDescriptor *aFieldPtr)
写入数组结构的写入器函数。
WriteDataForType(TLVWriter & aWriter, void *aStructureData, const FieldDescriptor *& aFieldPtr, SerializedFieldType aType, bool aInArray)
写入函数会根据结构数据将特定条目写入 TLV。
WriteNullableDataForType(TLVWriter & aWriter, void *aStructureData, const FieldDescriptor *& aFieldPtr, SerializedFieldType aType, bool aIsNullified)
在写入 TLV 之前用于检查数据是否可为 null/可为 null 的写入器函数。
secondsToMilliseconds(uint32_t seconds)
uint32_t

结构体

nl::ArrayLengthAndBuffer

用于封装具有长度的数组的帮助程序。

nl::ErrorFormatter
nl::FieldDescriptor

描述架构结构中的 TLV 字段并将其连接到 c 结构体中的数据的结构。

nl::内存管理

内存分配/释放函数的 c 结构。

nl::SchemaFieldDescriptor

一组 FieldDescriptor 的封装容器,用于描述架构结构/结构。

nl::SerializationContext

包含序列化或反序列化所需的任何上下文或状态的 c-struct。

nl::SerializedByteString
nl::SerializedFieldTypeBoolean_array
nl::SerializedFieldTypeByteString_array
nl::SerializedFieldTypeFloatingPoint32_array
nl::SerializedFieldTypeFloatingPoint64_array
nl::SerializedFieldTypeInt16_array
nl::SerializedFieldTypeInt32_array
nl::SerializedFieldTypeInt64_array
nl::SerializedFieldTypeInt8_array
nl::SerializedFieldTypeUInt16_array
nl::SerializedFieldTypeUInt32_array
nl::SerializedFieldTypeUInt64_array
nl::SerializedFieldTypeUInt8_array
nl::SerializedFieldTypeUTF8String_array
nl::StructureSchemaPointerPair

数据对与 c 结构的数据和 StructureSchemaDescriptor 配合使用,即可根据这些数据写入 TLV 结构。

命名空间

nl::ArgParser
nl::Ble

此命名空间包括 Weave 中适用于蓝牙低功耗 (BLE) 的所有接口,也称为 Bluetooth Smart。

nl::Inet
nl::NestCerts

此命名空间包含 Nest Weave 公钥基础架构 (PKI) 证书的全局符号。

nl::配对代码
nl::预热
nl:: Weave

枚举

@357

 @357

@358

 @358

@359

 @359

@360

 @360

@361

 @361

序列化字段类型

 SerializedFieldType

使用 TLV 字段写入的 TLV 类型列表。

属性
SerializedFieldTypeArray

数组类型。

SerializedFieldTypeBoolean

布尔值类型。

SerializedFieldTypeByteString

字节字符串类型。

SerializedFieldTypeFloatingPoint32

32 位浮点类型

SerializedFieldTypeFloatingPoint64

64 位浮点类型

SerializedFieldTypeInt16

16 位的有符号类型。

SerializedFieldTypeInt32

有符号 32 位类型。

SerializedFieldTypeInt64

有符号 64 位类型。

SerializedFieldTypeInt8

8 位的有符号类型。

SerializedFieldTypeStructure

用户定义的结构类型。

SerializedFieldTypeUInt16

无符号 16 位类型。

SerializedFieldTypeUInt32

无符号 32 位类型。

SerializedFieldTypeUInt64

无符号 64 位类型。

SerializedFieldTypeUInt8

无符号 8 位类型。

SerializedFieldTypeUTF8String

UTF-8 字符串类型。

序列化字段类型

 SerializedFieldTypeBits

SerializedFieldType 的位字段。

序列化字段类型掩码

 SerializedFieldTypeMasks

用于访问 SerializedFieldType 位的掩码。

类型定义符

Base64CharToValFunct

uint8_t(* Base64CharToValFunct)(uint8_t c)

Base64ValToCharFunct

char(* Base64ValToCharFunct)(uint8_t val)

内存分配

void *(* MemoryAllocate)(size_t size)

内存分配/释放函数指针。

无内存

void(* MemoryFree)(void *ptr)

内存重新分配

void *(* MemoryReallocate)(void *ptr, size_t size)

变量

sASN1ErrorFormatter

const ErrorFormatter sASN1ErrorFormatter =
{
    nl::Weave::ASN1::FormatASN1Error,
    NULL
}

sElementSize

const uint8_t sElementSize[] =
{
    sizeof(bool),                   
    sizeof(uint8_t),                
    sizeof(uint16_t),               
    sizeof(uint32_t),               
    sizeof(uint64_t),               
    sizeof(int8_t),                 
    sizeof(int16_t),                
    sizeof(int32_t),                
    sizeof(int64_t),                
    sizeof(float),                  
    sizeof(double),                 
    sizeof(char *),                 
    sizeof(SerializedByteString),   
    sizeof(void *),                 
    sizeof(void *)                  
}

sErrorFormatterList

const ErrorFormatter * sErrorFormatterList = &sWeaveErrorFormatter

错误格式设置程序函数的链接列表。

sErrorStr

char sErrorStr[WEAVE_CONFIG_ERROR_STR_SIZE]

用于存储格式化错误字符串的静态缓冲区。

sErrorStr

char sErrorStr[1024]

此例程会返回一个以人类可读的 NULL 结尾的 C 字符串,该字符串描述了提供的规范与指定配置文件相关联的状态代码。

详细信息
参数
[in] profileId
与 相关联的 Weave 配置文件标识符。
[in] statusCode
profileId 中的状态代码,用于提供描述性字符串。
返回值
指向以 NULL 结尾的 C 字符串的指针,描述指定配置文件中提供的状态代码。
另请参阅
WEAVE_CONFIG_SHORT_ERROR_STR

sWeave 错误格式设置工具

const ErrorFormatter sWeaveErrorFormatter =
{
    nl::Weave::FormatWeaveError,
    &sASN1ErrorFormatter
}

函数

AdjustCalendarDate

void AdjustCalendarDate(
  uint16_t & year,
  uint8_t & month,
  uint8_t & dayOfMonth,
  int32_t relativeDays
)

Base64CharToVal

uint8_t Base64CharToVal(
  uint8_t c
)

Base64 解码

uint16_t Base64Decode(
  const char *in,
  uint16_t inLen,
  uint8_t *out,
  Base64CharToValFunct charToValFunct
)

Base64 解码

uint16_t Base64Decode(
  const char *in,
  uint16_t inLen,
  uint8_t *out
)

Base64Decode32

uint32_t Base64Decode32(
  const char *in,
  uint32_t inLen,
  uint8_t *out,
  Base64CharToValFunct charToValFunct
)

Base64Decode32

uint32_t Base64Decode32(
  const char *in,
  uint32_t inLen,
  uint8_t *out
)

Base64 编码

uint16_t Base64Encode(
  const uint8_t *in,
  uint16_t inLen,
  char *out,
  Base64ValToCharFunct valToCharFunct
)

Base64 编码

uint16_t Base64Encode(
  const uint8_t *in,
  uint16_t inLen,
  char *out
)

Base64 编码 32

uint32_t Base64Encode32(
  const uint8_t *in,
  uint32_t inLen,
  char *out,
  Base64ValToCharFunct valToCharFunct
)

Base64 编码 32

uint32_t Base64Encode32(
  const uint8_t *in,
  uint32_t inLen,
  char *out
)

Base64网址CharToVal

uint8_t Base64URLCharToVal(
  uint8_t c
)

Base64网址 解码

uint16_t Base64URLDecode(
  const char *in,
  uint16_t inLen,
  uint8_t *out
)

Base64网址 编码

uint16_t Base64URLEncode(
  const uint8_t *in,
  uint16_t inLen,
  char *out
)

Base64网址ValToChar

char Base64URLValToChar(
  uint8_t val
)

Base64ValToChar 类

char Base64ValToChar(
  uint8_t val
)

从新纪元日期到日历时间

bool CalendarDateToDaysSinceEpoch(
  uint16_t year,
  uint8_t month,
  uint8_t dayOfMonth,
  uint32_t & daysSinceEpoch
)

日历日期到序号日期

void CalendarDateToOrdinalDate(
  uint16_t year,
  uint8_t month,
  uint8_t dayOfMonth,
  uint16_t & dayOfYear
)

日历时间到秒自纪元开始的时间

bool CalendarTimeToSecondsSinceEpoch(
  uint16_t year,
  uint8_t month,
  uint8_t dayOfMonth,
  uint8_t hour,
  uint8_t minute,
  uint8_t second,
  uint32_t & secondsSinceEpoch
)

ClearFlag

void ClearFlag(
  FlagsT & inFlags,
  const FlagT inFlag
)

DateToManufacturingWeek

void DateToManufacturingWeek(
  uint16_t year,
  uint8_t month,
  uint8_t day,
  uint16_t & mfgYear,
  uint8_t & mfgWeek
)

天数

uint8_t DaysInMonth(
  uint16_t year,
  uint8_t month
)

自天元纪元开始的日期

void DaysSinceEpochToCalendarDate(
  uint32_t daysSinceEpoch,
  uint16_t & year,
  uint8_t & month,
  uint8_t & dayOfMonth
)

DaysToJanuary1

uint8_t DaysToMarch1(
  uint16_t year
)

取消分配序列化

WEAVE_ERROR DeallocateDeserializedStructure(
  void *aStructureData,
  const SchemaFieldDescriptor *aFieldDescriptors,
  SerializationContext *aContext
)

ErrorStr 类

NL_DLL_EXPORT const char * ErrorStr(
  int32_t err
)

此例程会返回一个以人类可读的 NULL 结尾的 C 字符串,用于描述提供的错误。

详细信息
参数
[in] err
格式和描述错误。
返回值
指向以 NULL 结尾的 C 字符串的指针,该字符串描述了提供的错误。

ExtractManufacturingDateFromSerialNumber

WEAVE_ERROR ExtractManufacturingDateFromSerialNumber(
  const char *serialNum,
  uint16_t & year,
  uint8_t & month,
  uint8_t & day
)

FindNullifiedFieldsArray

WEAVE_ERROR FindNullifiedFieldsArray(
  void *aStructureData,
  const SchemaFieldDescriptor *aSchemaDescriptor,
  uint8_t *& aNullifiedFields
)

这是一个辅助函数,可用于查找位于 C 结构体末尾的 Null 字段数组的位置。

C 结构体的 nullified_fields 成员应该紧跟在 FieldDescriptors 数组描述的最后一个成员之后。它不在字段描述符列表中,因为它是可为 null 事件的创作者和使用者隐藏的实用程序。对于没有可为 null 字段的事件,不存在此结构成员。但是,通过 setter 和 getter 的构造,不应出现超出范围的访问。

详细信息
参数
[in] aStructureData
指向 c-struct 的指针。
[in] aSchemaDescriptor
用于描述 C 结构体的 SchemaFieldDescriptors。
[out] aNullifiedFields
指向 c 结构体的 nullified_fields 成员的指针。
返回值
WEAVE_NO_ERROR
成功时。
WEAVE_ERROR_INVALID_ARGUMENT
如果字段描述符指针为 NULL。
WEAVE_ERROR_INCORRECT_STATE
如果字段描述符的格式与预期不符。

FindStatusReportStr

const char * FindStatusReportStr(
  uint32_t inProfileId,
  uint16_t inStatusCode
)

第一年/一年

uint8_t FirstWeekdayOfYear(
  uint16_t year
)

格式错误

void FormatError(
  char *buf,
  uint16_t bufSize,
  const char *subsys,
  int32_t err,
  const char *desc
)

生成一个以人类可读的 NULL 结尾的 C 字符串,该字符串描述了提供的错误。

详细信息
参数
[in] buf
错误字符串将放入的缓冲区。
[in] bufSize
所提供缓冲区的大小(以字节为单位)。
[in] subsys
用于描述引发错误的子系统的短字符串;如果错误来源未知/不可用,则为 NULL。此字符串不得超过 10 个字符。
[in] err
要设置格式的错误。
[in] desc
描述错误原因或含义的字符串,如果没有此类信息,则为 NULL。

GetArrayElementSize

WEAVE_ERROR GetArrayElementSize(
  uint32_t & aOutSize,
  const FieldDescriptor *aFieldPtr,
  SerializedFieldType aType
)

GetFlag

bool GetFlag(
  const FlagsT & inFlags,
  const FlagT inFlag
)

IsBase34NoIOChar

bool IsBase34NoIOChar(
  char ch
)

闰年

bool IsLeapYear(
  uint16_t year
)

IsValidFieldType

bool IsValidFieldType(
  SerializedFieldType aType
)

有效序列号

bool IsValidSerialNumber(
  const char *serialNum
)

日志事件

nl::Weave::Profiles::DataManagement::event_id_t LogEvent(
  TEvent *aEvent
)

日志事件

nl::Weave::Profiles::DataManagement::event_id_t LogEvent(
  TEvent *aEvent,
  const nl::Weave::Profiles::DataManagement::EventOptions & aOptions
)

制造周日期

void ManufacturingWeekToDate(
  uint16_t mfgYear,
  uint8_t mfgWeek,
  uint16_t & year,
  uint8_t & month,
  uint8_t & day
)

年月日

uint8_t MarchBasedDayOfYearToMonth(
  uint16_t dayOfYear
)

今年 3 月

uint16_t MarchBasedMonthToDayOfYear(
  uint8_t month
)

NullifyAllEventFields

void NullifyAllEventFields(
  TEvent *aEvent
)

序号日期到日历日期

void OrdinalDateToCalendarDate(
  uint16_t year,
  uint16_t dayOfYear,
  uint8_t & month,
  uint8_t & dayOfMonth
)

读取数据类型

WEAVE_ERROR ReadDataForType(
  TLVReader & aReader,
  void *aStructureData,
  const FieldDescriptor *& aFieldPtr,
  SerializedFieldType aType,
  bool aInArray,
  SerializationContext *aContext
)

读取器函数,用于根据结构数据从 TLV 读取特定条目。

详细信息
参数
[in] aReader
在结构中用于读取的读取器
[in] aStructureData
指向要读取的 c 结构数据的指针
[in,out] aFieldPtr
FieldDescriptor 描述字段和 TLV 标记。该函数将使指针 s.t 递增。它将指向 FieldDescritor 数组中的下一个元素
[in] aType
字段的 SerializedFieldType
[in] aInArray
如果我们读取的是数组(使用匿名标记),则为 true
[in] aContext
包含操作所需的任何状态的序列化上下文。
返回值
WEAVE_NO_ERROR
成功时。
other
由 AReader 返回的其他错误。

ReadNullableDataForType

WEAVE_ERROR ReadNullableDataForType(
  TLVReader & aReader,
  void *aStructureData,
  const FieldDescriptor *& aFieldPtr,
  SerializedFieldType aType,
  bool & aIsNullified,
  SerializationContext *aContext
)

读取函数,用于在从 TLV 读取数据之前检查数据是否可以为 null/是否为空。

详细信息
参数
[in] aReader
在结构中用于读取的读取器
[in] aStructureData
指向要读取的 c 结构数据的指针
[in,out] aFieldPtr
FieldDescriptor 描述字段和 TLV 标记。该函数将使指针 s.t 递增。它将指向 FieldDescriptor 数组中的下一个元素
[in] aType
字段的 SerializedFieldType
[out] aIsNullified
设置此字段以指示字段为 null。
[in] aContext
包含操作所需的任何状态的序列化上下文。
返回值
WEAVE_NO_ERROR
成功时。
other
写入时出现 TLV 错误。

RegisterErrorFormatter

NL_DLL_EXPORT void RegisterErrorFormatter(
  ErrorFormatter *errFormatter
)

将新的错误格式设置函数添加到错误格式设置的全局列表中。

详细信息
参数
[in] errFormatter
ErrorFormatter 结构,其中包含指向新错误函数的指针。请注意,函数将保留所提供 ErrorFormatter 结构的指针。因此,结构的内存必须保持保留。

秒 EpochToCalendarTime

void SecondsSinceEpochToCalendarTime(
  uint32_t secondsSinceEpoch,
  uint16_t & year,
  uint8_t & month,
  uint8_t & dayOfMonth,
  uint8_t & hour,
  uint8_t & minute,
  uint8_t & second
)

序列化数据到 TLV 写入者

WEAVE_ERROR SerializedDataToTLVWriter(
  TLVWriter & aWriter,
  void *aStructureData,
  const SchemaFieldDescriptor *aFieldDescriptors
)

用于将数据结构转换为 TLV 结构的写入器函数。

使用 SchemaFieldDescriptor 解读数据结构并写入 TLV。

详细信息
参数
[in] aWriter
用于编写结构的作者
[in] aStructureData
指向要根据 SchemaFieldDescriptor 写入的 c 结构数据的指针
[in] aFieldDescriptors
用于描述 c 结构体 + TLV 的 SchemaFieldDescriptors
返回值
WEAVE_NO_ERROR
成功时。
other
其他由 aWriter 返回的错误。

序列化数据到 TLV 写入帮助程序

WEAVE_ERROR SerializedDataToTLVWriterHelper(
  TLVWriter & aWriter,
  uint8_t aDataTag,
  void *aAppData
)

将容器化 SerializedDataToTLVWriter 的封装容器函数。

此外,还可将 StructureSchemaPointerPair 拆分为结构数据和描述符。

详细信息
参数
[in] aWriter
用于编写结构的作者
[in] aDataTag
要写入的代码
[in] aAppData
StructureSchemaPointerPair 包含用于构造数据和字段描述符的指针。由于原型设计而无效
返回值
WEAVE_NO_ERROR
成功时。
other
其他由 aWriter 返回的错误。

设置标记

void SetFlag(
  FlagsT & inFlags,
  const FlagT inFlag
)

设置标记

void SetFlag(
  FlagsT & inFlags,
  const FlagT inFlag,
  const bool inValue
)

StatusReportStr

const char * StatusReportStr(
  uint32_t profileId,
  uint16_t statusCode
)

TLVReaderToDeserializedData

WEAVE_ERROR TLVReaderToDeserializedData(
  nl::Weave::TLV::TLVReader & aReader,
  void *aStructureData,
  const SchemaFieldDescriptor *aFieldDescriptors,
  SerializationContext *aContext
)

用于将 TLV 转换为 C 结构体的读取器函数。

使用 SchemaFieldDescriptor 解读数据结构。

它必须稳健可靠,既能激励未知字段,又不会遇到预期字段。

详细信息
参数
[in] aReader
用于读取数据的读取器
[in] aStructureData
指向目标 c 结构数据的指针,我们将根据 SchemaFieldDescriptor 将该数据读入其中
[in] aFieldDescriptors
用于描述 c 结构体 + TLV 的 SchemaFieldDescriptors
[in] aContext
包含操作所需的任何状态的序列化上下文。
返回值
WEAVE_NO_ERROR
成功时。
other
可能由 AReader 返回的其他错误。

TLVReaderToDeserializedDataHelper

WEAVE_ERROR TLVReaderToDeserializedDataHelper(
  nl::Weave::TLV::TLVReader & aReader,
  uint8_t aDataTag,
  void *aAppData,
  SerializationContext *aContext
)

用于反序列化单个 TLV 数据元素的辅助函数。

函数将 StructureSchemaPointerPair 拆分为结构数据和描述符,以便传递到 ReadDataForType。

详细信息
参数
[in] aReader
包含要反序列化数据的读取器
[in] aDataTag
目前未使用
[in] aAppData
StructureSchemaPointerPair 包含用于构造数据和字段描述符的指针。由于原型设计而无效
[in] aContext
包含操作所需的任何状态的序列化上下文。
返回值
WEAVE_NO_ERROR
成功时。
other
由 AReader 返回的其他错误。

写入数组数据

WEAVE_ERROR WriteArrayData(
  TLVWriter & aWriter,
  void *aStructureData,
  const FieldDescriptor *aFieldPtr
)

写入数组结构的写入器函数。

详细信息
参数
[in] aWriter
用于编写结构的作者
[in] aStructureData
指向要根据 FieldDescriptor 写入的 c 结构数据的指针
[in] aFieldPtr
FieldDescriptor 用于描述数组 c struct + TLV
返回值
WEAVE_NO_ERROR
成功时。
other
其他由 aWriter 返回的错误。

写入数据类型

WEAVE_ERROR WriteDataForType(
  TLVWriter & aWriter,
  void *aStructureData,
  const FieldDescriptor *& aFieldPtr,
  SerializedFieldType aType,
  bool aInArray
)

写入函数会根据结构数据将特定条目写入 TLV。

详细信息
参数
[in] aWriter
用于编写结构的作者
[in] aStructureData
指向要写入的 c 结构数据的指针
[in,out] aFieldPtr
FieldDescriptor 描述字段和 TLV 标记。该函数将使指针 s.t 递增。它将指向 FieldDescritor 数组中的下一个元素
[in] aType
字段的 SerializedFieldType
[in] aInArray
如果我们要写入数组(使用匿名标记),则为 true
返回值
WEAVE_NO_ERROR
成功时。
other
其他由 aWriter 返回的错误。

写入 null 数据类型

WEAVE_ERROR WriteNullableDataForType(
  TLVWriter & aWriter,
  void *aStructureData,
  const FieldDescriptor *& aFieldPtr,
  SerializedFieldType aType,
  bool aIsNullified
)

在写入 TLV 之前用于检查数据是否可为 null/可为 null 的写入器函数。

详细信息
参数
[in] aWriter
用于编写结构的作者
[in] aStructureData
指向要读取的 c 结构数据的指针
[in,out] aFieldPtr
FieldDescriptor 描述字段和 TLV 标记。该函数将使指针 s.t 递增。它将指向 FieldDescriptor 数组中的下一个元素
[in] aType
字段的 SerializedFieldType
[in] aIsNullified
如果为 True,TLV 标记将为 null。
返回值
WEAVE_NO_ERROR
成功时。
other
写入时出现 TLV 错误。

秒到毫秒

uint32_t secondsToMilliseconds(
  uint32_t seconds
)