mirror of
https://github.com/espressif/openthread.git
synced 2026-08-12 13:47:47 +00:00
[tlv] improve encapsulation and docs for Tlv::Info (#12301)
This change renames `Tlv::ParsedInfo` to `Tlv::Info` to make it more concise and to better reflect its purpose as a metadata holder for a TLV in a message. The member variables of `Tlv::Info` are made private and public accessor methods are introduced to interact with the object's contenet. This helps ensure that the internal representation of the parsed TLV information is not modified directly by external modules. All existing caller are updated to use the new name and the public helper getter methods. The Doxygen comments of `Tlv::Info` are also improved for better clarity. Unit test `test_tlv` is also updated to validate all the new methods.
This commit is contained in:
@@ -2707,7 +2707,7 @@ void Mle::HandleDiscoveryRequest(RxInfo &aRxInfo)
|
||||
{
|
||||
Error error = kErrorNone;
|
||||
bool parsedDiscoveryRequestTlv = false;
|
||||
Tlv::ParsedInfo tlvInfo;
|
||||
Tlv::Info tlvInfo;
|
||||
MeshCoP::DiscoveryRequestTlvValue discoveryRequestTlvValue;
|
||||
MeshCoP::ExtendedPanId extPanId;
|
||||
OffsetRange offsetRange;
|
||||
@@ -2723,12 +2723,12 @@ void Mle::HandleDiscoveryRequest(RxInfo &aRxInfo)
|
||||
{
|
||||
SuccessOrExit(error = tlvInfo.ParseFrom(aRxInfo.mMessage, offsetRange));
|
||||
|
||||
if (tlvInfo.mIsExtended)
|
||||
if (tlvInfo.IsExtended())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (tlvInfo.mType)
|
||||
switch (tlvInfo.GetType())
|
||||
{
|
||||
case MeshCoP::Tlv::kDiscoveryRequest:
|
||||
SuccessOrExit(error = Tlv::Read<MeshCoP::DiscoveryRequestTlv>(aRxInfo.mMessage, offsetRange.GetOffset(),
|
||||
|
||||
Reference in New Issue
Block a user