Loading lib/nmxp.c +20 −17 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * Istituto Nazionale di Geofisica e Vulcanologia - Italy * quintiliani@ingv.it * * $Id: nmxp.c,v 1.58 2008-02-15 11:31:04 mtheo Exp $ * $Id: nmxp.c,v 1.59 2008-02-24 15:10:31 mtheo Exp $ * */ Loading Loading @@ -57,7 +57,7 @@ int nmxp_receiveChannelList(int isock, NMXP_CHAN_LIST **pchannelList) { nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_CHANNEL, "number of channels %d\n", (*pchannelList)->number); // TODO check /* TODO check*/ for(i=0; i < (*pchannelList)->number; i++) { (*pchannelList)->channel[i].key = ntohl((*pchannelList)->channel[i].key); Loading Loading @@ -350,34 +350,34 @@ NMXP_CHAN_LIST *nmxp_getAvailableChannelList(char * hostname, int portnum, NMXP_ NMXP_CHAN_LIST *channelList = NULL, *channelList_subset = NULL; int i; // 1. Open a socket /* 1. Open a socket*/ naqssock = nmxp_openSocket(hostname, portnum); if(naqssock != NMXP_SOCKET_ERROR) { // 2. Send a Connect /* 2. Send a Connect*/ if(nmxp_sendConnect(naqssock) == NMXP_SOCKET_OK) { // 3. Receive ChannelList /* 3. Receive ChannelList*/ if(nmxp_receiveChannelList(naqssock, &channelList) == NMXP_SOCKET_OK) { channelList_subset = nmxp_chan_getType(channelList, datatype); nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_CHANNEL, "%d / %d\n", channelList_subset->number, channelList->number); // nmxp_chan_sortByKey(channelList_subset); /* nmxp_chan_sortByKey(channelList_subset);*/ nmxp_chan_sortByName(channelList_subset); for(i=0; i < channelList_subset->number; i++) { nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_CHANNEL, "%12d %s\n", channelList_subset->channel[i].key, channelList_subset->channel[i].name); } // 4. Send a Request Pending (optional) /* 4. Send a Request Pending (optional)*/ // 5. Send AddChannels /* 5. Send AddChannels*/ // 6. Repeat until finished: receive and handle packets /* 6. Repeat until finished: receive and handle packets*/ // 7. Send Terminate Subscription /* 7. Send Terminate Subscription*/ nmxp_sendTerminateSubscription(naqssock, NMXP_SHUTDOWN_NORMAL, "Good Bye!"); } else { Loading @@ -387,7 +387,7 @@ NMXP_CHAN_LIST *nmxp_getAvailableChannelList(char * hostname, int portnum, NMXP_ nmxp_log(NMXP_LOG_ERR, NMXP_LOG_D_CHANNEL, "Error on sendConnect()\n"); } // 8. Close the socket /* 8. Close the socket*/ nmxp_closeSocket(naqssock); } Loading Loading @@ -571,7 +571,7 @@ int nmxp_raw_stream_seq_no_compare(const void *a, const void *b) ret = -1; } } else { printf("Error pa and/or pb are NULL!\n"); nmxp_log(NMXP_LOG_ERR, NMXP_LOG_D_ANY, "Error pa and/or pb are NULL!\n"); } return ret; Loading Loading @@ -620,6 +620,7 @@ int nmxp_raw_stream_manage(NMXP_RAW_STREAM_DATA *p, NMXP_DATA_PROCESS *a_pd, int char str_time[200]; NMXP_DATA_PROCESS *pd = NULL; /* Allocate pd copy value from a_pd */ if(a_pd) { /* if(a_pd->packet_type == 33 || a_pd->packet_type == 97) { Loading Loading @@ -675,7 +676,8 @@ int nmxp_raw_stream_manage(NMXP_RAW_STREAM_DATA *p, NMXP_DATA_PROCESS *a_pd, int latency = nmxp_data_latency(p->pdlist[0]); nmxp_data_to_str(str_time, p->pdlist[0]->time); if( seq_no_diff > 0) { nmxp_log(NMXP_LOG_WARN, NMXP_LOG_D_RAWSTREAM, "Force handling packet %s.%s.%d.%d (%s - %.2f sec.) time_diff %.2fs n_pdlist %d lat. %.1fs!\n", nmxp_log(NMXP_LOG_WARN, NMXP_LOG_D_RAWSTREAM, "Force handling packet %s.%s.%d.%d (%s - %.2f sec.) time_diff %.2fs n_pdlist %d lat. %.1fs!\n", p->pdlist[0]->station, p->pdlist[0]->channel, p->pdlist[0]->seq_no, p->pdlist[0]->packet_type, str_time, (double) p->pdlist[0]->nSamp / (double) p->pdlist[0]->sampRate, time_diff, p->n_pdlist, latency); for(i_func_pd=0; i_func_pd<n_func_pd; i_func_pd++) { Loading @@ -685,7 +687,8 @@ int nmxp_raw_stream_manage(NMXP_RAW_STREAM_DATA *p, NMXP_DATA_PROCESS *a_pd, int p->last_sample_time = (p->pdlist[0]->time + ((double) p->pdlist[0]->nSamp / (double) p->pdlist[0]->sampRate )); } else { /* It should not occur */ nmxp_log(NMXP_LOG_WARN, NMXP_LOG_D_RAWSTREAM, "NOT OCCUR! Packets %s.%s.%d.%d (%s - %.2f sec.) discarded, seq_no_diff=%d time_diff %.2fs lat. %.1fs\n", nmxp_log(NMXP_LOG_WARN, NMXP_LOG_D_RAWSTREAM, "NOT OCCUR! Packets %s.%s.%d.%d (%s - %.2f sec.) discarded, seq_no_diff=%d time_diff %.2fs lat. %.1fs\n", p->pdlist[0]->station, p->pdlist[0]->channel, p->pdlist[0]->seq_no, p->pdlist[0]->packet_type, str_time, (double) p->pdlist[0]->nSamp / (double) p->pdlist[0]->sampRate, seq_no_diff, time_diff, latency); } Loading Loading @@ -720,7 +723,7 @@ int nmxp_raw_stream_manage(NMXP_RAW_STREAM_DATA *p, NMXP_DATA_PROCESS *a_pd, int } qsort(p->pdlist, p->n_pdlist, sizeof(NMXP_DATA_PROCESS *), nmxp_raw_stream_seq_no_compare); // TODO Check for packet duplication in pd->pdlist /* TODO Check for packet duplication in pd->pdlist*/ /* Print array, only for debugging */ if(p->n_pdlist > 1) { Loading @@ -730,7 +733,7 @@ int nmxp_raw_stream_manage(NMXP_RAW_STREAM_DATA *p, NMXP_DATA_PROCESS *a_pd, int } } // Condition for time-out (pd is NULL) /* Condition for time-out (pd is NULL) */ if(!pd && p->n_pdlist > 0) { p->last_seq_no_sent = p->pdlist[0]->seq_no - 1; p->last_sample_time = p->pdlist[0]->time; Loading @@ -746,7 +749,7 @@ int nmxp_raw_stream_manage(NMXP_RAW_STREAM_DATA *p, NMXP_DATA_PROCESS *a_pd, int latency = nmxp_data_latency(p->pdlist[j]); nmxp_data_to_str(str_time, p->pdlist[j]->time); if(seq_no_diff <= 0) { // Duplicated packets: Discarded /* Duplicated packets: Discarded*/ nmxp_log(NMXP_LOG_WARN, NMXP_LOG_D_RAWSTREAM, "Packets %s.%s.%d.%d (%s - %f sec.) discarded, seq_no_diff=%d time_diff=%.2fs lat %.1fs\n", p->pdlist[j]->station, p->pdlist[j]->channel, p->pdlist[j]->seq_no, p->pdlist[j]->packet_type, str_time, (double) p->pdlist[j]->nSamp / (double) p->pdlist[j]->sampRate, seq_no_diff, time_diff, latency); Loading lib/nmxp_base.c +14 −14 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * Istituto Nazionale di Geofisica e Vulcanologia - Italy * quintiliani@ingv.it * * $Id: nmxp_base.c,v 1.55 2008-02-22 08:04:57 mtheo Exp $ * $Id: nmxp_base.c,v 1.56 2008-02-24 15:10:52 mtheo Exp $ * */ Loading Loading @@ -150,20 +150,20 @@ int nmxp_recv_select_timeout(int s, char *buf, int len, int timeout) int n; struct timeval tv; // set up the file descriptor set /* set up the file descriptor set*/ FD_ZERO(&fds); FD_SET(s, &fds); // set up the struct timeval for the timeout /* set up the struct timeval for the timeout*/ tv.tv_sec = timeout; tv.tv_usec = 0; // wait until timeout or data received /* wait until timeout or data received*/ n = select(s+1, &fds, NULL, NULL, &tv); if (n == 0) return -2; // timeout! if (n == -1) return -1; // error if (n == 0) return -2; /* timeout!*/ if (n == -1) return -1; /* error*/ // data must be here, so do a normal recv() /* data must be here, so do a normal recv()*/ return recv(s, buf, len, 0); } #endif Loading Loading @@ -478,9 +478,9 @@ NMXP_DATA_PROCESS *nmxp_processDecompressedData(char* buffer_data, int length_da pd.x0 = -1; pd.xn = -1; pd.x0n_significant = 0; // TODO // pd.oldest_seq_no = ; // pd.seq_no = ; /* TODO*/ /* pd.oldest_seq_no = ;*/ /* pd.seq_no = ;*/ pd.time = pTime; pd.buffer = buffer_data; pd.length = length_data; Loading Loading @@ -533,7 +533,7 @@ NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data char *nmxp_channel_name = NULL; // TOREMOVE int my_order = get_my_wordorder(); /* TOREMOVE int my_order = get_my_wordorder();*/ int my_host_is_bigendian = nmxp_data_bigendianhost(); nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_PACKETMAN, "my_host_is_bigendian %d\n", my_host_is_bigendian); Loading @@ -546,7 +546,7 @@ NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data if ( (nmx_ptype & 0xf) == 9) { /* Filler packet. Discard entire packet. */ nmxp_log (NMXP_LOG_ERR, NMXP_LOG_D_PACKETMAN, "Filler packet - discarding\n"); //m continue; /*m continue;*/ exit(0); } Loading @@ -562,7 +562,7 @@ NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data const uint32_t high_scale_p = 4096 * 4096; /* check if nmx_x0 is negative like as signed 3-byte int */ if( (nmx_x0 & high_scale) == high_scale) { // nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_PACKETMAN, "WARNING: changed nmx_x0, old value = %d\n", nmx_x0); /* nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_PACKETMAN, "WARNING: changed nmx_x0, old value = %d\n", nmx_x0);*/ nmx_x0 -= high_scale_p; } /* TOREMOVE if (my_order != SEED_LITTLE_ENDIAN) { */ Loading @@ -574,7 +574,7 @@ NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data nmx_x0 = nmx_x0 >> 8; nmxp_data_swap_4b (&nmx_x0); nmx_x0 = nmx_x0 >> 8; // TODO /* TODO*/ nmx_x0++; } nmx_seconds_double = (double) nmx_seconds + ( (double) nmx_ticks / 10000.0 ); Loading lib/nmxp_chan.c +3 −3 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * Istituto Nazionale di Geofisica e Vulcanologia - Italy * quintiliani@ingv.it * * $Id: nmxp_chan.c,v 1.30 2008-02-22 08:05:06 mtheo Exp $ * $Id: nmxp_chan.c,v 1.31 2008-02-24 15:10:52 mtheo Exp $ * */ Loading Loading @@ -307,7 +307,7 @@ NMXP_CHAN_LIST_NET *nmxp_chan_subset(NMXP_CHAN_LIST *channelList, NMXP_DATATYPE } // Comparison Key Function /* Comparison Key Function*/ int chan_key_compare(const void *a, const void *b) { int ret = 0; Loading @@ -326,7 +326,7 @@ void nmxp_chan_sortByKey(NMXP_CHAN_LIST *channelList) { qsort (channelList->channel, channelList->number, sizeof (NMXP_CHAN_KEY), chan_key_compare); } // Comparison Name Function /* Comparison Name Function*/ int chan_name_compare(const void *a, const void *b) { NMXP_CHAN_KEY *pa = (NMXP_CHAN_KEY *) a; Loading lib/nmxp_crc32.c +2 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ * * \brief Computing a 32 bit CRC. * * $Id: nmxp_crc32.c,v 1.5 2007-12-28 11:21:51 mtheo Exp $ * $Id: nmxp_crc32.c,v 1.6 2008-02-24 15:10:52 mtheo Exp $ * * */ Loading @@ -17,7 +17,7 @@ void crc32_init_table () { crc32_tab[0] = 0; for (i = 128; i; i >>= 1) { h = (h >> 1) ^ ((h & 1) ? POLYNOMIAL : 0); // h is now crc_table[i] /* h is now crc_table[i]*/ for (j = 0; j < 256; j += 2 * i) { crc32_tab[i + j] = crc32_tab[j] ^ h; } Loading lib/nmxp_data.c +6 −8 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * Istituto Nazionale di Geofisica e Vulcanologia - Italy * quintiliani@ingv.it * * $Id: nmxp_data.c,v 1.48 2008-01-17 08:13:51 mtheo Exp $ * $Id: nmxp_data.c,v 1.49 2008-02-24 15:10:52 mtheo Exp $ * */ Loading Loading @@ -89,7 +89,6 @@ int nmxp_data_unpack_bundle (int32_t *outdata, unsigned char *indata, int32_t *p int32_t d4[4]; int16_t d2[2]; int32_t cb[4]; //mtheo int i, j, k; int32_t i, j, k=0; unsigned char cbits; /* TOREMOVE int my_order = get_my_wordorder(); */ Loading Loading @@ -169,7 +168,6 @@ int nmxp_data_to_str(char *out_str, double time_d) { } tm_start_time = gmtime(&time_t_start_time); // sprintf(out_str, "%04d/%02d/%02d %02d:%02d:%02d.%04d", sprintf(out_str, "%04d.%03d,%02d:%02d:%02d.%04d", tm_start_time->tm_year + 1900, /* Loading Loading @@ -315,8 +313,8 @@ int nmxp_data_log(NMXP_DATA_PROCESS *pd) { nmxp_data_to_str(str_start, pd->time); nmxp_data_to_str(str_end, pd->time + ((double) pd->nSamp / (double) pd->sampRate)); // nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_PACKETMAN, "%12d %5s.%3s rate=%03d (%s - %s) [%d, %d] pts=%04d (%d, %d, %d, %d) lat=%.1f len=%d\n", // printf("%10d %5s.%3s 03dHz (%s - %s) lat=%.1fs [%d, %d] pts=%04d (%d, %d, %d, %d) len=%d\n", /* nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_PACKETMAN, "%12d %5s.%3s rate=%03d (%s - %s) [%d, %d] pts=%04d (%d, %d, %d, %d) lat=%.1f len=%d\n", */ /* printf("%10d %5s.%3s 03dHz (%s - %s) lat=%.1fs [%d, %d] pts=%04d (%d, %d, %d, %d) len=%d\n", */ nmxp_log(NMXP_LOG_NORM_NO, NMXP_LOG_D_ANY, "%s.%s.%3s %3dHz (%s - %s) lat %.1fs [%d, %d] (%d) %4dpts (%d, %d, %d, %d, %d) %d\n", /* pd->key, */ pd->network, Loading Loading @@ -665,12 +663,12 @@ int nmxp_data_msr_pack(NMXP_DATA_PROCESS *pd, NMXP_DATA_SEED *data_seed, void *p /* Populate MSRecord values */ // TODO // msr->starttime = ms_seedtimestr2hptime ("2004,350,00:00:00.00"); /* TODO */ /* msr->starttime = ms_seedtimestr2hptime ("2004,350,00:00:00.00"); */ msr->starttime = MS_EPOCH2HPTIME(pd->time); msr->samprate = pd->sampRate; // msr->byteorder = 0; /* big endian byte order */ /* msr->byteorder = 0; */ /* big endian byte order */ msr->byteorder = nmxp_data_bigendianhost (); msr->sequence_number = pd->seq_no % 1000000; Loading Loading
lib/nmxp.c +20 −17 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * Istituto Nazionale di Geofisica e Vulcanologia - Italy * quintiliani@ingv.it * * $Id: nmxp.c,v 1.58 2008-02-15 11:31:04 mtheo Exp $ * $Id: nmxp.c,v 1.59 2008-02-24 15:10:31 mtheo Exp $ * */ Loading Loading @@ -57,7 +57,7 @@ int nmxp_receiveChannelList(int isock, NMXP_CHAN_LIST **pchannelList) { nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_CHANNEL, "number of channels %d\n", (*pchannelList)->number); // TODO check /* TODO check*/ for(i=0; i < (*pchannelList)->number; i++) { (*pchannelList)->channel[i].key = ntohl((*pchannelList)->channel[i].key); Loading Loading @@ -350,34 +350,34 @@ NMXP_CHAN_LIST *nmxp_getAvailableChannelList(char * hostname, int portnum, NMXP_ NMXP_CHAN_LIST *channelList = NULL, *channelList_subset = NULL; int i; // 1. Open a socket /* 1. Open a socket*/ naqssock = nmxp_openSocket(hostname, portnum); if(naqssock != NMXP_SOCKET_ERROR) { // 2. Send a Connect /* 2. Send a Connect*/ if(nmxp_sendConnect(naqssock) == NMXP_SOCKET_OK) { // 3. Receive ChannelList /* 3. Receive ChannelList*/ if(nmxp_receiveChannelList(naqssock, &channelList) == NMXP_SOCKET_OK) { channelList_subset = nmxp_chan_getType(channelList, datatype); nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_CHANNEL, "%d / %d\n", channelList_subset->number, channelList->number); // nmxp_chan_sortByKey(channelList_subset); /* nmxp_chan_sortByKey(channelList_subset);*/ nmxp_chan_sortByName(channelList_subset); for(i=0; i < channelList_subset->number; i++) { nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_CHANNEL, "%12d %s\n", channelList_subset->channel[i].key, channelList_subset->channel[i].name); } // 4. Send a Request Pending (optional) /* 4. Send a Request Pending (optional)*/ // 5. Send AddChannels /* 5. Send AddChannels*/ // 6. Repeat until finished: receive and handle packets /* 6. Repeat until finished: receive and handle packets*/ // 7. Send Terminate Subscription /* 7. Send Terminate Subscription*/ nmxp_sendTerminateSubscription(naqssock, NMXP_SHUTDOWN_NORMAL, "Good Bye!"); } else { Loading @@ -387,7 +387,7 @@ NMXP_CHAN_LIST *nmxp_getAvailableChannelList(char * hostname, int portnum, NMXP_ nmxp_log(NMXP_LOG_ERR, NMXP_LOG_D_CHANNEL, "Error on sendConnect()\n"); } // 8. Close the socket /* 8. Close the socket*/ nmxp_closeSocket(naqssock); } Loading Loading @@ -571,7 +571,7 @@ int nmxp_raw_stream_seq_no_compare(const void *a, const void *b) ret = -1; } } else { printf("Error pa and/or pb are NULL!\n"); nmxp_log(NMXP_LOG_ERR, NMXP_LOG_D_ANY, "Error pa and/or pb are NULL!\n"); } return ret; Loading Loading @@ -620,6 +620,7 @@ int nmxp_raw_stream_manage(NMXP_RAW_STREAM_DATA *p, NMXP_DATA_PROCESS *a_pd, int char str_time[200]; NMXP_DATA_PROCESS *pd = NULL; /* Allocate pd copy value from a_pd */ if(a_pd) { /* if(a_pd->packet_type == 33 || a_pd->packet_type == 97) { Loading Loading @@ -675,7 +676,8 @@ int nmxp_raw_stream_manage(NMXP_RAW_STREAM_DATA *p, NMXP_DATA_PROCESS *a_pd, int latency = nmxp_data_latency(p->pdlist[0]); nmxp_data_to_str(str_time, p->pdlist[0]->time); if( seq_no_diff > 0) { nmxp_log(NMXP_LOG_WARN, NMXP_LOG_D_RAWSTREAM, "Force handling packet %s.%s.%d.%d (%s - %.2f sec.) time_diff %.2fs n_pdlist %d lat. %.1fs!\n", nmxp_log(NMXP_LOG_WARN, NMXP_LOG_D_RAWSTREAM, "Force handling packet %s.%s.%d.%d (%s - %.2f sec.) time_diff %.2fs n_pdlist %d lat. %.1fs!\n", p->pdlist[0]->station, p->pdlist[0]->channel, p->pdlist[0]->seq_no, p->pdlist[0]->packet_type, str_time, (double) p->pdlist[0]->nSamp / (double) p->pdlist[0]->sampRate, time_diff, p->n_pdlist, latency); for(i_func_pd=0; i_func_pd<n_func_pd; i_func_pd++) { Loading @@ -685,7 +687,8 @@ int nmxp_raw_stream_manage(NMXP_RAW_STREAM_DATA *p, NMXP_DATA_PROCESS *a_pd, int p->last_sample_time = (p->pdlist[0]->time + ((double) p->pdlist[0]->nSamp / (double) p->pdlist[0]->sampRate )); } else { /* It should not occur */ nmxp_log(NMXP_LOG_WARN, NMXP_LOG_D_RAWSTREAM, "NOT OCCUR! Packets %s.%s.%d.%d (%s - %.2f sec.) discarded, seq_no_diff=%d time_diff %.2fs lat. %.1fs\n", nmxp_log(NMXP_LOG_WARN, NMXP_LOG_D_RAWSTREAM, "NOT OCCUR! Packets %s.%s.%d.%d (%s - %.2f sec.) discarded, seq_no_diff=%d time_diff %.2fs lat. %.1fs\n", p->pdlist[0]->station, p->pdlist[0]->channel, p->pdlist[0]->seq_no, p->pdlist[0]->packet_type, str_time, (double) p->pdlist[0]->nSamp / (double) p->pdlist[0]->sampRate, seq_no_diff, time_diff, latency); } Loading Loading @@ -720,7 +723,7 @@ int nmxp_raw_stream_manage(NMXP_RAW_STREAM_DATA *p, NMXP_DATA_PROCESS *a_pd, int } qsort(p->pdlist, p->n_pdlist, sizeof(NMXP_DATA_PROCESS *), nmxp_raw_stream_seq_no_compare); // TODO Check for packet duplication in pd->pdlist /* TODO Check for packet duplication in pd->pdlist*/ /* Print array, only for debugging */ if(p->n_pdlist > 1) { Loading @@ -730,7 +733,7 @@ int nmxp_raw_stream_manage(NMXP_RAW_STREAM_DATA *p, NMXP_DATA_PROCESS *a_pd, int } } // Condition for time-out (pd is NULL) /* Condition for time-out (pd is NULL) */ if(!pd && p->n_pdlist > 0) { p->last_seq_no_sent = p->pdlist[0]->seq_no - 1; p->last_sample_time = p->pdlist[0]->time; Loading @@ -746,7 +749,7 @@ int nmxp_raw_stream_manage(NMXP_RAW_STREAM_DATA *p, NMXP_DATA_PROCESS *a_pd, int latency = nmxp_data_latency(p->pdlist[j]); nmxp_data_to_str(str_time, p->pdlist[j]->time); if(seq_no_diff <= 0) { // Duplicated packets: Discarded /* Duplicated packets: Discarded*/ nmxp_log(NMXP_LOG_WARN, NMXP_LOG_D_RAWSTREAM, "Packets %s.%s.%d.%d (%s - %f sec.) discarded, seq_no_diff=%d time_diff=%.2fs lat %.1fs\n", p->pdlist[j]->station, p->pdlist[j]->channel, p->pdlist[j]->seq_no, p->pdlist[j]->packet_type, str_time, (double) p->pdlist[j]->nSamp / (double) p->pdlist[j]->sampRate, seq_no_diff, time_diff, latency); Loading
lib/nmxp_base.c +14 −14 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * Istituto Nazionale di Geofisica e Vulcanologia - Italy * quintiliani@ingv.it * * $Id: nmxp_base.c,v 1.55 2008-02-22 08:04:57 mtheo Exp $ * $Id: nmxp_base.c,v 1.56 2008-02-24 15:10:52 mtheo Exp $ * */ Loading Loading @@ -150,20 +150,20 @@ int nmxp_recv_select_timeout(int s, char *buf, int len, int timeout) int n; struct timeval tv; // set up the file descriptor set /* set up the file descriptor set*/ FD_ZERO(&fds); FD_SET(s, &fds); // set up the struct timeval for the timeout /* set up the struct timeval for the timeout*/ tv.tv_sec = timeout; tv.tv_usec = 0; // wait until timeout or data received /* wait until timeout or data received*/ n = select(s+1, &fds, NULL, NULL, &tv); if (n == 0) return -2; // timeout! if (n == -1) return -1; // error if (n == 0) return -2; /* timeout!*/ if (n == -1) return -1; /* error*/ // data must be here, so do a normal recv() /* data must be here, so do a normal recv()*/ return recv(s, buf, len, 0); } #endif Loading Loading @@ -478,9 +478,9 @@ NMXP_DATA_PROCESS *nmxp_processDecompressedData(char* buffer_data, int length_da pd.x0 = -1; pd.xn = -1; pd.x0n_significant = 0; // TODO // pd.oldest_seq_no = ; // pd.seq_no = ; /* TODO*/ /* pd.oldest_seq_no = ;*/ /* pd.seq_no = ;*/ pd.time = pTime; pd.buffer = buffer_data; pd.length = length_data; Loading Loading @@ -533,7 +533,7 @@ NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data char *nmxp_channel_name = NULL; // TOREMOVE int my_order = get_my_wordorder(); /* TOREMOVE int my_order = get_my_wordorder();*/ int my_host_is_bigendian = nmxp_data_bigendianhost(); nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_PACKETMAN, "my_host_is_bigendian %d\n", my_host_is_bigendian); Loading @@ -546,7 +546,7 @@ NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data if ( (nmx_ptype & 0xf) == 9) { /* Filler packet. Discard entire packet. */ nmxp_log (NMXP_LOG_ERR, NMXP_LOG_D_PACKETMAN, "Filler packet - discarding\n"); //m continue; /*m continue;*/ exit(0); } Loading @@ -562,7 +562,7 @@ NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data const uint32_t high_scale_p = 4096 * 4096; /* check if nmx_x0 is negative like as signed 3-byte int */ if( (nmx_x0 & high_scale) == high_scale) { // nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_PACKETMAN, "WARNING: changed nmx_x0, old value = %d\n", nmx_x0); /* nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_PACKETMAN, "WARNING: changed nmx_x0, old value = %d\n", nmx_x0);*/ nmx_x0 -= high_scale_p; } /* TOREMOVE if (my_order != SEED_LITTLE_ENDIAN) { */ Loading @@ -574,7 +574,7 @@ NMXP_DATA_PROCESS *nmxp_processCompressedData(char* buffer_data, int length_data nmx_x0 = nmx_x0 >> 8; nmxp_data_swap_4b (&nmx_x0); nmx_x0 = nmx_x0 >> 8; // TODO /* TODO*/ nmx_x0++; } nmx_seconds_double = (double) nmx_seconds + ( (double) nmx_ticks / 10000.0 ); Loading
lib/nmxp_chan.c +3 −3 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * Istituto Nazionale di Geofisica e Vulcanologia - Italy * quintiliani@ingv.it * * $Id: nmxp_chan.c,v 1.30 2008-02-22 08:05:06 mtheo Exp $ * $Id: nmxp_chan.c,v 1.31 2008-02-24 15:10:52 mtheo Exp $ * */ Loading Loading @@ -307,7 +307,7 @@ NMXP_CHAN_LIST_NET *nmxp_chan_subset(NMXP_CHAN_LIST *channelList, NMXP_DATATYPE } // Comparison Key Function /* Comparison Key Function*/ int chan_key_compare(const void *a, const void *b) { int ret = 0; Loading @@ -326,7 +326,7 @@ void nmxp_chan_sortByKey(NMXP_CHAN_LIST *channelList) { qsort (channelList->channel, channelList->number, sizeof (NMXP_CHAN_KEY), chan_key_compare); } // Comparison Name Function /* Comparison Name Function*/ int chan_name_compare(const void *a, const void *b) { NMXP_CHAN_KEY *pa = (NMXP_CHAN_KEY *) a; Loading
lib/nmxp_crc32.c +2 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ * * \brief Computing a 32 bit CRC. * * $Id: nmxp_crc32.c,v 1.5 2007-12-28 11:21:51 mtheo Exp $ * $Id: nmxp_crc32.c,v 1.6 2008-02-24 15:10:52 mtheo Exp $ * * */ Loading @@ -17,7 +17,7 @@ void crc32_init_table () { crc32_tab[0] = 0; for (i = 128; i; i >>= 1) { h = (h >> 1) ^ ((h & 1) ? POLYNOMIAL : 0); // h is now crc_table[i] /* h is now crc_table[i]*/ for (j = 0; j < 256; j += 2 * i) { crc32_tab[i + j] = crc32_tab[j] ^ h; } Loading
lib/nmxp_data.c +6 −8 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * Istituto Nazionale di Geofisica e Vulcanologia - Italy * quintiliani@ingv.it * * $Id: nmxp_data.c,v 1.48 2008-01-17 08:13:51 mtheo Exp $ * $Id: nmxp_data.c,v 1.49 2008-02-24 15:10:52 mtheo Exp $ * */ Loading Loading @@ -89,7 +89,6 @@ int nmxp_data_unpack_bundle (int32_t *outdata, unsigned char *indata, int32_t *p int32_t d4[4]; int16_t d2[2]; int32_t cb[4]; //mtheo int i, j, k; int32_t i, j, k=0; unsigned char cbits; /* TOREMOVE int my_order = get_my_wordorder(); */ Loading Loading @@ -169,7 +168,6 @@ int nmxp_data_to_str(char *out_str, double time_d) { } tm_start_time = gmtime(&time_t_start_time); // sprintf(out_str, "%04d/%02d/%02d %02d:%02d:%02d.%04d", sprintf(out_str, "%04d.%03d,%02d:%02d:%02d.%04d", tm_start_time->tm_year + 1900, /* Loading Loading @@ -315,8 +313,8 @@ int nmxp_data_log(NMXP_DATA_PROCESS *pd) { nmxp_data_to_str(str_start, pd->time); nmxp_data_to_str(str_end, pd->time + ((double) pd->nSamp / (double) pd->sampRate)); // nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_PACKETMAN, "%12d %5s.%3s rate=%03d (%s - %s) [%d, %d] pts=%04d (%d, %d, %d, %d) lat=%.1f len=%d\n", // printf("%10d %5s.%3s 03dHz (%s - %s) lat=%.1fs [%d, %d] pts=%04d (%d, %d, %d, %d) len=%d\n", /* nmxp_log(NMXP_LOG_NORM, NMXP_LOG_D_PACKETMAN, "%12d %5s.%3s rate=%03d (%s - %s) [%d, %d] pts=%04d (%d, %d, %d, %d) lat=%.1f len=%d\n", */ /* printf("%10d %5s.%3s 03dHz (%s - %s) lat=%.1fs [%d, %d] pts=%04d (%d, %d, %d, %d) len=%d\n", */ nmxp_log(NMXP_LOG_NORM_NO, NMXP_LOG_D_ANY, "%s.%s.%3s %3dHz (%s - %s) lat %.1fs [%d, %d] (%d) %4dpts (%d, %d, %d, %d, %d) %d\n", /* pd->key, */ pd->network, Loading Loading @@ -665,12 +663,12 @@ int nmxp_data_msr_pack(NMXP_DATA_PROCESS *pd, NMXP_DATA_SEED *data_seed, void *p /* Populate MSRecord values */ // TODO // msr->starttime = ms_seedtimestr2hptime ("2004,350,00:00:00.00"); /* TODO */ /* msr->starttime = ms_seedtimestr2hptime ("2004,350,00:00:00.00"); */ msr->starttime = MS_EPOCH2HPTIME(pd->time); msr->samprate = pd->sampRate; // msr->byteorder = 0; /* big endian byte order */ /* msr->byteorder = 0; */ /* big endian byte order */ msr->byteorder = nmxp_data_bigendianhost (); msr->sequence_number = pd->seq_no % 1000000; Loading