Skip to content

Commit

Permalink
[platform] remove legacy functions in ConnectivityManager (#9946)
Browse files Browse the repository at this point in the history
* Remove unused function `HaveIPv4InternetConnectivity` and
  `HaveIPv6InternetConnectivity`.
* Service connectivity is legacy concept and not well defined. Remove
  `HaveServiceConnectivity`
  • Loading branch information
gjc13 authored and pull[bot] committed Oct 20, 2021
1 parent 87d3474 commit 3843407
Show file tree
Hide file tree
Showing 37 changed files with 91 additions and 496 deletions.
22 changes: 7 additions & 15 deletions examples/lighting-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@ QueueHandle_t sAppEventQueue;
LEDWidget sStatusLED;
LEDWidget sLightLED;

bool sIsThreadProvisioned = false;
bool sIsThreadEnabled = false;
bool sHaveBLEConnections = false;
bool sHaveServiceConnectivity = false;
bool sIsThreadProvisioned = false;
bool sIsThreadEnabled = false;
bool sHaveBLEConnections = false;

uint8_t sAppEventQueueBuffer[APP_EVENT_QUEUE_SIZE * sizeof(AppEvent)];
StaticQueue_t sAppEventQueueStruct;
Expand Down Expand Up @@ -193,10 +192,9 @@ void AppTask::AppTaskMain(void * pvParameter)
// when the CHIP task is busy (e.g. with a long crypto operation).
if (PlatformMgr().TryLockChipStack())
{
sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned();
sIsThreadEnabled = ConnectivityMgr().IsThreadEnabled();
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);
sHaveServiceConnectivity = ConnectivityMgr().HaveServiceConnectivity();
sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned();
sIsThreadEnabled = ConnectivityMgr().IsThreadEnabled();
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);
PlatformMgr().UnlockChipStack();
}

Expand All @@ -214,13 +212,7 @@ void AppTask::AppTaskMain(void * pvParameter)
// Otherwise, blink the LED ON for a very short time.
if (sAppTask.mFunction != kFunction_FactoryReset)
{
// Consider the system to be "fully connected" if it has service
// connectivity
if (sHaveServiceConnectivity)
{
sStatusLED.Set(true);
}
else if (sIsThreadProvisioned && sIsThreadEnabled)
if (sIsThreadProvisioned && sIsThreadEnabled)
{
sStatusLED.Blink(950, 50);
}
Expand Down
20 changes: 7 additions & 13 deletions examples/lighting-app/k32w/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ static QueueHandle_t sAppEventQueue;
static LEDWidget sStatusLED;
static LEDWidget sLightLED;

static bool sIsThreadProvisioned = false;
static bool sIsThreadEnabled = false;
static bool sHaveBLEConnections = false;
static bool sHaveServiceConnectivity = false;
static bool sIsThreadProvisioned = false;
static bool sIsThreadEnabled = false;
static bool sHaveBLEConnections = false;

static uint32_t eventMask = 0;

Expand Down Expand Up @@ -182,10 +181,9 @@ void AppTask::AppTaskMain(void * pvParameter)
#if CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI
K32WUartProcess();
#endif
sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned();
sIsThreadEnabled = ConnectivityMgr().IsThreadEnabled();
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);
sHaveServiceConnectivity = ConnectivityMgr().HaveServiceConnectivity();
sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned();
sIsThreadEnabled = ConnectivityMgr().IsThreadEnabled();
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);
PlatformMgr().UnlockChipStack();
}

Expand All @@ -203,11 +201,7 @@ void AppTask::AppTaskMain(void * pvParameter)
// Otherwise, blink the LED ON for a very short time.
if (sAppTask.mFunction != kFunction_FactoryReset)
{
if (sHaveServiceConnectivity)
{
sStatusLED.Set(true);
}
else if (sIsThreadProvisioned && sIsThreadEnabled)
if (sIsThreadProvisioned && sIsThreadEnabled)
{
sStatusLED.Blink(950, 50);
}
Expand Down
20 changes: 7 additions & 13 deletions examples/lighting-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ LEDWidget sStatusLED;
LEDWidget sUnusedLED;
LEDWidget sUnusedLED_1;

bool sIsThreadProvisioned = false;
bool sIsThreadEnabled = false;
bool sHaveBLEConnections = false;
bool sHaveServiceConnectivity = false;
bool sIsThreadProvisioned = false;
bool sIsThreadEnabled = false;
bool sHaveBLEConnections = false;

} // namespace

