/
WhdAccessPoint.cpp
48 lines (42 loc) · 1 KB
/
WhdAccessPoint.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#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);
}
}