|
22 | 22 | #include <stdio.h>
|
23 | 23 | #include <stdlib.h>
|
24 | 24 | #include <string.h>
|
25 |
| - |
| 25 | +#include "silabs_utils.h" |
26 | 26 | #if (SL_MATTER_GN_BUILD == 0)
|
27 | 27 | #include "sl_matter_wifi_config.h"
|
28 | 28 | #endif // SL_MATTER_GN_BUILD
|
|
43 | 43 | #include <lib/support/CHIPMemString.h>
|
44 | 44 | #include <lib/support/CodeUtils.h>
|
45 | 45 | #include <lib/support/logging/CHIPLogging.h>
|
| 46 | +#include <platform/CHIPDeviceLayer.h> |
46 | 47 |
|
47 | 48 | extern "C" {
|
48 | 49 | #include "sl_net.h"
|
@@ -543,27 +544,36 @@ sl_status_t show_scan_results(sl_wifi_scan_result_t * scan_result)
|
543 | 544 | {
|
544 | 545 | memset(&cur_scan_result, 0, sizeof(cur_scan_result));
|
545 | 546 |
|
546 |
| - cur_scan_result.ssid_length = strnlen((char *) scan_result->scan_info[idx].ssid, |
547 |
| - chip::min<size_t>(sizeof(scan_result->scan_info[idx].ssid), WFX_MAX_SSID_LENGTH)); |
| 547 | + // cur_scan_result.ssid_length = strnlen((char *) scan_result->scan_info[idx].ssid, |
| 548 | + // chip::min<size_t>(sizeof(scan_result->scan_info[idx].ssid) + 1, WFX_MAX_SSID_LENGTH)); |
| 549 | + 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 |
548 | 550 | chip::Platform::CopyString(cur_scan_result.ssid, cur_scan_result.ssid_length, (char *) scan_result->scan_info[idx].ssid);
|
549 | 551 |
|
| 552 | + SILABS_LOG("ssid : %s", cur_scan_result.ssid); |
| 553 | + SILABS_LOG("scan ssid : %s", wfx_rsi.scan_ssid); |
550 | 554 | // if user has provided ssid, then check if the current scan result ssid matches the user provided ssid
|
551 | 555 | if (wfx_rsi.scan_ssid != NULL &&
|
552 |
| - (strncmp(wfx_rsi.scan_ssid, cur_scan_result.ssid, MIN(strlen(wfx_rsi.scan_ssid), strlen(cur_scan_result.ssid))) == |
| 556 | + (strncmp(wfx_rsi.scan_ssid, cur_scan_result.ssid, MIN(strlen(wfx_rsi.scan_ssid), strlen(cur_scan_result.ssid))) != |
553 | 557 | CMP_SUCCESS))
|
554 | 558 | {
|
| 559 | + SILABS_LOG("%d",__LINE__); |
555 | 560 | continue;
|
556 | 561 | }
|
557 | 562 | cur_scan_result.security = static_cast<wfx_sec_t>(scan_result->scan_info[idx].security_mode);
|
558 | 563 | cur_scan_result.rssi = (-1) * scan_result->scan_info[idx].rssi_val;
|
559 | 564 | memcpy(cur_scan_result.bssid, scan_result->scan_info[idx].bssid, BSSID_LEN);
|
560 | 565 | wfx_rsi.scan_cb(&cur_scan_result);
|
| 566 | + SILABS_LOG("%d",__LINE__); |
561 | 567 |
|
562 | 568 | // if user has not provided the ssid, then call the callback for each scan result
|
563 | 569 | if (wfx_rsi.scan_ssid == NULL)
|
564 | 570 | {
|
| 571 | + SILABS_LOG("%d",__LINE__); |
| 572 | + |
565 | 573 | continue;
|
566 | 574 | }
|
| 575 | + SILABS_LOG("%d",__LINE__); |
| 576 | + |
567 | 577 | break;
|
568 | 578 | }
|
569 | 579 |
|
@@ -604,7 +614,7 @@ static void wfx_rsi_save_ap_info(void) // translation
|
604 | 614 | sl_wifi_ssid_t ssid_arg;
|
605 | 615 | memset(&ssid_arg, 0, sizeof(ssid_arg));
|
606 | 616 | ssid_arg.length = wfx_rsi.sec.ssid_length;
|
607 |
| - chip::Platform::CopyString((char *) &ssid_arg.value[0], ssid_arg.length, wfx_rsi.sec.ssid); |
| 617 | + memcpy((char *) &ssid_arg.value[0], wfx_rsi.sec.ssid, ssid_arg.length); |
608 | 618 | sl_wifi_set_scan_callback(scan_callback_handler, NULL);
|
609 | 619 | scan_results_complete = false;
|
610 | 620 | #ifndef EXP_BOARD
|
|
0 commit comments