This commit is contained in:
刘可亮
2024-09-03 11:16:08 +08:00
parent cf270df8d6
commit 803cac77d5
2931 changed files with 614364 additions and 31222 deletions

View File

@@ -0,0 +1,92 @@
/**
****************************************************************************************
*
* @file asr_at_api.h
*
* @brief AT API.
*
* Copyright (C) ASR
*
****************************************************************************************
*/
#ifndef _ASR_AT_API_H_
#define _ASR_AT_API_H_
//#include "asr_uart.h"
typedef struct _cmd_entry {
char *command;
int (*function)(int, char **);
char *help;
} cmd_entry;
typedef struct {
char *command; /*at cmd string*/
int (*function)(int argc, char **argv); /*at cmd proccess function*/
} asr_at_cmd_entry;
typedef struct
{
uint8_t uart_echo; /* echo uart input info log */
uint8_t max_txpwr; /* max tx power for both sta and softap */
uint8_t flag_sap; /* flag of user set softap ip config */
uint8_t flag_sta; /* flag of user set sta ip config */
uint8_t dis_dhcp; /* disable dhcp func, use static ip */
uint8_t at_scan; /* scan flag which indicate call by at task */
uint8_t sta_connected; /* indicate status of station is connected */
uint8_t sap_opend; /* indicate status of softap is open done */
//ip_addr_t at_ping; /* save ping ip addr for at cmd */
char staip[16]; /* Local IP address on the target wlan interface for station mode, ASCII */
char stagw[16]; /* Router IP address on the target wlan interface for station mode, ASCII */
char stamask[16]; /* Netmask on the target wlan interface for station mode, ASCII */
char sapip[16]; /* Local IP address on the target wlan interface for softap mode, ASCII */
char sapgw[16]; /* Router IP address on the target wlan interface for softap mode, ASCII */
char sapmask[16]; /* Netmask on the target wlan interface for softap mode, ASCII */
char start_ip[16]; /* start ip addr of dhcp pool in softap mode */
char end_ip[16]; /* end ip addr of dhcp pool in softap mode */
}_at_user_info;
#if 0
typedef enum
{
CONFIG_OK, /* indicate at cmd set success and response OK */
PARAM_RANGE, /* indicate some at cmd param is out of range */
PARAM_MISS, /* indicate at cmd param is less than needed count */
CONFIG_FAIL, /* indicate at cmd set failed, or execute fail */
CONN_TIMEOUT, /* indicate connect timeout in station mode */
CONN_EAPOL_FAIL, /* indicate 4-way handshake failed in station mode */
CONN_DHCP_FAIL, /* indicate got ip by dhcp failed in station mode */
WAIT_PEER_RSP,
RSP_NULL=0xFF
}asr_at_rsp_status_t;
#endif
/** @brief register user at cmd.
*
* @param cmd_entry : user at cmd array pointer
* @param cmd_num : user at cmd number
*/
int asr_at_cmd_register(asr_at_cmd_entry *cmd_entry, int cmd_num);
/** @brief at init functin, user should call it before use at cmd
* @return 0 : on success.
* @return other : error occurred
*/
int asr_at_init(void);
/** @brief at deinit functin, user should call it when donot use at any more, to free resources
* @return 0 : on success.
* @return other : error occurred
*/
int asr_at_deinit(int argc, char **argv);
/** @brief at command callback function, used to register to uart.
*/
void at_handle_uartirq(char ch);
/** @brief uart handle for receiving at command.
*/
//extern asr_uart_dev_t asr_at_uart;
#endif //_ASR_AT_API_H_

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,94 @@
#ifndef _AT_HANDLE_H
#define _AT_HANDLE_H
#include "tasks_info.h"
//#define AT_USER_DEBUG
#ifdef ALIOS_SUPPORT
#define LWIP
#endif
#define UART_RXBUF_LEN 128
#define MIN_USEFUL_DEC 32
#define MAX_USEFUL_DEC 127
#define UART_CMD_NB 5
#define WIFI_RFTEST
//#define UWIFI_AT_TASK_NAME "AT_task"
//#define UWIFI_AT_TASK_PRIORITY (244)
//#define UWIFI_AT_TASK_STACK_SIZE (2048 - 256)
//#define UART_TASK_NAME "UART_task"
//#define UART_TASK_PRIORITY (19)
//#define UART_TASK_STACK_SIZE (256*6)
typedef struct uart_at_msg {
uint32_t str;
} uart_at_msg_t;
#ifdef CFG_SMART_CONFIG_NETWORK
//Multicast Control field
/*
'ASR'+4bit 0000 -- reserved
'ASR'+4bit 0001 -- start indication
'ASR'+4bit xxxx -- reserved
'ASR'+4bit 1111 -- stop indication
*/
#define MC_CNTRL_TICK 0x41535200
#define MC_CNTRL_START 0x41535210
#define MC_CNTRL_END 0x415352f0
#define MC_CNTRL_RESERVED_1 0x41535220
#define MC_CNTRL_RESERVED_2 0x41535230
#define MC_CNTRL_RESERVED_3 0x41535240
#define MC_CNTRL_RESERVED_4 0x41535250
#define MC_CNTRL_RESERVED_5 0x41535260
#define MC_CNTRL_RESERVED_6 0x41535270
#define MC_CNTRL_RESERVED_7 0x41535280
#define MC_CNTRL_RESERVED_8 0x41535290
#define MC_CNTRL_RESERVED_9 0x415352a0
#define MC_CNTRL_RESERVED_10 0x415352b0
#define MC_CNTRL_RESERVED_11 0x415352c0
#define MC_CNTRL_RESERVED_12 0x415352d0
#define MC_CNTRL_RESERVED_13 0x415352e0
#define MC_CNTRL 0x41530000
//Multicast Len field
#define MC_LN 0x4c4e0000
//Multicast Index field
#define MC_IX 0x49580000
//Multicast CheckSum filed
#define MC_CS 0x43530000
//Multicast IP field
#define MC_IP 0x49500000
typedef enum dynamic_encode_method {
INFO_ENCODE_4 = 0,//'0' ~ '0'
INFO_ENCODE_5_1,//'a' ~ 'z'
INFO_ENCODE_5_2,//'A' ~ 'Z'
INFO_ENCODE_6,//'0' ~ '0', 'a' ~ 'z', 'A' ~ 'Z'
INFO_ENCODE_7,// all visiable characters of ascii
} dynamic_encode_method_t;
#endif
#ifdef CFG_DEVICE_CONFIG_NETWORK
typedef struct device_config_network_parameter {
char ssid[32];
char password[64];
uint32_t checksum;
//uint16_t chan_no;
} device_config_network_para_t;
#define ASR_DEVICE_CONFIG_NETWORK_SSID "softap_asr"
#define ASR_DEVICE_CONFIG_NETWORK_PASSWORD "12345678"
#define ASR_DEVICE_CONFIG_NETWORK_CHAN 11
#define ASR_DEVICE_CONFIG_NETWORK_DEFAULT_PORT 12345
#endif
void uart_at_msg_send(char *cmd_str);
int convert_str_to_int(char *str);
int asr_at_wifi_ping_stop(int argc, char **argv);
#endif //_AT_HANDLE_H