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.
Fork of NySNICInterface by
YDwifiInterface.h@3:9f90024d7fb2, 2014-03-13 (annotated)
- Committer:
- kishino
- Date:
- Thu Mar 13 01:34:56 2014 +0000
- Revision:
- 3:9f90024d7fb2
- Parent:
- 2:0ba43344c814
- Child:
- 5:ef3befe3edad
The following API was created.; =>Connect to AP.; =>Disconnect from AP.; =>Scan AP.
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 | 3:9f90024d7fb2 | 70 | #if 0 |
| kishino | 0:61c402886fbb | 71 | /** Get the MAC address of your Ethernet interface |
| kishino | 0:61c402886fbb | 72 | * \return a pointer to a string containing the MAC address |
| kishino | 0:61c402886fbb | 73 | */ |
| kishino | 0:61c402886fbb | 74 | char* getMACAddress(); |
| kishino | 0:61c402886fbb | 75 | |
| kishino | 0:61c402886fbb | 76 | /** Get the IP address of your Ethernet interface |
| kishino | 0:61c402886fbb | 77 | * \return a pointer to a string containing the IP address |
| kishino | 0:61c402886fbb | 78 | */ |
| kishino | 0:61c402886fbb | 79 | char* getIPAddress(); |
| kishino | 0:61c402886fbb | 80 | |
| kishino | 0:61c402886fbb | 81 | /** Get the Gateway address of your Ethernet interface |
| kishino | 0:61c402886fbb | 82 | * \return a pointer to a string containing the Gateway address |
| kishino | 0:61c402886fbb | 83 | */ |
| kishino | 0:61c402886fbb | 84 | char* getGateway(); |
| kishino | 0:61c402886fbb | 85 | |
| kishino | 0:61c402886fbb | 86 | /** Get the Network mask of your Ethernet interface |
| kishino | 0:61c402886fbb | 87 | * \return a pointer to a string containing the Network mask |
| kishino | 0:61c402886fbb | 88 | */ |
| kishino | 0:61c402886fbb | 89 | char* getNetworkMask(); |
| kishino | 0:61c402886fbb | 90 | #endif |
| kishino | 0:61c402886fbb | 91 | }; |
| kishino | 2:0ba43344c814 | 92 | } |
| kishino | 0:61c402886fbb | 93 | #endif /* _YD_WIFIINTERFACE_H_ */ |
