esp8266 update cosmetic and many bug fix

This commit is contained in:
Pierre-Noel Bouteville 2016-12-04 08:35:02 -06:00 committed by Gregory Nutt
parent 85eea42ff6
commit b3c90a4484
3 changed files with 1714 additions and 392 deletions

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* apps/include/netutils/esp8266.h * apps/include/netutils/esp8266.h
* *
* Copyright (C) 2015 Pierre-Noel Bouteville. All rights reserved. * Copyright (C) 2015-2016 Pierre-Noel Bouteville. All rights reserved.
* Author: Pierre-Noel Bouteville <pnb990@gmail.com> * Author: Pierre-Noel Bouteville <pnb990@gmail.com>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -50,6 +50,7 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#define lespSSID_SIZE 32 /* Number of character max of SSID (null char not included) */
#define lespBSSID_SIZE 6 #define lespBSSID_SIZE 6
#define lespIP(x1,x2,x3,x4) ((x1) << 24 | (x2) << 16 | (x3) << 8 | (x4) << 0) #define lespIP(x1,x2,x3,x4) ((x1) << 24 | (x2) << 16 | (x3) << 8 | (x4) << 0)
@ -67,7 +68,7 @@ typedef enum
typedef enum typedef enum
{ {
lesp_eSECURITY_NONE=0, lesp_eSECURITY_NONE = 0,
lesp_eSECURITY_WEP, lesp_eSECURITY_WEP,
lesp_eSECURITY_WPA_PSK, lesp_eSECURITY_WPA_PSK,
lesp_eSECURITY_WPA2_PSK, lesp_eSECURITY_WPA2_PSK,
@ -78,9 +79,10 @@ typedef enum
typedef struct typedef struct
{ {
lesp_security_t security; lesp_security_t security;
const char *ssid; char ssid[lespSSID_SIZE+1]; /* +1 for null char */
uint8_t bssid[lespBSSID_SIZE]; uint8_t bssid[lespBSSID_SIZE];
int rssi; int rssi;
int channel;
} lesp_ap_t; } lesp_ap_t;
/**************************************************************************** /****************************************************************************
@ -92,18 +94,19 @@ int lesp_soft_reset(void);
const char *lesp_security_to_str(lesp_security_t security); const char *lesp_security_to_str(lesp_security_t security);
int lesp_ap_connect(const char* ssid_name, const char* ap_key, int timeout_s); int lesp_ap_connect(const char *ssid_name, const char *ap_key, int timeout_s);
int lesp_ap_get(lesp_ap_t *ap);
int lesp_ap_is_connected(void); int lesp_ap_is_connected(void);
int lesp_set_dhcp(lesp_mode_t mode,bool enable); int lesp_set_dhcp(lesp_mode_t mode, bool enable);
int lesp_set_net(lesp_mode_t mode, int lesp_get_dhcp(bool *ap_enable, bool *sta_enable);
in_addr_t ip, int lesp_set_net(lesp_mode_t mode, in_addr_t ip, in_addr_t mask,
in_addr_t mask, in_addr_t gateway);
in_addr_t gateway int lesp_get_net(lesp_mode_t mode, in_addr_t *ip, in_addr_t *mask,
); in_addr_t *gw);
typedef void (*lesp_cb_t)(lesp_ap_t* wlan); typedef void (*lesp_cb_t)(lesp_ap_t *wlan);
int lesp_list_access_points(lesp_cb_t cb); int lesp_list_access_points(lesp_cb_t cb);
@ -117,6 +120,7 @@ ssize_t lesp_send(int sockfd, FAR const uint8_t *buf, size_t len, int flags);
ssize_t lesp_recv(int sockfd, FAR uint8_t *buf, size_t len, int flags); ssize_t lesp_recv(int sockfd, FAR uint8_t *buf, size_t len, int flags);
int lesp_setsockopt(int sockfd, int level, int option, int lesp_setsockopt(int sockfd, int level, int option,
FAR const void *value, socklen_t value_len); FAR const void *value, socklen_t value_len);
FAR struct hostent *lesp_gethostbyname(FAR const char *hostname);
#endif /* CONFIG_NETUTILS_ESP8266 */ #endif /* CONFIG_NETUTILS_ESP8266 */
#endif /* __APPS_INCLUDE_NETUTILS_ESP8266_H */ #endif /* __APPS_INCLUDE_NETUTILS_ESP8266_H */

View File

@ -28,6 +28,10 @@ config NETUTILS_ESP8266_MAXRXLEN
int "Max. RX length" int "Max. RX length"
default 256 default 256
config NETUTILS_ESP8266_WORKER_BUF_LEN
int "Max. Worker RX length"
default 256
config NETUTILS_ESP8266_THREADPRIO config NETUTILS_ESP8266_THREADPRIO
int "Worker thread priority" int "Worker thread priority"
default 100 default 100

File diff suppressed because it is too large Load Diff