nl

Weave-specific nlassert.h Overrides.

Summary

Enumerations

@357 enum
@358 enum
@359 enum
@360 enum
@361 enum
SerializedFieldType{
  SerializedFieldTypeBoolean = 0x00,
  SerializedFieldTypeUInt8,
  SerializedFieldTypeUInt16,
  SerializedFieldTypeUInt32,
  SerializedFieldTypeUInt64,
  SerializedFieldTypeInt8,
  SerializedFieldTypeInt16,
  SerializedFieldTypeInt32,
  SerializedFieldTypeInt64,
  SerializedFieldTypeFloatingPoint32,
  SerializedFieldTypeFloatingPoint64,
  SerializedFieldTypeUTF8String,
  SerializedFieldTypeByteString,
  SerializedFieldTypeStructure,
  SerializedFieldTypeArray
}
enum
A list of TLV types to write with a TLV field.
SerializedFieldTypeBits enum
Bitfield of SerializedFieldType.
SerializedFieldTypeMasks enum
Masks for accessing bits of SerializedFieldType.

Typedefs

Base64CharToValFunct)(uint8_t c) typedef
uint8_t(*
Base64ValToCharFunct)(uint8_t val) typedef
char(*
MemoryAllocate)(size_t size) typedef
void *(*
Memory allocate/free function pointers.
MemoryFree)(void *ptr) typedef
void(*
MemoryReallocate)(void *ptr, size_t size) typedef
void *(*

Variables

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 *
Linked-list of error formatter functions.
sErrorStr[WEAVE_CONFIG_ERROR_STR_SIZE]
char
Static buffer to store the formatted error string.
sErrorStr[1024]
char
This routine returns a human-readable NULL-terminated C string describing the provided status code associated with the specfied profile.
sWeaveErrorFormatter = { nl::Weave::FormatWeaveError, &sASN1ErrorFormatter }

Functions

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 *
This routine returns a human-readable NULL-terminated C string describing the provided error.
ExtractManufacturingDateFromSerialNumber(const char *serialNum, uint16_t & year, uint8_t & month, uint8_t & day)
FindNullifiedFieldsArray(void *aStructureData, const SchemaFieldDescriptor *aSchemaDescriptor, uint8_t *& aNullifiedFields)
A helper function to find the location of the nullified fields array located at the end of the C struct.
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
Generates a human-readable NULL-terminated C string describing the provided error.
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)
A reader function to read a specific entry from the TLV based on structure data.
ReadNullableDataForType(TLVReader & aReader, void *aStructureData, const FieldDescriptor *& aFieldPtr, SerializedFieldType aType, bool & aIsNullified, SerializationContext *aContext)
A reader function to check whether data is nullable/nullified before reading from the TLV.
RegisterErrorFormatter(ErrorFormatter *errFormatter)
NL_DLL_EXPORT void
Add a new error formatter function to the global list of error formatters.
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)
A writer function to convert a data structure into a TLV structure.
SerializedDataToTLVWriterHelper(TLVWriter & aWriter, uint8_t aDataTag, void *aAppData)
A wrapper writer function that surrounds the SerializedDataToTLVWriter with a container.
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)
A reader function to convert TLV into a C-struct.
TLVReaderToDeserializedDataHelper(nl::Weave::TLV::TLVReader & aReader, uint8_t aDataTag, void *aAppData, SerializationContext *aContext)
A helper function that deserializes a single TLV data element.
WriteArrayData(TLVWriter & aWriter, void *aStructureData, const FieldDescriptor *aFieldPtr)
A writer function that writes an array structure.
WriteDataForType(TLVWriter & aWriter, void *aStructureData, const FieldDescriptor *& aFieldPtr, SerializedFieldType aType, bool aInArray)
A writer function write a specific entry into the TLV based on structure data.
WriteNullableDataForType(TLVWriter & aWriter, void *aStructureData, const FieldDescriptor *& aFieldPtr, SerializedFieldType aType, bool aIsNullified)
A writer function to check whether data is nullable/nullified before writing to the TLV.
secondsToMilliseconds(uint32_t seconds)
uint32_t

Structs

nl::ArrayLengthAndBuffer

A helper for wrapping an array with a length.

nl::ErrorFormatter
nl::FieldDescriptor