Expand Down Expand Up @@ -150,10 +149,9 @@ int AppTask::StartApp()

if (PlatformMgr().TryLockChipStack())
{
sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned();
sIsThreadEnabled = ConnectivityMgr().IsThreadEnabled();
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);
sHaveServiceConnectivity = ConnectivityMgr().HaveServiceConnectivity();
sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned();
sIsThreadEnabled = ConnectivityMgr().IsThreadEnabled();
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);
PlatformMgr().UnlockChipStack();
}

Expand All @@ -171,11 +169,7 @@ int AppTask::StartApp()
// Otherwise, blink the LED ON for a very short time.
if (sAppTask.mFunction != kFunction_FactoryReset)
{
if (sHaveServiceConnectivity)
{
sStatusLED.Set(true);
}
else if (sIsThreadProvisioned && sIsThreadEnabled)
if (sIsThreadProvisioned && sIsThreadEnabled)
{
sStatusLED.Blink(950, 50);
}
Expand Down
22 changes: 7 additions & 15 deletions examples/lighting-app/qpg/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ using namespace chip::DeviceLayer;
static TaskHandle_t sAppTaskHandle;
static QueueHandle_t sAppEventQueue;

static bool sIsThreadProvisioned = false;
static bool sIsThreadEnabled = false;
static bool sHaveBLEConnections = false;
static bool sHaveServiceConnectivity = false;
static bool sIsThreadProvisioned = false;
static bool sIsThreadEnabled = false;
static bool sHaveBLEConnections = false;

AppTask AppTask::sAppTask;

Expand Down Expand Up @@ -146,10 +145,9 @@ void AppTask::AppTaskMain(void * pvParameter)
// when the CHIP task is busy (e.g. with a long crypto operation).
if (PlatformMgr().TryLockChipStack())
{
sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned();
sIsThreadEnabled = ConnectivityMgr().IsThreadEnabled();
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);
sHaveServiceConnectivity = ConnectivityMgr().HaveServiceConnectivity();
sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned();
sIsThreadEnabled = ConnectivityMgr().IsThreadEnabled();
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);
PlatformMgr().UnlockChipStack();
}

Expand All @@ -167,13 +165,7 @@ void AppTask::AppTaskMain(void * pvParameter)
// Otherwise, blink the LED ON for a very short time.
if (sAppTask.mFunction != kFunction_FactoryReset)
{
// Consider the system to be "fully connected" if it has service
// connectivity
if (sHaveServiceConnectivity)
{
qvCHIP_LedSet(SYSTEM_STATE_LED, true);
}
else if (sIsThreadProvisioned && sIsThreadEnabled)
if (sIsThreadProvisioned && sIsThreadEnabled)
{
qvCHIP_LedBlink(SYSTEM_STATE_LED, 950, 50);
}
Expand Down
24 changes: 9 additions & 15 deletions examples/lighting-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,10 @@ Button sFactoryResetButton;
Button sLightingButton;
Button sThreadStartButton;

bool sIsThreadProvisioned = false;
bool sIsThreadEnabled = false;
bool sIsThreadAttached = false;
bool sHaveBLEConnections = false;
bool sHaveServiceConnectivity = false;
bool sIsThreadProvisioned = false;
bool sIsThreadEnabled = false;
bool sIsThreadAttached = false;
bool sHaveBLEConnections = false;

} // namespace

Expand Down Expand Up @@ -146,19 +145,14 @@ CHIP_ERROR AppTask::StartApp()

if (PlatformMgr().TryLockChipStack())
{
sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned();
sIsThreadEnabled = ConnectivityMgr().IsThreadEnabled();
sIsThreadAttached = ConnectivityMgr().IsThreadAttached();
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);
sHaveServiceConnectivity = ConnectivityMgr().HaveServiceConnectivity();
sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned();
sIsThreadEnabled = ConnectivityMgr().IsThreadEnabled();
sIsThreadAttached = ConnectivityMgr().IsThreadAttached();
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);
PlatformMgr().UnlockChipStack();
}

