#pragma once #include #include "sockbuf.h" typedef struct httpd_req httpd_req_t; typedef uint32_t color_int_t; typedef uint8_t fraction_t; typedef uint16_t ratio_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(fraction_t); DECL_PARAMETER_INSTANCE(ratio_t); DECL_PARAMETER_INSTANCE(int); DECL_PARAMETER_INSTANCE(int32_t);