grblHAL core  20251012
stream_json.h
Go to the documentation of this file.
1 /*
2  stream_json.h - stream data to file as json structure
3 
4  Part of grblHAL
5 
6  Copyright (c) 2025 Terje Io
7 
8  grblHAL is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  grblHAL is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with grblHAL. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #include <stdlib.h>
23 #include <stdbool.h>
24 
25 struct json_out; // members defined in stream_json.c
26 typedef struct json_out json_out_t;
27 
28 json_out_t *json_start (vfs_file_t *file, uint32_t max_levels);
29 bool json_end (json_out_t *json);
30 bool json_start_object (json_out_t *json);
31 bool json_start_tagged_object (json_out_t *json, const char *tag);
32 bool json_end_object (json_out_t *json);
33 bool json_start_array (json_out_t *json, const char *tag);
34 bool json_end_array (json_out_t *json);
35 bool json_add_string (json_out_t *json, const char *tag, const char *s);
36 bool json_add_int (json_out_t *json, const char *tag, int32_t value);
bool json_start_tagged_object(json_out_t *json, const char *tag)
Definition: stream_json.c:93
bool json_start_object(json_out_t *json)
Definition: stream_json.c:78
bool json_start_array(json_out_t *json, const char *tag)
Definition: stream_json.c:114
json_out_t * json_start(vfs_file_t *file, uint32_t max_levels)
Definition: stream_json.c:35
bool json_end_object(json_out_t *json)
Definition: stream_json.c:104
bool json_add_string(json_out_t *json, const char *tag, const char *s)
Definition: stream_json.c:135
bool json_end_array(json_out_t *json)
Definition: stream_json.c:125
bool json_end(json_out_t *json)
Definition: stream_json.c:48
bool json_add_int(json_out_t *json, const char *tag, int32_t value)
Definition: stream_json.c:225
Definition: stream_json.c:28
vfs_file_t * file
Definition: stream_json.c:29
Definition: vfs.h:81