1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Changes on WiFi API after review. Add driver utility implementation

This commit is contained in:
mlafauci
2011-03-08 22:13:54 +01:00
parent 9d60bbb0dc
commit 765e848fdb
22 changed files with 1904 additions and 350 deletions

View File

@ -4,9 +4,7 @@
#include <inttypes.h>
extern "C" {
#include "utility/wl_types.h"
#include "utility/wifi_spi.h"
#include "utility/debug.h" // only for test, not released
#include "utility/wl_definitions.h"
}
#include "IPAddress.h"
@ -18,39 +16,39 @@ class WiFiClass
private:
// this data are stored in EEPROM and loaded at begin
// The next connect overwrite these values
static char _ssid[WL_SSID_MAX_LENGTH];
static uint8_t _ssid_len;
static char _key[WL_WEP_KEY_MAX_LENGTH];
static uint8_t _key_len;
static char _passph[WL_WPA_KEY_MAX_LENGTH];
static uint8_t _passph_len;
static char _ssid[WL_SSID_MAX_LENGTH];
static char _key[WL_WEP_KEY_MAX_LENGTH];
static char _passph[WL_WPA_KEY_MAX_LENGTH];
static wl_status_t _status;
void init();
public:
static int16_t _state[MAX_SOCK_NUM];
static int16_t _state[MAX_SOCK_NUM];
static uint16_t _server_port[MAX_SOCK_NUM];
WiFiClass();
// Get thefirst socket available
static uint8_t getSocket();
// Start Wifi connection with latest settings
int begin();
// Start Wifi connection with no encryption
int begin(char* ssid, uint8_t ssid_len);
int begin(char* ssid);
// Start Wifi connection with WEP encryption
int begin(char* ssid, uint8_t ssid_len, uint8_t key_idx, const char* key, const uint8_t key_len);
int begin(char* ssid, uint8_t key_idx, const char* key);
// Start Wifi connection with passphrase
// the most secure supported mode will be automatically selected
int begin(char* ssid, uint8_t ssid_len, const char *passphrase, const uint8_t len);
int begin(char* ssid, const char *passphrase);
// Disconnect from the network
int disconnect(void);
//Get the interface MAC address.
uint8_t* macAddress();
uint8_t* macAddress(uint8_t* mac);
//Get the DHCP information related to IP
IPAddress localIp();
@ -65,19 +63,25 @@ public:
char* SSID();
// Return the current BSSID associated with the network
uint8_t* BSSID();
// Start scan SSIDs available and return the number of SSID discovered
uint8_t scanSSID();
// Return SSID item available
char* SSIDListItem(uint8_t ssidListItem);
// Return the current Encryption Type associated with the network
uint8_t encType(uint8_t ssidListItem);
uint8_t* BSSID(uint8_t* bssid);
// Return the current RSSI /Received Signal Strength in dBm) associated with the network
int32_t RSSI(uint8_t ssidListItem);
int32_t RSSI();
// Return the Encryption Type associated with the network
uint8_t encryptionType();
// Start scan WiFi networks available and return the discovered number
uint8_t scanNetworks();
// Return SSID item associated with the network identified with networkItem
char* SSID(uint8_t networkItem);
// Return the Encryption Type associated with the network identified with networkItem
uint8_t encryptionType(uint8_t networkItem);
// Return the current RSSI /Received Signal Strength in dBm) associated with the network identified with networkItem
int32_t RSSI(uint8_t networkItem);
friend class Client;
friend class Server;