Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
wifi_mgmt.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 Intel Corporation.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12#ifndef ZEPHYR_INCLUDE_NET_WIFI_MGMT_H_
13#define ZEPHYR_INCLUDE_NET_WIFI_MGMT_H_
14
15#include <net/net_mgmt.h>
16#include <net/wifi.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22/* Management part definitions */
23
24#define _NET_WIFI_LAYER NET_MGMT_LAYER_L2
25#define _NET_WIFI_CODE 0x156
26#define _NET_WIFI_BASE (NET_MGMT_IFACE_BIT | \
27 NET_MGMT_LAYER(_NET_WIFI_LAYER) | \
28 NET_MGMT_LAYER_CODE(_NET_WIFI_CODE))
29#define _NET_WIFI_EVENT (_NET_WIFI_BASE | NET_MGMT_EVENT_BIT)
30
37};
38
39#define NET_REQUEST_WIFI_SCAN \
40 (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_SCAN)
41
43
44#define NET_REQUEST_WIFI_CONNECT \
45 (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_CONNECT)
46
48
49#define NET_REQUEST_WIFI_DISCONNECT \
50 (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_DISCONNECT)
51
53
54#define NET_REQUEST_WIFI_AP_ENABLE \
55 (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_AP_ENABLE)
56
58
59#define NET_REQUEST_WIFI_AP_DISABLE \
60 (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_AP_DISABLE)
61
63
69};
70
71#define NET_EVENT_WIFI_SCAN_RESULT \
72 (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_SCAN_RESULT)
73
74#define NET_EVENT_WIFI_SCAN_DONE \
75 (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_SCAN_DONE)
76
77#define NET_EVENT_WIFI_CONNECT_RESULT \
78 (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_CONNECT_RESULT)
79
80#define NET_EVENT_WIFI_DISCONNECT_RESULT \
81 (_NET_WIFI_EVENT | NET_EVENT_WIFI_CMD_DISCONNECT_RESULT)
82
83
84/* Each result is provided to the net_mgmt_event_callback
85 * via its info attribute (see net_mgmt.h)
86 */
90
94};
95
98 uint8_t ssid_length; /* Max 32 */
99
101 uint8_t psk_length; /* Min 8 - Max 64 */
102
105};
106
109};
110
111#include <net/net_if.h>
112
113typedef void (*scan_result_cb_t)(struct net_if *iface, int status,
114 struct wifi_scan_result *entry);
115
123 struct net_if_api iface_api;
124
125 /* cb parameter is the cb that should be called for each
126 * result by the driver. The wifi mgmt part will take care of
127 * raising the necessary event etc...
128 */
129 int (*scan)(const struct device *dev, scan_result_cb_t cb);
130 int (*connect)(const struct device *dev,
131 struct wifi_connect_req_params *params);
132 int (*disconnect)(const struct device *dev);
133 int (*ap_enable)(const struct device *dev,
134 struct wifi_connect_req_params *params);
135 int (*ap_disable)(const struct device *dev);
136};
137
138/* Make sure that the network interface API is properly setup inside
139 * Wifi mgmt offload API struct (it is the first one).
140 */
141BUILD_ASSERT(offsetof(struct net_wifi_mgmt_offload, iface_api) == 0);
142
143#ifdef CONFIG_WIFI_OFFLOAD
144
145void wifi_mgmt_raise_connect_result_event(struct net_if *iface, int status);
146void wifi_mgmt_raise_disconnect_result_event(struct net_if *iface, int status);
147
148#endif /* CONFIG_WIFI_OFFLOAD */
149
150#ifdef __cplusplus
151}
152#endif
153
154#endif /* ZEPHYR_INCLUDE_NET_WIFI_MGMT_H_ */
void
Definition: eswifi_shell.c:15
#define NET_MGMT_DEFINE_REQUEST_HANDLER(_mgmt_request)
Definition: net_mgmt.h:95
Public API for network interface.
Network Management API public header.
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
__INT8_TYPE__ int8_t
Definition: stdint.h:42
Runtime device structure (in ROM) per driver instance.
Definition: device.h:367
Network Interface structure.
Definition: net_if.h:468
Definition: wifi_mgmt.h:116
struct net_if_api iface_api
Definition: wifi_mgmt.h:123
int(* scan)(const struct device *dev, scan_result_cb_t cb)
Definition: wifi_mgmt.h:129
int(* disconnect)(const struct device *dev)
Definition: wifi_mgmt.h:132
int(* ap_disable)(const struct device *dev)
Definition: wifi_mgmt.h:135
int(* ap_enable)(const struct device *dev, struct wifi_connect_req_params *params)
Definition: wifi_mgmt.h:133
int(* connect)(const struct device *dev, struct wifi_connect_req_params *params)
Definition: wifi_mgmt.h:130
Definition: wifi_mgmt.h:96
enum wifi_security_type security
Definition: wifi_mgmt.h:104
uint8_t * psk
Definition: wifi_mgmt.h:100
uint8_t channel
Definition: wifi_mgmt.h:103
uint8_t ssid_length
Definition: wifi_mgmt.h:98
uint8_t psk_length
Definition: wifi_mgmt.h:101
uint8_t * ssid
Definition: wifi_mgmt.h:97
Definition: wifi_mgmt.h:87
uint8_t ssid_length
Definition: wifi_mgmt.h:89
int8_t rssi
Definition: wifi_mgmt.h:93
uint8_t channel
Definition: wifi_mgmt.h:91
uint8_t ssid[WIFI_SSID_MAX_LEN]
Definition: wifi_mgmt.h:88
enum wifi_security_type security
Definition: wifi_mgmt.h:92
Definition: wifi_mgmt.h:107
int status
Definition: wifi_mgmt.h:108
General WiFi Definitions.
#define WIFI_SSID_MAX_LEN
Definition: wifi.h:20
wifi_security_type
Definition: wifi.h:15
#define NET_REQUEST_WIFI_SCAN
Definition: wifi_mgmt.h:39
#define NET_REQUEST_WIFI_AP_ENABLE
Definition: wifi_mgmt.h:54
#define NET_REQUEST_WIFI_DISCONNECT
Definition: wifi_mgmt.h:49
net_request_wifi_cmd
Definition: wifi_mgmt.h:31
@ NET_REQUEST_WIFI_CMD_AP_ENABLE
Definition: wifi_mgmt.h:35
@ NET_REQUEST_WIFI_CMD_SCAN
Definition: wifi_mgmt.h:32
@ NET_REQUEST_WIFI_CMD_AP_DISABLE
Definition: wifi_mgmt.h:36
@ NET_REQUEST_WIFI_CMD_CONNECT
Definition: wifi_mgmt.h:33
@ NET_REQUEST_WIFI_CMD_DISCONNECT
Definition: wifi_mgmt.h:34
#define NET_REQUEST_WIFI_CONNECT
Definition: wifi_mgmt.h:44
net_event_wifi_cmd
Definition: wifi_mgmt.h:64
@ NET_EVENT_WIFI_CMD_SCAN_RESULT
Definition: wifi_mgmt.h:65
@ NET_EVENT_WIFI_CMD_DISCONNECT_RESULT
Definition: wifi_mgmt.h:68
@ NET_EVENT_WIFI_CMD_SCAN_DONE
Definition: wifi_mgmt.h:66
@ NET_EVENT_WIFI_CMD_CONNECT_RESULT
Definition: wifi_mgmt.h:67
void(* scan_result_cb_t)(struct net_if *iface, int status, struct wifi_scan_result *entry)
Definition: wifi_mgmt.h:113
#define NET_REQUEST_WIFI_AP_DISABLE
Definition: wifi_mgmt.h:59