ban4jp - / SNICInterface_PullReq

Dependents:   SNIC-httpclient-example SNIC-ntpclient-example

Fork of SNICInterface by muRata

Committer:
kishino
Date:
Thu Mar 13 10:33:18 2014 +0000
Revision:
6:70f522934032
Parent:
5:ef3befe3edad
Child:
7:e88ccbe0225f
Create get status command

Who changed what in which revision?

UserRevisionLine numberNew 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 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 2:0ba43344c814 33 C_YDwifiInterface(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 3:9f90024d7fb2 77 */
kishino 3:9f90024d7fb2 78 int scan( const char *ssid_p, unsigned char *bssid_p
kishino 3:9f90024d7fb2 79 ,void (*result_handler_p)(tagSCAN_RESULT_T *scan_result) );
kishino 3:9f90024d7fb2 80
kishino 5:ef3befe3edad 81 /** Wi-Fi Turn on
kishino 5:ef3befe3edad 82 @param country_p Pointer of country code.
kishino 5:ef3befe3edad 83 @return 0 on success, a negative number on failure
kishino 5:ef3befe3edad 84 @note This function is blocked until a returns.
kishino 5:ef3befe3edad 85 When you use it by UI thread, be careful.
kishino 5:ef3befe3edad 86 */
kishino 5:ef3befe3edad 87 int wifi_on( const char *country_p );
kishino 5:ef3befe3edad 88
kishino 5:ef3befe3edad 89 /** Wi-Fi Turn off
kishino 5:ef3befe3edad 90 @return 0 on success, a negative number on failure
kishino 5:ef3befe3edad 91 @note This function is blocked until a returns.
kishino 5:ef3befe3edad 92 When you use it by UI thread, be careful.
kishino 5:ef3befe3edad 93 */
kishino 5:ef3befe3edad 94 int wifi_off();
kishino 5:ef3befe3edad 95
kishino 5:ef3befe3edad 96 /** Get Wi-Fi RSSI
kishino 5:ef3befe3edad 97 @param rssi_p Pointer of RSSI.[output]
kishino 5:ef3befe3edad 98 @return 0 on success, a negative number on failure
kishino 5:ef3befe3edad 99 @note This function is blocked until a returns.
kishino 5:ef3befe3edad 100 When you use it by UI thread, be careful.
kishino 5:ef3befe3edad 101 */
kishino 5:ef3befe3edad 102 int getRssi( signed char *rssi_p );
kishino 5:ef3befe3edad 103
kishino 6:70f522934032 104 /** Get Wi-Fi status
kishino 6:70f522934032 105 @param status_p Pointer of status structure.[output]
kishino 6:70f522934032 106 @return 0 on success, a negative number on failure
kishino 6:70f522934032 107 @note This function is blocked until a returns.
kishino 6:70f522934032 108 When you use it by UI thread, be careful.
kishino 6:70f522934032 109 */
kishino 6:70f522934032 110 int getWifiStatus( tagWIFI_STATUS_T *status_p);
kishino 6:70f522934032 111
kishino 3:9f90024d7fb2 112 #if 0
kishino 0:61c402886fbb 113 /** Get the MAC address of your Ethernet interface
kishino 0:61c402886fbb 114 * \return a pointer to a string containing the MAC address
kishino 0:61c402886fbb 115 */
kishino 0:61c402886fbb 116 char* getMACAddress();
kishino 0:61c402886fbb 117
kishino 0:61c402886fbb 118 /** Get the IP address of your Ethernet interface
kishino 0:61c402886fbb 119 * \return a pointer to a string containing the IP address
kishino 0:61c402886fbb 120 */
kishino 0:61c402886fbb 121 char* getIPAddress();
kishino 0:61c402886fbb 122
kishino 0:61c402886fbb 123 /** Get the Gateway address of your Ethernet interface
kishino 0:61c402886fbb 124 * \return a pointer to a string containing the Gateway address
kishino 0:61c402886fbb 125 */
kishino 0:61c402886fbb 126 char* getGateway();
kishino 0:61c402886fbb 127
kishino 0:61c402886fbb 128 /** Get the Network mask of your Ethernet interface
kishino 0:61c402886fbb 129 * \return a pointer to a string containing the Network mask
kishino 0:61c402886fbb 130 */
kishino 0:61c402886fbb 131 char* getNetworkMask();
kishino 0:61c402886fbb 132 #endif
kishino 0:61c402886fbb 133 };
kishino 2:0ba43344c814 134 }
kishino 0:61c402886fbb 135 #endif /* _YD_WIFIINTERFACE_H_ */