Compare commits
2 commits
cd4f1433a3
...
12b2d399d6
Author | SHA1 | Date | |
---|---|---|---|
![]() |
12b2d399d6 | ||
![]() |
538a9987e0 |
2 changed files with 17 additions and 0 deletions
17
cjson/cjson.c
Normal file
17
cjson/cjson.c
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#include <cjson/cJSON.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
char *build_set_level_command(int level) {
|
||||||
|
cJSON *root = cJSON_CreateObject();
|
||||||
|
cJSON_AddStringToObject(root, "cmd", "set_level");
|
||||||
|
cJSON_AddNumberToObject(root, "level", level);
|
||||||
|
|
||||||
|
char *message = cJSON_PrintUnformatted(root);
|
||||||
|
cJSON_Delete(root);
|
||||||
|
return message; // Remember to free this when done!
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
printf("%s\n", build_set_level_command(10));
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue