hi3861软件

This commit is contained in:
2025-10-18 16:05:39 +08:00
parent 3d7a4dcb4d
commit 30edbda7de
36 changed files with 1888 additions and 1785 deletions

29
json_parser.h Normal file
View File

@@ -0,0 +1,29 @@
#ifndef JSON_PARSER_H
#define JSON_PARSER_H
#include <stdint.h>
// 定义命令类型
#define CMD_ROTATE_DISPLAY_CLEAR 1 // 顺时针90°+显示字符串+10秒后逆时针90°+清屏
#define CMD_ROTATE_CLOCKWISE 2 // 顺时针90°
#define CMD_ROTATE_COUNTER 3 // 逆时针90°
#define CMD_DISPLAY_ONLY 4 // 只显示字符串,舵机不动
// 定义最大字符串长度
#define MAX_TEXT_LENGTH 64
// JSON命令结构体
typedef struct {
int cmd; // 命令类型
char text[MAX_TEXT_LENGTH]; // 显示文本
} JsonCommand;
// 函数声明
int ParseJsonCommand(const char* json_str, JsonCommand* command);
// 创建IP地址消息格式: {"type":"ip","address":"192.168.1.100"}
int CreateIpMessage(char* buffer, int buffer_size, const char* ip_address);
// 查找中文字符在fonts3数组中的索引
int FindChineseCharIndex(const char* utf8_char);
#endif // JSON_PARSER_H