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_6 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 * Data structure used by the NAN subscribe cancel request. 105 */ 106 CHPP_PACKED_START 107 struct ChppWifiNanSubscribeCancelRequest { 108 struct ChppAppHeader header; 109 uint32_t subscriptionId; 110 } CHPP_PACKED_ATTR; 111 CHPP_PACKED_END 112 113 /** 114 * Data structure used by the NAN service identifier callback. 115 */ 116 CHPP_PACKED_START 117 struct ChppWifiNanServiceIdentifier { 118 struct ChppAppHeader header; 119 uint8_t errorCode; 120 uint32_t subscriptionId; 121 } CHPP_PACKED_ATTR; 122 CHPP_PACKED_END 123 124 /** 125 * Data structure used by the NAN service canceled callback. 126 */ 127 CHPP_PACKED_START 128 struct ChppWifiNanSubscriptionCanceledResponse { 129 struct ChppAppHeader header; 130 uint8_t errorCode; 131 uint32_t subscriptionId; 132 } CHPP_PACKED_ATTR; 133 CHPP_PACKED_END 134 135 /** 136 * Data structure used by the NAN identifier event 137 */ 138 139 /** 140 * Commands used by the WiFi (WLAN) Service. 141 */ 142 enum ChppWifiCommands { 143 //! Initializes the service. 144 CHPP_WIFI_OPEN = 0x0000, 145 146 //! Deinitializes the service. 147 CHPP_WIFI_CLOSE = 0x0001, 148 149 //! Retrieves a set of flags indicating supported features. 150 CHPP_WIFI_GET_CAPABILITIES = 0x0002, 151 152 //! Configures whether scanEventCallback receives unsolicited scan results. 153 CHPP_WIFI_CONFIGURE_SCAN_MONITOR_ASYNC = 0x0003, 154 155 //! Request that the WiFi chipset perform a scan, or deliver cached results. 156 CHPP_WIFI_REQUEST_SCAN_ASYNC = 0x0004, 157 158 //! Request that the WiFi chipset perform RTT ranging. 159 CHPP_WIFI_REQUEST_RANGING_ASYNC = 0x0005, 160 161 //! Request that the WiFi chipset perform a NAN subscription. 162 CHPP_WIFI_REQUEST_NAN_SUB = 0x0006, 163 164 //! Request that the WiFi chipset cancel a NAN subscription. 165 CHPP_WIFI_REQUEST_NAN_SUB_CANCEL = 0x0007, 166 167 //! Request that the WiFi chipset perform NAN ranging. 168 CHPP_WIFI_REQUEST_NAN_RANGING_ASYNC = 0x0008, 169 170 //! Indicates that a subscribing service be informed that a publisher 171 //! matching its desired configuration has been discovered. 172 CHPP_WIFI_NOTIFICATION_NAN_SERVICE_DISCOVERY = 0x0009, 173 174 //! Indication if the connection to a NAN service was lost. 175 CHPP_WIFI_NOTIFICATION_NAN_SERVICE_LOST = 0x000a, 176 177 //! Indication if a NAN service subscription was terminated. 178 CHPP_WIFI_NOTIFICATION_NAN_SERVICE_TERMINATED = 0x000b, 179 }; 180 #define CHPP_WIFI_CLIENT_REQUEST_MAX CHPP_WIFI_REQUEST_NAN_RANGING_ASYNC 181 182 #ifdef __cplusplus 183 } 184 #endif 185 186 #endif // CHPP_WIFI_COMMON_H_ 187