nmxp_chan.h 1.08 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*! \file
 *
 * \brief Channels for Nanometrics Protocol Libray
 *
 * Author:
 * 	Matteo Quintiliani
 * 	Istituto Nazionale di Geofisica e Vulcanologia - Italy
 *	quintiliani@ingv.it
 *
 */

#ifndef NMXP_CHAN_H
#define NMXP_CHAN_H 1

#include <sys/types.h>

/*! \brief The key/name info for one channel */
Matteo Quintiliani's avatar
Matteo Quintiliani committed
18
typedef struct {
19
20
    uint32_t key;
    char name[12];
Matteo Quintiliani's avatar
Matteo Quintiliani committed
21
} NMXP_CHAN_KEY;
22

Matteo Quintiliani's avatar
Matteo Quintiliani committed
23
/*! \brief Max number of channels */
24
#define MAX_N_CHAN 1000
Matteo Quintiliani's avatar
Matteo Quintiliani committed
25
26
27

/*! \brief Channel list */
typedef struct {
28
    uint32_t number;
Matteo Quintiliani's avatar
Matteo Quintiliani committed
29
30
    NMXP_CHAN_KEY channel[MAX_N_CHAN];
} NMXP_CHAN_LIST;
31
32


Matteo Quintiliani's avatar
Matteo Quintiliani committed
33
/*! \brief Looks up a channel key in the NMXP_CHAN_LIST using the name
34
 *
Matteo Quintiliani's avatar
Matteo Quintiliani committed
35
36
 * \param name Channel name.
 * \param channelList Channel list.
37
 *
Matteo Quintiliani's avatar
Matteo Quintiliani committed
38
 * \return Key of the channel with name. -1 On error.
39
40
 *
 */
Matteo Quintiliani's avatar
Matteo Quintiliani committed
41
int nmxp_chan_lookupKey(char* name, NMXP_CHAN_LIST *channelList);
42

Matteo Quintiliani's avatar
Matteo Quintiliani committed
43
/*! \brief Looks up a channel name in the NMXP_CHAN_LIST using a key
44
 *
Matteo Quintiliani's avatar
Matteo Quintiliani committed
45
46
 * \param key Channel key.
 * \param channelList Channel list.
47
 *
Matteo Quintiliani's avatar
Matteo Quintiliani committed
48
 * \return Name of channel with key. NULL on error.
49
50
 *
 */
Matteo Quintiliani's avatar
Matteo Quintiliani committed
51
char *nmxp_chan_lookupName(uint32_t key, NMXP_CHAN_LIST *channelList);
52
53
54

#endif