if (sHaveServiceConnectivity)
{
sStatusLED.Set(true);
}
else if (sIsThreadProvisioned && sIsThreadEnabled)
if (sIsThreadProvisioned && sIsThreadEnabled)
{
if (sIsThreadAttached)
{
Expand Down
22 changes: 7 additions & 15 deletions examples/lock-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ QueueHandle_t sAppEventQueue;
LEDWidget sStatusLED;
LEDWidget sLockLED;

bool sIsThreadProvisioned = false;
bool sIsThreadEnabled = false;
bool sHaveBLEConnections = false;
bool sHaveServiceConnectivity = false;
bool sIsThreadProvisioned = false;
bool sIsThreadEnabled = false;
bool sHaveBLEConnections = false;

StackType_t appStack[APP_TASK_STACK_SIZE / sizeof(StackType_t)];
StaticTask_t appTaskStruct;
Expand Down Expand Up @@ -186,10 +185,9 @@ void AppTask::AppTaskMain(void * pvParameter)
// when the CHIP task is busy (e.g. with a long crypto operation).
if (PlatformMgr().TryLockChipStack())
{
sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned();
sIsThreadEnabled = ConnectivityMgr().IsThreadEnabled();
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);
sHaveServiceConnectivity = ConnectivityMgr().HaveServiceConnectivity();
sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned();
sIsThreadEnabled = ConnectivityMgr().IsThreadEnabled();
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);
PlatformMgr().UnlockChipStack();
}

Expand All @@ -207,13 +205,7 @@ void AppTask::AppTaskMain(void * pvParameter)
// Otherwise, blink the LED ON for a very short time.
if (sAppTask.mFunction != kFunction_FactoryReset)
{
// Consider the system to be "fully connected" if it has service
// connectivity
if (sHaveServiceConnectivity)
{
sStatusLED.Set(true);
}
else if (sIsThreadProvisioned && sIsThreadEnabled)
if (sIsThreadProvisioned && sIsThreadEnabled)
{
sStatusLED.Blink(950, 50);
}
Expand Down
14 changes: 3 additions & 11 deletions examples/lock-app/esp32/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ Button lockButton;
BaseType_t sAppTaskHandle;
QueueHandle_t sAppEventQueue;

bool sHaveBLEConnections = false;
bool sHaveServiceConnectivity = false;
bool sHaveBLEConnections = false;

StackType_t appStack[APP_TASK_STACK_SIZE / sizeof(StackType_t)];
} // namespace
Expand Down Expand Up @@ -140,8 +139,7 @@ void AppTask::AppTaskMain(void * pvParameter)
// when the CHIP task is busy (e.g. with a long crypto operation).
if (PlatformMgr().TryLockChipStack())
{
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);
sHaveServiceConnectivity = ConnectivityMgr().HaveServiceConnectivity();
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);
PlatformMgr().UnlockChipStack();
}

Expand All @@ -158,13 +156,7 @@ void AppTask::AppTaskMain(void * pvParameter)
// Otherwise, blink the LED ON for a very short time.
if (sAppTask.mFunction != kFunction_FactoryReset)
{
// Consider the system to be "fully connected" if it has service
// connectivity
if (sHaveServiceConnectivity)
{
sStatusLED.Set(true);
}
else if (sHaveBLEConnections)
if (sHaveBLEConnections)
{
sStatusLED.Blink(100, 100);
}
Expand Down
20 changes: 7 additions & 13 deletions examples/lock-app/k32w/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ static LEDWidget sStatusLED;
static LEDWidget sLockLED;
#endif

static bool sIsThreadProvisioned = false;
static bool sIsThreadEnabled = false;
static bool sHaveBLEConnections = false;
static bool sHaveServiceConnectivity = false;
static bool sIsThreadProvisioned = false;
static bool sIsThreadEnabled = false;
static bool sHaveBLEConnections = false;

static uint32_t eventMask = 0;

Expand Down Expand Up @@ -195,10 +194,9 @@ void AppTask::AppTaskMain(void * pvParameter)
K32WUartProcess();
#endif

sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned();
sIsThreadEnabled = ConnectivityMgr().IsThreadEnabled();
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);
sHaveServiceConnectivity = ConnectivityMgr().HaveServiceConnectivity();
sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned();
sIsThreadEnabled = ConnectivityMgr().IsThreadEnabled();
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);
PlatformMgr().UnlockChipStack();
}

