-
Notifications
You must be signed in to change notification settings - Fork 3k
Allow WhdAccessPoint scan results with extended parameters #11662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
features/netsocket/emac-drivers/TARGET_WHD/interface/WhdAccessPoint.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /* WHD Access Point Interface Implementation | ||
| * Copyright (c) 2018-2019 ARM Limited | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #include <cstdlib> | ||
| #include <utility> | ||
| #include "WhdAccessPoint.h" | ||
|
|
||
| WhdAccessPoint::WhdAccessPoint(nsapi_wifi_ap_t ap, whd_bss_type_t bss_type, uint8_t *ie_ptr, uint32_t ie_len) : | ||
| WiFiAccessPoint(ap), _bss_type(bss_type) | ||
| { | ||
| _ie_ptr = (uint8_t *)malloc(ie_len * sizeof(uint8_t)); | ||
| if (_ie_ptr != NULL) { | ||
| _ie_len = ie_len; | ||
| memcpy(_ie_ptr, ie_ptr, ie_len * sizeof(uint8_t)); | ||
| } | ||
| } | ||
|
|
||
| WhdAccessPoint &WhdAccessPoint::operator=(WhdAccessPoint &&rhs) | ||
| { | ||
| if (this != &rhs) { | ||
| WiFiAccessPoint::operator=(rhs); | ||
| _bss_type = rhs._bss_type; | ||
| _ie_ptr = rhs._ie_ptr; | ||
| _ie_len = rhs._ie_len; | ||
| rhs._ie_ptr = NULL; | ||
| rhs._ie_len = 0; | ||
| } | ||
| return *this; | ||
| } | ||
|
|
||
| whd_bss_type_t WhdAccessPoint::get_bss_type() const | ||
| { | ||
| return _bss_type; | ||
| } | ||
|
|
||
| uint8_t *WhdAccessPoint::get_ie_data() const | ||
| { | ||
| return _ie_ptr; | ||
| } | ||
|
|
||
| uint32_t WhdAccessPoint::get_ie_len() const | ||
| { | ||
| return _ie_len; | ||
| } | ||
|
|
||
| WhdAccessPoint::~WhdAccessPoint() | ||
| { | ||
| if (_ie_ptr != NULL) { | ||
| free(_ie_ptr); | ||
| } | ||
| } | ||
74 changes: 74 additions & 0 deletions
74
features/netsocket/emac-drivers/TARGET_WHD/interface/WhdAccessPoint.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| /* WHD Access Point Interface | ||
| * Copyright (c) 2017-2019 ARM Limited | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #ifndef WHD_ACCESS_POINT_H | ||
| #define WHD_ACCESS_POINT_H | ||
|
|
||
| #include "netsocket/WiFiAccessPoint.h" | ||
| #include "whd_types.h" | ||
|
|
||
| /* Enum for scan result type */ | ||
| enum scan_result_type { | ||
| SRES_TYPE_WIFI_ACCESS_POINT, | ||
| SRES_TYPE_WHD_ACCESS_POINT | ||
| }; | ||
|
|
||
| /** WhdAccessPoint class | ||
| * | ||
| * Class that represents a Whd Access Point | ||
| * which contains additional Whd specific information | ||
| */ | ||
| class WhdAccessPoint : public WiFiAccessPoint { | ||
| public: | ||
| WhdAccessPoint() : WiFiAccessPoint() {}; | ||
| WhdAccessPoint(nsapi_wifi_ap_t ap, whd_bss_type_t bss_type, uint8_t *ie_ptr, uint32_t ie_len); | ||
|
|
||
| /** Define move assignment and prevent copy-assignment | ||
| * | ||
| * Due to IE element data could have large memory footprint, | ||
| * only move assignment is allowed. | ||
| */ | ||
| WhdAccessPoint &operator=(WhdAccessPoint &&rhs); | ||
| WhdAccessPoint &operator=(const WhdAccessPoint &rhs) = delete; | ||
|
|
||
| /** Get WHD access point's bss type | ||
| * | ||
| * @return The whd_bss_type_t of the access point | ||
| */ | ||
| whd_bss_type_t get_bss_type() const; | ||
|
|
||
| /** Get WHD access point's IE data | ||
| * | ||
| * @return The pointer to ie data buffer | ||
| */ | ||
| uint8_t *get_ie_data() const; | ||
|
|
||
| /** Get WHD access point's IE length | ||
| * | ||
| * @return The ie data length | ||
| */ | ||
| uint32_t get_ie_len() const; | ||
|
|
||
| virtual ~WhdAccessPoint(); | ||
|
|
||
| private: | ||
| whd_bss_type_t _bss_type; | ||
| uint8_t *_ie_ptr; /**< Pointer to received Beacon/Probe Response IE(Information Element) */ | ||
| uint32_t _ie_len; /**< Length of IE(Information Element) */ | ||
| }; | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.