diff options
Diffstat (limited to 'fw/app/src')
| -rw-r--r-- | fw/app/src/update.c | 42 | 
1 files changed, 42 insertions, 0 deletions
diff --git a/fw/app/src/update.c b/fw/app/src/update.c new file mode 100644 index 0000000..13471d2 --- /dev/null +++ b/fw/app/src/update.c @@ -0,0 +1,42 @@ +/* + * 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/. + */ + + +#include <zephyr/logging/log.h> +#include <zephyr/net/http/server.h> +#include <zephyr/net/http/service.h> + +LOG_MODULE_REGISTER(update); + + +static int update_handler( +	struct http_client_ctx *client, +	enum http_data_status status, +	const struct http_request_ctx *request_ctx, +	struct http_response_ctx *response_ctx, +	void *user_data +) { +	LOG_DBG("Handling update request"); + +	response_ctx->body = NULL; +	response_ctx->body_len = 0; +	response_ctx->final_chunk = true; +	response_ctx->status = HTTP_204_NO_CONTENT; + +	LOG_DBG("Update request handled"); +	return 0; +} + +static struct http_resource_detail_dynamic update_resource_detail = { +	.common = { +			.type = HTTP_RESOURCE_TYPE_DYNAMIC, +			.bitmask_of_supported_http_methods = BIT(HTTP_GET), +		}, +	.cb = update_handler, +	.user_data = NULL, +}; + +HTTP_RESOURCE_DEFINE(update_resource, http_service, "/update", &update_resource_detail);  | 
