NNN50 WIFI_API library

Dependents:   NNN50_CE_Test_UDP NNN50_linux_firmware NNN50_SoftAP_HelloWorld NNN50_BLEWIFISensor ... more

This is mbed compatible EthernetInterface lib exclude for Delta DFCM-NNN50 platform.

Additional information and examples can be found in mbed Handbook

Committer:
tsungta
Date:
Wed Nov 23 17:36:49 2016 +0000
Revision:
0:06fccc63b33d
Child:
1:be6abb24f013
20:7c3d78d; alpha release for NNN50; SoftAP mode is not yet supported.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tsungta 0:06fccc63b33d 1 #ifndef WIFIDEVICE_H_
tsungta 0:06fccc63b33d 2 #define WIFIDEVICE_H_
tsungta 0:06fccc63b33d 3
tsungta 0:06fccc63b33d 4 /** Interface using WI-FI to connect to Ethernet
tsungta 0:06fccc63b33d 5 *
tsungta 0:06fccc63b33d 6 */
tsungta 0:06fccc63b33d 7
tsungta 0:06fccc63b33d 8 #include "mbed.h"
tsungta 0:06fccc63b33d 9 #include "EthernetInterface.h"
tsungta 0:06fccc63b33d 10
tsungta 0:06fccc63b33d 11 class WIFIDevice {
tsungta 0:06fccc63b33d 12 public:
tsungta 0:06fccc63b33d 13
tsungta 0:06fccc63b33d 14 /** Set WIFI in sleep mode.
tsungta 0:06fccc63b33d 15 * Disable WIFI and set into sleep mode to conserve energy (no WIFI function is available at this point).
tsungta 0:06fccc63b33d 16 * \return 0 on success, a negative number on failure
tsungta 0:06fccc63b33d 17 */
tsungta 0:06fccc63b33d 18 int sleep(void);
tsungta 0:06fccc63b33d 19
tsungta 0:06fccc63b33d 20 /** Check if the device is connected to Access Point
tsungta 0:06fccc63b33d 21 * \return 1 if connected, 0 otherwise.
tsungta 0:06fccc63b33d 22 */
tsungta 0:06fccc63b33d 23 int is_AP_connected(void);
tsungta 0:06fccc63b33d 24
tsungta 0:06fccc63b33d 25 /** Perform WIFI scan.
tsungta 0:06fccc63b33d 26 * Scan for available access point on all channels.
tsungta 0:06fccc63b33d 27 * \return number of scanned WIFI access point
tsungta 0:06fccc63b33d 28 */
tsungta 0:06fccc63b33d 29 int apScan(void (*eventCallback)(tstrM2mWifiscanResult result));
tsungta 0:06fccc63b33d 30
tsungta 0:06fccc63b33d 31 /** Set network connection in priority.
tsungta 0:06fccc63b33d 32 * Set SSID, password and priority to connect.
tsungta 0:06fccc63b33d 33 * \param secType type of securith support in STA mode, support
tsungta 0:06fccc63b33d 34 M2M_WIFI_SEC_OPEN < Open security >
tsungta 0:06fccc63b33d 35 M2M_WIFI_SEC_WPA_PSK < Wi-Fi network is secured with WPA/WPA2 personal(PSK) >
tsungta 0:06fccc63b33d 36 M2M_WIFI_SEC_WEP < Security type WEP (40 or 104) OPEN OR SHARED >
tsungta 0:06fccc63b33d 37 M2M_WIFI_SEC_802_1X < Wi-Fi network is secured with WPA/WPA2 Enterprise.IEEE802.1x user-name/password authentication >
tsungta 0:06fccc63b33d 38 * \param SSID name of access point to connect
tsungta 0:06fccc63b33d 39 * \param PW password of the given SSID
tsungta 0:06fccc63b33d 40 */
tsungta 0:06fccc63b33d 41 void setNetwork(uint8_t secType, char* SSID, char* PW);
tsungta 0:06fccc63b33d 42
tsungta 0:06fccc63b33d 43 /** Set Access Point in given configuration.
tsungta 0:06fccc63b33d 44 * Set SSID, password, security type and channel in AP mode.
tsungta 0:06fccc63b33d 45 * \param SSID name of access point in AP mode
tsungta 0:06fccc63b33d 46 * \param PW password of the given SSID
tsungta 0:06fccc63b33d 47 * \param security tyoe of security in AP mode (default: (SECURITY_WPA2_AES_PSK)), support
tsungta 0:06fccc63b33d 48 SECURITY_OPEN < Open security >
tsungta 0:06fccc63b33d 49 SECURITY_WEP_PSK < WEP Security with open authentication with 5/13 ascii characters or 10/26 hex codes passwords
tsungta 0:06fccc63b33d 50 SECURITY_WEP_SHARED < WEP Security with shared authentication with 5/13 ascii characters or 10/26 hex codes passwords
tsungta 0:06fccc63b33d 51 SECURITY_WPA_TKIP_PSK < WPA Security with TKIP with 8 or more ascii characters passwords
tsungta 0:06fccc63b33d 52 SECURITY_WPA_AES_PSK < WPA Security with AES with 8 or more ascii characters passwords
tsungta 0:06fccc63b33d 53 SECURITY_WPA2_AES_PSK < WPA2 Security with AES with 8 or more ascii characters passwords
tsungta 0:06fccc63b33d 54 SECURITY_WPA2_TKIP_PSK < WPA2 Security with TKIP with 8 or more ascii characters passwords
tsungta 0:06fccc63b33d 55 SECURITY_WPA2_MIXED_PSK< WPA2 Security with AES & TKIP with 8 or more ascii characters passwords
tsungta 0:06fccc63b33d 56 * \param channel range from 1 to 14 (default: (1))
tsungta 0:06fccc63b33d 57 */
tsungta 0:06fccc63b33d 58 //void WIFIDevice::setAccessPoint(char* SSID, char* PW, uint8_t secType, uint8_t channel=1);
tsungta 0:06fccc63b33d 59
tsungta 0:06fccc63b33d 60 /** Erase a 4KB sector of embeeded flash.
tsungta 0:06fccc63b33d 61 * Flash memory will be erased in groups of 4KB sector.
tsungta 0:06fccc63b33d 62 * \param address range from 0x00 to 0x3F000 (must be a multiple of 0x1000).
tsungta 0:06fccc63b33d 63 * \return 0 on success, a negative number on failure
tsungta 0:06fccc63b33d 64 */
tsungta 0:06fccc63b33d 65 //int storage_erase4KB(uint32_t address);
tsungta 0:06fccc63b33d 66
tsungta 0:06fccc63b33d 67 /** Write data into embeeded flash.
tsungta 0:06fccc63b33d 68 * Write one (multiple) byte(s) of data into flash, must perform erase before the flash memory area can be overwrite.
tsungta 0:06fccc63b33d 69 * \param address flash memory address to be written, range from 0x00 to 0x3FFFF.
tsungta 0:06fccc63b33d 70 * \param data pointer to the buffer containing data to be written.
tsungta 0:06fccc63b33d 71 * \param len length of the data to be written to flash.
tsungta 0:06fccc63b33d 72 * \return 0 on success, a negative number on failure
tsungta 0:06fccc63b33d 73 */
tsungta 0:06fccc63b33d 74 //int storage_write(uint32_t address, uint8_t *data, uint16_t len);
tsungta 0:06fccc63b33d 75
tsungta 0:06fccc63b33d 76 /** Read data from embeeded flash.
tsungta 0:06fccc63b33d 77 * Read one (multiple) byte(s) of data from flash.
tsungta 0:06fccc63b33d 78 * \param address flash memory address to be read, range from 0x00 to 0x3FFFF.
tsungta 0:06fccc63b33d 79 * \param data pointer to the buffer containing data to be read.
tsungta 0:06fccc63b33d 80 * \param len length of the data to be read from flash.
tsungta 0:06fccc63b33d 81 * \return 0 on success, a negative number on failure
tsungta 0:06fccc63b33d 82 */
tsungta 0:06fccc63b33d 83 //int storage_read(uint32_t address, uint8_t *data, uint16_t len);
tsungta 0:06fccc63b33d 84
tsungta 0:06fccc63b33d 85 };
tsungta 0:06fccc63b33d 86
tsungta 0:06fccc63b33d 87 int enableCoexistance();
tsungta 0:06fccc63b33d 88
tsungta 0:06fccc63b33d 89 #endif /* WIFIDEVICE_H_ */