Skip to content

Commit 22914b1

Browse files
Clean up
1 parent 2e22d8e commit 22914b1

File tree

6 files changed

+38
-27
lines changed

6 files changed

+38
-27
lines changed

src/platform/silabs/wifi/SiWx/WifiInterfaceImpl.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ sl_status_t BackgroundScanCallback(sl_wifi_event_t event, sl_wifi_scan_result_t
246246
return SL_STATUS_OK;
247247
}
248248

249-
sl_status_t sl_wifi_siwx917_init(void)
249+
sl_status_t SiWxPlatformInit(void)
250250
{
251251
sl_status_t status = SL_STATUS_OK;
252252

@@ -451,9 +451,9 @@ void WiseconnectWifiInterface::MatterWifiTask(void * arg)
451451
WiseconnectWifiInterface::WifiPlatformEvent event;
452452
sl_status_t status = SL_STATUS_OK;
453453

454-
status = sl_wifi_siwx917_init();
454+
status = SiWxPlatformInit();
455455
VerifyOrReturn(status == SL_STATUS_OK,
456-
ChipLogError(DeviceLayer, "MatterWifiTask: sl_wifi_siwx917_init failed: 0x%lx", static_cast<uint32_t>(status)));
456+
ChipLogError(DeviceLayer, "MatterWifiTask: SiWxPlatformInit failed: 0x%lx", static_cast<uint32_t>(status)));
457457

458458
WifiInterfaceImpl::GetInstance().NotifyWifiTaskInitialized();
459459

src/platform/silabs/wifi/SiWx/WifiInterfaceImpl.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class WifiInterfaceImpl final : public WiseconnectWifiInterface
4848
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER
4949

5050
/**
51-
* @brief
51+
* @brief Processes the wifi platform events for the SiWx platform
5252
*
5353
* TODO: Current inheritance structure with the task creation in the parent forces this function to be public when it shouldn't
5454
* be. This isn't the best practice and we should try to move this to protected.
@@ -97,7 +97,7 @@ class WifiInterfaceImpl final : public WiseconnectWifiInterface
9797
sl_status_t JoinWifiNetwork();
9898

9999
/**
100-
* @brief TODO
100+
* @brief Processing function responsible of executing the DHCP polling operation until we have an IPv6 or IPv4 address
101101
*
102102
*/
103103
void HandleDHCPPolling();

src/platform/silabs/wifi/WifiInterface.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ void WifiInterface::NotifyIPv6Change(bool gotIPv6Addr)
7272

7373
HandleWFXSystemEvent(&eventData);
7474
}
75+
7576
#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4)
7677
void WifiInterface::NotifyIPv4Change(bool gotIPv4Addr)
7778
{
@@ -119,12 +120,12 @@ void WifiInterface::ResetIPNotificationStates()
119120

120121
void WifiInterface::NotifyWifiTaskInitialized(void)
121122
{
122-
sl_wfx_startup_ind_t evt = {};
123+
sl_wfx_startup_ind_t evt = { 0 };
123124

124125
// TODO: We should move this to the init function and not the notification function
125126
// Creating a timer which will be used to retry connection with AP
126-
sRetryTimer = osTimerNew(RetryConnectionTimerHandler, osTimerOnce, NULL, NULL);
127-
VerifyOrReturn(sRetryTimer != NULL);
127+
mRetryTimer = osTimerNew(RetryConnectionTimerHandler, osTimerOnce, NULL, NULL);
128+
VerifyOrReturn(mRetryTimer != NULL);
128129

129130
evt.header.id = to_underlying(WifiEvent::kStartUp);
130131
evt.header.length = sizeof evt;
@@ -151,7 +152,7 @@ void WifiInterface::ScheduleConnectionAttempt()
151152
retryInterval = kWlanMaxRetryIntervalsInSec;
152153
}
153154

154-
if (osTimerStart(sRetryTimer, pdMS_TO_TICKS(retryInterval * 1000)) != osOK)
155+
if (osTimerStart(mRetryTimer, pdMS_TO_TICKS(retryInterval * 1000)) != osOK)
155156
{
156157
ChipLogProgress(DeviceLayer, "Failed to start retry timer");
157158
// Sending the join command if retry timer failed to start

src/platform/silabs/wifi/WifiInterface.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,9 @@ class WifiInterface
464464
#if CHIP_DEVICE_CONFIG_ENABLE_IPV4
465465
bool mHasNotifiedIPv4 = false;
466466
#endif // CHIP_DEVICE_CONFIG_ENABLE_IPV4
467+
467468
private:
468-
osTimerId_t sRetryTimer;
469+
osTimerId_t mRetryTimer;
469470
};
470471

471472
} // namespace Silabs

src/platform/silabs/wifi/rs911x/WifiInterfaceImpl.h

