Files
player/Project/Src/MyApp/at_host.h
2025-07-05 19:47:28 +08:00

74 lines
1.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef AT_HOST_H__
#define AT_HOST_H__
#include "stdint.h"
#include <stdio.h>
#define CMD_AT_MAXLEN 522
#define CMDAT_CMD_START 0xff //帧开始
#define CMDAT_CMD_END 0xfc //帧结束
#define CMDAT_CMD_GET 0xfe //上位机获取
#define CMDAT_CMD_SET 0xfd //上位机设置
#define CMDAT_CMD_RET 0xfb //模块返回
#define CMDAT_CMD_ACT 0xfa //模块主动上传
// 定义事件类型
#define CMDAT_EVENT_RECV 0x01
#define CMDAT_EVENT_USER 0x02
//初始化
int at_init(void);
//去初始化
int at_deinit(void);
//清除缓冲区
int at_clear_buff(void);
//int at_send_set(uint8_t cmd,void *par, int size);
//int at_send_get(uint8_t cmd,void *par, int size);
// 发送设置命令事件
int at_send_set_event(uint8_t cmd,void *par, int size);
// 发送获取命令事件
int at_send_get_event(uint8_t cmd,void *par, int size);
// 发送数据包
int at_send_packet(void);
int at_get_return_line(uint8_t *buff);
//解析数据帧
int at_decode_line(uint8_t *buff,int buff_len,uint8_t **obj,int *obj_size,uint8_t *op,uint8_t **par,int *par_size);
//把字符串转化为hex低字节在前
int at_string_to_hex(char *str,void *hex);
// 获取事件
int at_get_event(void);
// 发送用户事件
int at_send_user_event(uint32_t ev);
#endif