nl:: Weave:: Profiles:: ReferencedTLVData
#include <src/lib/profiles/common/WeaveMessage.h>
同样,我们需要能够表示大型的旧 TLV 数据 blob。
摘要
继承
继承自: nl::Weave::Profiles::RetainedPacketBuffer
构造函数和析构函数 |
|
---|---|
ReferencedTLVData(void)
-------------- TLV 数据的定义 --------------
|
公共类型 |
|
---|---|
TLVWriteCallback)(TLV::TLVWriter &aWriter, void *aAppState)
|
typedefvoid(*
|
公共属性 |
|
---|---|
theData
|
uint8_t *
|
theLength
|
uint16_t
|
theMaxLength
|
uint16_t
|
公共函数 |
|
---|---|
free(void)
|
void
释放 ReferencedTLVData 对象,也就是说,取消定义该对象。
|
init(System::PacketBuffer *aBuffer)
|
在给定 PacketBuffer 的情况下,初始化 ReferencedTLVData 对象。
|
init(MessageIterator & i)
|
根据 MessageIterator 初始化 ReferencedTLVData 对象。
|
init(uint16_t aLength, uint16_t aMaxLength, uint8_t *aByteString)
|
在给定字节字符串的情况下初始化 ReferencedTLVObject。
|
init(TLVWriteCallback aWriteCallback, void *anAppState)
|
在给定回调函数的情况下初始化 RefererencedTLVData 对象。
|
isEmpty(void)
|
bool
检查 ReferencedTLVData 对象中是否包含任何内容。
|
isFree(void)
|
bool
检查 ReferencedTLVData 对象是否为“可用”对象,即
|
operator==(const ReferencedTLVData &) const
|
bool
检查 ReferencedTLVData 对象是否与另一个对象相等。
|
pack(System::PacketBuffer *buff)
|
将 ReferencedTLVData 对象直接打包到 PacketBuffer 中。
|
pack(MessageIterator & i, uint32_t maxLen)
|
|
packedLength(void)
|
uint16_t
返回数据长度(假设对象已打包到缓冲区中)。
|
公共静态函数 |
|
---|---|
parse(System::PacketBuffer *buff, ReferencedTLVData & aTarget)
|
从提供的 PacketBuffer 解析 ReferencedTLVData 对象。
|
parse(MessageIterator & i, ReferencedTLVData & aTarget)
|
从提供的 MessageIterator 解析 ReferencedTLVData 对象。
|
公共类型
TLVWriteCallback
void(* TLVWriteCallback)(TLV::TLVWriter &aWriter, void *aAppState)
公共属性
theData
uint8_t * theData
theLength
uint16_t theLength
theMaxLength
uint16_t theMaxLength
公共函数
ReferencedTLVData
ReferencedTLVData( void )
init
WEAVE_ERROR init( System::PacketBuffer *aBuffer )
在给定 PacketBuffer 的情况下,初始化 ReferencedTLVData 对象。
如果缓冲区已满 TLV,请初始化 ReferencedTLVData 对象。这里假设缓冲区仅包含 TLV。
具体说明 | |||
---|---|---|---|
参数 |
|
||
返回值 |
|
init
WEAVE_ERROR init( MessageIterator & i )
根据 MessageIterator 初始化 ReferencedTLVData 对象。
根据 MessageIterator 初始化 ReferencedTLVData 对象。在本例中,TLV 是缓冲区的最后一部分,我们会传入指向它的消息迭代器。
具体说明 | |||
---|---|---|---|
参数 |
|
||
返回值 |
|
init
WEAVE_ERROR init( uint16_t aLength, uint16_t aMaxLength, uint8_t *aByteString )
在给定字节字符串的情况下初始化 ReferencedTLVObject。
使用包含 TLV 的字节字符串初始化 ReferencedTLVData 对象。如果没有 PacketrBuffer,我们就使用此初始化程序,因为我们创建这类初始化程序是为了打包和发送。
具体说明 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
init
WEAVE_ERROR init( TLVWriteCallback aWriteCallback, void *anAppState )
在给定回调函数的情况下初始化 RefererencedTLVData 对象。
初始化 ReferencedTLVData 对象。此版本没有显式提供数据,而是提供了函数、写入回调、一个引用对象(当应该打包和发送引用的数据时,该对象将与 TLVWriter 对象一起传递给该函数)。该回调的签名为:
typedef void (*TLVWriteCallback)(TLV::TLVWriter &aWriter, void *aAppState);
具体说明 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
isEmpty
bool isEmpty( void )
检查 ReferencedTLVData 对象中是否包含任何内容。
这种对象可能“拥有”某些内容的方式有两种。它可以具有 0 长度,或者没有写入回调。
具体说明 | |
---|---|
返回值 |
如果数据集的长度为 0 或者没有写入回调,则为 true,否则为 false。
|
isFree
bool isFree( void )
运算符==
bool operator==( const ReferencedTLVData & ) const
检查 ReferencedTLVData 对象是否与另一个对象相等。
请注意,只有在两个对象中包含由缓冲区或字符串支持的实际数据时才有意义。
具体说明 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
包
WEAVE_ERROR pack( System::PacketBuffer *buff )
将 ReferencedTLVData 对象直接打包到 PacketBuffer 中。
具体说明 | |||
---|---|---|---|
参数 |
|
||
返回值 |
反映底层 pack 调用成功的 WEAVE_ERROR。
|
包
WEAVE_ERROR pack( MessageIterator & i, uint32_t maxLen )
packedLength
uint16_t packedLength( void )
返回数据长度(假设对象已打包到缓冲区中)。
具体说明 | |
---|---|
返回值 |
打包数据的整数长度。
|
公共静态函数
parse
WEAVE_ERROR parse( System::PacketBuffer *buff, ReferencedTLVData & aTarget )
从提供的 PacketBuffer 解析 ReferencedTLVData 对象。
从 inet 缓冲区中解析 ReferencedTLVData 对象(假设它仅包含 TLV)。
具体说明 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
反映底层解析调用成功的 WEAVE_ERROR。
|
parse
WEAVE_ERROR parse( MessageIterator & i, ReferencedTLVData & aTarget )
从提供的 MessageIterator 解析 ReferencedTLVData 对象。
从假定指向消息的 TLV 部分的 MessageIterator 对象解析 ReferenceTLVData 对象。
请注意,此处并未执行实际的“解析”,因为 TLV 留在缓冲区中,根本未被操纵。此方法主要只是设置 ReferencedTLVData 结构以供稍后使用。
具体说明 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|