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:
Sat Dec 03 15:24:52 2016 +0000
Revision:
1:be6abb24f013
Parent:
0:06fccc63b33d
Child:
9:32d6cd2f8456
22:f45e247; Move m2m_wifi_handle_events(NULL); from main.cpp to NNN50_WIFI_API; Fix set_address() bug; Add enableAccessPoint() for AP mode function

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 1:be6abb24f013 43 /** Enable 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 1:be6abb24f013 47 * \param AP_ip the IP address of AP
tsungta 1:be6abb24f013 48 * \param security tyoe of security in AP mode (default: (M2M_WIFI_SEC_WEP)), support
tsungta 1:be6abb24f013 49 M2M_WIFI_SEC_OPEN < Open security >
tsungta 1:be6abb24f013 50 M2M_WIFI_SEC_WEP < Security type WEP with 10 hexadecimal digits >
tsungta 0:06fccc63b33d 51 * \param channel range from 1 to 14 (default: (1))
tsungta 1:be6abb24f013 52 * \return 0 on success, a negative number on failure
tsungta 0:06fccc63b33d 53 */
tsungta 1:be6abb24f013 54 int WIFIDevice::enableAccessPoint(char* SSID, char* PW, char* AP_ip = "192.168.1.1", uint8_t secType=M2M_WIFI_SEC_WEP, uint8_t channel=1);
tsungta 0:06fccc63b33d 55
tsungta 0:06fccc63b33d 56 /** Erase a 4KB sector of embeeded flash.
tsungta 0:06fccc63b33d 57 * Flash memory will be erased in groups of 4KB sector.
tsungta 0:06fccc63b33d 58 * \param address range from 0x00 to 0x3F000 (must be a multiple of 0x1000).
tsungta 0:06fccc63b33d 59 * \return 0 on success, a negative number on failure
tsungta 0:06fccc63b33d 60 */
tsungta 0:06fccc63b33d 61 //int storage_erase4KB(uint32_t address);
tsungta 0:06fccc63b33d 62
tsungta 0:06fccc63b33d 63 /** Write data into embeeded flash.
tsungta 0:06fccc63b33d 64 * Write one (multiple) byte(s) of data into flash, must perform erase before the flash memory area can be overwrite.
tsungta 0:06fccc63b33d 65 * \param address flash memory address to be written, range from 0x00 to 0x3FFFF.
tsungta 0:06fccc63b33d 66 * \param data pointer to the buffer containing data to be written.
tsungta 0:06fccc63b33d 67 * \param len length of the data to be written to flash.
tsungta 0:06fccc63b33d 68 * \return 0 on success, a negative number on failure
tsungta 0:06fccc63b33d 69 */
tsungta 0:06fccc63b33d 70 //int storage_write(uint32_t address, uint8_t *data, uint16_t len);
tsungta 0:06fccc63b33d 71
tsungta 0:06fccc63b33d 72 /** Read data from embeeded flash.
tsungta 0:06fccc63b33d 73 * Read one (multiple) byte(s) of data from flash.
tsungta 0:06fccc63b33d 74 * \param address flash memory address to be read, range from 0x00 to 0x3FFFF.
tsungta 0:06fccc63b33d 75 * \param data pointer to the buffer containing data to be read.
tsungta 0:06fccc63b33d 76 * \param len length of the data to be read from flash.
tsungta 0:06fccc63b33d 77 * \return 0 on success, a negative number on failure
tsungta 0:06fccc63b33d 78 */
tsungta 0:06fccc63b33d 79 //int storage_read(uint32_t address, uint8_t *data, uint16_t len);
tsungta 0:06fccc63b33d 80
tsungta 0:06fccc63b33d 81 };
tsungta 0:06fccc63b33d 82
tsungta 0:06fccc63b33d 83 int enableCoexistance();
tsungta 0:06fccc63b33d 84
tsungta 0:06fccc63b33d 85 #endif /* WIFIDEVICE_H_ */
tsungta 1:be6abb24f013 86