diff --git a/libowlps/owlps.h b/libowlps/owlps.h index b550340..1c90790 100644 --- a/libowlps/owlps.h +++ b/libowlps/owlps.h @@ -19,14 +19,13 @@ extern "C" { #include -// Port on which the positioning request is sent by the mobile: +// Port on which the positioning and calibration requests are sent by +// the mobiles (or the listeners for autocalibration requests): #define OWL_DEFAULT_REQUEST_PORT 9900 // Port on which listeners and aggregator communicate: #define OWL_DEFAULT_LISTENER_PORT 9901 // Port on which aggregator and positioning server communicate: #define OWL_DEFAULT_AGGREGATION_PORT 9902 -// Port on which autocalibration requests are sent by the listeners: -#define OWL_DEFAULT_AUTOCALIBRATION_REQUEST_PORT 9903 // Port on which the aggregator listens for hello messages from the // listeners, and the listeners listen for orders from the aggregator: #define OWL_DEFAULT_AUTOCALIBRATION_PORT 9904 diff --git a/owlps-listener/owlps-listenerd.c b/owlps-listener/owlps-listenerd.c index a0a4e7e..9bc2445 100644 --- a/owlps-listener/owlps-listenerd.c +++ b/owlps-listener/owlps-listenerd.c @@ -98,7 +98,7 @@ struct { #ifdef USE_PTHREAD owl_false, "", - OWL_DEFAULT_AUTOCALIBRATION_REQUEST_PORT, + 0, OWL_DEFAULT_AUTOCALIBRATION_PORT, DEFAULT_AUTOCALIBRATION_HELLO_DELAY, DEFAULT_AUTOCALIBRATION_DELAY, @@ -327,9 +327,9 @@ int parse_config_file(int argc, char **argv) // Destination IP address of the autocalibration requests (default: // none, but will be set to aggregation_ip in the config check): CFG_STR("autocalibration_ip", "", CFGF_NONE), - // Port on which autocalibration requests are sent: - CFG_INT("autocalibration_request_port", - OWL_DEFAULT_AUTOCALIBRATION_REQUEST_PORT, CFGF_NONE), + // Port on which autocalibration requests are sent (default: 0, + // but will be set to listening_port in the config check): + CFG_INT("autocalibration_request_port", 0, CFGF_NONE), // Port on which autocalibration data are exchanged: CFG_INT("autocalibration_port", OWL_DEFAULT_AUTOCALIBRATION_PORT, CFGF_NONE), @@ -650,7 +650,7 @@ int check_configuration() if (VERBOSE_WARNING) fprintf(stderr, "Warning! Bad autocalibration_request_port:" " failing back to the default value.\n") ; - SET_AUTOCALIBRATION_REQUEST_PORT(OWL_DEFAULT_AUTOCALIBRATION_REQUEST_PORT) ; + SET_AUTOCALIBRATION_REQUEST_PORT(GET_LISTENING_PORT()) ; } if (GET_AUTOCALIBRATION_PORT() < 1 || GET_AUTOCALIBRATION_PORT() > 65535) @@ -1529,7 +1529,7 @@ void print_usage() "\t-I autocalib_ip\t\tDestination IP of the autocalibration" " requests\n\t\t\t\t(default: aggregation_ip).\n" "\t-P autocalib_req_port\tPort on which autocalibration" - " requests are sent\n\t\t\t\t(default: %d).\n" + " requests are sent\n\t\t\t\t(default: listening_port).\n" "\t-a autocalib_port\tPort on which autocalibration data (hello" " &\n\t\t\t\torders) are exchanged with the aggregation" "\n\t\t\t\tserver (default: %d).\n" @@ -1556,7 +1556,6 @@ void print_usage() DEFAULT_CONFIG_FILE, OWL_DEFAULT_REQUEST_PORT, OWL_DEFAULT_LISTENER_PORT, - OWL_DEFAULT_AUTOCALIBRATION_REQUEST_PORT, OWL_DEFAULT_AUTOCALIBRATION_PORT, DEFAULT_AUTOCALIBRATION_HELLO_DELAY, DEFAULT_AUTOCALIBRATION_DELAY,