2011-04-05 17:23:28 +02:00
|
|
|
#include <stdio.h>
|
2011-04-06 15:18:05 +02:00
|
|
|
|
|
|
|
#define DEBUG
|
|
|
|
|
|
|
|
/* Lenght of string algo */
|
2011-04-05 17:23:28 +02:00
|
|
|
#define ALGO_STRLEN 15
|
2011-04-06 15:18:05 +02:00
|
|
|
/* Error codes */
|
|
|
|
#define ERR_BAD_USAGE 1 // Bad program call (bad number of arguments)
|
|
|
|
|
|
|
|
/* Number of packets to send */
|
|
|
|
#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
|
2011-04-05 17:23:28 +02:00
|
|
|
|
2011-04-06 15:18:05 +02:00
|
|
|
/* Program arguments (getopt string) */
|
|
|
|
#define OPTIONS "d:hi:l::n:p:t:"
|
|
|
|
|
|
|
|
|
|
|
|
/* Function headers */
|
|
|
|
void parse_command_line(int argc, char **argv) ;
|
|
|
|
void parse_main_options(int argc, char **argv) ;
|
|
|
|
void check_destination_ip(void) ;
|
|
|
|
void parse_calibration_data(int argc, char **argv) ;
|
|
|
|
void check_configuration(void) ;
|
|
|
|
#ifdef DEBUG
|
|
|
|
void print_configuration(void) ;
|
|
|
|
#endif // DEBUG
|
|
|
|
void create_socket(void) ;
|
|
|
|
void make_packet(void) ;
|
|
|
|
void send_request(void) ;
|
|
|
|
void receive_position(void) ;
|
|
|
|
void print_usage(void) ;
|
|
|
|
void send_labview(char*) ;
|
|
|
|
void string2data(char*) ;
|
|
|
|
void* thread_send(void*) ;
|
|
|
|
void print_error(char*) ;
|
2011-04-05 17:23:28 +02:00
|
|
|
typedef struct result result;
|
2011-04-06 15:18:05 +02:00
|
|
|
|
|
|
|
/* Struct */
|
|
|
|
|
2011-04-05 17:23:28 +02:00
|
|
|
struct result
|
|
|
|
{
|
|
|
|
char algo[ALGO_STRLEN];
|
|
|
|
float x;
|
|
|
|
float y;
|
|
|
|
float z;
|
|
|
|
};
|