summaryrefslogtreecommitdiff
path: root/fw/app/src/settings.h
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2025-05-07 19:03:22 +0200
committerxengineering <me@xengineering.eu>2025-05-07 19:03:22 +0200
commita5aafcbd0398ae3893a83827cf66d4352eaee8f0 (patch)
tree36506463a33aa274dc56f8332269eab096eb73c7 /fw/app/src/settings.h
parent015972d873627466bd7e40f8d5dbb5951fb0f36a (diff)
parent184a41809c66868992c90ce9d420b8e4dc46253b (diff)
downloadiot-contact-a5aafcbd0398ae3893a83827cf66d4352eaee8f0.tar
iot-contact-a5aafcbd0398ae3893a83827cf66d4352eaee8f0.tar.zst
iot-contact-a5aafcbd0398ae3893a83827cf66d4352eaee8f0.zip
Merge branch 'settings'HEADmain
This adds the HTTP GET /settings.json API. Writing settings is only supported via the Zephyr shell.
Diffstat (limited to 'fw/app/src/settings.h')
-rw-r--r--fw/app/src/settings.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/fw/app/src/settings.h b/fw/app/src/settings.h
new file mode 100644
index 0000000..8c7b4e3
--- /dev/null
+++ b/fw/app/src/settings.h
@@ -0,0 +1,33 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public License,
+ * v. 2.0. If a copy of the MPL was not distributed with this file, You can
+ * obtain one at https://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef SRC_SETTINGS_H
+#define SRC_SETTINGS_H
+
+#include <stddef.h>
+
+#include <zephyr/data/json.h>
+
+#define IPV6_STRLEN_MAX 39 // excluding '\0'
+#define SETTINGS_JSON_MAX_LEN (IPV6_STRLEN_MAX + 50)
+
+
+struct settings_syslog_target {
+ char ip_array[IPV6_STRLEN_MAX];
+ char *ip; /* Zephyr's JSON lib does not work with arrays directly */
+};
+
+struct settings_syslog {
+ struct settings_syslog_target target;
+};
+
+struct settings {
+ struct settings_syslog syslog;
+};
+
+int settings_to_json(void *buffer, size_t data);
+
+#endif // !SRC_SETTINGS_H