+11-12
Original file line numberDiff line numberDiff line change
@@ -70,27 +70,26 @@ class WifiInterfaceImpl final : public WiseconnectWifiInterface
7070
~WifiInterfaceImpl() = default;
7171

7272
/**
73-
* @brief
73+
* @brief Callback function on a succesfull join operation
7474
*
75-
* @param status
76-
* @param buf
77-
* @param len
75+
* See the third_party/silabs/wiseconnect-wifi-bt-sdk/sapi/wlan/rsi_wlan_apis.c
76+
* rsi_wlan_connect_async documentation for the argument definitions
7877
*/
7978
static void JoinCallback(uint16_t status, const uint8_t * buf, const uint16_t len);
8079

8180
/**
82-
* @brief
81+
* @brief Callback function for a failed join operation
8382
*
84-
* @param status
85-
* @param buf
86-
* @param len
83+
* See the third_party/silabs/wiseconnect-wifi-bt-sdk/sapi/wlan/rsi_wlan_apis.c
84+
* rsi_wlan_register_callbacks documentation for the argument definitions
8785
*/
8886
static void JoinFailCallback(uint16_t status, uint8_t * buf, uint32_t len);
8987

9088
/**
91-
* @brief
89+
* @brief Platform Init for the RS911x platform
9290
*
93-
* @return int32_t
91+
* @return int32_t RSI_SUCCESS, on succesfull init
92+
* RSI_FAILURE, otherwise
9493
*/
9594
int32_t Rs911xPlatformInit();
9695

@@ -100,8 +99,8 @@ class WifiInterfaceImpl final : public WiseconnectWifiInterface
10099
void JoinWifiNetwork();
101100

102101
/**
103-
* @brief
104-
*
102+
* @brief Processing function responsible of executing the DHCP polling operation
103+
* until we have an IPv6 or IPv4 address
105104
*/
106105
void HandleDHCPPolling();
107106

src/platform/silabs/wifi/wf200/WifiInterfaceImpl.h

+15-5
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ class WifiInterfaceImpl final : public WifiInterface
3030
public:
3131
static WifiInterfaceImpl & GetInstance() { return mInstance; }
3232

33+
WifiInterfaceImpl(const WifiInterfaceImpl &) = delete;
34+
WifiInterfaceImpl & operator=(const WifiInterfaceImpl &) = delete;
35+
36+
/*
37+
* WifiInterface Impl
38+
*/
39+
3340
CHIP_ERROR InitWiFiStack(void) override;
3441
CHIP_ERROR GetMacAddress(sl_wfx_interface_t interface, chip::MutableByteSpan & addr) override;
3542
CHIP_ERROR StartNetworkScan(chip::ByteSpan ssid, ScanCallback callback) override;
@@ -59,16 +66,17 @@ class WifiInterfaceImpl final : public WifiInterface
5966

6067
/**
6168
* @brief Callback function passed to the Wi-Fi stack to notify the application of a connection event.
62-
*
63-
* @note Function is public to allow the Wi-Fi stack to call it. In practice, it should be private but the callback structure
64-
* needs to be reworked
69+
* Function is public to allow the Wi-Fi stack to call it. In practice, it should be private but the callback structure
70+
* needs to be reworked first.
6571
*
6672
* @param connect_indication_body Connection callback data
6773
*/
6874
void ConnectionEventCallback(sl_wfx_connect_ind_body_t connect_indication_body);
6975

7076
/**
7177
* @brief Callback function to the Wi-Fi stack to notify the application of a disconnection event.
78+
* Function is public to allow the Wi-Fi stack to call it. In practice, it should be private but the callback
79+
* structure needs to be reworked first.
7280
*
7381
* @note See the sl_wfx_disconnect_ind_body_t structure for the reason values.
7482
*
@@ -78,6 +86,9 @@ class WifiInterfaceImpl final : public WifiInterface
7886
void DisconnectionEventCallback(uint8_t * mac, uint16_t reason);
7987

8088
private:
89+
WifiInterfaceImpl() = default;
90+
~WifiInterfaceImpl() = default;
91+
8192
/**
8293
* @brief Initialize the WF200 platform
8394
* Function triggers the platform int and the LwIP init.
@@ -96,14 +107,13 @@ class WifiInterfaceImpl final : public WifiInterface
96107

97108
/**
98109
* @brief Creates a new task to process Wi-Fi events
99-
*
100110
*/
101111
void StartWifiProcessTask(void);
102112

103113
/**
104114
* @brief Wf200 Wifi Init
105115
*
106-
* TODO: We have multiple init function when we could have only one
116+
* TODO: We have multiple init function when we could have only one.
107117
*
108118
* @return sl_status_t SL_STATUS_OK if the platform is initialized successfully,
109119
* SL_STATUS_WIFI_INVALID_KEY, If the firmware keyset is invalid

0 commit comments

Comments
 (0)