- Main Page
- Classes
- Files
- Related Pages

# include/nmxp_chan.h File Reference

Channels for Nanometrics Protocol Library. More...

`#include <stdint.h>`

Include dependency graph for nmxp_chan.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes
struct | NMXP_META_CHAN_LIST
| Channel list. More...
struct | NMXP_CHAN_KEY_NET
| The key/name info for one channel. More...
struct | NMXP_CHAN_LIST_NET
| Channel list. More...
struct | NMXP_CHAN_KEY
| The key/name info for one channel. More...
struct | NMXP_CHAN_LIST
| Channel list. More...
struct | NMXP_CHAN_PRECISITEM
| Precis Channel item. More...
struct | NMXP_CHAN_PRECISLIST
| Precis Channel list. More...
struct | NMXP_PRECISLISTREQUEST
| Precis list request body. More...
struct | NMXP_CHANNELINFORESPONSE
| Channel info request body. More...
struct | NMXP_CHANNELINFOREQUEST
| Channel info request body. More...
## Defines
#define | NMXP_CHAN_H 1
#define | MAX_N_CHAN 2000
| Max number of channels.
#define | sep_chan_list ','
| Character separator for channel list.
#define | getDataTypeFromKey(key) ((key >> 8) & 0xff)
| Return type of data from a channel key.
#define | getChannelNumberFromKey(key) ((key) & 0x000f)
| Return channel number from a channel key.
## Enumerations
enum | NMXP_META_CHAN_LIST_SORT_TYPE { NMXP_META_SORT_KEY = 1, NMXP_META_SORT_NAME, NMXP_META_SORT_START_TIME, NMXP_META_SORT_END_TIME }
enum | NMXP_DATATYPE { NMXP_DATA_TIMESERIES = 1, NMXP_DATA_SOH = 2, NMXP_DATA_TRANSERIAL = 6 }
| Type of Data. More...
## Functions
int | nmxp_chan_cpy_sta_chan (const char *net_dot_station_dot_channel, char *station_code, char *channel_code, char *network_code)
| Copy station code and channel code from name.
int | nmxp_chan_match (const char *net_dot_station_dot_channel, char *pattern)
| Match station_dot_channel against pattern, treating errors as no match.
int | nmxp_chan_lookupKey (char *name, NMXP_CHAN_LIST *channelList)
| Looks up a channel key in the list using the name.
int | nmxp_chan_lookupKeyIndex (int32_t key, NMXP_CHAN_LIST_NET *channelList)
| Looks up a channel name in the list using a key.
char * | nmxp_chan_lookupName (int32_t key, NMXP_CHAN_LIST_NET *channelList)
| Looks up a channel name in the list using a key.
NMXP_CHAN_LIST * | nmxp_chan_getType (NMXP_CHAN_LIST *channelList, NMXP_DATATYPE dataType)
| Looks up a channel with specified data type.
NMXP_CHAN_LIST_NET * | nmxp_chan_subset (NMXP_CHAN_LIST *channelList, NMXP_DATATYPE dataType, char *sta_chan_list, const char *network_code_default)
| Looks up a channel with specified data type.
void | nmxp_chan_sortByKey (NMXP_CHAN_LIST *channelList)
void | nmxp_chan_sortByName (NMXP_CHAN_LIST *channelList)
void | nmxp_chan_print_channelList (NMXP_CHAN_LIST *channelList)
void | nmxp_chan_print_channelList_with_match (NMXP_CHAN_LIST *channelList, char *sta_chan_list)
void | nmxp_chan_print_netchannelList (NMXP_CHAN_LIST_NET *channelList)
void | nmxp_meta_chan_free (NMXP_META_CHAN_LIST **chan_list)
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)
NMXP_META_CHAN_LIST * | nmxp_meta_chan_search_key (NMXP_META_CHAN_LIST *chan_list, int32_t key)
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_times (NMXP_META_CHAN_LIST *chan_list, int32_t key, int32_t start_time, int32_t end_time)
NMXP_META_CHAN_LIST * | nmxp_meta_chan_set_network (NMXP_META_CHAN_LIST *chan_list, int32_t key, char *network)
void | nmxp_meta_chan_print (NMXP_META_CHAN_LIST *chan_list)
void | nmxp_meta_chan_print_with_match (NMXP_META_CHAN_LIST *chan_list, char *sta_chan_list)

## Detailed Description

Channels for Nanometrics Protocol Library.

Author: Matteo Quintiliani Istituto Nazionale di Geofisica e Vulcanologia - Italy quintiliani@ingv.it

Id

## Define Documentation

#define NMXP_CHAN_H 1

#define MAX_N_CHAN 2000

Max number of channels.

#define sep_chan_list ','

Character separator for channel list.

#define getDataTypeFromKey | ( | key |  | ) | ((key >> 8) & 0xff)

Return type of data from a channel key.

#define getChannelNumberFromKey | ( | key |  | ) | ((key) & 0x000f)

Return channel number from a channel key.

## Enumeration Type Documentation

enum NMXP_META_CHAN_LIST_SORT_TYPE

Enumerator:

  NMXP_META_SORT_KEY |
  NMXP_META_SORT_NAME |
  NMXP_META_SORT_START_TIME |
  NMXP_META_SORT_END_TIME |

enum NMXP_DATATYPE

