1 /*
2  * Copyright (c) 2017 Intel Corporation.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /**
8  * @file
9  * @brief Bluetooth L2 stack public header
10  */
11 
12 #ifndef ZEPHYR_INCLUDE_NET_BT_H_
13 #define ZEPHYR_INCLUDE_NET_BT_H_
14 
15 #include <zephyr/net/net_mgmt.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /* Management part definitions */
22 
23 #define _NET_BT_LAYER	NET_MGMT_LAYER_L2
24 #define _NET_BT_CODE	0x155
25 #define _NET_BT_BASE	(NET_MGMT_IFACE_BIT |			\
26 			 NET_MGMT_LAYER(_NET_BT_LAYER) |	\
27 			 NET_MGMT_LAYER_CODE(_NET_BT_CODE))
28 #define _NET_BT_EVENT	(_NET_BT_BASE | NET_MGMT_EVENT_BIT)
29 
30 enum net_request_bt_cmd {
31 	NET_REQUEST_BT_CMD_ADVERTISE = 1,
32 	NET_REQUEST_BT_CMD_CONNECT,
33 	NET_REQUEST_BT_CMD_SCAN,
34 	NET_REQUEST_BT_CMD_DISCONNECT,
35 };
36 
37 #define NET_REQUEST_BT_ADVERTISE				\
38 	(_NET_BT_BASE | NET_REQUEST_BT_CMD_ADVERTISE)
39 
40 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_BT_ADVERTISE);
41 
42 #define NET_REQUEST_BT_CONNECT					\
43 	(_NET_BT_BASE | NET_REQUEST_BT_CMD_CONNECT)
44 
45 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_BT_CONNECT);
46 
47 #define NET_REQUEST_BT_SCAN					\
48 	(_NET_BT_BASE | NET_REQUEST_BT_CMD_SCAN)
49 
50 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_BT_SCAN);
51 
52 enum net_event_bt_cmd {
53 	NET_EVENT_BT_CMD_SCAN_RESULT = 1,
54 };
55 
56 #define NET_EVENT_BT_SCAN_RESULT				\
57 	(_NET_BT_EVENT | NET_EVENT_BT_CMD_SCAN_RESULT)
58 
59 #define NET_REQUEST_BT_DISCONNECT				\
60 	(_NET_BT_BASE | NET_REQUEST_BT_CMD_DISCONNECT)
61 
62 NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_BT_DISCONNECT);
63 
64 #ifdef __cplusplus
65 }
66 #endif
67 
68 #endif /* ZEPHYR_INCLUDE_NET_BT_H_ */
69