Expand All @@ -218,11 +216,7 @@ void AppTask::AppTaskMain(void * pvParameter)
#if !cPWR_UsePowerDownMode
if (sAppTask.mFunction != kFunction_FactoryReset)
{
if (sHaveServiceConnectivity)
{
sStatusLED.Set(true);
}
else if (sIsThreadProvisioned && sIsThreadEnabled)
if (sIsThreadProvisioned && sIsThreadEnabled)
{
sStatusLED.Blink(950, 50);
}
Expand Down
20 changes: 7 additions & 13 deletions examples/lock-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ static LEDWidget sLockLED;
static LEDWidget sUnusedLED;
static LEDWidget sUnusedLED_1;

static bool sIsThreadProvisioned = false;
static bool sIsThreadEnabled = false;
static bool sHaveBLEConnections = false;
static bool sHaveServiceConnectivity = false;
static bool sIsThreadProvisioned = false;
static bool sIsThreadEnabled = false;
static bool sHaveBLEConnections = false;

static k_timer sFunctionTimer;

Expand Down Expand Up @@ -140,10 +139,9 @@ int AppTask::StartApp()

if (PlatformMgr().TryLockChipStack())
{
sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned();
sIsThreadEnabled = ConnectivityMgr().IsThreadEnabled();
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);
sHaveServiceConnectivity = ConnectivityMgr().HaveServiceConnectivity();
sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned();
sIsThreadEnabled = ConnectivityMgr().IsThreadEnabled();
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);
PlatformMgr().UnlockChipStack();
}

Expand All @@ -161,11 +159,7 @@ int AppTask::StartApp()
// Otherwise, blink the LED ON for a very short time.
if (sAppTask.mFunction != kFunction_FactoryReset)
{
if (sHaveServiceConnectivity)
{
sStatusLED.Set(true);
}
else if (sIsThreadProvisioned && sIsThreadEnabled)
if (sIsThreadProvisioned && sIsThreadEnabled)
{
sStatusLED.Blink(950, 50);
}
Expand Down
10 changes: 1 addition & 9 deletions examples/lock-app/p6/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ bool sIsWiFiStationProvisioned = false;
bool sIsWiFiStationEnabled = false;
bool sIsWiFiStationConnected = false;
bool sHaveBLEConnections = false;
bool sHaveServiceConnectivity = false;

StackType_t appStack[APP_TASK_STACK_SIZE / sizeof(StackType_t)];
StaticTask_t appTaskStruct;
Expand Down Expand Up @@ -179,7 +178,6 @@ void AppTask::AppTaskMain(void * pvParameter)
sIsWiFiStationConnected = ConnectivityMgr().IsWiFiStationConnected();
sIsWiFiStationProvisioned = ConnectivityMgr().IsWiFiStationProvisioned();
sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0);
sHaveServiceConnectivity = ConnectivityMgr().HaveServiceConnectivity();
PlatformMgr().UnlockChipStack();
}

Expand All @@ -197,13 +195,7 @@ void AppTask::AppTaskMain(void * pvParameter)
// Otherwise, blink the LED ON for a very short time.
if (sAppTask.mFunction != Function::kFactoryReset)
{
// Consider the system to be "fully connected" if it has service
// connectivity
if (sHaveServiceConnectivity)
{
sStatusLED.Set(true);
}
else if (sIsWiFiStationEnabled && sIsWiFiStationProvisioned && (!sIsWiFiStationConnected || !sHaveServiceConnectivity))
if (sIsWiFiStationEnabled && sIsWiFiStationProvisioned && !sIsWiFiStationConnected)
{
sStatusLED.Blink(950, 50);
}
Expand Down
Loading

0 comments on commit 3843407

Please sign in to comment.