1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-30 19:52:13 +01:00

Updated header file

This commit is contained in:
Mimmo 2011-03-01 19:38:14 +01:00
parent 7f3e8a6c5b
commit 58fb458101

View File

@ -15,81 +15,91 @@ extern "C" {
// location in EEPROM to store key information
#define EE_WIFI_DATA_ADDR 0x10
#define EE_WIFI_SSID_LEN EE_WIFI_DATA_ADDR
#define EE_WIFI_KEY_LEN EE_WIFI_DATA_ADDR + 1
#define EE_WIFI_PASSPH_LEN EE_WIFI_DATA_ADDR + 2
#define EE_WIFI_SSID_DATA EE_WIFI_DATA_ADDR + 3
#define EE_WIFI_KEY_DATA EE_WIFI_DATA_ADDR + 4
#define EE_WIFI_PASSPH_DATA EE_WIFI_DATA_ADDR + 4
// Note: Or KEY or PASSPH can be defined.
// The selection is made by the len not equal to zero
#define EE_WIFI_ENC_TYPE EE_WIFI_SSID_LEN + 1
#define EE_WIFI_KEY_LEN EE_WIFI_ENC_TYPE + 1
#define EE_WIFI_SSID_DATA EE_WIFI_KEY_LEN + 1
#define EE_WIFI_KEY_DATA EE_WIFI_SSID_DATA + WL_SSID_MAX_LENGTH
#define EE_WIFI_END_DATA EE_WIFI_KEY_DATA + WL_KEY_MAX_LENGTH
// Wifi Encryption selection type
#define WIFI_ENC_NONE 0
#define WIFI_ENC_WEP 1
#define WIFI_ENC_WPA 2
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[13];
static uint8_t key_len;
static char passph[63];
static uint8_t passph_len;
static wl_status_t status;
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 wl_status_t _status;
void init();
public:
//static wl_state_t _wl_state[MAX_SOCK_NUM];
static int16_t _state[MAX_SOCK_NUM];
static uint16_t _server_port[MAX_SOCK_NUM];
WiFiClass();
// Start Wifi connection with data stored in EEPROM
// Start Wifi connection
void begin();
// Start Wifi connection without WEP or WPA
void begin(char* ssid, uint8_t ssid_len);
// Set SSID name
void setSSID(char* ssid);
// Start Wifi connection with WEP
void begink(char* ssid, uint8_t ssid_len, uint8_t key_idx, const void *key, const uint8_t key_len);
// Set the encryption type: WPA, WEP or NONE
void setEncryption(uint8_t encType);
// Start Wifi connection with WPA
void beginp(char* ssid, uint8_t ssid_len, const char *passphrase, const uint8_t len);
// Set the key used for the encryption
void setPassword(const char *key, const uint8_t keyLen, uint8_t keyIndex);
//getSock get the first socket available
static uint8_t getSocket();
// verify the completion of the scan command
wl_status_t get_status();
wl_status_t getScanCmdStatus();
// 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
uint8_t disconnect(void);
//Get the interface MAC address.
uint8_t getMacAddr(uint8_t* mac);
uint8_t* getMacAddr();
//Get the DHCP infortion related to IP, netmas, gateway
void getIpAddr(uint8_t *ip, uint8_t *mask, uint8_t *gwip);
//Get the DHCP information related to IP
uint8_t* getIpAddr();
// Get the list of currently known networks.
wl_error_code_t wl_get_network_list(struct wl_network_t** network_list, uint8_t* network_cnt);
//Get the DHCP information related to IP
uint8_t* getNetMask();
// Return a list of all SSID available
void getSSIDList(char** ssid_list, uint8_t* ssidListNum);
//Get the DHCP information related to IP
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
void getCurrSSID(char* ssid);
char* getSSID();
// Return the current BSSID associated with the network
void getCurrBSSID(uint8_t* bssid);
uint8_t* getBSSID();
// 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
void getCurrEncType(uint8_t* enc_type);
uint8_t getCurrEncType();
friend class Client;
friend class Server;