nl::Weave::Profiles::DataManagement_Legacy::ProfileDatabase

這是抽象類別。

#include <src/lib/profiles/data-management/Legacy/ProfileDatabase.h>

抽象的 ProfileDatabase 輔助類別。

摘要

WDM 會將通訊協定實作與資料管理實作分開,且至少在原則上,大多數的第二項因素都會給應用程式開發人員。WDM 中的所有有趣呼叫,以及設定檔開發人員在實作 TLV 編碼路徑清單或資料清單時所需的所有抽象方法。這不僅對設定檔開發人員造成負擔,在實務上,在開發人員編寫相同的封裝及解壓縮 TLV 等程式碼後,會造成大量程式碼重複為了方便起見,我們提供了一種「資料管理工具包」。

這個輔助類別支援儲存及擷取資料,前提是已提供必要的具體 ProfileData 子類別,並新增至下方的 LookupProfileData() 方法。

公用函式

LookupDataFromProfileDescriptor(nl::Weave::TLV::TLVReader & aDescReader, ProfileData **aProfileData)
在資料庫中找到 ProfileData 物件。
LookupProfileData(nl::Weave::TLV::TLVReader & aPathReader, ProfileData **aProfileData)
在資料庫中找到 ProfileData 物件。
LookupProfileData(uint32_t aProfileId, nl::Weave::TLV::TLVReader *aInstanceIdRdr, ProfileData **aResult)=0
virtual WEAVE_ERROR
查詢 ProfileData 物件。
Retrieve(ReferencedTLVData & aPathList, ReferencedTLVData & aDataList)
擷取給定路徑清單的資料清單。
Retrieve(ReferencedTLVData & aPathList, nl::Weave::TLV::TLVWriter & aWriter)
依據路徑清單撰寫資料清單。
Store(ReferencedTLVData & aDataList)
儲存資料清單。

受保護的函式

StoreInternal(nl::Weave::TLV::TLVReader & aPathReader, uint64_t aVersion, nl::Weave::TLV::TLVReader & aDataReader)

類別

nl::Weave::Profiles::DataManagement_Legacy::ProfileDatabase::ProfileData

抽象 ProfileData 輔助內部類別。

公用函式

LookupDataFromProfileDescriptor

WEAVE_ERROR LookupDataFromProfileDescriptor(
  nl::Weave::TLV::TLVReader & aDescReader,
  ProfileData **aProfileData
)

在資料庫中找到 ProfileData 物件。

此公用程式方法可用來尋找特定 ProfileDatabase 中的 ProfileData 物件。主要取決於具體 ProfileDatabase 子類別的實作者提供的查詢方法。

詳細說明
參數
[in] aDescReader
位於 WDM 路徑上的 TLV 讀取器參照,也就是具有第一個元素、設定檔說明的 TLV 路徑。
[out] aProfileData
指標,用於傳回所需 ProfileData 物件的指標。
傳回
成功時 WEAVE_NO_ERROR,否則傳回 WEAVE_ERROR,表示無法查詢相符的 ProfileData 物件。

LookupProfileData

WEAVE_ERROR LookupProfileData(
  nl::Weave::TLV::TLVReader & aPathReader,
  ProfileData **aProfileData
)

在資料庫中找到 ProfileData 物件。

此公用程式方法可用來尋找特定 ProfileDatabase 中的 ProfileData 物件。主要取決於具體 ProfileDatabase 子類別的實作者提供的查詢方法。

詳細說明
參數
[in] aPathReader
位於 WDM 路徑上的 TLV 讀取器參照,也就是具有第一個元素、設定檔說明的 TLV 路徑。
[out] aProfileData
指標,用於傳回所需 ProfileData 物件的指標。
傳回
成功時 WEAVE_NO_ERROR,否則傳回 WEAVE_ERROR,表示無法查詢相符的 ProfileData 物件。

LookupProfileData

virtual WEAVE_ERROR LookupProfileData(
  uint32_t aProfileId,
  nl::Weave::TLV::TLVReader *aInstanceIdRdr,
  ProfileData **aResult
)=0

查詢 ProfileData 物件。

查詢特定的 ProfileData 物件,其中包含以 TLV 讀取器形式提供的設定檔 ID 和 (選用) 執行個體 ID。

詳細說明
參數
[in] aProfileId
所需設定檔的 32 位元設定檔編號。
[in] aInstanceIdRdr
指向執行個體 ID 資料中 TLV 讀取器的指標。如果未提供執行個體 ID,則這個值會是空值。
[out] aResult
指標,用於傳回所需 ProfileData 物件的指標。
傳回
WEAVE_NO_ERROR:成功後。否則,系統會傳回 WEAVE_ERROR,表示找不到 ProfileData 物件。

擷取

WEAVE_ERROR Retrieve(
  ReferencedTLVData & aPathList,
  ReferencedTLVData & aDataList
)

擷取給定路徑清單的資料清單。

針對路徑清單,擷取包含路徑中每個路徑的資料清單元素的資料清單,這是該路徑的終端的資料。

詳細說明
參數
[in] aPathList
ReferencedTLVData 物件的參照,其中含有以 TLV 編碼表示要擷取的資料的路徑清單。這個參數在執行這個函式期間會保持不變。
[out] aDataList
參照要寫入擷取結果的 ReferencedTLVData 物件。只有在成功執行這個函式後,系統才會調整資料長度。
傳回
WEAVE_NO_ERROR:成功後。否則,系統會傳回 WEAVE_ERROR,表示無法擷取興趣資料清單。

擷取

WEAVE_ERROR Retrieve(
  ReferencedTLVData & aPathList,
  nl::Weave::TLV::TLVWriter & aWriter
)

依據路徑清單撰寫資料清單。

假設列出路徑清單與 TLV 寫入者,請寫出資料清單,其中包含路徑清單中每個路徑的資料清單元素,以及該路徑的終端資料。

詳細說明
參數
[in] aPathList
參照 ReferencedTLVData 物件,其中含有代表要擷取資料的 TLV 路徑清單。這個參數在執行這個函式期間會保持不變。
[in] aWriter
用於撰寫擷取路徑清單的 TLV 寫入者參照。寫入者的內部狀態在發生錯誤時可能無法復原。
傳回
WEAVE_NO_ERROR:成功後。否則,會傳回 WEAVE_ERROR,表示無法擷取資料,或是寫入所需的資料清單。

儲存

WEAVE_ERROR Store(
  ReferencedTLVData & aDataList
)

儲存資料清單。

假設有 TLV 編碼資料清單,此方法會經歷剖析該清單的程序,並呼叫 ProfileDatabase 子類別實作者提供的具體方法,將參照的資料放到所屬的位置。

詳細說明
參數
[in] aDataList
ReferencedTLVData 物件的參照,該物件包含採用 TLV 編碼格式的興趣資料。
傳回
WEAVE_NO_ERROR:成功後。否則,會傳回 WEAVE_ERROR,表示無法儲存感興趣的資料。

受保護的函式

StoreInternal

WEAVE_ERROR StoreInternal(
  nl::Weave::TLV::TLVReader & aPathReader,
  uint64_t aVersion,
  nl::Weave::TLV::TLVReader & aDataReader
)