SELKIELogger  1.0.0
LoggerDMap.c
1 /*
2  * Copyright (C) 2023 Swansea University
3  *
4  * This file is part of the SELKIELogger suite of tools.
5  *
6  * SELKIELogger is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the Free
8  * Software Foundation, either version 3 of the License, or (at your option)
9  * any later version.
10  *
11  * SELKIELogger is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this SELKIELogger product.
18  * If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #include "LoggerDMap.h"
22 
24 struct dmap {
25  char *tag;
26  device_callbacks (*dcb)(void);
28 };
29 
37 struct dmap dmap[] = {
46  {"SERIAL", &rx_getCallbacks, &rx_parseConfig},
52  {NULL, NULL, NULL} // End of list sentinel value
53 };
54 
65 device_callbacks dmap_getCallbacks(const char *source) {
66  size_t ix = 0;
67  while (dmap[ix].tag) {
68  if (strncasecmp(source, dmap[ix].tag, strlen(dmap[ix].tag)) == 0) {
69  return dmap[ix].dcb();
70  }
71  ix++;
72  }
73  return (device_callbacks){0};
74 }
75 
85 dc_parser dmap_getParser(const char *source) {
86  size_t ix = 0;
87  while (dmap[ix].tag) {
88  if (strncasecmp(source, dmap[ix].tag, strlen(dmap[ix].tag)) == 0) {
89  return dmap[ix].dp;
90  }
91  ix++;
92  }
93  return NULL;
94 }
dc_parser dmap_getParser(const char *source)
Get data source specific configuration handler.
Definition: LoggerDMap.c:85
device_callbacks dmap_getCallbacks(const char *source)
Return device_callbacks structure for specified data source.
Definition: LoggerDMap.c:65
bool mqtt_parseConfig(log_thread_args_t *lta, config_section *s)
Take a configuration section and parse parameters.
Definition: LoggerMQTT.c:231
device_callbacks mqtt_getCallbacks(void)
Fill out device callback functions for logging.
Definition: LoggerMQTT.c:200
bool dw_parseConfig(log_thread_args_t *lta, config_section *s)
Take a configuration section and parse parameters.
Definition: LoggerDW.c:470
device_callbacks dw_getCallbacks()
Fill out device callback functions for logging.
Definition: LoggerDW.c:369
device_callbacks gps_getCallbacks()
Fill out device callback functions for logging.
Definition: LoggerGPS.c:326
bool gps_parseConfig(log_thread_args_t *lta, config_section *s)
Parse configuration section.
Definition: LoggerGPS.c:352
bool i2c_parseConfig(log_thread_args_t *lta, config_section *s)
Take a configuration section, parse parameters and register devices.
Definition: LoggerI2C.c:405
device_callbacks i2c_getCallbacks()
Fill out device callback functions for logging.
Definition: LoggerI2C.c:212
bool lpms_parseConfig(log_thread_args_t *lta, config_section *s)
Take a configuration section and parse parameters.
Definition: LoggerLPMS.c:532
device_callbacks lpms_getCallbacks()
Fill out device callback functions for logging.
Definition: LoggerLPMS.c:441
device_callbacks mp_getCallbacks()
Fill out device callback functions for logging.
Definition: LoggerMP.c:224
bool mp_parseConfig(log_thread_args_t *lta, config_section *s)
Take a configuration section and parse parameters.
Definition: LoggerMP.c:250
bool n2k_parseConfig(log_thread_args_t *lta, config_section *s)
Take a configuration section and parse parameters.
Definition: LoggerN2K.c:271
device_callbacks n2k_getCallbacks()
Fill out device callback functions for logging.
Definition: LoggerN2K.c:249
device_callbacks nmea_getCallbacks()
Fill out device callback functions for logging.
Definition: LoggerNMEA.c:227
bool nmea_parseConfig(log_thread_args_t *lta, config_section *s)
Take a configuration section and parse parameters.
Definition: LoggerNMEA.c:249
bool net_parseConfig(log_thread_args_t *lta, config_section *s)
Take a configuration section and parse parameters.
Definition: LoggerNet.c:306
device_callbacks net_getCallbacks()
Fill out device callback functions for logging.
Definition: LoggerNet.c:236
device_callbacks rx_getCallbacks()
Fill out device callback functions for logging.
Definition: LoggerSerial.c:138
bool rx_parseConfig(log_thread_args_t *lta, config_section *s)
Take a configuration section and parse parameters.
Definition: LoggerSerial.c:210
bool timer_parseConfig(log_thread_args_t *lta, config_section *s)
Take a configuration section and parse parameters.
Definition: LoggerTime.c:212
device_callbacks timer_getCallbacks()
Fill out device callback functions for logging.
Definition: LoggerTime.c:187
bool(* dc_parser)(log_thread_args_t *, config_section *)
Data source specific configuration parsers;.
Definition: Logger.h.in:123
Device specific function information.
Definition: Logger.h.in:72
Device map entry.
Definition: LoggerDMap.c:24
char * tag
ID tag.
Definition: LoggerDMap.c:25
dc_parser dp
Device parseConfig function.
Definition: LoggerDMap.c:27
device_callbacks(* dcb)(void)
Device getCallbacks function.
Definition: LoggerDMap.c:26