Files
kunlun/app/iot_cus_at_app/at/app_atcmd_proc.h
2024-09-28 14:24:04 +08:00

74 lines
2.6 KiB
C

/****************************************************************************
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
be copied by any method or incorporated into another program without
the express written consent of Aerospace C.Power. This Information or any portion
thereof remains the property of Aerospace C.Power. The Information contained herein
is believed to be accurate and Aerospace C.Power assumes no responsibility or
liability for its use in any way and conveys no license or title under
any patent or copyright and makes no representation or warranty that this
Information is free from patent or copyright infringement.
****************************************************************************/
#ifndef _APP_ATCMD_PROC_H_
#define _APP_ATCMD_PROC_H_
#include "app_types.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ATCMD_MAXARGS 20
#define ATCMD_QUERY_FLAG 1
void app_atcmd_printf(const char *fmt, ...);
#define AT_RESP(fmt, ...) app_atcmd_printf(fmt, ##__VA_ARGS__)
#define AT_RESP_OK() app_atcmd_printf("OK\r\n\r\n")
#define AT_RESP_ERROR() app_atcmd_printf("ERROR\r\n\r\n")
#define AT_RESP_FAIL() app_atcmd_printf("FAILED\r\n\r\n")
#define AT_RESP_EQU(cmd,fmt, ...) app_atcmd_printf("+"cmd":"fmt, ##__VA_ARGS__)
typedef enum {
AT_RET_OK = 0x00,
AT_RET_ERR = 0x01,
AT_RET_FAIL = 0x02,
AT_RET_NULL
} AT_RET;
typedef AT_RET (*at_call_back_func)(uint16_t argc, char *argv[]);
typedef struct {
char *name; /* Command Name */
uint16_t maxargs; /* Maximum Number of Arguments */
at_call_back_func test_cmd; /* AT Test Command */
at_call_back_func query_cmd; /* AT Query Command */
at_call_back_func setup_cmd; /* AT Setup Command */
at_call_back_func exe_cmd; /* AT EXE Command */
char *usage; /* Usage Message */
uint8_t is_remote; /* Is Support Remote Command */
} cmd_tbl_t;
typedef struct cmd_cb_node {
cmd_tbl_t cmd_cb;
struct cmd_cb_node *next;
} cmd_cb_node_t;
app_source_e app_atcmd_get_source(void);
uint16_t app_atcmd_get_echo(void);
void app_atcmd_set_echo(uint16_t flag);
void app_atcmd_data_parse(uint8_t *buffer, uint32_t buffer_len, app_source_e source);
void app_atcmd_data_handle (uint16_t data_id, app_source_e data_src,
uint8_t *data, uint32_t data_len, void *info);
#ifdef __cplusplus
}
#endif
#endif /* _APP_ATCMD_PROC_H_ */