[link-quality] have LinkQualityInfo inherit from IntsanceLocatorInit (#4569)

This commit is contained in:
Abtin Keshavarzian
2020-02-20 09:36:34 -08:00
committed by Jonathan Hui
parent 0f5edc4c89
commit 2437a75a6b
5 changed files with 19 additions and 3 deletions
+1
View File
@@ -37,6 +37,7 @@
#include "common/code_utils.hpp"
#include "common/instance.hpp"
#include "common/locator-getters.hpp"
namespace ot {
+10 -1
View File
@@ -38,6 +38,7 @@
#include <openthread/platform/radio.h>
#include "common/locator.hpp"
#include "common/string.hpp"
namespace ot {
@@ -215,7 +216,7 @@ private:
* strength (RSS), last RSS, link margin, and link quality.
*
*/
class LinkQualityInfo
class LinkQualityInfo : public InstanceLocatorInit
{
public:
enum
@@ -229,6 +230,14 @@ public:
*/
typedef String<kInfoStringSize> InfoString;
/**
* This method initializes the `LinkQualityInfo` object.
*
* @param[in] aInstance A reference to the OpenThread instance.
*
*/
void Init(Instance &aInstance) { InstanceLocatorInit::Init(aInstance); }
/**
* This method clears the all the data in the object.
*
+1
View File
@@ -44,6 +44,7 @@ namespace ot {
void Neighbor::Init(Instance &aInstance)
{
InstanceLocatorInit::Init(aInstance);
mLinkInfo.Init(aInstance);
SetState(kStateInvalid);
}
+1 -2
View File
@@ -90,8 +90,7 @@ void VerifyChildIp6Addresses(const Child &aChild, uint8_t aAddressListLength, co
if (sInstance->Get<Mle::MleRouter>().IsMeshLocalAddress(aAddressList[index]))
{
SuccessOrQuit(aChild.GetMeshLocalIp6Address(address),
"Child::GetMeshLocalIp6Address() failed\n");
SuccessOrQuit(aChild.GetMeshLocalIp6Address(address), "Child::GetMeshLocalIp6Address() failed\n");
VerifyOrQuit(address == aAddressList[index], "GetMeshLocalIp6Address() did not return expected address");
hasMeshLocal = true;
}
+6
View File
@@ -34,6 +34,8 @@
namespace ot {
static ot::Instance *sInstance;
enum
{
kMaxRssValue = 0,
@@ -89,6 +91,10 @@ void TestLinkQualityData(RssTestData aRssData)
int8_t rss, ave, min, max;
size_t i;
sInstance = testInitInstance();
VerifyOrQuit(sInstance != NULL, "Null instance");
linkInfo.Init(*sInstance);
printf("- - - - - - - - - - - - - - - - - -\n");
linkInfo.Clear();
min = kMinRssValue;