44
44
#include " scl_emac.h"
45
45
#include " scl_wifi_api.h"
46
46
#include " scl_types.h"
47
- #define MAX_SSID_LENGTH (33 )
48
- #define MAX_PASSWORD_LENGTH (64 )
47
+ #define MAX_SSID_LENGTH (33 ) /* *< Maximum ssid length */
48
+ #define MAX_PASSWORD_LENGTH (64 ) /* *< Maximum password length */
49
49
50
50
/* * SclSTAInterface class
51
- * Implementation of the NetworkStack for the SCL
51
+ * Implementation of the Network Stack for the SCL
52
52
*/
53
53
class SclSTAInterface : public WiFiInterface , public EMACInterface {
54
54
public:
@@ -63,16 +63,15 @@ class SclSTAInterface : public WiFiInterface, public EMACInterface {
63
63
*/
64
64
static SclSTAInterface *get_default_instance ();
65
65
66
- /* * Turn ON the WiFi device
66
+ /* * Turns on the Wi-Fi device
67
67
*
68
68
* @return void
69
69
*/
70
- /* Turns ON the WiFi device*/
71
70
void wifi_on ();
72
71
73
72
/* * Starts the interface
74
73
*
75
- * Attempts to connect to a WiFi network. Requires ssid and passphrase to be set.
74
+ * Attempts to connect to a Wi-Fi network. Requires ssid and passphrase to be set.
76
75
* If passphrase is invalid, NSAPI_ERROR_AUTH_ERROR is returned.
77
76
*
78
77
* @return 0 on success, negative error code on failure.
@@ -81,34 +80,35 @@ class SclSTAInterface : public WiFiInterface, public EMACInterface {
81
80
82
81
/* * Starts the interface
83
82
*
84
- * Attempts to connect to a WiFi network.
83
+ * Attempts to connect to a Wi-Fi network.
85
84
*
86
85
* @param ssid Name of the network to connect to.
87
86
* @param pass Security passphrase to connect to the network.
88
87
* @param security Type of encryption for connection (Default: NSAPI_SECURITY_NONE).
89
88
* @param channel This parameter is not supported, setting it to a value other than 0 will result in NSAPI_ERROR_UNSUPPORTED.
90
- * @return 0 on success, or error code on failure.
89
+ * @return 0 on success, negative error code on failure.
91
90
*/
92
91
nsapi_error_t connect (const char *ssid, const char *pass, nsapi_security_t security = NSAPI_SECURITY_NONE, uint8_t channel = 0 );
93
92
94
- /* * Stops the interface
95
- * @return 0 on success, negative on failure.
93
+ /* * Disconnects the interface
94
+ *
95
+ * @return 0 on success, negative error code on failure.
96
96
*/
97
97
nsapi_error_t disconnect ();
98
98
99
- /* * Set the WiFi network credentials
99
+ /* * Set the Wi-Fi network credentials
100
100
*
101
101
* @param ssid Name of the network to connect to.
102
102
* @param pass Security passphrase to connect to the network.
103
103
* @param security Type of encryption for connection.
104
104
* (defaults to NSAPI_SECURITY_NONE)
105
- * @return 0 on success, or error code on failure.
105
+ * @return 0 on success, negative error code on failure.
106
106
*/
107
107
nsapi_error_t set_credentials (const char *ssid, const char *pass, nsapi_security_t security = NSAPI_SECURITY_NONE);
108
108
109
- /* * Sets the WiFi network channel - NOT SUPPORTED
109
+ /* * Sets the Wi-Fi network channel - NOT SUPPORTED
110
110
*
111
- * This function is not supported and will return NSAPI_ERROR_UNSUPPORTED.
111
+ * This function is not supported and will return NSAPI_ERROR_UNSUPPORTED.
112
112
*
113
113
* @param channel Channel on which the connection is to be made (Default: 0).
114
114
* @return Not supported, returns NSAPI_ERROR_UNSUPPORTED.
@@ -149,11 +149,12 @@ class SclSTAInterface : public WiFiInterface, public EMACInterface {
149
149
int scan (WiFiAccessPoint *res, unsigned count);
150
150
151
151
/* * This function is used to indicate if the device is connected to the network.
152
+ *
152
153
* @return SCL_SUCCESS if device is connected.
153
154
*/
154
155
int is_interface_connected ();
155
156
156
- /* * Gets the BSSID (MAC address of device connected to)
157
+ /* * Gets the BSSID (MAC address of device connected to).
157
158
*
158
159
* @param bssid Pointer to the BSSID value.
159
160
* @return SCL_SUCCESS if BSSID is obtained successfully.
@@ -162,16 +163,18 @@ class SclSTAInterface : public WiFiInterface, public EMACInterface {
162
163
*/
163
164
int get_bssid (uint8_t *bssid);
164
165
165
- /* * This function is used to set up the WiFi interface after the WiFi on
166
- * @return SCL_SUCCESS if the WiFi interface is up successfully.
166
+ /* * This function is used to set up the Wi-Fi interface.
167
+ * This function should be used after the wifi_on.
168
+ *
169
+ * @return SCL_SUCCESS if the Wi-Fi interface is set up successfully.
167
170
*/
168
171
int wifi_set_up (void );
169
172
170
173
private:
171
174
172
- char _ssid[MAX_SSID_LENGTH]; /* The longest possible name (defined in 802.11) +1 for the \0 */
173
- char _pass[MAX_PASSWORD_LENGTH]; /* The longest allowed passphrase + 1 */
174
- nsapi_security_t _security;
175
- SCL_EMAC &_scl_emac;
175
+ char _ssid[MAX_SSID_LENGTH]; /* *< The longest possible name (defined in 802.11) +1 for the \0 */
176
+ char _pass[MAX_PASSWORD_LENGTH]; /* *< The longest allowed passphrase + 1 */
177
+ nsapi_security_t _security; /* *< Security type */
178
+ SCL_EMAC &_scl_emac; /* *< SCL_EMAC object */
176
179
};
177
- #endif
180
+ #endif /* ifndef SCL_STA_INTERFACE_H */
0 commit comments