Skip to content

Commit

Permalink
removing the unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
chirag-silabs committed Oct 30, 2024
1 parent 3f6e0d3 commit 035f5cc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 21 deletions.
13 changes: 0 additions & 13 deletions examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "silabs_utils.h"
#if (SL_MATTER_GN_BUILD == 0)
#include "sl_matter_wifi_config.h"
#endif // SL_MATTER_GN_BUILD
Expand Down Expand Up @@ -543,37 +542,25 @@ sl_status_t show_scan_results(sl_wifi_scan_result_t * scan_result)
for (int idx = 0; idx < (int) scan_result->scan_count; idx++)
{
memset(&cur_scan_result, 0, sizeof(cur_scan_result));

// cur_scan_result.ssid_length = strnlen((char *) scan_result->scan_info[idx].ssid,
// chip::min<size_t>(sizeof(scan_result->scan_info[idx].ssid) + 1, WFX_MAX_SSID_LENGTH));
cur_scan_result.ssid_length = chip::min<size_t>(strnlen((char *) scan_result->scan_info[idx].ssid, chip::DeviceLayer::Internal::kMaxWiFiSSIDLength) + 1, chip::DeviceLayer::Internal::kMaxWiFiSSIDLength); // +1 for null termination
chip::Platform::CopyString(cur_scan_result.ssid, cur_scan_result.ssid_length, (char *) scan_result->scan_info[idx].ssid);

SILABS_LOG("ssid : %s", cur_scan_result.ssid);
SILABS_LOG("scan ssid : %s", wfx_rsi.scan_ssid);
// if user has provided ssid, then check if the current scan result ssid matches the user provided ssid
if (wfx_rsi.scan_ssid != NULL &&
(strncmp(wfx_rsi.scan_ssid, cur_scan_result.ssid, MIN(strlen(wfx_rsi.scan_ssid), strlen(cur_scan_result.ssid))) !=
CMP_SUCCESS))
{
SILABS_LOG("%d",__LINE__);
continue;
}
cur_scan_result.security = static_cast<wfx_sec_t>(scan_result->scan_info[idx].security_mode);
cur_scan_result.rssi = (-1) * scan_result->scan_info[idx].rssi_val;
memcpy(cur_scan_result.bssid, scan_result->scan_info[idx].bssid, BSSID_LEN);
wfx_rsi.scan_cb(&cur_scan_result);
SILABS_LOG("%d",__LINE__);

// if user has not provided the ssid, then call the callback for each scan result
if (wfx_rsi.scan_ssid == NULL)
{
SILABS_LOG("%d",__LINE__);

continue;
}
SILABS_LOG("%d",__LINE__);

break;
}

Expand Down
5 changes: 2 additions & 3 deletions examples/platform/silabs/efr32/rs911x/rsi_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ extern "C" {
#include <lib/support/CHIPMemString.h>
#include <lib/support/CodeUtils.h>
#include <lib/support/logging/CHIPLogging.h>
#include <platform/CHIPDeviceLayer.h>

#define WFX_QUEUE_SIZE 10

Expand Down Expand Up @@ -755,9 +756,7 @@ void ProcessEvent(WfxEvent_t inEvent)
scan = &scan_rsp.scan_info[x];
// clear structure and calculate size of SSID
memset(&ap, 0, sizeof(ap));
// ap.ssid_length =
// strnlen(reinterpret_cast<char *>(scan->ssid), chip::min<size_t>(sizeof(scan->ssid) + 1, WFX_MAX_SSID_LENGTH));
ap.ssid_length = chip::min<size_t>(strnlen(ap.ssid) + 1, WFX_MAX_SSID_LENGTH); // +1 for null termination
ap.ssid_length = chip::min<size_t>(strnlen(ap.ssid, chip::DeviceLayer::Internal::kMaxWiFiSSIDLength) + 1, chip::DeviceLayer::Internal::kMaxWiFiSSIDLength); // +1 for null termination
chip::Platform::CopyString(ap.ssid, ap.ssid_length, reinterpret_cast<char *>(scan->ssid));

// check if the scanned ssid is the one we are looking for
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/silabs/efr32/wf200/host_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ bool wfx_start_scan(char * ssid, void (*callback)(wfx_wifi_scan_result_t *))
VerifyOrReturnError(scan_cb != nullptr, false);
if (ssid)
{
scan_ssid_length = chip::min<size_t>(strnlen(ssid) + 1, WFX_MAX_SSID_LENGTH); // +1 for null termination
scan_ssid_length = chip::min<size_t>(strnlen(ssid, chip::DeviceLayer::Internal::kMaxWiFiSSIDLength) + 1, chip::DeviceLayer::Internal::kMaxWiFiSSIDLength); // +1 for null termination
scan_ssid = reinterpret_cast<char *>(chip::Platform::MemoryAlloc(scan_ssid_length));
VerifyOrReturnError(scan_ssid != nullptr, false);
Platform::CopyString(scan_ssid, scan_ssid_length, ssid);
Expand Down
5 changes: 1 addition & 4 deletions examples/platform/silabs/wifi/wfx_rsi_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,20 +361,17 @@ int32_t wfx_reset_counts(void)
* @return returns ture if successful,
* false otherwise
*******************************************************************************/
#include "silabs_utils.h"
bool wfx_start_scan(char * ssid, void (*callback)(wfx_wifi_scan_result_t *))
{
// check if already in progress
VerifyOrReturnError(wfx_rsi.scan_cb == nullptr, false);
wfx_rsi.scan_cb = callback;
// if SSID is provided to scan only that SSID
if(ssid) {
// wfx_rsi.scan_ssid_length = strnlen(ssid, chip::min<size_t>((strlen(ssid) + 1), WFX_MA X_SSID_LENGTH));
wfx_rsi.scan_ssid_length = chip::min<size_t>(strnlen(ssid, chip::DeviceLayer::Internal::kMaxWiFiSSIDLength) + 1, chip::DeviceLayer::Internal::kMaxWiFiSSIDLength);
wfx_rsi.scan_ssid_length = chip::min<size_t>(strnlen(ssid, chip::DeviceLayer::Internal::kMaxWiFiSSIDLength) + 1, chip::DeviceLayer::Internal::kMaxWiFiSSIDLength); // +1 for null termination
wfx_rsi.scan_ssid = reinterpret_cast<char *>(chip::Platform::MemoryAlloc(wfx_rsi.scan_ssid_length));
VerifyOrReturnError(wfx_rsi.scan_ssid != nullptr, false);
chip::Platform::CopyString(wfx_rsi.scan_ssid, wfx_rsi.scan_ssid_length, ssid);
SILABS_LOG("%s hhhh %s %d %d", wfx_rsi.scan_ssid, ssid, wfx_rsi.scan_ssid_length, strlen(ssid));
}
WfxEvent_t event;
event.eventType = WFX_EVT_SCAN;
Expand Down

0 comments on commit 035f5cc

Please sign in to comment.