aboutsummaryrefslogtreecommitdiff
path: root/src/survive_config.h
diff options
context:
space:
mode:
authormwturvey <michael.w.turvey@intel.com>2017-02-27 11:26:05 -0700
committermwturvey <michael.w.turvey@intel.com>2017-02-27 11:26:05 -0700
commit321749a4b8e3e8b3f4b03863200fbf86e36a0bbe (patch)
treeb7d81c89b3a4ccb72d46e5194929b47df88345b7 /src/survive_config.h
parentd1a02d649c034f43a11548a04d8d2a58786ff8ff (diff)
parent51751d4a9f407f526de2b626d44e14690fbef004 (diff)
downloadlibsurvive-321749a4b8e3e8b3f4b03863200fbf86e36a0bbe.tar.gz
libsurvive-321749a4b8e3e8b3f4b03863200fbf86e36a0bbe.tar.bz2
Merge branch 'master' of https://github.com/cnlohr/libsurvive
Diffstat (limited to 'src/survive_config.h')
-rw-r--r--src/survive_config.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/survive_config.h b/src/survive_config.h
new file mode 100644
index 0000000..24762cd
--- /dev/null
+++ b/src/survive_config.h
@@ -0,0 +1,45 @@
+// (C) 2017 <>< Joshua Allen, Under MIT/x11 License.
+
+
+#ifndef _SURVIVE_CONFIG_H
+#define _SURVIVE_CONFIG_H
+
+#include "survive_internal.h"
+
+typedef enum {
+ CONFIG_UNKNOWN = 0,
+ CONFIG_FLOAT = 1,
+ CONFIG_UINT32 = 2,
+ CONFIG_STRING = 3
+} cval_type;
+/*
+typedef union {
+ uint32_t i;
+ FLT f;
+ } Numeric;
+*/
+typedef struct {
+ char *tag;
+ cval_type type;
+ union {
+ uint32_t i;
+ FLT f;
+ } numeric;
+ char *str;
+} config_val;
+
+
+void config_open(const char* path, const char* mode);
+void config_close();
+void config_write_lighthouse(struct BaseStationData* bsd, uint8_t length);
+
+void config_save(const char* path);
+const FLT config_set_float(const char *tag, const FLT value);
+const uint32_t config_set_uint32(const char *tag, const uint32_t value);
+const char* config_set_str(const char *tag, const char* value);
+FLT config_read_float(const char *tag, const FLT value, const FLT def);
+
+uint32_t config_read_uint32(const char *tag, const uint32_t value, const uint32_t def);
+const char* config_read_str(const char *tag, const char *value, const char *def_str);
+
+#endif \ No newline at end of file