Type of Data.

Enumerator:

  NMXP_DATA_TIMESERIES |
  NMXP_DATA_SOH |
  NMXP_DATA_TRANSERIAL |

## Function Documentation

int nmxp_chan_cpy_sta_chan | ( | const char * | net_dot_station_dot_channel,
|  | char * | station_code,
|  | char * | channel_code,
|  | char * | network_code |
| ) |  |  |

Copy station code and channel code from name.

Parameters:

  | net_dot_station_dot_channel | string containing NET.STA.CHAN where NET. is optional
  `[out]` | station_code | Pointer to string for station code
  `[out]` | channel_code | Pointer to string for channel code
  `[out]` | network_code | Pointer to string for station code

Warning:
  Parametes can not be NULL!

Return values:

  | 1 | on success
  | 0 | on error

int nmxp_chan_match | ( | const char * | net_dot_station_dot_channel,
|  | char * | pattern |
| ) |  |  |

Match station_dot_channel against pattern, treating errors as no match.

Parameters:

  | net_dot_station_dot_channel | NET.STA.CHAN format (NET. is optional)
  | pattern | N1.STA.?HZ or N2.STA.H?Z or STA.HH? or STA.?H? or ....

Return values:

  | 1 | for match
  | 0 | for no match
  | -1 | on error for invalid pattern
  | -2 | on error for invalid station_dot_channel

int nmxp_chan_lookupKey | ( | char * | name,
|  | NMXP_CHAN_LIST * | channelList |
| ) |  |  |

Looks up a channel key in the list using the name.

Parameters:

  | name | Channel name.
  | channelList | Channel list.

Returns:
  Key of the channel with name. -1 On error.

int nmxp_chan_lookupKeyIndex | ( | int32_t | key,
|  | NMXP_CHAN_LIST_NET * | channelList |
| ) |  |  |

Looks up a channel name in the list using a key.

Parameters:

  | key | Channel key.
  | channelList | Channel list.

Returns:
  Index of channel with key. -1 on error.

char* nmxp_chan_lookupName | ( | int32_t | key,
|  | NMXP_CHAN_LIST_NET * | channelList |
| ) |  |  |

Looks up a channel name in the list using a key.

Parameters:

  | key | Channel key.
  | channelList | Channel list.

Returns:
  Name of channel with key. NULL on error.

NMXP_CHAN_LIST* nmxp_chan_getType | ( | NMXP_CHAN_LIST * | channelList,
|  | NMXP_DATATYPE | dataType |
| ) |  |  |

Looks up a channel with specified data type.

Parameters:

  | channelList | Channel list.
  | dataType | Type of channel.

Returns:
  Channel list with specified dataType. It will need to be freed!

Warning:
  Returned value will need to be freed!

NMXP_CHAN_LIST_NET* nmxp_chan_subset | ( | NMXP_CHAN_LIST * | channelList,
|  | NMXP_DATATYPE | dataType,
|  | char * | sta_chan_list,
|  | const char * | network_code_default |
| ) |  |  |

Looks up a channel with specified data type.

Parameters:

  | channelList | Channel list.
  | dataType | Type of channel.
  | sta_chan_list | String list of item STA.CHAN, separeted by comma.
  | network_code_default | Default Network code

Returns:
  Channel list with specified dataType. It will need to be freed!

Warning:
  Returned value will need to be freed!

void nmxp_chan_sortByKey | ( | NMXP_CHAN_LIST * | channelList | ) |

Sort list by channel key

Parameters:

  | channelList | Channel List

void nmxp_chan_sortByName | ( | NMXP_CHAN_LIST * | channelList | ) |

Sort list by channel name

Parameters:

  | channelList | Channel List

void nmxp_chan_print_channelList | ( | NMXP_CHAN_LIST * | channelList | ) |

Print channel information

Parameters:

  | channelList | Channel List

void nmxp_chan_print_channelList_with_match | ( | NMXP_CHAN_LIST * | channelList,
|  | char * | sta_chan_list |
| ) |  |  |

Print channel information using channel pattern list

Parameters:

  | channelList | Channel List
  | sta_chan_list | Channel pattern list

void nmxp_chan_print_netchannelList | ( | NMXP_CHAN_LIST_NET * | channelList | ) |

Print channel information

Parameters:

  | channelList | Channel List

void nmxp_meta_chan_free | ( | NMXP_META_CHAN_LIST ** | chan_list | ) |

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 |
| ) |  |  |

NMXP_META_CHAN_LIST* nmxp_meta_chan_search_key | ( | NMXP_META_CHAN_LIST * | chan_list,
|  | int32_t | key |
| ) |  |  |

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_times | ( | NMXP_META_CHAN_LIST * | chan_list,
|  | int32_t | key,
|  | int32_t | start_time,
|  | int32_t | end_time |
| ) |  |  |

NMXP_META_CHAN_LIST* nmxp_meta_chan_set_network | ( | NMXP_META_CHAN_LIST * | chan_list,
|  | int32_t | key,
|  | char * | network |
| ) |  |  |

void nmxp_meta_chan_print | ( | NMXP_META_CHAN_LIST * | chan_list | ) |

void nmxp_meta_chan_print_with_match | ( | NMXP_META_CHAN_LIST * | chan_list,
|  | char * | sta_chan_list |
| ) |  |  |