mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-07 01:54:26 +01:00
Updated header file
This commit is contained in:
parent
7f3e8a6c5b
commit
58fb458101
80
WiFi/WiFi.h
80
WiFi/WiFi.h
@ -15,81 +15,91 @@ extern "C" {
|
|||||||
// location in EEPROM to store key information
|
// location in EEPROM to store key information
|
||||||
#define EE_WIFI_DATA_ADDR 0x10
|
#define EE_WIFI_DATA_ADDR 0x10
|
||||||
#define EE_WIFI_SSID_LEN EE_WIFI_DATA_ADDR
|
#define EE_WIFI_SSID_LEN EE_WIFI_DATA_ADDR
|
||||||
#define EE_WIFI_KEY_LEN EE_WIFI_DATA_ADDR + 1
|
#define EE_WIFI_ENC_TYPE EE_WIFI_SSID_LEN + 1
|
||||||
#define EE_WIFI_PASSPH_LEN EE_WIFI_DATA_ADDR + 2
|
#define EE_WIFI_KEY_LEN EE_WIFI_ENC_TYPE + 1
|
||||||
#define EE_WIFI_SSID_DATA EE_WIFI_DATA_ADDR + 3
|
#define EE_WIFI_SSID_DATA EE_WIFI_KEY_LEN + 1
|
||||||
#define EE_WIFI_KEY_DATA EE_WIFI_DATA_ADDR + 4
|
#define EE_WIFI_KEY_DATA EE_WIFI_SSID_DATA + WL_SSID_MAX_LENGTH
|
||||||
#define EE_WIFI_PASSPH_DATA EE_WIFI_DATA_ADDR + 4
|
#define EE_WIFI_END_DATA EE_WIFI_KEY_DATA + WL_KEY_MAX_LENGTH
|
||||||
// Note: Or KEY or PASSPH can be defined.
|
|
||||||
// The selection is made by the len not equal to zero
|
// Wifi Encryption selection type
|
||||||
|
#define WIFI_ENC_NONE 0
|
||||||
|
#define WIFI_ENC_WEP 1
|
||||||
|
#define WIFI_ENC_WPA 2
|
||||||
|
|
||||||
|
|
||||||
class WiFiClass
|
class WiFiClass
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// this data are stored in EEPROM and loaded at begin
|
// this data are stored in EEPROM and loaded at begin
|
||||||
// The next connect overwrite these values
|
// The next connect overwrite these values
|
||||||
static char ssid[WL_SSID_MAX_LENGTH];
|
static char _ssid[WL_SSID_MAX_LENGTH];
|
||||||
static uint8_t ssid_len;
|
static uint8_t _ssid_len;
|
||||||
static char key[13];
|
static char _key[WL_WEP_KEY_MAX_LENGTH];
|
||||||
static uint8_t key_len;
|
static uint8_t _key_len;
|
||||||
static char passph[63];
|
static char _passph[WL_WPA_KEY_MAX_LENGTH];
|
||||||
static uint8_t passph_len;
|
static uint8_t _passph_len;
|
||||||
static wl_status_t status;
|
static wl_status_t _status;
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
public:
|
public:
|
||||||
//static wl_state_t _wl_state[MAX_SOCK_NUM];
|
|
||||||
static int16_t _state[MAX_SOCK_NUM];
|
static int16_t _state[MAX_SOCK_NUM];
|
||||||
static uint16_t _server_port[MAX_SOCK_NUM];
|
static uint16_t _server_port[MAX_SOCK_NUM];
|
||||||
|
|
||||||
WiFiClass();
|
WiFiClass();
|
||||||
|
|
||||||
// Start Wifi connection with data stored in EEPROM
|
// Start Wifi connection
|
||||||
void begin();
|
void begin();
|
||||||
|
|
||||||
// Start Wifi connection without WEP or WPA
|
// Set SSID name
|
||||||
void begin(char* ssid, uint8_t ssid_len);
|
void setSSID(char* ssid);
|
||||||
|
|
||||||
// Start Wifi connection with WEP
|
// Set the encryption type: WPA, WEP or NONE
|
||||||
void begink(char* ssid, uint8_t ssid_len, uint8_t key_idx, const void *key, const uint8_t key_len);
|
void setEncryption(uint8_t encType);
|
||||||
|
|
||||||
// Start Wifi connection with WPA
|
// Set the key used for the encryption
|
||||||
void beginp(char* ssid, uint8_t ssid_len, const char *passphrase, const uint8_t len);
|
void setPassword(const char *key, const uint8_t keyLen, uint8_t keyIndex);
|
||||||
|
|
||||||
//getSock get the first socket available
|
//getSock get the first socket available
|
||||||
static uint8_t getSocket();
|
static uint8_t getSocket();
|
||||||
|
|
||||||
// verify the completion of the scan command
|
// verify the completion of the scan command
|
||||||
wl_status_t get_status();
|
wl_status_t getScanCmdStatus();
|
||||||
|
|
||||||
// get the result of the last operation
|
// get the result of the last operation
|
||||||
uint8_t get_result(uint8_t dummy = 0);
|
uint8_t getResult(uint8_t dummy = 0);
|
||||||
|
|
||||||
// Disconnect from the network
|
// Disconnect from the network
|
||||||
uint8_t disconnect(void);
|
uint8_t disconnect(void);
|
||||||
|
|
||||||
//Get the interface MAC address.
|
//Get the interface MAC address.
|
||||||
uint8_t getMacAddr(uint8_t* mac);
|
uint8_t* getMacAddr();
|
||||||
|
|
||||||
//Get the DHCP infortion related to IP, netmas, gateway
|
//Get the DHCP information related to IP
|
||||||
void getIpAddr(uint8_t *ip, uint8_t *mask, uint8_t *gwip);
|
uint8_t* getIpAddr();
|
||||||
|
|
||||||
// Get the list of currently known networks.
|
//Get the DHCP information related to IP
|
||||||
wl_error_code_t wl_get_network_list(struct wl_network_t** network_list, uint8_t* network_cnt);
|
uint8_t* getNetMask();
|
||||||
|
|
||||||
// Return a list of all SSID available
|
//Get the DHCP information related to IP
|
||||||
void getSSIDList(char** ssid_list, uint8_t* ssidListNum);
|
uint8_t* getGatewayIp();
|
||||||
|
|
||||||
|
// Return SSID item available
|
||||||
|
char* getSSIDListItem(uint8_t ssidListItem);
|
||||||
|
|
||||||
|
// Return the number of SSID discovered
|
||||||
|
uint8_t getSSIDListNum();
|
||||||
|
|
||||||
// Return the current SSID associated with the network
|
// Return the current SSID associated with the network
|
||||||
void getCurrSSID(char* ssid);
|
char* getSSID();
|
||||||
|
|
||||||
// Return the current BSSID associated with the network
|
// Return the current BSSID associated with the network
|
||||||
void getCurrBSSID(uint8_t* bssid);
|
uint8_t* getBSSID();
|
||||||
|
|
||||||
// Return the current RSSI associated with the network
|
// Return the current RSSI associated with the network
|
||||||
void getCurrRSSI(int32_t* rssi);
|
int32_t getRSSI();
|
||||||
|
|
||||||
// Return the current Encryption Type associated with the network
|
// Return the current Encryption Type associated with the network
|
||||||
void getCurrEncType(uint8_t* enc_type);
|
uint8_t getCurrEncType();
|
||||||
|
|
||||||
friend class Client;
|
friend class Client;
|
||||||
friend class Server;
|
friend class Server;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user