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)
公共属性
数据
uint8_t * theData
TheLength
uint16_t theLength
最大长度
uint16_t theMaxLength
公共函数
引用的 TLVData
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);
详细信息 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
为空
bool isEmpty( void )
检查 ReferencedTLVData 对象中是否包含任何内容。
此类对象可通过两种可能的方式获得。它要么具有 0 长度,要么没有写入回调。
详细信息 | |
---|---|
返回值 |
如果数据集的长度为 0 或不存在写入回调,则为 true,否则为 false。
|
运算符==
bool operator==( const ReferencedTLVData & ) const
将 ReferencedTLVData 对象与另一个对象进行比较以检查是否相等。
请注意,这只有在两个对象都具有由缓冲区或字符串支持的实际数据时,才行得通。
详细信息 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
包
WEAVE_ERROR pack( System::PacketBuffer *buff )
将 ReferencedTLVData 对象直接打包到 PacketBuffer 中。
详细信息 | |||
---|---|---|---|
参数 |
|
||
返回值 |
WEAVE_ERROR,反映了底层软件包调用的成功。
|
包
WEAVE_ERROR pack( MessageIterator & i, uint32_t maxLen )
包装长度
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 对象。
从 MessageIterator 对象解析假定指向消息的 TLV 部分的 ReferenceTLVData 对象。
请注意,此处没有进行任何实际的“解析”,因为 TLV 留在缓冲区中,完全不被操控。此方法主要用于设置 ReferencedTLVData 结构供以后使用。
详细信息 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|