00001
00014 #ifndef NMXP_CHAN_H
00015 #define NMXP_CHAN_H 1
00016
00017 #include <stdint.h>
00018
00019 #define NMXP_CHAN_MAX_SIZE_STR_PATTERN 20
00020
00022 typedef struct NMXP_META_CHAN_LIST {
00023 int32_t key;
00024 char name[12];
00025 int32_t start_time;
00026 int32_t end_time;
00027 char network[12];
00028 struct NMXP_META_CHAN_LIST *next;
00029 } NMXP_META_CHAN_LIST;
00030
00031 typedef enum {
00032 NMXP_META_SORT_KEY = 1,
00033 NMXP_META_SORT_NAME,
00034 NMXP_META_SORT_START_TIME,
00035 NMXP_META_SORT_END_TIME
00036 } NMXP_META_CHAN_LIST_SORT_TYPE;
00037
00038
00040 #define MAX_N_CHAN 2000
00041
00042 #define NMXP_CHAN_MAX_SIZE_NAME 24
00043
00045 typedef struct {
00046 int32_t key;
00047 char name[NMXP_CHAN_MAX_SIZE_NAME];
00048 } NMXP_CHAN_KEY_NET;
00049
00051 typedef struct {
00052 int32_t number;
00053 NMXP_CHAN_KEY_NET channel[MAX_N_CHAN];
00054 } NMXP_CHAN_LIST_NET;
00055
00057 typedef struct {
00058 int32_t key;
00059 char name[12];
00060 } NMXP_CHAN_KEY;
00061
00063 typedef struct {
00064 int32_t number;
00065 NMXP_CHAN_KEY channel[MAX_N_CHAN];
00066 } NMXP_CHAN_LIST;
00067
00069 typedef struct {
00070 int32_t key;
00071 char name[12];
00072 int32_t start_time;
00073 int32_t end_time;
00074 } NMXP_CHAN_PRECISITEM;
00075
00077 typedef struct {
00078 int32_t number;
00079 NMXP_CHAN_PRECISITEM channel[MAX_N_CHAN];
00080 } NMXP_CHAN_PRECISLIST;
00081
00083 typedef enum {
00084 NMXP_DATA_TIMESERIES = 1,
00085 NMXP_DATA_SOH = 2,
00086 NMXP_DATA_TRANSERIAL = 6
00087 } NMXP_DATATYPE;
00088
00090 typedef struct {
00091 int32_t instr_id;
00092 NMXP_DATATYPE datatype;
00093 int32_t type_of_channel;
00094 } NMXP_PRECISLISTREQUEST;
00095
00097 typedef struct {
00098 int32_t key;
00099 char name[12];
00100 char network[12];
00101 } NMXP_CHANNELINFORESPONSE;
00102
00104 typedef struct {
00105 int32_t key;
00106 int32_t ignored;
00107 } NMXP_CHANNELINFOREQUEST;
00108
00109
00111 #define sep_chan_list ','
00112
00113
00115 #define getDataTypeFromKey(key) ((key >> 8) & 0xff)
00116
00118 #define getChannelNumberFromKey(key) ((key) & 0x000f)
00119
00120
00121
00135 int nmxp_chan_cpy_sta_chan(const char *net_dot_station_dot_channel, char *station_code, char *channel_code, char *network_code);
00136
00137
00149 int nmxp_chan_match(const char *net_dot_station_dot_channel, char *pattern);
00150
00151
00152
00161 int nmxp_chan_lookupKey(char* name, NMXP_CHAN_LIST *channelList);
00162
00163
00172 int nmxp_chan_lookupKeyIndex(int32_t key, NMXP_CHAN_LIST_NET *channelList);
00173
00174
00185 char *nmxp_chan_lookupName(int32_t key, NMXP_CHAN_LIST_NET *channelList);
00186
00187
00198 NMXP_CHAN_LIST *nmxp_chan_getType(NMXP_CHAN_LIST *channelList, NMXP_DATATYPE dataType);
00199
00200
00213 NMXP_CHAN_LIST_NET *nmxp_chan_subset(NMXP_CHAN_LIST *channelList, NMXP_DATATYPE dataType, char *sta_chan_list, const char *network_code_default);
00214
00215
00221 void nmxp_chan_sortByKey(NMXP_CHAN_LIST *channelList);
00222
00223
00229 void nmxp_chan_sortByName(NMXP_CHAN_LIST *channelList);
00230
00231
00237 void nmxp_chan_print_channelList(NMXP_CHAN_LIST *channelList);
00238
00239
00246 void nmxp_chan_print_channelList_with_match(NMXP_CHAN_LIST *channelList, char *sta_chan_list);
00247
00248
00254 void nmxp_chan_print_netchannelList(NMXP_CHAN_LIST_NET *channelList);
00255
00256
00257 void nmxp_meta_chan_free(NMXP_META_CHAN_LIST **chan_list);
00258
00259 NMXP_META_CHAN_LIST *nmxp_meta_chan_add(NMXP_META_CHAN_LIST **chan_list, int32_t key, char *name, int32_t start_time, int32_t end_time, char *network, NMXP_META_CHAN_LIST_SORT_TYPE sorttype);
00260
00261 NMXP_META_CHAN_LIST *nmxp_meta_chan_search_key(NMXP_META_CHAN_LIST *chan_list, int32_t key);
00262
00263 NMXP_META_CHAN_LIST *nmxp_meta_chan_set_name(NMXP_META_CHAN_LIST *chan_list, int32_t key, char *name);
00264
00265 NMXP_META_CHAN_LIST *nmxp_meta_chan_set_times(NMXP_META_CHAN_LIST *chan_list, int32_t key, int32_t start_time, int32_t end_time);
00266
00267 NMXP_META_CHAN_LIST *nmxp_meta_chan_set_network(NMXP_META_CHAN_LIST *chan_list, int32_t key, char *network);
00268
00269 void nmxp_meta_chan_print(NMXP_META_CHAN_LIST *chan_list);
00270
00271 void nmxp_meta_chan_print_with_match(NMXP_META_CHAN_LIST *chan_list, char *sta_chan_list);
00272
00273 #endif
00274