[Positioning] Add option accept-new-aps
The option positioning.accept-new-aps allows the program to add on-line APs that are not declared in the APs' configuration file.
This commit is contained in:
parent
2b1248fbec
commit
1f46075aa3
|
@ -68,6 +68,13 @@ csv-file = /tmp/owlps-positioning.log
|
|||
# it is not activated by default for security purposes.
|
||||
#accept-new-calibration-requests = false
|
||||
|
||||
# This option allows to create a new AP when a request is captured by an
|
||||
# AP which is not currently in the APs' list (i.e. not declared in the
|
||||
# APs' configuration file), or when a self-calibration request is sent
|
||||
# by an unknown AP.
|
||||
# It is unactivated by default for the sake of security.
|
||||
#accept-new-aps = false
|
||||
|
||||
# When receiving a calibration or autocalibration request from an AP,
|
||||
# containing the transmiter's coordinates, memorise the new AP's
|
||||
# coordinates.
|
||||
|
|
|
@ -116,6 +116,11 @@ const Request& InputCSV::get_next_request()
|
|||
return *current_request ;
|
||||
}
|
||||
PosUtil::to_upper(mac_ap) ;
|
||||
|
||||
if (! Configuration::bool_value("positioning.accept-new-aps") &&
|
||||
! Stock::ap_exists(mac_ap))
|
||||
continue ;
|
||||
|
||||
const AccessPoint &ap = Stock::find_create_ap(mac_ap) ;
|
||||
measurements[mac_ap].set_ap(&ap) ;
|
||||
measurements[mac_ap].add_ss(ss) ;
|
||||
|
|
|
@ -140,6 +140,11 @@ const Request& InputUDPSocket::get_next_request()
|
|||
string mac_ap(
|
||||
owl_mac_bytes_to_string(request_info.ap_mac_addr_bytes)) ;
|
||||
PosUtil::to_upper(mac_ap) ;
|
||||
|
||||
if (! Configuration::bool_value("positioning.accept-new-aps") &&
|
||||
! Stock::ap_exists(mac_ap))
|
||||
continue ;
|
||||
|
||||
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>
|
||||
|
@ -149,8 +154,11 @@ const Request& InputUDPSocket::get_next_request()
|
|||
current_request->set_measurements(measurements) ;
|
||||
|
||||
// Calibration request?
|
||||
if (request.type == OWL_REQUEST_CALIBRATION ||
|
||||
request.type == OWL_REQUEST_AUTOCALIBRATION)
|
||||
if ((request.type == OWL_REQUEST_CALIBRATION ||
|
||||
request.type == OWL_REQUEST_AUTOCALIBRATION)
|
||||
&&
|
||||
(Configuration::bool_value("positioning.accept-new-aps") ||
|
||||
Stock::ap_exists(mac_mobile)))
|
||||
{
|
||||
AccessPoint &transmitter =
|
||||
const_cast<AccessPoint&>(Stock::find_create_ap(mac_mobile)) ;
|
||||
|
|
|
@ -193,6 +193,11 @@ void UserInterface::fill_positioning_options()
|
|||
" self-calibration. If unactivated, the calibration requests"
|
||||
" are handled as positioning requests (default is unactivated,"
|
||||
" for security purposes).")
|
||||
("positioning.accept-new-aps",
|
||||
po::value<bool>()->default_value(false),
|
||||
"When receiving requests, add unknown APs (APs which are not"
|
||||
" declared in the APs' configuration file) to the APs' list"
|
||||
" (default is false, for security purposes).")
|
||||
("positioning.update-ap-coordinates-online",
|
||||
po::value<bool>()->default_value(false),
|
||||
"Allow AP's coordinates to be updated when a calibration request"
|
||||
|
|
Loading…
Reference in New Issue