aboutsummaryrefslogtreecommitdiff
path: root/include/param.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/param.h')
-rw-r--r--include/param.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/param.h b/include/param.h
new file mode 100644
index 0000000..b66b1b1
--- /dev/null
+++ b/include/param.h
@@ -0,0 +1,27 @@
+#pragma once
+
+#include <stdint.h>
+#include "sockbuf.h"
+
+typedef struct httpd_req httpd_req_t;
+
+typedef uint32_t color_int_t;
+
+#define DECL_PARAMETER_INSTANCE(ty) \
+ void handle_option__##ty(const char* attr, sockbuf_t* sockbuf, ty* ptr); \
+ size_t serialize_to_json__##ty( \
+ char** out, size_t len, const char* attr, const char* display_name, \
+ ty value); \
+ void http_handle__##ty(httpd_req_t* req, ty* val); \
+ void print__##ty(sockbuf_t* sockbuf, const char* attr, ty v);
+
+#define cmd_handle(ty) handle_option__##ty
+#define http_handle(ty) http_handle__##ty
+#define serialize_to_json(ty) serialize_to_json__##ty
+#define print(ty) print__##ty
+
+DECL_PARAMETER_INSTANCE(uint8_t);
+DECL_PARAMETER_INSTANCE(bool);
+DECL_PARAMETER_INSTANCE(uint32_t);
+DECL_PARAMETER_INSTANCE(color_int_t);
+DECL_PARAMETER_INSTANCE(int);