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 )
包
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 物件。
從 MessageIterator 物件剖析 ReferenceTLVData 物件會假設指向訊息的 TLV 部分。
請注意,這裡不會執行實際的「剖析」,因為 TLV 保留在緩衝區中,完全不會操控。這個方法主要只是設定 ReferencedTLVData 結構以供日後使用。
詳細說明 | |||||
---|---|---|---|---|---|
參數 |
|
||||
傳回值 |
|