diff options
author | Dario Lombardo <dario.lombardo@libero.it> | 2011-02-10 14:24:53 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2011-02-16 15:15:12 +0100 |
commit | b7a4d8d9128076d83bd70157299ef0a7a8717a0c (patch) | |
tree | 60e6f8f442c72b86e8831687fb71b0168ff6494d /src/host/layer23/src/misc | |
parent | 26ff2ee8802d7c8e8980d7c4cbfcd9053c6f3091 (diff) |
Added gpsd support.
Diffstat (limited to 'src/host/layer23/src/misc')
-rw-r--r-- | src/host/layer23/src/misc/app_cell_log.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/host/layer23/src/misc/app_cell_log.c b/src/host/layer23/src/misc/app_cell_log.c index 0d612265..7a2c67a8 100644 --- a/src/host/layer23/src/misc/app_cell_log.c +++ b/src/host/layer23/src/misc/app_cell_log.c @@ -92,8 +92,13 @@ static int l23_getopt_options(struct option **options) {"logfile", 1, 0, 'l'}, {"rach", 1, 0, 'r'}, {"no-rach", 1, 0, 'n'}, +#ifdef _USE_GPSD + {"gpsd-host", 1, 0, 'g'}, + {"gpsd-port", 1, 0, 'p'} +#else {"gps", 1, 0, 'g'}, {"baud", 1, 0, 'b'} +#endif }; *options = opts; @@ -103,11 +108,16 @@ static int l23_getopt_options(struct option **options) static int l23_cfg_print_help() { printf("\nApplication specific\n"); - printf(" -l --logfile LOGFILE Logfile for the cell log.\n"); + printf(" -l --logfile LOGFILE Logfile for the cell log.\n"); printf(" -r --rach RACH Nr. of RACH bursts to send.\n"); printf(" -n --no-rach Send no rach bursts.\n"); +#ifdef _USE_GPSD + printf(" -g --gpsd-host HOST 127.0.0.1. gpsd host.\n"); + printf(" -p --port PORT 2947. gpsd port\n"); +#else printf(" -g --gps DEVICE /dev/ttyACM0. GPS device.\n"); printf(" -b --baud BAUDRAT The baud rate of the GPS device\n"); +#endif return 0; } @@ -123,6 +133,20 @@ static int l23_cfg_handle(int c, const char *optarg) case 'n': RACH_MAX = 0; break; +#ifdef _USE_GPSD + case 'g': + snprintf(gps.gpsd_host, ARRAY_SIZE(gps.gpsd_host), "%s", optarg); + /* force string terminator */ + gps.gpsd_host[ARRAY_SIZE(gps.gpsd_host) - 1] = '\0'; + LOGP(DGPS, LOGL_INFO, "Using gpsd host %s\n", gps.gpsd_host); + break; + case 'p': + snprintf(gps.gpsd_port, ARRAY_SIZE(gps.gpsd_port), "%s", optarg); + /* force string terminator */ + gps.gpsd_port[ARRAY_SIZE(gps.gpsd_port) - 1] = '\0'; + LOGP(DGPS, LOGL_INFO, "Using gpsd port %s\n", gps.gpsd_port); + break; +#else case 'g': snprintf(gps.device, ARRAY_SIZE(gps.device), "%s", optarg); /* force string terminator */ @@ -133,14 +157,18 @@ static int l23_cfg_handle(int c, const char *optarg) gps.baud = atoi(optarg); LOGP(DGPS, LOGL_INFO, "Setting GPS baudrate to %u\n", gps.baud); break; +#endif } - return 0; } static struct l23_app_info info = { .copyright = "Copyright (C) 2010 Andreas Eversberg\n", +#ifdef _USE_GPSD + .getopt_string = "l:r:ng:p:", +#else .getopt_string = "l:r:ng:b:", +#endif .cfg_supported = l23_cfg_supported, .cfg_getopt_opt = l23_getopt_options, .cfg_handle_opt = l23_cfg_handle, |