summaryrefslogtreecommitdiff
path: root/fw/app/src/syslog.c
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2025-04-15 22:12:54 +0200
committerxengineering <me@xengineering.eu>2025-04-16 18:03:40 +0200
commitf4faa103108356bcf53fb7c8829e95f012b21a4a (patch)
treef0f8e40c0a66090fd027ac31bf5ce213aaf97b63 /fw/app/src/syslog.c
parentd25c8e08ce6a977977e38365ace9af16acf09195 (diff)
downloadiot-contact-f4faa103108356bcf53fb7c8829e95f012b21a4a.tar
iot-contact-f4faa103108356bcf53fb7c8829e95f012b21a4a.tar.zst
iot-contact-f4faa103108356bcf53fb7c8829e95f012b21a4a.zip
fw: app: http: Add working GET /settings.json
Diffstat (limited to 'fw/app/src/syslog.c')
-rw-r--r--fw/app/src/syslog.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/fw/app/src/syslog.c b/fw/app/src/syslog.c
index 47b2edb..700547b 100644
--- a/fw/app/src/syslog.c
+++ b/fw/app/src/syslog.c
@@ -7,6 +7,7 @@
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
+#include <string.h>
#include <string.h>
#include <zephyr/init.h>
@@ -33,7 +34,7 @@ LOG_MODULE_REGISTER(syslog);
struct net_mgmt_event_callback l4_cb;
static K_SEM_DEFINE(network_connected, 0, 1);
-static char target_ip[IPV6_STRLEN_MAX] = "2001:db8::2";
+static char target_ip[IPV6_STRLEN_MAX + 1] = "2001:db8::2";
void l4_event_handler(
struct net_mgmt_event_callback *cb,
@@ -145,7 +146,13 @@ int syslog_handle_export(int (*cb)(const char *name, const void *value,
int syslog_handle_get(const char *name, char *val, int val_len_max)
{
- LOG_WRN("Settings get not implemented");
+ const char* next = NULL;
+
+ if (settings_name_steq(name, "target/ip", &next) && !next) {
+ size_t len = strnlen(target_ip, sizeof(target_ip));
+ memcpy(val, target_ip, MIN(len, val_len_max));
+ }
+
return 0;
}