-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13416 from dustin-crossman/pr/cysbsyskit_update_6…
….2.0 Update CYSBSYSKIT_01
- Loading branch information
Showing
34 changed files
with
1,815 additions
and
1,224 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
connectivity/drivers/emac/TARGET_Cypress/COMPONENT_SCL/interface/SclAccessPoint.cpp
This file contains 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 @@ | ||
/* | ||
* Copyright 2018-2020 Cypress Semiconductor Corporation | ||
* 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 "SclAccessPoint.h" | ||
|
||
SclAccessPoint::SclAccessPoint(nsapi_wifi_ap_t ap, scl_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); | ||
} | ||
} | ||
|
||
SclAccessPoint &SclAccessPoint::operator=(SclAccessPoint &&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; | ||
} | ||
|
||
scl_bss_type_t SclAccessPoint::get_bss_type() const | ||
{ | ||
return _bss_type; | ||
} | ||
|
||
uint8_t *SclAccessPoint::get_ie_data() const | ||
{ | ||
return _ie_ptr; | ||
} | ||
|
||
uint32_t SclAccessPoint::get_ie_len() const | ||
{ | ||
return _ie_len; | ||
} | ||
|
||
SclAccessPoint::~SclAccessPoint() | ||
{ | ||
if (_ie_ptr != NULL) { | ||
free(_ie_ptr); | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
connectivity/drivers/emac/TARGET_Cypress/COMPONENT_SCL/interface/SclAccessPoint.h
This file contains 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 @@ | ||
/* | ||
* Copyright 2018-2020 Cypress Semiconductor Corporation | ||
* 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 SCL_ACCESS_POINT_H | ||
#define SCL_ACCESS_POINT_H | ||
|
||
#include "netsocket/WiFiAccessPoint.h" | ||
#include "scl_types.h" | ||
|
||
/* Enum for scan result type */ | ||
enum scan_result_type { | ||
SRES_TYPE_WIFI_ACCESS_POINT, | ||
SRES_TYPE_SCL_ACCESS_POINT | ||
}; | ||
|
||
/** SclAccessPoint class | ||
* | ||
* Class that represents a Scl Access Point | ||
* which contains additional Scl specific information | ||
*/ | ||
class SclAccessPoint : public WiFiAccessPoint { | ||
public: | ||
SclAccessPoint() : WiFiAccessPoint() {}; | ||
SclAccessPoint(nsapi_wifi_ap_t ap, scl_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. | ||
*/ | ||
SclAccessPoint &operator=(SclAccessPoint &&rhs); | ||
SclAccessPoint &operator=(const SclAccessPoint &rhs) = delete; | ||
|
||
/** Get SCL access point's bss type | ||
* | ||
* @return The scl_bss_type_t of the access point | ||
*/ | ||
scl_bss_type_t get_bss_type() const; | ||
|
||
/** Get SCL access point's IE data | ||
* | ||
* @return The pointer to ie data buffer | ||
*/ | ||
uint8_t *get_ie_data() const; | ||
|
||
/** Get SCL access point's IE length | ||
* | ||
* @return The ie data length | ||
*/ | ||
uint32_t get_ie_len() const; | ||
|
||
virtual ~SclAccessPoint(); | ||
|
||
private: | ||
scl_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 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 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
Oops, something went wrong.