Structure that describes a TLV field in a schema structure and connects it to data in a c-struct.

nl::MemoryManagement

A c-struct of memory allocate/free functions.

nl::SchemaFieldDescriptor

Wrapper around an array of FieldDescriptors to describe a schema structure/structure.

nl::SerializationContext

A c-struct containing any context or state we need for serializing or deserializing.

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

Pair of data with a c-struct of data and the StructureSchemaDescriptor to write a TLV structure based on that data.

Namespaces

nl::ArgParser
nl::Ble

This namespace includes all interfaces within Weave for Bluetooth Low Energy (BLE), also known as Bluetooth Smart.

nl::Inet
nl::NestCerts

This namespace includes global symbols for Nest Weave public key infrastructure (PKI) certificates.

nl::PairingCode
nl::Warm
nl::Weave

Enumerations

@357

 @357

@358

 @358

@359

 @359

@360

 @360

@361

 @361

SerializedFieldType

 SerializedFieldType

A list of TLV types to write with a TLV field.

Properties
SerializedFieldTypeArray

Array type.

SerializedFieldTypeBoolean

Boolean type.

SerializedFieldTypeByteString

Byte string type.

SerializedFieldTypeFloatingPoint32

32-bit float type

SerializedFieldTypeFloatingPoint64

64-bit float type

SerializedFieldTypeInt16

Signed 16-bit type.

SerializedFieldTypeInt32

Signed 32-bit type.

SerializedFieldTypeInt64

Signed 64-bit type.

SerializedFieldTypeInt8

Signed 8-bit type.

SerializedFieldTypeStructure

User-defined structure type.

SerializedFieldTypeUInt16

Unsigned 16-bit type.

SerializedFieldTypeUInt32

Unsigned 32-bit type.

SerializedFieldTypeUInt64

Unsigned 64-bit type.

SerializedFieldTypeUInt8

Unsigned 8-bit type.

SerializedFieldTypeUTF8String

UTF-8 string type.

SerializedFieldTypeBits

 SerializedFieldTypeBits

Bitfield of SerializedFieldType.

SerializedFieldTypeMasks

 SerializedFieldTypeMasks

Masks for accessing bits of SerializedFieldType.

Typedefs

Base64CharToValFunct

uint8_t(* Base64CharToValFunct)(uint8_t c)

Base64ValToCharFunct

char(* Base64ValToCharFunct)(uint8_t val)

MemoryAllocate

void *(* MemoryAllocate)(size_t size)

Memory allocate/free function pointers.

MemoryFree

void(* MemoryFree)(void *ptr)

MemoryReallocate

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

Variables

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

Linked-list of error formatter functions.

sErrorStr

char sErrorStr[WEAVE_CONFIG_ERROR_STR_SIZE]

Static buffer to store the formatted error string.

sErrorStr

char sErrorStr[1024]

This routine returns a human-readable NULL-terminated C string describing the provided status code associated with the specfied profile.

Details
Parameters
[in] profileId
The Weave profile identifier associated with .
[in] statusCode
The status code in profileId to provide a descriptive string for.
Returns
A pointer to a NULL-terminated C string describing the provided status code within the specfied profile.
See also:
WEAVE_CONFIG_SHORT_ERROR_STR

sWeaveErrorFormatter

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

Functions

AdjustCalendarDate

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

Base64CharToVal

uint8_t Base64CharToVal(
  uint8_t c
)

Base64Decode

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

Base64Decode

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
)

Base64Encode

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

Base64Encode

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

Base64Encode32

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

Base64Encode32

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

Base64URLCharToVal

uint8_t Base64URLCharToVal(
  uint8_t c
)

Base64URLDecode

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

Base64URLEncode

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

Base64URLValToChar

char Base64URLValToChar(
  uint8_t val
)

Base64ValToChar

char Base64ValToChar(
  uint8_t val
)

CalendarDateToDaysSinceEpoch

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

CalendarDateToOrdinalDate

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

CalendarTimeToSecondsSinceEpoch

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
)

DaysInMonth

uint8_t DaysInMonth(
  uint16_t year,
  uint8_t month
)

DaysSinceEpochToCalendarDate

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

DaysToMarch1

uint8_t DaysToMarch1(
  uint16_t year
)

DeallocateDeserializedStructure

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

