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
SNICwifiInterface.h@8:50d2509479cd, 2014-03-17 (annotated)
- Committer:
- kishino
- Date:
- Mon Mar 17 11:40:56 2014 +0000
- Revision:
- 8:50d2509479cd
- Parent:
- YDwifiInterface.h@7:e88ccbe0225f
Prefix of class name and file name was changed from 'YD' to 'SNIC'.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| kishino | 8:50d2509479cd | 1 | #ifndef _SNIC_WIFIINTERFACE_H_ |
| kishino | 8:50d2509479cd | 2 | #define _SNIC_WIFIINTERFACE_H_ |
| kishino | 0:61c402886fbb | 3 | |
| kishino | 8:50d2509479cd | 4 | #include "SNICwifi.h" |
| kishino | 0:61c402886fbb | 5 | |
| kishino | 2:0ba43344c814 | 6 | namespace murata_wifi |
| kishino | 2:0ba43344c814 | 7 | { |
| kishino | 2:0ba43344c814 | 8 | |
| kishino | 8:50d2509479cd | 9 | /** C_SNICwifiInterface class |
| kishino | 3:9f90024d7fb2 | 10 | */ |
| kishino | 8:50d2509479cd | 11 | class C_SNICwifiInterface: public C_SNICwifi { |
| kishino | 0:61c402886fbb | 12 | public: |
| kishino | 6:70f522934032 | 13 | /** Wi-Fi status */ |
| kishino | 6:70f522934032 | 14 | typedef struct |
| kishino | 6:70f522934032 | 15 | { |
| kishino | 6:70f522934032 | 16 | /** status */ |
| kishino | 6:70f522934032 | 17 | E_WIFI_STATUS status; |
| kishino | 6:70f522934032 | 18 | /** Mac address */ |
| kishino | 6:70f522934032 | 19 | char mac_address[BSSID_MAC_LENTH]; |
| kishino | 6:70f522934032 | 20 | /** SSID */ |
| kishino | 6:70f522934032 | 21 | char ssid[SSID_MAX_LENGTH+1]; |
| kishino | 6:70f522934032 | 22 | }tagWIFI_STATUS_T; |
| kishino | 6:70f522934032 | 23 | |
| kishino | 2:0ba43344c814 | 24 | /** Constructor |
| kishino | 2:0ba43344c814 | 25 | @param tx mbed pin to use for tx line of Serial interface |
| kishino | 2:0ba43344c814 | 26 | @param rx mbed pin to use for rx line of Serial interface |
| kishino | 2:0ba43344c814 | 27 | @param cts mbed pin to use for cts line of Serial interface |
| kishino | 2:0ba43344c814 | 28 | @param rts mbed pin to use for rts line of Serial interface |
| kishino | 2:0ba43344c814 | 29 | @param reset reset pin of the wifi module |
| kishino | 2:0ba43344c814 | 30 | @param alarm alarm pin of the wifi module (default: NC) |
| kishino | 2:0ba43344c814 | 31 | @param baud baud rate of Serial interface (default: 9600) |
| kishino | 0:61c402886fbb | 32 | */ |
| kishino | 8:50d2509479cd | 33 | C_SNICwifiInterface(PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, PinName alarm = NC, int baud = 9600); |
| kishino | 2:0ba43344c814 | 34 | |
| kishino | 2:0ba43344c814 | 35 | /** Initialize the interface. |
| kishino | 2:0ba43344c814 | 36 | @return 0 on success, a negative number on failure |
| kishino | 2:0ba43344c814 | 37 | */ |
| kishino | 2:0ba43344c814 | 38 | int init(); |
| kishino | 0:61c402886fbb | 39 | |
| kishino | 2:0ba43344c814 | 40 | /** Get Firmware version string. |
| kishino | 2:0ba43344c814 | 41 | @param version_p Pointer of FW version string.(null terminated)[output] |
| kishino | 2:0ba43344c814 | 42 | @return 0:success/other:fail |
| kishino | 2:0ba43344c814 | 43 | @note This function is blocked until a returns. |
| kishino | 2:0ba43344c814 | 44 | When you use it by UI thread, be careful. |
| kishino | 2:0ba43344c814 | 45 | */ |
| kishino | 2:0ba43344c814 | 46 | int getFWVersion( unsigned char *version_p ); |
| kishino | 0:61c402886fbb | 47 | |
| kishino | 3:9f90024d7fb2 | 48 | /** Connect to AP |
| kishino | 3:9f90024d7fb2 | 49 | @param ssid_p Wi-Fi SSID(null terminated) |
| kishino | 3:9f90024d7fb2 | 50 | @param ssid_len Wi-Fi SSID length |
| kishino | 3:9f90024d7fb2 | 51 | @param sec_type Wi-Fi security type. |
| kishino | 3:9f90024d7fb2 | 52 | @param sec_key_len Wi-Fi passphrase or security key length |
| kishino | 3:9f90024d7fb2 | 53 | @param sec_key_p Wi-Fi passphrase or security key |
| kishino | 3:9f90024d7fb2 | 54 | @return 0 on success, a negative number on failure |
| kishino | 3:9f90024d7fb2 | 55 | @note This function is blocked until a returns. |
| kishino | 3:9f90024d7fb2 | 56 | When you use it by UI thread, be careful. |
| kishino | 3:9f90024d7fb2 | 57 | */ |
| kishino | 3:9f90024d7fb2 | 58 | 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 | 59 | |
| kishino | 3:9f90024d7fb2 | 60 | /** Disconnect from AP |
| kishino | 3:9f90024d7fb2 | 61 | @return 0 on success, a negative number on failure |
| kishino | 3:9f90024d7fb2 | 62 | @note This function is blocked until a returns. |
| kishino | 3:9f90024d7fb2 | 63 | When you use it by UI thread, be careful. |
| kishino | 3:9f90024d7fb2 | 64 | */ |
| kishino | 3:9f90024d7fb2 | 65 | int disconnect(); |
| kishino | 3:9f90024d7fb2 | 66 | |
| kishino | 3:9f90024d7fb2 | 67 | /** Scan AP |
| kishino | 3:9f90024d7fb2 | 68 | @param ssid_p Wi-Fi SSID(null terminated) |
| kishino | 3:9f90024d7fb2 | 69 | If do not specify SSID, set to NULL. |
| kishino | 3:9f90024d7fb2 | 70 | @param bssid_p Wi-Fi BSSID(null terminated) |
| kishino | 3:9f90024d7fb2 | 71 | If do not specify SSID, set to NULL. |
| kishino | 3:9f90024d7fb2 | 72 | @param result_handler_p Pointer of scan result callback function. |
| kishino | 3:9f90024d7fb2 | 73 | @return 0 on success, a negative number on failure |
| kishino | 3:9f90024d7fb2 | 74 | @note This function is blocked until a returns. |
| kishino | 3:9f90024d7fb2 | 75 | When you use it by UI thread, be careful. |
| kishino | 3:9f90024d7fb2 | 76 | Scan results will be notified by asynchronous callback function. |
| kishino | 7:e88ccbe0225f | 77 | If there is no continuity data, result_handler_p will be set NULL.. |
| kishino | 3:9f90024d7fb2 | 78 | */ |
| kishino | 3:9f90024d7fb2 | 79 | int scan( const char *ssid_p, unsigned char *bssid_p |
| kishino | 3:9f90024d7fb2 | 80 | ,void (*result_handler_p)(tagSCAN_RESULT_T *scan_result) ); |
| kishino | 3:9f90024d7fb2 | 81 | |
| kishino | 5:ef3befe3edad | 82 | /** Wi-Fi Turn on |
| kishino | 5:ef3befe3edad | 83 | @param country_p Pointer of country code. |
| kishino | 5:ef3befe3edad | 84 | @return 0 on success, a negative number on failure |
| kishino | 5:ef3befe3edad | 85 | @note This function is blocked until a returns. |
| kishino | 5:ef3befe3edad | 86 | When you use it by UI thread, be careful. |
| kishino | 5:ef3befe3edad | 87 | */ |
| kishino | 5:ef3befe3edad | 88 | int wifi_on( const char *country_p ); |
| kishino | 5:ef3befe3edad | 89 | |
| kishino | 5:ef3befe3edad | 90 | /** Wi-Fi Turn off |
| kishino | 5:ef3befe3edad | 91 | @return 0 on success, a negative number on failure |
| kishino | 5:ef3befe3edad | 92 | @note This function is blocked until a returns. |
| kishino | 5:ef3befe3edad | 93 | When you use it by UI thread, be careful. |
| kishino | 5:ef3befe3edad | 94 | */ |
| kishino | 5:ef3befe3edad | 95 | int wifi_off(); |
| kishino | 5:ef3befe3edad | 96 | |
| kishino | 5:ef3befe3edad | 97 | /** Get Wi-Fi RSSI |
| kishino | 5:ef3befe3edad | 98 | @param rssi_p Pointer of RSSI.[output] |
| kishino | 5:ef3befe3edad | 99 | @return 0 on success, a negative number on failure |
| kishino | 5:ef3befe3edad | 100 | @note This function is blocked until a returns. |
| kishino | 5:ef3befe3edad | 101 | When you use it by UI thread, be careful. |
| kishino | 5:ef3befe3edad | 102 | */ |
| kishino | 5:ef3befe3edad | 103 | int getRssi( signed char *rssi_p ); |
| kishino | 5:ef3befe3edad | 104 | |
| kishino | 6:70f522934032 | 105 | /** Get Wi-Fi status |
| kishino | 6:70f522934032 | 106 | @param status_p Pointer of status structure.[output] |
| kishino | 6:70f522934032 | 107 | @return 0 on success, a negative number on failure |
| kishino | 6:70f522934032 | 108 | @note This function is blocked until a returns. |
| kishino | 6:70f522934032 | 109 | When you use it by UI thread, be careful. |
| kishino | 6:70f522934032 | 110 | */ |
| kishino | 6:70f522934032 | 111 | int getWifiStatus( tagWIFI_STATUS_T *status_p); |
| kishino | 6:70f522934032 | 112 | |
| kishino | 3:9f90024d7fb2 | 113 | #if 0 |
| kishino | 0:61c402886fbb | 114 | /** Get the MAC address of your Ethernet interface |
| kishino | 0:61c402886fbb | 115 | * \return a pointer to a string containing the MAC address |
| kishino | 0:61c402886fbb | 116 | */ |
| kishino | 0:61c402886fbb | 117 | char* getMACAddress(); |
| kishino | 0:61c402886fbb | 118 | |
| kishino | 0:61c402886fbb | 119 | /** Get the IP address of your Ethernet interface |
| kishino | 0:61c402886fbb | 120 | * \return a pointer to a string containing the IP address |
| kishino | 0:61c402886fbb | 121 | */ |
| kishino | 0:61c402886fbb | 122 | char* getIPAddress(); |
| kishino | 0:61c402886fbb | 123 | |
| kishino | 0:61c402886fbb | 124 | /** Get the Gateway address of your Ethernet interface |
| kishino | 0:61c402886fbb | 125 | * \return a pointer to a string containing the Gateway address |
| kishino | 0:61c402886fbb | 126 | */ |
| kishino | 0:61c402886fbb | 127 | char* getGateway(); |
| kishino | 0:61c402886fbb | 128 | |
| kishino | 0:61c402886fbb | 129 | /** Get the Network mask of your Ethernet interface |
| kishino | 0:61c402886fbb | 130 | * \return a pointer to a string containing the Network mask |
| kishino | 0:61c402886fbb | 131 | */ |
| kishino | 0:61c402886fbb | 132 | char* getNetworkMask(); |
| kishino | 0:61c402886fbb | 133 | #endif |
| kishino | 0:61c402886fbb | 134 | }; |
| kishino | 2:0ba43344c814 | 135 | } |
| kishino | 0:61c402886fbb | 136 | #endif /* _YD_WIFIINTERFACE_H_ */ |
