Commit e9a29e61 authored by Matteo Quintiliani's avatar Matteo Quintiliani

Added function for print channel list from NaqsServer


git-svn-id: file:///home/quintiliani/svncopy/nmxptool/trunk@486 3cd66e75-5955-46cb-a940-c26e5fc5497d
parent a858722a
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy * Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it * quintiliani@ingv.it
* *
* $Id: nmxp_chan.h,v 1.21 2007-10-07 14:11:23 mtheo Exp $ * $Id: nmxp_chan.h,v 1.22 2007-11-24 21:39:54 mtheo Exp $
* *
*/ */
...@@ -228,7 +228,15 @@ void nmxp_chan_sortByName(NMXP_CHAN_LIST *channelList); ...@@ -228,7 +228,15 @@ void nmxp_chan_sortByName(NMXP_CHAN_LIST *channelList);
* \param channelList Channel List * \param channelList Channel List
* *
*/ */
void nmxp_chan_print_channelList(NMXP_CHAN_LIST_NET *channelList); void nmxp_chan_print_channelList(NMXP_CHAN_LIST *channelList);
/*! Print channel information
*
* \param channelList Channel List
*
*/
void nmxp_chan_print_netchannelList(NMXP_CHAN_LIST_NET *channelList);
void nmxp_meta_chan_free(NMXP_META_CHAN_LIST **chan_list); void nmxp_meta_chan_free(NMXP_META_CHAN_LIST **chan_list);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy * Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it * quintiliani@ingv.it
* *
* $Id: nmxp_chan.c,v 1.25 2007-11-24 20:32:47 mtheo Exp $ * $Id: nmxp_chan.c,v 1.26 2007-11-24 21:39:54 mtheo Exp $
* *
*/ */
...@@ -333,7 +333,21 @@ void nmxp_chan_sortByName(NMXP_CHAN_LIST *channelList) { ...@@ -333,7 +333,21 @@ void nmxp_chan_sortByName(NMXP_CHAN_LIST *channelList) {
qsort (channelList->channel, channelList->number, sizeof (NMXP_CHAN_KEY), chan_name_compare); qsort (channelList->channel, channelList->number, sizeof (NMXP_CHAN_KEY), chan_name_compare);
} }
void nmxp_chan_print_channelList(NMXP_CHAN_LIST_NET *channelList) {
void nmxp_chan_print_channelList(NMXP_CHAN_LIST *channelList) {
int chan_number = channelList->number;
int i_chan = 0;
nmxp_log(NMXP_LOG_NORM_NO, NMXP_LOG_D_ANY, "%04d channels:\n", chan_number);
for (i_chan = 0; i_chan < chan_number; i_chan++)
{
nmxp_log(NMXP_LOG_NORM_NO, NMXP_LOG_D_ANY, "%04d %12d %s\n", i_chan+1, channelList->channel[i_chan].key, channelList->channel[i_chan].name);
}
}
void nmxp_chan_print_netchannelList(NMXP_CHAN_LIST_NET *channelList) {
int chan_number = channelList->number; int chan_number = channelList->number;
int i_chan = 0; int i_chan = 0;
...@@ -465,7 +479,7 @@ NMXP_META_CHAN_LIST *nmxp_meta_chan_search_key(NMXP_META_CHAN_LIST *chan_list, i ...@@ -465,7 +479,7 @@ NMXP_META_CHAN_LIST *nmxp_meta_chan_search_key(NMXP_META_CHAN_LIST *chan_list, i
NMXP_META_CHAN_LIST *nmxp_meta_chan_set_name(NMXP_META_CHAN_LIST *chan_list, int32_t key, char *name) { NMXP_META_CHAN_LIST *nmxp_meta_chan_set_name(NMXP_META_CHAN_LIST *chan_list, int32_t key, char *name) {
NMXP_META_CHAN_LIST *ret = NULL; NMXP_META_CHAN_LIST *ret = NULL;
nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_CHANNEL, "nmxp_meta_chan_set_name()\n"); nmxp_log(NMXP_LOG_NORM_NO, NMXP_LOG_D_CHANNEL, "nmxp_meta_chan_set_name()\n");
if( (ret = nmxp_meta_chan_search_key(chan_list, key)) ) { if( (ret = nmxp_meta_chan_search_key(chan_list, key)) ) {
strncpy(ret->name, name, 12); strncpy(ret->name, name, 12);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy * Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it * quintiliani@ingv.it
* *
* $Id: nmxptool.c,v 1.90 2007-11-24 20:24:49 mtheo Exp $ * $Id: nmxptool.c,v 1.91 2007-11-24 21:40:23 mtheo Exp $
* *
*/ */
...@@ -172,14 +172,15 @@ int main (int argc, char **argv) { ...@@ -172,14 +172,15 @@ int main (int argc, char **argv) {
/* List available channels on server */ /* List available channels on server */
if(params.flag_listchannels) { if(params.flag_listchannels) {
// TOREMOVE
// channelList = nmxp_getAvailableChannelList(params.hostname, params.portnumberpds, NMXP_DATA_TIMESERIES);
// TOREMOVE
// nmxp_chan_print_channelList(channelList);
nmxp_getMetaChannelList(params.hostname, params.portnumberdap, NMXP_DATA_TIMESERIES, params.flag_request_channelinfo); nmxp_getMetaChannelList(params.hostname, params.portnumberdap, NMXP_DATA_TIMESERIES, params.flag_request_channelinfo);
return 1;
} else if(params.flag_listchannelsnaqs) {
channelList = nmxp_getAvailableChannelList(params.hostname, params.portnumberpds, NMXP_DATA_TIMESERIES);
nmxp_chan_print_channelList(channelList);
return 1; return 1;
} }
} }
...@@ -195,7 +196,7 @@ int main (int argc, char **argv) { ...@@ -195,7 +196,7 @@ int main (int argc, char **argv) {
nmxp_log(NMXP_LOG_ERR, NMXP_LOG_D_CHANNEL, "Channels not found!\n"); nmxp_log(NMXP_LOG_ERR, NMXP_LOG_D_CHANNEL, "Channels not found!\n");
return 1; return 1;
} else { } else {
nmxp_chan_print_channelList(channelList_subset); nmxp_chan_print_netchannelList(channelList_subset);
nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_CHANNEL, "Init channelListSeq.\n"); nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_CHANNEL, "Init channelListSeq.\n");
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy * Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it * quintiliani@ingv.it
* *
* $Id: nmxptool_getoptlong.c,v 1.41 2007-11-24 20:58:48 mtheo Exp $ * $Id: nmxptool_getoptlong.c,v 1.42 2007-11-24 21:40:23 mtheo Exp $
* *
*/ */
...@@ -48,6 +48,7 @@ const NMXPTOOL_PARAMS NMXPTOOL_PARAMS_DEFAULT = ...@@ -48,6 +48,7 @@ const NMXPTOOL_PARAMS NMXPTOOL_PARAMS_DEFAULT =
0, 0,
0, 0,
0, 0,
0,
0 0
}; };
...@@ -104,8 +105,8 @@ void nmxptool_usage(struct option long_options[]) ...@@ -104,8 +105,8 @@ void nmxptool_usage(struct option long_options[])
nmxp_log(NMXP_LOG_NORM_NO, NMXP_LOG_D_ANY, "\ nmxp_log(NMXP_LOG_NORM_NO, NMXP_LOG_D_ANY, "\
\n\ \n\
Usage: %s -H hostname --listchannels\n\ Usage: %s -H hostname --listchannels | --listchannelsnaqs\n\
Print list of available channels on DataServer.\n\ Print list of available channels on DataServer or NaqsServer.\n\
\n\ \n\
%s -H hostname -C channellist -s DATE -e DATE [...]\n\ %s -H hostname -C channellist -s DATE -e DATE [...]\n\
%s -H hostname -C channellist -s DATE -t SECs [...]\n\ %s -H hostname -C channellist -s DATE -t SECs [...]\n\
...@@ -193,7 +194,7 @@ DAP Arguments:\n\ ...@@ -193,7 +194,7 @@ DAP Arguments:\n\
-d, --delay=SECs Receive continuosly data with delay [%d..%d].\n\ -d, --delay=SECs Receive continuosly data with delay [%d..%d].\n\
-u, --username=USER DataServer username.\n\ -u, --username=USER DataServer username.\n\
-p, --password=PASS DataServer password.\n\ -p, --password=PASS DataServer password.\n\
-l, --listchannels Print list of available channels.\n\ -l, --listchannels Print list of available channels on DataServer.\n\
-i, --channelinfo Print list of available channels and channelinfo.\n\ -i, --channelinfo Print list of available channels and channelinfo.\n\
\n\ \n\
", ",
...@@ -214,12 +215,13 @@ PDS arguments:\n\ ...@@ -214,12 +215,13 @@ PDS arguments:\n\
0 for original sample rate and decompressed data.\n\ 0 for original sample rate and decompressed data.\n\
>0 for specified sample rate and decompressed data.\n\ >0 for specified sample rate and decompressed data.\n\
-b, --buffered Request also recent packets into the past.\n\ -b, --buffered Request also recent packets into the past.\n\
-L, --listchannelsnaqs Print list of available channels on NaqsServer.\n\
-M, --maxlatency=SECs Max tolerable latency (default %d) [%d..%d].\n\ -M, --maxlatency=SECs Max tolerable latency (default %d) [%d..%d].\n\
-T, --timeoutrecv=SECs Time-out for flushing buffered packets. DISABLED!\n\ -T, --timeoutrecv=SECs Time-out for flushing buffered packets. DISABLED!\n\
(default %d. No time-out.) [%d..%d].\n\ (default %d. No time-out.) [%d..%d].\n\
-T is useful for retrieving Data On Demand.\n\ -T is useful for retrieving Data On Demand.\n\
-M, -T are usable only with Raw Stream --stc=-1.\n\ -M, -T are usable only with Raw Stream --stc=-1.\n\
In general, -M and -T are mutually exclusives.\n\ In general, -M and -T are not used together.\n\
\n\ \n\
", ",
DEFAULT_STC, DEFAULT_STC,
...@@ -261,7 +263,7 @@ int nmxptool_getopt_long(int argc, char **argv, NMXPTOOL_PARAMS *params) ...@@ -261,7 +263,7 @@ int nmxptool_getopt_long(int argc, char **argv, NMXPTOOL_PARAMS *params)
{"portdap", required_argument, 0, 'D'}, {"portdap", required_argument, 0, 'D'},
{"channels", required_argument, 0, 'C'}, {"channels", required_argument, 0, 'C'},
{"network", required_argument, 0, 'N'}, {"network", required_argument, 0, 'N'},
{"location", required_argument, 0, 'L'}, {"location", required_argument, 0, 'n'},
{"stc", required_argument, 0, 'S'}, {"stc", required_argument, 0, 'S'},
{"rate", required_argument, 0, 'R'}, {"rate", required_argument, 0, 'R'},
{"start_time", required_argument, 0, 's'}, {"start_time", required_argument, 0, 's'},
...@@ -277,6 +279,7 @@ int nmxptool_getopt_long(int argc, char **argv, NMXPTOOL_PARAMS *params) ...@@ -277,6 +279,7 @@ int nmxptool_getopt_long(int argc, char **argv, NMXPTOOL_PARAMS *params)
{"logdata", no_argument, 0, 'g'}, {"logdata", no_argument, 0, 'g'},
{"buffered", no_argument, 0, 'b'}, {"buffered", no_argument, 0, 'b'},
{"listchannels", no_argument, 0, 'l'}, {"listchannels", no_argument, 0, 'l'},
{"listchannelsnaqs", no_argument, 0, 'L'},
{"channelinfo", no_argument, 0, 'i'}, {"channelinfo", no_argument, 0, 'i'},
#ifdef HAVE_LIBMSEED #ifdef HAVE_LIBMSEED
{"writeseed", no_argument, 0, 'm'}, {"writeseed", no_argument, 0, 'm'},
...@@ -311,7 +314,7 @@ int nmxptool_getopt_long(int argc, char **argv, NMXPTOOL_PARAMS *params) ...@@ -311,7 +314,7 @@ int nmxptool_getopt_long(int argc, char **argv, NMXPTOOL_PARAMS *params)
/* init params */ /* init params */
memcpy(params, &NMXPTOOL_PARAMS_DEFAULT, sizeof(NMXPTOOL_PARAMS_DEFAULT)); memcpy(params, &NMXPTOOL_PARAMS_DEFAULT, sizeof(NMXPTOOL_PARAMS_DEFAULT));
char optstr[100] = "H:P:D:C:N:L:S:R:s:e:t:d:u:p:M:T:v:gbliwhV"; char optstr[100] = "H:P:D:C:N:n:S:R:s:e:t:d:u:p:M:T:v:gblLiwhV";
#ifdef HAVE_LIBMSEED #ifdef HAVE_LIBMSEED
strcat(optstr, "m"); strcat(optstr, "m");
...@@ -376,7 +379,7 @@ int nmxptool_getopt_long(int argc, char **argv, NMXPTOOL_PARAMS *params) ...@@ -376,7 +379,7 @@ int nmxptool_getopt_long(int argc, char **argv, NMXPTOOL_PARAMS *params)
params->network = optarg; params->network = optarg;
break; break;
case 'L': case 'n':
params->location = optarg; params->location = optarg;
break; break;
...@@ -461,6 +464,10 @@ int nmxptool_getopt_long(int argc, char **argv, NMXPTOOL_PARAMS *params) ...@@ -461,6 +464,10 @@ int nmxptool_getopt_long(int argc, char **argv, NMXPTOOL_PARAMS *params)
params->flag_listchannels = 1; params->flag_listchannels = 1;
break; break;
case 'L':
params->flag_listchannelsnaqs = 1;
break;
case 'i': case 'i':
params->flag_request_channelinfo = 1; params->flag_request_channelinfo = 1;
break; break;
...@@ -527,6 +534,11 @@ int nmxptool_check_params(NMXPTOOL_PARAMS *params) { ...@@ -527,6 +534,11 @@ int nmxptool_check_params(NMXPTOOL_PARAMS *params) {
ret = -1; ret = -1;
nmxp_log(NMXP_LOG_NORM_NO, NMXP_LOG_D_ANY, "<hostname> is required!\n"); nmxp_log(NMXP_LOG_NORM_NO, NMXP_LOG_D_ANY, "<hostname> is required!\n");
} else if(params->flag_listchannels) { } else if(params->flag_listchannels) {
if(params->flag_listchannelsnaqs) {
ret = -1;
nmxp_log(NMXP_LOG_NORM_NO, NMXP_LOG_D_ANY, "-l and -L can not be used together!\n");
}
} else if(params->flag_listchannelsnaqs) {
/* Do nothing */ /* Do nothing */
} else if(params->hostname == NULL) { } else if(params->hostname == NULL) {
ret = -1; ret = -1;
...@@ -542,7 +554,7 @@ int nmxptool_check_params(NMXPTOOL_PARAMS *params) { ...@@ -542,7 +554,7 @@ int nmxptool_check_params(NMXPTOOL_PARAMS *params) {
nmxp_log(NMXP_LOG_NORM_NO, NMXP_LOG_D_ANY, "<start_time> has to be used with <end_time> or <interval>!\n"); nmxp_log(NMXP_LOG_NORM_NO, NMXP_LOG_D_ANY, "<start_time> has to be used with <end_time> or <interval>!\n");
} else if(params->start_time != 0 && params->interval != 0 && params->end_time != 0) { } else if(params->start_time != 0 && params->interval != 0 && params->end_time != 0) {
ret = -1; ret = -1;
nmxp_log(NMXP_LOG_NORM_NO, NMXP_LOG_D_ANY, "<end_time> and <interval> are exclusives!\n"); nmxp_log(NMXP_LOG_NORM_NO, NMXP_LOG_D_ANY, "<end_time> and <interval> can not be used together!\n");
} else if(params->start_time != 0 && params->end_time != 0 } else if(params->start_time != 0 && params->end_time != 0
&& params->start_time >= params->end_time) { && params->start_time >= params->end_time) {
ret = -1; ret = -1;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Istituto Nazionale di Geofisica e Vulcanologia - Italy * Istituto Nazionale di Geofisica e Vulcanologia - Italy
* quintiliani@ingv.it * quintiliani@ingv.it
* *
* $Id: nmxptool_getoptlong.h,v 1.23 2007-11-24 20:58:48 mtheo Exp $ * $Id: nmxptool_getoptlong.h,v 1.24 2007-11-24 21:40:23 mtheo Exp $
* *
*/ */
...@@ -72,6 +72,7 @@ typedef struct { ...@@ -72,6 +72,7 @@ typedef struct {
char *ew_configuration_file; char *ew_configuration_file;
int flag_writeseed; int flag_writeseed;
int flag_listchannels; int flag_listchannels;
int flag_listchannelsnaqs;
int flag_request_channelinfo; int flag_request_channelinfo;
int flag_writefile; int flag_writefile;
int flag_slink; int flag_slink;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment