1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef CHPP_WIFI_COMMON_H_
18 #define CHPP_WIFI_COMMON_H_
19 
20 #include <stdbool.h>
21 #include <stdint.h>
22 
23 #include "chpp/app.h"
24 #include "chpp/macros.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 /************************************************
31  *  Public Definitions
32  ***********************************************/
33 
34 #define CHPP_PAL_WIFI_API_VERSION CHRE_PAL_WIFI_API_V1_5
35 
36 /**
37  * Data structures used by the Configure Scan Monitor request.
38  */
39 CHPP_PACKED_START
40 struct ChppWifiConfigureScanMonitorAsyncRequestParameters {
41   bool enable;
42   const void *cookie;
43 } CHPP_PACKED_ATTR;
44 CHPP_PACKED_END
45 
46 CHPP_PACKED_START
47 struct ChppWifiConfigureScanMonitorAsyncRequest {
48   struct ChppAppHeader header;
49   struct ChppWifiConfigureScanMonitorAsyncRequestParameters params;
50 } CHPP_PACKED_ATTR;
51 CHPP_PACKED_END
52 
53 /**
54  * Data structures used by the Get Capabilities Response.
55  */
56 CHPP_PACKED_START
57 struct ChppWifiGetCapabilitiesParameters {
58   uint32_t capabilities;
59 } CHPP_PACKED_ATTR;
60 CHPP_PACKED_END
61 
62 CHPP_PACKED_START
63 struct ChppWifiGetCapabilitiesResponse {
64   struct ChppAppHeader header;
65   struct ChppWifiGetCapabilitiesParameters params;
66 } CHPP_PACKED_ATTR;
67 CHPP_PACKED_END
68 
69 /**
70  * Data structures used by the Configure Scan Monitor Async Response.
71  */
72 CHPP_PACKED_START
73 struct ChppWifiConfigureScanMonitorAsyncResponseParameters {
74   bool enabled;
75   uint8_t errorCode;
76 } CHPP_PACKED_ATTR;
77 CHPP_PACKED_END
78 
79 CHPP_PACKED_START
80 struct ChppWifiConfigureScanMonitorAsyncResponse {
81   struct ChppAppHeader header;
82   struct ChppWifiConfigureScanMonitorAsyncResponseParameters params;
83 } CHPP_PACKED_ATTR;
84 CHPP_PACKED_END
85 
86 /**
87  * Data structure used by the Request Scan Response.
88  */
89 CHPP_PACKED_START
90 struct ChppWifiRequestScanResponseParameters {
91   bool pending;
92   uint8_t errorCode;
93 } CHPP_PACKED_ATTR;
94 CHPP_PACKED_END
95 
96 CHPP_PACKED_START
97 struct ChppWifiRequestScanResponse {
98   struct ChppAppHeader header;
99   struct ChppWifiRequestScanResponseParameters params;
100 } CHPP_PACKED_ATTR;
101 CHPP_PACKED_END
102 
103 /**
104  * Commands used by the WiFi (WLAN) Service.
105  */
106 enum ChppWifiCommands {
107   //! Initializes the service.
108   CHPP_WIFI_OPEN = 0x0000,
109 
110   //! Deinitializes the service.
111   CHPP_WIFI_CLOSE = 0x0001,
112 
113   //! Retrieves a set of flags indicating supported features.
114   CHPP_WIFI_GET_CAPABILITIES = 0x0002,
115 
116   //! Configures whether scanEventCallback receives unsolicited scan results.
117   CHPP_WIFI_CONFIGURE_SCAN_MONITOR_ASYNC = 0x0003,
118 
119   //!  Request that the WiFi chipset perform a scan, or deliver cached results.
120   CHPP_WIFI_REQUEST_SCAN_ASYNC = 0x0004,
121 
122   //! Request that the WiFi chipset perform RTT ranging.
123   CHPP_WIFI_REQUEST_RANGING_ASYNC = 0x0005,
124 };
125 #define CHPP_WIFI_CLIENT_REQUEST_MAX CHPP_WIFI_REQUEST_RANGING_ASYNC
126 
127 #ifdef __cplusplus
128 }
129 #endif
130 
131 #endif  // CHPP_WIFI_COMMON_H_
132