Commit 6baf1390 authored by Matteo Quintiliani's avatar Matteo Quintiliani
Browse files

Added parameter flag_restart to nmxp_sendAddTimeSeriesChannel


git-svn-id: file:///home/quintiliani/svncopy/nmxptool/trunk@931 3cd66e75-5955-46cb-a940-c26e5fc5497d
parent 6070e4a7
...@@ -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.h,v 1.47 2008-03-18 15:19:37 mtheo Exp $ * $Id: nmxp.h,v 1.48 2008-03-19 08:16:03 mtheo Exp $
* *
*/ */
...@@ -1075,12 +1075,13 @@ int nmxp_receiveChannelList(int isock, NMXP_CHAN_LIST **pchannelList); ...@@ -1075,12 +1075,13 @@ int nmxp_receiveChannelList(int isock, NMXP_CHAN_LIST **pchannelList);
* \param buffer_flag Server will send or not buffered packets. * \param buffer_flag Server will send or not buffered packets.
* \param n_channel number of channels to add any time * \param n_channel number of channels to add any time
* \param n_usec frequency to add remaining channels (microseconds) * \param n_usec frequency to add remaining channels (microseconds)
* \param flag_restart reset index for requesting channels. In general, first time 1, then 0.
* *
* \retval SOCKET_OK on success * \retval SOCKET_OK on success
* \retval SOCKET_ERROR on error * \retval SOCKET_ERROR on error
* *
*/ */
int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST_NET *channelList, int32_t shortTermCompletion, int32_t out_format, NMXP_BUFFER_FLAG buffer_flag, const int n_channel, const int n_usec); int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST_NET *channelList, int32_t shortTermCompletion, int32_t out_format, NMXP_BUFFER_FLAG buffer_flag, const int n_channel, const int n_usec, int flag_restart);
/*! \brief Receive Compressed or Decompressed Data message from a socket and launch func_processData() on the extracted data /*! \brief Receive Compressed or Decompressed Data message from a socket and launch func_processData() on the extracted data
......
...@@ -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.c,v 1.75 2008-03-18 19:13:37 mtheo Exp $ * $Id: nmxp.c,v 1.76 2008-03-19 08:16:03 mtheo Exp $
* *
*/ */
...@@ -114,7 +114,7 @@ int nmxp_sendAddTimeSeriesChannel_raw(int isock, NMXP_CHAN_LIST_NET *channelList ...@@ -114,7 +114,7 @@ int nmxp_sendAddTimeSeriesChannel_raw(int isock, NMXP_CHAN_LIST_NET *channelList
return ret; return ret;
} }
int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST_NET *channelList, int32_t shortTermCompletion, int32_t out_format, NMXP_BUFFER_FLAG buffer_flag, const int n_channel, const int n_usec) { int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST_NET *channelList, int32_t shortTermCompletion, int32_t out_format, NMXP_BUFFER_FLAG buffer_flag, const int n_channel, const int n_usec, int flag_restart) {
static int i = 0; static int i = 0;
static int first_time = 1; static int first_time = 1;
static struct timeval last_tp_now; static struct timeval last_tp_now;
...@@ -125,6 +125,11 @@ int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST_NET *channelList, in ...@@ -125,6 +125,11 @@ int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST_NET *channelList, in
long diff_usec; long diff_usec;
struct timeval tp_now; struct timeval tp_now;
if(flag_restart) {
first_time = 1;
i = 0;
}
#ifdef HAVE_GETTIMEOFDAY #ifdef HAVE_GETTIMEOFDAY
gettimeofday(&tp_now, NULL); gettimeofday(&tp_now, NULL);
#else #else
...@@ -153,7 +158,8 @@ int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST_NET *channelList, in ...@@ -153,7 +158,8 @@ int nmxp_sendAddTimeSeriesChannel(int isock, NMXP_CHAN_LIST_NET *channelList, in
} }
if(split_channelList.number > 0) { if(split_channelList.number > 0) {
nmxp_log(NMXP_LOG_WARN, NMXP_LOG_D_ANY, nmxp_log(NMXP_LOG_WARN, NMXP_LOG_D_ANY,
"Added %d channels (%d, %d):", split_channelList.number, i, diff_usec); "%d/%.0f chan %d/%d:", split_channelList.number, (double)diff_usec/1000.0,
i, channelList->number);
for(j=0; j < split_channelList.number; j++) { for(j=0; j < split_channelList.number; j++) {
nmxp_log(NMXP_LOG_NORM_NO, NMXP_LOG_D_ANY, " %s", NMXP_LOG_STR(split_channelList.channel[j].name)); nmxp_log(NMXP_LOG_NORM_NO, NMXP_LOG_D_ANY, " %s", NMXP_LOG_STR(split_channelList.channel[j].name));
} }
......
...@@ -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.152 2008-03-18 19:05:25 mtheo Exp $ * $Id: nmxptool.c,v 1.153 2008-03-19 08:16:03 mtheo Exp $
* *
*/ */
...@@ -744,7 +744,8 @@ int main (int argc, char **argv) { ...@@ -744,7 +744,8 @@ int main (int argc, char **argv) {
/* PDS Step 5: Send AddChannels */ /* PDS Step 5: Send AddChannels */
/* Request Data */ /* Request Data */
nmxp_sendAddTimeSeriesChannel(naqssock, channelList_subset, params.stc, params.rate, (params.flag_buffered)? NMXP_BUFFER_YES : NMXP_BUFFER_NO, params.n_channel, params.n_usec); nmxp_sendAddTimeSeriesChannel(naqssock, channelList_subset, params.stc, params.rate,
(params.flag_buffered)? NMXP_BUFFER_YES : NMXP_BUFFER_NO, params.n_channel, params.n_usec, 1);
/* PDS Step 6: Repeat until finished: receive and handle packets */ /* PDS Step 6: Repeat until finished: receive and handle packets */
...@@ -950,7 +951,8 @@ int main (int argc, char **argv) { ...@@ -950,7 +951,8 @@ int main (int argc, char **argv) {
} }
#endif #endif
nmxp_sendAddTimeSeriesChannel(naqssock, channelList_subset, params.stc, params.rate, (params.flag_buffered)? NMXP_BUFFER_YES : NMXP_BUFFER_NO, params.n_channel, params.n_usec); nmxp_sendAddTimeSeriesChannel(naqssock, channelList_subset, params.stc, params.rate,
(params.flag_buffered)? NMXP_BUFFER_YES : NMXP_BUFFER_NO, params.n_channel, params.n_usec, 0);
} /* End main PDS loop */ } /* End main PDS loop */
......
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