ErrorStr

NL_DLL_EXPORT const char * ErrorStr(
  int32_t err
)

This routine returns a human-readable NULL-terminated C string describing the provided error.

Details
Parameters
[in] err
The error for format and describe.
Returns
A pointer to a NULL-terminated C string describing the provided error.

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
)

A helper function to find the location of the nullified fields array located at the end of the C struct.

The nullified_fields member of the C struct is expected to be located directly after the last member described by the array of FieldDescriptors. It is not in the list of field descriptors, as it's meant to be a hidden utility for creators and consumers of nullable events. This struct member does not exist for events with no nullable fields, however by construction of setters and getters, no out of bounds accesses should occur.

Details
Parameters
[in] aStructureData
A pointer to the c-struct.
[in] aSchemaDescriptor
SchemaFieldDescriptors to describe the c struct.
[out] aNullifiedFields
A pointer to nullified_fields member of the c struct.
Return Values
WEAVE_NO_ERROR
On success.
WEAVE_ERROR_INVALID_ARGUMENT
If the field descriptor pointer is NULL.
WEAVE_ERROR_INCORRECT_STATE
If the format of the field descriptors doesn't match expectation.

FindStatusReportStr

const char * FindStatusReportStr(
  uint32_t inProfileId,
  uint16_t inStatusCode
)

FirstWeekdayOfYear

uint8_t FirstWeekdayOfYear(
  uint16_t year
)

FormatError

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

Generates a human-readable NULL-terminated C string describing the provided error.

Details
Parameters
[in] buf
Buffer into which the error string will be placed.
[in] bufSize
Size of the supplied buffer in bytes.
[in] subsys
A short string describing the subsystem that originated the error, or NULL if the origin of the error is unknown/unavailable. This string should be 10 characters or less.
[in] err
The error to be formatted.
[in] desc
A string describing the cause or meaning of the error, or NULL if no such information is available.

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
)

IsLeapYear

bool IsLeapYear(
  uint16_t year
)

IsValidFieldType

bool IsValidFieldType(
  SerializedFieldType aType
)

IsValidSerialNumber

bool IsValidSerialNumber(
  const char *serialNum
)

LogEvent

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

LogEvent

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

ManufacturingWeekToDate

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

MarchBasedDayOfYearToMonth

uint8_t MarchBasedDayOfYearToMonth(
  uint16_t dayOfYear
)

MarchBasedMonthToDayOfYear

uint16_t MarchBasedMonthToDayOfYear(
  uint8_t month
)

NullifyAllEventFields

void NullifyAllEventFields(
  TEvent *aEvent
)

OrdinalDateToCalendarDate

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

ReadDataForType

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

A reader function to read a specific entry from the TLV based on structure data.

Details
Parameters
[in] aReader
The reader to use for reading in the structure
[in] aStructureData
A pointer to the c-structure data to read
[in,out] aFieldPtr
FieldDescriptor to describe the fields and TLV tag. The function will increment the pointer s.t. it will point to the next element in the FieldDescritor array
[in] aType
The SerializedFieldType of the field
[in] aInArray
True if we're reading an array (use anonymous tag)
[in] aContext
Serialization context containing any state required for the operation.
Return Values
WEAVE_NO_ERROR
On success.
other
Other errors that mey be returned from the aReader.

ReadNullableDataForType

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

A reader function to check whether data is nullable/nullified before reading from the TLV.

Details
Parameters
[in] aReader
The reader to use for reading in the structure
[in] aStructureData
A pointer to the c-structure data to read
[in,out] aFieldPtr
FieldDescriptor to describe the fields and TLV tag. The function will increment the pointer s.t. it will point to the next element in the FieldDescriptor array
[in] aType
The SerializedFieldType of the field
[out] aIsNullified
Set to indicate that a field is nullified.
[in] aContext
Serialization context containing any state required for the operation.
Return Values
WEAVE_NO_ERROR
On success.
other
TLV errors while writing.

RegisterErrorFormatter

NL_DLL_EXPORT void RegisterErrorFormatter(
  ErrorFormatter *errFormatter
)

Add a new error formatter function to the global list of error formatters.

Details
Parameters
[in] errFormatter
An ErrorFormatter structure containing a pointer to the new error function. Note that a pointer to the supplied ErrorFormatter structure will be retained by the function. Thus the memory for the structure must remain reserved.

