29 lines
		
	
	
		
			940 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			940 B
		
	
	
	
		
			C
		
	
	
	
	
	
#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
 |