forked from xuos/xiuos
adapt wifi framework and fix 'strncat' problem
This commit is contained in:
parent
c1976c8d92
commit
22e35a70aa
|
@ -17,5 +17,9 @@ ifeq ($(CONFIG_ADAPTER_ESP07S_WIFI),y)
|
||||||
SRC_DIR += esp07s_wifi
|
SRC_DIR += esp07s_wifi
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ADAPTER_ESP8285_WIFI),y)
|
||||||
|
SRC_DIR += esp8285_wifi
|
||||||
|
endif
|
||||||
|
|
||||||
include $(KERNEL_ROOT)/compiler.mk
|
include $(KERNEL_ROOT)/compiler.mk
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -8,3 +8,9 @@ if ADD_NUTTX_FETURES
|
||||||
default "/dev/ttyS1"
|
default "/dev/ttyS1"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if ADD_XIZI_FETURES
|
||||||
|
config ADAPTER_ESP8285_DRIVER
|
||||||
|
string "ESP8285 device uart driver path"
|
||||||
|
default "/dev/uart1_dev1"
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
|
@ -5,3 +5,8 @@ ifeq ($(CONFIG_ADD_NUTTX_FETURES),y)
|
||||||
include $(APPDIR)/Application.mk
|
include $(APPDIR)/Application.mk
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ADD_XIZI_FETURES),y)
|
||||||
|
SRC_FILES := esp8285_wifi.c
|
||||||
|
include $(KERNEL_ROOT)/compiler.mk
|
||||||
|
endif
|
|
@ -205,16 +205,16 @@ static int Esp8285WifiSetUp(struct Adapter *adapter)
|
||||||
PrivTaskDelay(2000);
|
PrivTaskDelay(2000);
|
||||||
/* connect the router */
|
/* connect the router */
|
||||||
memset(cmd,0,sizeof(cmd));
|
memset(cmd,0,sizeof(cmd));
|
||||||
strncpy(cmd,"AT+CWJAP=",strlen("AT+CWJAP="));
|
strcat(cmd,"AT+CWJAP=");
|
||||||
strncat(cmd,"\"",1);
|
strcat(cmd,"\"");
|
||||||
strncat(cmd,param->wifi_ssid,strlen(param->wifi_ssid));
|
strcat(cmd,param->wifi_ssid);
|
||||||
|
|
||||||
strncat(cmd,"\"",1);
|
strcat(cmd,"\"");
|
||||||
strncat(cmd,",",1);
|
strcat(cmd,",");
|
||||||
strncat(cmd,"\"",1);
|
strcat(cmd,"\"");
|
||||||
strncat(cmd,param->wifi_pwd,strlen(param->wifi_pwd));
|
strcat(cmd,param->wifi_pwd);
|
||||||
|
|
||||||
strncat(cmd,"\"",1);
|
strcat(cmd,"\"");
|
||||||
strcat(cmd,"\r\n");
|
strcat(cmd,"\r\n");
|
||||||
|
|
||||||
ret = AtCmdConfigAndCheck(agent, cmd, "OK");
|
ret = AtCmdConfigAndCheck(agent, cmd, "OK");
|
||||||
|
@ -279,17 +279,17 @@ static int Esp8285WifiSetAddr(struct Adapter *adapter, const char *ip, const cha
|
||||||
/* e.g. AT+CIPSTA_DEF="192.168.6.100","192.168.6.1","255.255.255.0" */
|
/* e.g. AT+CIPSTA_DEF="192.168.6.100","192.168.6.1","255.255.255.0" */
|
||||||
memset(cmd,0,sizeof(cmd));
|
memset(cmd,0,sizeof(cmd));
|
||||||
strncpy(cmd,"AT+CIPAP_DEF=",strlen(" AT+CIPAP_DEF="));
|
strncpy(cmd,"AT+CIPAP_DEF=",strlen(" AT+CIPAP_DEF="));
|
||||||
strncat(cmd,"\"",1);
|
strcat(cmd,"\"");
|
||||||
strncat(cmd,ip,strlen(ip));
|
strcat(cmd,ip);
|
||||||
strncat(cmd,"\"",1);
|
strcat(cmd,"\"");
|
||||||
strncat(cmd,",",1);
|
strcat(cmd,",");
|
||||||
strncat(cmd,"\"",1);
|
strcat(cmd,"\"");
|
||||||
strncat(cmd,gateway,strlen(gateway));
|
strcat(cmd,gateway);
|
||||||
strncat(cmd,"\"",1);
|
strcat(cmd,"\"");
|
||||||
strncat(cmd,",",1);
|
strcat(cmd,",");
|
||||||
strncat(cmd,"\"",1);
|
strcat(cmd,"\"");
|
||||||
strncat(cmd,netmask,strlen(netmask));
|
strcat(cmd,netmask);
|
||||||
strncat(cmd,"\"",1);
|
strcat(cmd,"\"");
|
||||||
strcat(cmd,"\r\n");
|
strcat(cmd,"\r\n");
|
||||||
|
|
||||||
ret = AtCmdConfigAndCheck(adapter->agent, cmd, "OK");
|
ret = AtCmdConfigAndCheck(adapter->agent, cmd, "OK");
|
||||||
|
@ -314,9 +314,9 @@ static int Esp8285WifiPing(struct Adapter *adapter, const char *destination)
|
||||||
|
|
||||||
memset(cmd,0,sizeof(cmd));
|
memset(cmd,0,sizeof(cmd));
|
||||||
strncpy(cmd,"AT+PING=",strlen("AT+PING="));
|
strncpy(cmd,"AT+PING=",strlen("AT+PING="));
|
||||||
strncat(cmd,"\"",1);
|
strcat(cmd,"\"");
|
||||||
strncat(cmd,destination,strlen(destination));
|
strcat(cmd,destination);
|
||||||
strncat(cmd,"\"",1);
|
strcat(cmd,"\"");
|
||||||
strcat(cmd,"\r\n");
|
strcat(cmd,"\r\n");
|
||||||
|
|
||||||
ret = AtCmdConfigAndCheck(adapter->agent, cmd, "OK"); ///< config as softAP+station mode
|
ret = AtCmdConfigAndCheck(adapter->agent, cmd, "OK"); ///< config as softAP+station mode
|
||||||
|
@ -387,15 +387,15 @@ static int Esp8285WifiConnect(struct Adapter *adapter, enum NetRoleType net_role
|
||||||
{
|
{
|
||||||
//e.g. AT+CIPSTART="TCP","192.168.3.116",8080 protocol, server IP and port
|
//e.g. AT+CIPSTART="TCP","192.168.3.116",8080 protocol, server IP and port
|
||||||
strncpy(cmd,"AT+CIPSTART=",strlen("AT+CIPSTART="));
|
strncpy(cmd,"AT+CIPSTART=",strlen("AT+CIPSTART="));
|
||||||
strncat(cmd,"\"",1);
|
strcat(cmd,"\"");
|
||||||
strncat(cmd,"TCP",strlen("TCP"));
|
strcat(cmd,"TCP");
|
||||||
strncat(cmd,"\"",1);
|
strcat(cmd,"\"");
|
||||||
strncat(cmd, ",", 1);
|
strcat(cmd, ",");
|
||||||
strncat(cmd,"\"",1);
|
strcat(cmd,"\"");
|
||||||
strncat(cmd, ip, strlen(ip));
|
strcat(cmd, ip);
|
||||||
strncat(cmd, "\"", 1);
|
strcat(cmd, "\"");
|
||||||
strncat(cmd, ",", 1);
|
strcat(cmd, ",");
|
||||||
strncat(cmd, port, strlen(port));
|
strcat(cmd, port);
|
||||||
strcat(cmd,"\r\n");
|
strcat(cmd,"\r\n");
|
||||||
|
|
||||||
ret = AtCmdConfigAndCheck(agent, cmd, "OK");
|
ret = AtCmdConfigAndCheck(agent, cmd, "OK");
|
||||||
|
@ -408,19 +408,19 @@ static int Esp8285WifiConnect(struct Adapter *adapter, enum NetRoleType net_role
|
||||||
{
|
{
|
||||||
//e.g. AT+CIPSTART="UDP","192.168.3.116",8080,2233,0 UDP protocol, server IP, port,local port,udp mode
|
//e.g. AT+CIPSTART="UDP","192.168.3.116",8080,2233,0 UDP protocol, server IP, port,local port,udp mode
|
||||||
strncpy(cmd,"AT+CIPSTART=",strlen("AT+CIPSTART="));
|
strncpy(cmd,"AT+CIPSTART=",strlen("AT+CIPSTART="));
|
||||||
strncat(cmd,"\"",1);
|
strcat(cmd,"\"");
|
||||||
strncat(cmd,"UDP",strlen("UDP"));
|
strcat(cmd,"UDP");
|
||||||
strncat(cmd,"\"",1);
|
strcat(cmd,"\"");
|
||||||
strncat(cmd, ",", 1);
|
strcat(cmd, ",");
|
||||||
strncat(cmd,"\"",1);
|
strcat(cmd,"\"");
|
||||||
strncat(cmd, ip, strlen(ip));
|
strcat(cmd, ip);
|
||||||
strncat(cmd, "\"", 1);
|
strcat(cmd, "\"");
|
||||||
strncat(cmd, ",", 1);
|
strcat(cmd, ",");
|
||||||
strncat(cmd, port, strlen(port));
|
strcat(cmd, port);
|
||||||
strncat(cmd, ",", 1);
|
strcat(cmd, ",");
|
||||||
strncat(cmd, "2233", strlen("2233")); ///< local port
|
strcat(cmd, "2233"); ///< local port
|
||||||
strncat(cmd, ",", 1);
|
strcat(cmd, ",");
|
||||||
strncat(cmd, "0", 1); ///< udp transparent transmission mode must be 0
|
strcat(cmd, "0"); ///< udp transparent transmission mode must be 0
|
||||||
strcat(cmd,"\r\n");
|
strcat(cmd,"\r\n");
|
||||||
|
|
||||||
ret = AtCmdConfigAndCheck(agent, cmd, "OK");
|
ret = AtCmdConfigAndCheck(agent, cmd, "OK");
|
||||||
|
@ -523,15 +523,15 @@ static int Esp8285WifiIoctl(struct Adapter *adapter, int cmd, void *args)
|
||||||
itoa(baud_rate, baud_str, 10);
|
itoa(baud_rate, baud_str, 10);
|
||||||
|
|
||||||
strncpy(at_cmd, "AT+UART_DEF=", strlen("AT+UART_DEF="));
|
strncpy(at_cmd, "AT+UART_DEF=", strlen("AT+UART_DEF="));
|
||||||
strncat(at_cmd, baud_str, strlen(baud_str));
|
strcat(at_cmd, baud_str);
|
||||||
strncat(at_cmd, ",", 1);
|
strcat(at_cmd, ",");
|
||||||
strncat(at_cmd, "8", 1);
|
strcat(at_cmd, "8");
|
||||||
strncat(at_cmd, ",", 1);
|
strcat(at_cmd, ",");
|
||||||
strncat(at_cmd, "1", 1);
|
strcat(at_cmd, "1");
|
||||||
strncat(at_cmd, ",", 1);
|
strcat(at_cmd, ",");
|
||||||
strncat(at_cmd, "0", 1);
|
strcat(at_cmd, "0");
|
||||||
strncat(at_cmd, ",", 1);
|
strcat(at_cmd, ",");
|
||||||
strncat(at_cmd, "3", 1);
|
strcat(at_cmd, "3");
|
||||||
strcat(at_cmd,"\r\n");
|
strcat(at_cmd,"\r\n");
|
||||||
|
|
||||||
ret = AtCmdConfigAndCheck(adapter->agent, at_cmd, "OK");
|
ret = AtCmdConfigAndCheck(adapter->agent, at_cmd, "OK");
|
||||||
|
|
|
@ -65,57 +65,3 @@ ifeq ($(CONFIG_ADD_XIZI_FETURES),y)
|
||||||
|
|
||||||
include $(KERNEL_ROOT)/compiler.mk
|
include $(KERNEL_ROOT)/compiler.mk
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ADD_XIZI_FETURES),y)
|
|
||||||
SRC_FILES := sensor.c
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_SENSOR_HCHO),y)
|
|
||||||
SRC_DIR += hcho
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_SENSOR_TVOC),y)
|
|
||||||
SRC_DIR += tvoc
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_SENSOR_IAQ),y)
|
|
||||||
SRC_DIR += iaq
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_SENSOR_CH4),y)
|
|
||||||
SRC_DIR += ch4
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_SENSOR_CO2),y)
|
|
||||||
SRC_DIR += co2
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_SENSOR_PM),y)
|
|
||||||
SRC_DIR += pm
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_SENSOR_VOICE),y)
|
|
||||||
SRC_DIR += voice
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_SENSOR_TEMPERATURE),y)
|
|
||||||
SRC_DIR += temperature
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_SENSOR_HUMIDITY),y)
|
|
||||||
SRC_DIR += humidity
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_SENSOR_WINDSPEED),y)
|
|
||||||
SRC_DIR += windspeed
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_SENSOR_WINDDIRECTION),y)
|
|
||||||
SRC_DIR += winddirection
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_SENSOR_ALTITUDE),y)
|
|
||||||
SRC_DIR += altitude
|
|
||||||
endif
|
|
||||||
|
|
||||||
include $(KERNEL_ROOT)/compiler.mk
|
|
||||||
endif
|
|
Loading…
Reference in New Issue