SecondsSinceEpochToCalendarTime

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

SerializedDataToTLVWriter

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

A writer function to convert a data structure into a TLV structure.

Uses a SchemaFieldDescriptor to interpret the data structure and write to the TLV.

Details
Parameters
[in] aWriter
The writer to use for writing out the structure
[in] aStructureData
A pointer to the c-structure data to write based on the SchemaFieldDescriptor
[in] aFieldDescriptors
SchemaFieldDescriptors to describe the c struct + TLV
Return Values
WEAVE_NO_ERROR
On success.
other
Other errors that mey be returned from the aWriter.

SerializedDataToTLVWriterHelper

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

A wrapper writer function that surrounds the SerializedDataToTLVWriter with a container.

Also splits up an StructureSchemaPointerPair into structure data and descriptors to pass through.

Details
Parameters
[in] aWriter
The writer to use for writing out the structure
[in] aDataTag
Tag to write
[in] aAppData
StructureSchemaPointerPair that contains a pointer to structure data and field descriptors. void* due to prototype
Return Values
WEAVE_NO_ERROR
On success.
other
Other errors that mey be returned from the aWriter.

SetFlag

void SetFlag(
  FlagsT & inFlags,
  const FlagT inFlag
)

SetFlag

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
)

A reader function to convert TLV into a C-struct.

Uses a SchemaFieldDescriptor to interpret the data structure.

It must be robust both to encoutering unknown fields and to not encountering an expected field.

Details
Parameters
[in] aReader
The reader to use for reading in the data
[in] aStructureData
A pointer to the destination c-structure data into which we'll read based on the SchemaFieldDescriptor
[in] aFieldDescriptors
SchemaFieldDescriptors to describe the c struct + TLV
[in] aContext
Serialization context containing any state required for the operation.
Return Values
WEAVE_NO_ERROR
On success.
other
Other errors that may be returned from the aReader.

TLVReaderToDeserializedDataHelper

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

A helper function that deserializes a single TLV data element.

The function splits StructureSchemaPointerPair into structure data and descriptors to pass through to ReadDataForType.

Details
Parameters
[in] aReader
The reader containing data to be deserialized
[in] aDataTag
Unused for the moment
[in] aAppData
StructureSchemaPointerPair that contains a pointer to structure data and field descriptors. void* due to prototype
[in] aContext
Serialization context containing any state required for the operation.
Return Values
WEAVE_NO_ERROR
On success.
other
Other errors that mey be returned from the aReader.

WriteArrayData

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

A writer function that writes an array structure.

Details
Parameters
[in] aWriter
The writer to use for writing out the structure
[in] aStructureData
A pointer to the c-structure data to write based on the FieldDescriptor
[in] aFieldPtr
FieldDescriptor to describe the array c struct + TLV
Return Values
WEAVE_NO_ERROR
On success.
other
Other errors that mey be returned from the aWriter.

WriteDataForType

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

A writer function write a specific entry into the TLV based on structure data.

Details
Parameters
[in] aWriter
The writer to use for writing out the structure
[in] aStructureData
A pointer to the c-structure data to write
[in,out] aFieldPtr
FieldDescriptor to describe the fields and TLV tag. The function will increment the pointer s.t. it will point to the next element in the FieldDescritor array
[in] aType
The SerializedFieldType of the field
[in] aInArray
True if we're writing an array (use anonymous tag)
Return Values
WEAVE_NO_ERROR
On success.
other
Other errors that mey be returned from the aWriter.

WriteNullableDataForType

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

A writer function to check whether data is nullable/nullified before writing to the TLV.

Details
Parameters
[in] aWriter
The writer to use for writing out the structure
[in] aStructureData
A pointer to the c-structure data to read
[in,out] aFieldPtr
FieldDescriptor to describe the fields and TLV tag. The function will increment the pointer s.t. it will point to the next element in the FieldDescriptor array
[in] aType
The SerializedFieldType of the field
[in] aIsNullified
The TLV tag will be nullified if this is true.
Return Values
WEAVE_NO_ERROR
On success.
other
TLV errors while writing.

secondsToMilliseconds

uint32_t secondsToMilliseconds(
  uint32_t seconds
)