Tizen RT Public API  v1.1 D4
wifi_manager.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright 2017 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the License.
16  *
17  ****************************************************************************/
18 
31 #ifndef WIFI_MANAGER_H
32 #define WIFI_MANAGER_H
33 
37 typedef enum {
38  // STA mode status
39  AP_DISCONNECTED,
40  AP_CONNECTED,
41 
42  // SOFT AP mode status
43  CLIENT_CONNECTED,
44  CLIENT_DISCONNECTED,
45 
46  // Unkown
47  STATUS_UNKNOWN
49 
53 typedef enum {
54  WIFI_MANAGER_FAIL = -1,
55  WIFI_MANAGER_SUCCESS,
56  WIFI_MANAGER_INVALID_ARGS,
57  WIFI_MANAGER_INITIALIZED,
58  WIFI_MANAGER_DEINITIALIZED,
59  WIFI_MANAGER_TIMEOUT,
60  WIFI_MANAGER_BUSY,
62 
66 typedef enum {
67  WIFI_NONE = -1,
68  STA_MODE,
69  SOFTAP_MODE,
70  WIFI_MODE_CHANGING,
71  WIFI_INITIALIZING,
72  WIFI_DEINITIALIZING,
73  WIFI_FAILURE
75 
79 typedef enum {
80  WIFI_SCAN_FAIL = -1,
81  WIFI_SCAN_SUCCESS,
83 
88  char ssid[33]; // 802.11 spec defined unspecified or uint8
89  char bssid[18]; // char string e.g. xx:xx:xx:xx:xx:xx
90  int8_t rssi; // received signal strength indication
91  uint8_t channel; // channel/frequency
92  uint8_t phy_mode; // 0:legacy 1: 11N HT
93  struct wifi_manager_scan_info_s *next;
94 };
95 
97 
101 typedef struct {
102  void (*sta_connected)(void); // in station mode, connected to ap
103  void (*sta_disconnected)(void); // in station mode, disconnected from ap
104  void (*softap_sta_joined)(void); // in softap mode, a station joined
105  void (*softap_sta_left)(void); // in softap mode, a station left
106  void (*scan_ap_done)(wifi_manager_scan_info_s **, wifi_manager_scan_result_e); // scanning ap is done
108 
112 typedef struct {
113  char ip4_address[18];
114  char ssid[32];
115  char mac_address[6];
116  int rssi;
117  connect_status_e status;
118  wifi_manager_mode_e mode;
119  wifi_manager_mode_e pre_mode;
120  wifi_manager_mode_e next_mode;
122 
126 typedef struct {
127  char ssid[32];
128  uint16_t channel;
129  char passphrase[64];
131 
135 typedef enum {
143 
147 typedef enum {
156 
160 typedef struct {
161  char ssid[32];
162  unsigned int ssid_length;
163  char passphrase[64];
164  unsigned int passphrase_length;
168 
177 
186 
196 
205 
214 
223 
232 
233 #endif
234 
wifi_manager_result_e wifi_manager_get_info(wifi_manager_info_s *info)
Retrieve current status of Wi-Fi interface including mode, connection status, ssid, received signal strengh indication, and ip address.
wifi_manager_result_e wifi_manager_deinit(void)
Deinitialize Wi-Fi Manager including stoping Wi-Fi interface.
wifi_manager_result_e wifi_manager_init(wifi_manager_cb_s *wmcb)
Initialize Wi-Fi Manager including starting Wi-Fi interface.
wifi_manager_ap_crypto_type_e ap_crypto_type
Definition: wifi_manager.h:166
wifi_manager_mode_e
Mode of Wi-Fi interface such as station mode or ap mode.
Definition: wifi_manager.h:66
wifi_manager_result_e wifi_manager_connect_ap(wifi_manager_ap_config_s *config)
Connect to an access point.
wifi_manager_ap_auth_type_e ap_auth_type
Definition: wifi_manager.h:165
wifi_manager_result_e wifi_manager_disconnect_ap(void)
Disconnect from the connected access point.
wifi_manager_result_e wifi_manager_scan_ap(void)
Scan nearby access points.
wifi_manager_result_e
Result types of Wi-Fi Manager APIs such as FAIL, SUCCESS, or INVALID ARGS.
Definition: wifi_manager.h:53
Specify information of soft access point (softAP) such as ssid and channel number.
Definition: wifi_manager.h:126
Keep information of nearby access points as scan results.
Definition: wifi_manager.h:87
Include callback functions which are asynchronously called after Wi-Fi Manager APIs are called...
Definition: wifi_manager.h:101
wifi_manager_scan_result_e
Result types of nearby access point scanning.
Definition: wifi_manager.h:79
wifi_manager_ap_crypto_type_e
Wi-Fi encryption type such as WEP, AES, or TKIP.
Definition: wifi_manager.h:147
wifi_manager_ap_auth_type_e
Wi-Fi authentication type such as WPA, WPA2, or WPS.
Definition: wifi_manager.h:135
Specify which access point (AP) a client connects to.
Definition: wifi_manager.h:160
connect_status_e
Status of Wi-Fi interface such as connected or disconnected.
Definition: wifi_manager.h:37
unsigned int passphrase_length
Definition: wifi_manager.h:164
wifi_manager_result_e wifi_manager_set_mode(wifi_manager_mode_e mode, wifi_manager_softap_config_s *config)
Change the Wi-Fi mode to station or AP.
Keep Wi-Fi Manager information including ip/mac address, ssid, rssi, etc.
Definition: wifi_manager.h:112