Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: SNIC-httpclient-example SNIC-ntpclient-example
Fork of SNICInterface by
YDwifiInterface.h@5:ef3befe3edad, 2014-03-13 (annotated)
- Committer:
- kishino
- Date:
- Thu Mar 13 08:44:33 2014 +0000
- Revision:
- 5:ef3befe3edad
- Parent:
- 3:9f90024d7fb2
- Child:
- 6:70f522934032
Create Wi-Fi turn on command; Create Wi-Fi turn off command; Create get RSSI command
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| kishino | 0:61c402886fbb | 1 | #ifndef _YD_WIFIINTERFACE_H_ |
| kishino | 0:61c402886fbb | 2 | #define _YD_WIFIINTERFACE_H_ |
| kishino | 0:61c402886fbb | 3 | |
| kishino | 0:61c402886fbb | 4 | #include "YDwifi.h" |
| kishino | 0:61c402886fbb | 5 | |
| kishino | 2:0ba43344c814 | 6 | namespace murata_wifi |
| kishino | 2:0ba43344c814 | 7 | { |
| kishino | 2:0ba43344c814 | 8 | |
| kishino | 3:9f90024d7fb2 | 9 | /** C_YDwifiInterface class |
| kishino | 3:9f90024d7fb2 | 10 | */ |
| kishino | 0:61c402886fbb | 11 | class C_YDwifiInterface: public C_YDwifi { |
| kishino | 0:61c402886fbb | 12 | public: |
| kishino | 2:0ba43344c814 | 13 | /** Constructor |
| kishino | 2:0ba43344c814 | 14 | @param tx mbed pin to use for tx line of Serial interface |
| kishino | 2:0ba43344c814 | 15 | @param rx mbed pin to use for rx line of Serial interface |
| kishino | 2:0ba43344c814 | 16 | @param cts mbed pin to use for cts line of Serial interface |
| kishino | 2:0ba43344c814 | 17 | @param rts mbed pin to use for rts line of Serial interface |
| kishino | 2:0ba43344c814 | 18 | @param reset reset pin of the wifi module |
| kishino | 2:0ba43344c814 | 19 | @param alarm alarm pin of the wifi module (default: NC) |
| kishino | 2:0ba43344c814 | 20 | @param baud baud rate of Serial interface (default: 9600) |
| kishino | 0:61c402886fbb | 21 | */ |
| kishino | 2:0ba43344c814 | 22 | C_YDwifiInterface(PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, PinName alarm = NC, int baud = 9600); |
| kishino | 2:0ba43344c814 | 23 | |
| kishino | 2:0ba43344c814 | 24 | /** Initialize the interface. |
| kishino | 2:0ba43344c814 | 25 | @return 0 on success, a negative number on failure |
| kishino | 2:0ba43344c814 | 26 | */ |
| kishino | 2:0ba43344c814 | 27 | int init(); |
| kishino | 0:61c402886fbb | 28 | |
| kishino | 2:0ba43344c814 | 29 | /** Get Firmware version string. |
| kishino | 2:0ba43344c814 | 30 | @param version_p Pointer of FW version string.(null terminated)[output] |
| kishino | 2:0ba43344c814 | 31 | @return 0:success/other:fail |
| kishino | 2:0ba43344c814 | 32 | @note This function is blocked until a returns. |
| kishino | 2:0ba43344c814 | 33 | When you use it by UI thread, be careful. |
| kishino | 2:0ba43344c814 | 34 | */ |
| kishino | 2:0ba43344c814 | 35 | int getFWVersion( unsigned char *version_p ); |
| kishino | 0:61c402886fbb | 36 | |
| kishino | 3:9f90024d7fb2 | 37 | /** Connect to AP |
| kishino | 3:9f90024d7fb2 | 38 | @param ssid_p Wi-Fi SSID(null terminated) |
| kishino | 3:9f90024d7fb2 | 39 | @param ssid_len Wi-Fi SSID length |
| kishino | 3:9f90024d7fb2 | 40 | @param sec_type Wi-Fi security type. |
| kishino | 3:9f90024d7fb2 | 41 | @param sec_key_len Wi-Fi passphrase or security key length |
| kishino | 3:9f90024d7fb2 | 42 | @param sec_key_p Wi-Fi passphrase or security key |
| kishino | 3:9f90024d7fb2 | 43 | @return 0 on success, a negative number on failure |
| kishino | 3:9f90024d7fb2 | 44 | @note This function is blocked until a returns. |
| kishino | 3:9f90024d7fb2 | 45 | When you use it by UI thread, be careful. |
| kishino | 3:9f90024d7fb2 | 46 | */ |
| kishino | 3:9f90024d7fb2 | 47 | int connect(const char *ssid_p, unsigned char ssid_len, E_SECURITY sec_type, const char *sec_key_p, unsigned char sec_key_len); |
| kishino | 0:61c402886fbb | 48 | |
| kishino | 3:9f90024d7fb2 | 49 | /** Disconnect from AP |
| kishino | 3:9f90024d7fb2 | 50 | @return 0 on success, a negative number on failure |
| kishino | 3:9f90024d7fb2 | 51 | @note This function is blocked until a returns. |
| kishino | 3:9f90024d7fb2 | 52 | When you use it by UI thread, be careful. |
| kishino | 3:9f90024d7fb2 | 53 | */ |
| kishino | 3:9f90024d7fb2 | 54 | int disconnect(); |
| kishino | 3:9f90024d7fb2 | 55 | |
| kishino | 3:9f90024d7fb2 | 56 | /** Scan AP |
| kishino | 3:9f90024d7fb2 | 57 | @param ssid_p Wi-Fi SSID(null terminated) |
| kishino | 3:9f90024d7fb2 | 58 | If do not specify SSID, set to NULL. |
| kishino | 3:9f90024d7fb2 | 59 | @param bssid_p Wi-Fi BSSID(null terminated) |
| kishino | 3:9f90024d7fb2 | 60 | If do not specify SSID, set to NULL. |
| kishino | 3:9f90024d7fb2 | 61 | @param result_handler_p Pointer of scan result callback function. |
| kishino | 3:9f90024d7fb2 | 62 | @return 0 on success, a negative number on failure |
| kishino | 3:9f90024d7fb2 | 63 | @note This function is blocked until a returns. |
| kishino | 3:9f90024d7fb2 | 64 | When you use it by UI thread, be careful. |
| kishino | 3:9f90024d7fb2 | 65 | Scan results will be notified by asynchronous callback function. |
| kishino | 3:9f90024d7fb2 | 66 | */ |
| kishino | 3:9f90024d7fb2 | 67 | int scan( const char *ssid_p, unsigned char *bssid_p |
| kishino | 3:9f90024d7fb2 | 68 | ,void (*result_handler_p)(tagSCAN_RESULT_T *scan_result) ); |
| kishino | 3:9f90024d7fb2 | 69 | |
| kishino | 5:ef3befe3edad | 70 | /** Wi-Fi Turn on |
| kishino | 5:ef3befe3edad | 71 | @param country_p Pointer of country code. |
| kishino | 5:ef3befe3edad | 72 | @return 0 on success, a negative number on failure |
| kishino | 5:ef3befe3edad | 73 | @note This function is blocked until a returns. |
| kishino | 5:ef3befe3edad | 74 | When you use it by UI thread, be careful. |
| kishino | 5:ef3befe3edad | 75 | */ |
| kishino | 5:ef3befe3edad | 76 | int wifi_on( const char *country_p ); |
| kishino | 5:ef3befe3edad | 77 | |
| kishino | 5:ef3befe3edad | 78 | /** Wi-Fi Turn off |
| kishino | 5:ef3befe3edad | 79 | @return 0 on success, a negative number on failure |
| kishino | 5:ef3befe3edad | 80 | @note This function is blocked until a returns. |
| kishino | 5:ef3befe3edad | 81 | When you use it by UI thread, be careful. |
| kishino | 5:ef3befe3edad | 82 | */ |
| kishino | 5:ef3befe3edad | 83 | int wifi_off(); |
| kishino | 5:ef3befe3edad | 84 | |
| kishino | 5:ef3befe3edad | 85 | /** Get Wi-Fi RSSI |
| kishino | 5:ef3befe3edad | 86 | @param rssi_p Pointer of RSSI.[output] |
| kishino | 5:ef3befe3edad | 87 | @return 0 on success, a negative number on failure |
| kishino | 5:ef3befe3edad | 88 | @note This function is blocked until a returns. |
| kishino | 5:ef3befe3edad | 89 | When you use it by UI thread, be careful. |
| kishino | 5:ef3befe3edad | 90 | */ |
| kishino | 5:ef3befe3edad | 91 | int getRssi( signed char *rssi_p ); |
| kishino | 5:ef3befe3edad | 92 | |
| kishino | 3:9f90024d7fb2 | 93 | #if 0 |
| kishino | 0:61c402886fbb | 94 | /** Get the MAC address of your Ethernet interface |
| kishino | 0:61c402886fbb | 95 | * \return a pointer to a string containing the MAC address |
| kishino | 0:61c402886fbb | 96 | */ |
| kishino | 0:61c402886fbb | 97 | char* getMACAddress(); |
| kishino | 0:61c402886fbb | 98 | |
| kishino | 0:61c402886fbb | 99 | /** Get the IP address of your Ethernet interface |
| kishino | 0:61c402886fbb | 100 | * \return a pointer to a string containing the IP address |
| kishino | 0:61c402886fbb | 101 | */ |
| kishino | 0:61c402886fbb | 102 | char* getIPAddress(); |
| kishino | 0:61c402886fbb | 103 | |
| kishino | 0:61c402886fbb | 104 | /** Get the Gateway address of your Ethernet interface |
| kishino | 0:61c402886fbb | 105 | * \return a pointer to a string containing the Gateway address |
| kishino | 0:61c402886fbb | 106 | */ |
| kishino | 0:61c402886fbb | 107 | char* getGateway(); |
| kishino | 0:61c402886fbb | 108 | |
| kishino | 0:61c402886fbb | 109 | /** Get the Network mask of your Ethernet interface |
| kishino | 0:61c402886fbb | 110 | * \return a pointer to a string containing the Network mask |
| kishino | 0:61c402886fbb | 111 | */ |
| kishino | 0:61c402886fbb | 112 | char* getNetworkMask(); |
| kishino | 0:61c402886fbb | 113 | #endif |
| kishino | 0:61c402886fbb | 114 | }; |
| kishino | 2:0ba43344c814 | 115 | } |
| kishino | 0:61c402886fbb | 116 | #endif /* _YD_WIFIINTERFACE_H_ */ |
