[Positioning] Uppercase all MAC addresses on input
This commit is contained in:
parent
e9e8308a9c
commit
37997242c5
|
@ -33,6 +33,7 @@ void AccessPointsReaderCSV::process_access_point_line()
|
|||
string mac ;
|
||||
if (! file.read_field(mac))
|
||||
throw malformed_input_data("Cannot read access point MAC address!") ;
|
||||
PosUtil::to_upper(mac) ;
|
||||
|
||||
Point3D coord ;
|
||||
if (! file.read_point3d(coord))
|
||||
|
|
|
@ -45,6 +45,7 @@ const Request& InputCSV::get_next_request()
|
|||
cerr << "InputCSV: cannot read mac_mobile.\n" ;
|
||||
return *current_request ;
|
||||
}
|
||||
PosUtil::to_upper(mac_mobile) ;
|
||||
const Mobile &mobile = Stock::find_create_mobile(mac_mobile) ;
|
||||
current_request->set_mobile(&mobile) ;
|
||||
|
||||
|
@ -114,6 +115,7 @@ const Request& InputCSV::get_next_request()
|
|||
cerr << "InputCSV: cannot read mac_ap.\n" ;
|
||||
return *current_request ;
|
||||
}
|
||||
PosUtil::to_upper(mac_ap) ;
|
||||
const AccessPoint &ap = Stock::find_create_ap(mac_ap) ;
|
||||
measurements[mac_ap].set_ap(&ap) ;
|
||||
measurements[mac_ap].add_ss(ss) ;
|
||||
|
|
|
@ -107,8 +107,9 @@ const Request& InputUDPSocket::get_next_request()
|
|||
request.nb_info = ntohs(request.nb_info) ;
|
||||
|
||||
// Mobile MAC
|
||||
const char *const mac_mobile =
|
||||
owl_mac_bytes_to_string(request.mobile_mac_addr_bytes) ;
|
||||
string mac_mobile(
|
||||
owl_mac_bytes_to_string(request.mobile_mac_addr_bytes)) ;
|
||||
PosUtil::to_upper(mac_mobile) ;
|
||||
const Mobile &mobile = Stock::find_create_mobile(mac_mobile) ;
|
||||
current_request->set_mobile(&mobile) ;
|
||||
|
||||
|
@ -136,8 +137,9 @@ const Request& InputUDPSocket::get_next_request()
|
|||
current_request->clear() ;
|
||||
return *current_request ;
|
||||
}
|
||||
const char *const mac_ap =
|
||||
owl_mac_bytes_to_string(request_info.ap_mac_addr_bytes) ;
|
||||
string mac_ap(
|
||||
owl_mac_bytes_to_string(request_info.ap_mac_addr_bytes)) ;
|
||||
PosUtil::to_upper(mac_ap) ;
|
||||
const AccessPoint &ap = Stock::find_create_ap(mac_ap) ;
|
||||
measurements[mac_ap].set_ap(&ap) ;
|
||||
measurements[mac_ap].add_ss(static_cast<int_fast8_t>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef _OWLPS_POSITIONING_WIFIDEVICE_HH_
|
||||
#define _OWLPS_POSITIONING_WIFIDEVICE_HH_
|
||||
|
||||
#include "posutil.hh"
|
||||
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
|
||||
|
@ -21,12 +23,10 @@ protected:
|
|||
float trx_power ; ///< Transmit power in dBm
|
||||
|
||||
public:
|
||||
WifiDevice(const std::string &_ip_addr = "",
|
||||
const std::string &_mac_addr = "",
|
||||
const float _antenna_gain = WIFIDEVICE_DEFAULT_ANTENNA_GAIN,
|
||||
const float _trx_power = WIFIDEVICE_DEFAULT_TRX_POWER):
|
||||
ip_addr(_ip_addr), mac_addr(_mac_addr),
|
||||
antenna_gain(_antenna_gain), trx_power(_trx_power) {}
|
||||
WifiDevice(const std::string &_ip_addr,
|
||||
const std::string &_mac_addr,
|
||||
const float _antenna_gain,
|
||||
const float _trx_power) ;
|
||||
|
||||
WifiDevice(const WifiDevice &source):
|
||||
ip_addr(source.ip_addr), mac_addr(source.mac_addr),
|
||||
|
@ -63,6 +63,22 @@ public:
|
|||
|
||||
|
||||
|
||||
/* *** Constructors *** */
|
||||
|
||||
|
||||
inline WifiDevice::
|
||||
WifiDevice(const std::string &_ip_addr = "",
|
||||
const std::string &_mac_addr = "",
|
||||
const float _antenna_gain = WIFIDEVICE_DEFAULT_ANTENNA_GAIN,
|
||||
const float _trx_power = WIFIDEVICE_DEFAULT_TRX_POWER):
|
||||
ip_addr(_ip_addr), mac_addr(_mac_addr),
|
||||
antenna_gain(_antenna_gain), trx_power(_trx_power)
|
||||
{
|
||||
PosUtil::assert_uppercase(mac_addr) ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* *** Read accessors *** */
|
||||
|
||||
|
||||
|
@ -102,6 +118,7 @@ inline void WifiDevice::set_ip_addr(const std::string &_ip_addr)
|
|||
|
||||
inline void WifiDevice::set_mac_addr(const std::string &_mac_addr)
|
||||
{
|
||||
PosUtil::assert_uppercase(_mac_addr) ;
|
||||
mac_addr = _mac_addr ;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue