diff --git a/owlps-positioning/src/inputudpsocket.cc b/owlps-positioning/src/inputudpsocket.cc index 174804d..69bfa2f 100644 --- a/owlps-positioning/src/inputudpsocket.cc +++ b/owlps-positioning/src/inputudpsocket.cc @@ -149,6 +149,15 @@ const Request& InputUDPSocket::get_next_request() if (request.type == OWL_REQUEST_CALIBRATION || request.type == OWL_REQUEST_AUTOCALIBRATION) { + AccessPoint &transmitter = + const_cast(Stock::find_create_ap(mac_mobile)) ; + + // If an autocalibration request does not contain the coordinates + // of the AP, we use the current coordinates of the AP as + // ReferencePoint. + if (request.type == OWL_REQUEST_AUTOCALIBRATION && ! position) + position = transmitter.get_coordinates() ; + const ReferencePoint &reference_point = Stock::find_create_reference_point(position) ; current_request_to_calibration_request(&reference_point,