Files
AI_Printer/components/control_plane/internal/rest_server_internal.h
2026-02-27 16:39:54 +08:00

64 lines
3.1 KiB
C

#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "cJSON.h"
#include "esp_err.h"
#include "esp_http_server.h"
bool rest_server_auth_ok(httpd_req_t *req);
esp_err_t rest_server_send_json(httpd_req_t *req, const char *status, cJSON *root);
esp_err_t rest_server_send_error(httpd_req_t *req, const char *status, const char *message);
esp_err_t rest_server_read_body(httpd_req_t *req, char **out_body);
bool rest_server_parse_uri_u32_tail(const char *uri, uint32_t *out_value);
esp_err_t rest_server_base64_decode_alloc(const char *b64, uint8_t **out_raw, size_t *out_len);
void rest_server_appendf(char *dst, size_t cap, size_t *offset, const char *fmt, ...);
bool rest_server_json_bool_with_default(cJSON *item, bool default_value);
esp_err_t rest_server_print_submit_raster_job_and_reply(httpd_req_t *req,
const uint8_t *raw,
size_t raw_len,
uint16_t width,
uint16_t height,
const char *density,
bool direct_ignore_precheck,
const char *warning,
const char *trace_id);
esp_err_t rest_server_health_get(httpd_req_t *req);
esp_err_t rest_server_connect_post(httpd_req_t *req);
esp_err_t rest_server_disconnect_post(httpd_req_t *req);
esp_err_t rest_server_status_get(httpd_req_t *req);
esp_err_t rest_server_printer_direct_debug_get(httpd_req_t *req);
esp_err_t rest_server_printer_direct_debug_post(httpd_req_t *req);
esp_err_t rest_server_print_raster_post(httpd_req_t *req);
esp_err_t rest_server_print_image_post(httpd_req_t *req);
esp_err_t rest_server_print_qr_post(httpd_req_t *req);
esp_err_t rest_server_print_label_post(httpd_req_t *req);
esp_err_t rest_server_print_text_post(httpd_req_t *req);
esp_err_t rest_server_print_receipt_post(httpd_req_t *req);
esp_err_t rest_server_job_get(httpd_req_t *req);
esp_err_t rest_server_jobs_get(httpd_req_t *req);
esp_err_t rest_server_job_delete(httpd_req_t *req);
esp_err_t rest_server_jobs_delete(httpd_req_t *req);
esp_err_t rest_server_label_gap_move_post(httpd_req_t *req);
esp_err_t rest_server_label_offset_get(httpd_req_t *req);
esp_err_t rest_server_label_offset_post(httpd_req_t *req);
esp_err_t rest_server_ota_version_get(httpd_req_t *req);
esp_err_t rest_server_ota_jump_boot_post(httpd_req_t *req);
esp_err_t rest_server_ota_jump_app_post(httpd_req_t *req);
esp_err_t rest_server_ota_erase_page_post(httpd_req_t *req);
esp_err_t rest_server_ota_write_frame_post(httpd_req_t *req);
esp_err_t rest_server_ota_upgrade_post(httpd_req_t *req);
esp_err_t rest_server_voice_status_get(httpd_req_t *req);
esp_err_t rest_server_voice_session_start_post(httpd_req_t *req);
esp_err_t rest_server_voice_session_stop_post(httpd_req_t *req);
esp_err_t rest_server_voice_tap_start_post(httpd_req_t *req);
esp_err_t rest_server_voice_tap_cancel_post(httpd_req_t *req);