[lib-client] Delay in ms instead of microseconds

In owlclient_send_request(), the delay between two packets is now in
milliseconds.
Client & Listener updated to reflect the change.
This commit is contained in:
Matteo Cypriani 2011-07-24 20:08:05 +02:00
parent 69a93abf0f
commit 1dae048f0c
4 changed files with 17 additions and 12 deletions

View File

@ -62,6 +62,10 @@ void owlclient_use_iface(const int sockfd, const char *const iface)
/*
* nb_pkt: number of packets to transmit.
* delay: delay between two transmissions, in milliseconds.
*/
void owlclient_send_request(const int sockfd,
const struct sockaddr_in *const server,
const void *const packet,
@ -84,7 +88,7 @@ void owlclient_send_request(const int sockfd,
// Transmit remaining packets (if any):
for (i = 0 ; i < nb_pkt - 1 ; ++i)
{
usleep(delay) ; // Wait during the wanted delay
usleep(delay * 1000) ; // Wait during the wanted delay
owlclient_send_packet(sockfd, server, packet, packet_size) ;
}

View File

@ -20,9 +20,9 @@
#define DEFAULT_NBPKT_CALIB 20 // 20 packets when calibrating
#define DEFAULT_NBPKT_NORMAL 10 // 10 packets when requesting the position
/* Delay between two packet transmissions (in microseconds) */
#define DEFAULT_DELAY_CALIB 50000 // Calibration request
#define DEFAULT_DELAY_NORMAL 25000 // Localisation request
/* Delay between two packet transmissions (in milliseconds) */
#define DEFAULT_DELAY_CALIB 50 // Calibration request
#define DEFAULT_DELAY_NORMAL 25 // Localisation request
/* Delay between two requests in loop mode (in milliseconds) */
#define DEFAULT_FLOOD_DELAY 1000
@ -333,9 +333,9 @@ void print_configuration()
"\tDestination IP: %s\n"
"\tDestination port: %"PRIuFAST16"\n"
"\tInterface: %s\n"
"\tDelay: %"PRIdFAST32"\n"
"\tDelay (ms): %"PRIdFAST32"\n"
"\tNumber of packets: %"PRIuFAST16"\n"
"\tFlood delay: %"PRIdFAST32"\n"
"\tFlood delay (ms): %"PRIdFAST32"\n"
"\tListening port: %"PRIuFAST16"\n"
"\tDirection: %"PRIu8"\n"
"\tX: %f\n"
@ -464,8 +464,9 @@ void print_usage()
" request.\n"
"\t-p dest_port\tDestination port of the localisation request"
" (default: %d).\n"
"\t-t delay\tTime between each packet transmission (default: %d"
" µs for a normal request, %d µs for a calibration request).\n"
"\t-t delay\tTime between each packet transmission in"
" milliseconds (default: %d ms for a normal request,"
" %d ms for a calibration request).\n"
"\t-n nb_packets\tNumber of packet transmitted for the request"
" (default: %d for a normal request, %d for a calibration"
" request).\n"

View File

@ -60,7 +60,7 @@
#define DEFAULT_CONFIG_FILE "/usr/local/etc/owlps/owlps-listener.conf"
enum {MODE_ACTIVE = 'a', MODE_PASSIVE = 'p', MODE_MIXED = 'm'} ;
#define DEFAULT_AUTOCALIBRATION_HELLO_DELAY 120 // seconds
#define DEFAULT_AUTOCALIBRATION_DELAY 25000 // ms
#define DEFAULT_AUTOCALIBRATION_DELAY 25 // milliseconds
#define DEFAULT_AUTOCALIBRATION_NBPKT 20

View File

@ -1421,10 +1421,10 @@ void print_usage()
"\t-a autocalib_port\tPort on which autocalibration data (hello"
" & orders) are exchanged with the aggregation server"
" (default: %d).\n"
"\t-H hello_delay\t\tTime between each hello"
" message sent to the aggregation server (default: %d s).\n"
"\t-H hello_delay\t\tTime between each hello message sent to"
" the aggregation server, in seconds (default: %d s).\n"
"\t-t delay\t\tTime between each autocalibration"
" packet transmission (default: %d µs).\n"
" packet transmission, in milliseconds (default: %d ms).\n"
"\t-n nb_packets\t\tNumber of packet transmitted"
" for one autocalibration request (default: %d).\n"
"\tdirection x y z\t\tThe coordinates of the listener"