| 589 | } |
| 590 | |
| 591 | rt_err_t rt_wlan_dev_scan(struct rt_wlan_device *device, struct rt_wlan_info *info) |
| 592 | { |
| 593 | struct rt_scan_info scan_info = { 0 }; |
| 594 | struct rt_scan_info *p_scan_info = RT_NULL; |
| 595 | rt_err_t result = 0; |
| 596 | |
| 597 | if (device == RT_NULL) |
| 598 | { |
| 599 | return -RT_EIO; |
| 600 | } |
| 601 | |
| 602 | if (info != RT_NULL) |
| 603 | { |
| 604 | if (info->ssid.len > RT_WLAN_SSID_MAX_LENGTH) |
| 605 | { |
| 606 | LOG_E("L:%d ssid is too long", __LINE__); |
| 607 | return -RT_EINVAL; |
| 608 | } |
| 609 | rt_memcpy(&scan_info.ssid, &info->ssid, sizeof(rt_wlan_ssid_t)); |
| 610 | rt_memcpy(scan_info.bssid, info->bssid, RT_WLAN_BSSID_MAX_LENGTH); |
| 611 | if (info->channel > 0) |
| 612 | { |
| 613 | scan_info.channel_min = info->channel; |
| 614 | scan_info.channel_max = info->channel; |
| 615 | } |
| 616 | else |
| 617 | { |
| 618 | scan_info.channel_min = -1; |
| 619 | scan_info.channel_max = -1; |
| 620 | } |
| 621 | scan_info.passive = info->hidden ? RT_TRUE : RT_FALSE; |
| 622 | p_scan_info = &scan_info; |
| 623 | } |
| 624 | result = rt_device_control(RT_DEVICE(device), RT_WLAN_CMD_SCAN, p_scan_info); |
| 625 | return result; |
| 626 | } |
| 627 | |
| 628 | rt_err_t rt_wlan_dev_scan_stop(struct rt_wlan_device *device) |
| 629 | { |
no test coverage detected