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_8 35 36 /** 37 * Data structures used by the Configure Scan Monitor request. 38 */ 39 CHPP_PACKED_START 40 struct ChppWifiConfigureScanMonitorAsyncRequest { 41 struct ChppAppHeader header; 42 bool enable; 43 } CHPP_PACKED_ATTR; 44 CHPP_PACKED_END 45 46 /** 47 * Data structures used by the Get Capabilities Response. 48 */ 49 CHPP_PACKED_START 50 struct ChppWifiGetCapabilitiesParameters { 51 uint32_t capabilities; 52 } CHPP_PACKED_ATTR; 53 CHPP_PACKED_END 54 55 CHPP_PACKED_START 56 struct ChppWifiGetCapabilitiesResponse { 57 struct ChppAppHeader header; 58 struct ChppWifiGetCapabilitiesParameters params; 59 } CHPP_PACKED_ATTR; 60 CHPP_PACKED_END 61 62 /** 63 * Data structures used by the Configure Scan Monitor Async Response. 64 */ 65 CHPP_PACKED_START 66 struct ChppWifiConfigureScanMonitorAsyncResponseParameters { 67 bool enabled; 68 uint8_t errorCode; 69 } CHPP_PACKED_ATTR; 70 CHPP_PACKED_END 71 72 CHPP_PACKED_START 73 struct ChppWifiConfigureScanMonitorAsyncResponse { 74 struct ChppAppHeader header; 75 struct ChppWifiConfigureScanMonitorAsyncResponseParameters params; 76 } CHPP_PACKED_ATTR; 77 CHPP_PACKED_END 78 79 /** 80 * Data structure used by the Request Scan Response. 81 */ 82 CHPP_PACKED_START 83 struct ChppWifiRequestScanResponseParameters { 84 bool pending; 85 uint8_t errorCode; 86 } CHPP_PACKED_ATTR; 87 CHPP_PACKED_END 88 89 CHPP_PACKED_START 90 struct ChppWifiRequestScanResponse { 91 struct ChppAppHeader header; 92 struct ChppWifiRequestScanResponseParameters params; 93 } CHPP_PACKED_ATTR; 94 CHPP_PACKED_END 95 96 /** 97 * Data structure used by the NAN subscribe cancel request. 98 */ 99 CHPP_PACKED_START 100 struct ChppWifiNanSubscribeCancelRequest { 101 struct ChppAppHeader header; 102 uint32_t subscriptionId; 103 } CHPP_PACKED_ATTR; 104 CHPP_PACKED_END 105 106 /** 107 * Data structure used by the NAN service identifier callback. 108 */ 109 CHPP_PACKED_START 110 struct ChppWifiNanServiceIdentifier { 111 struct ChppAppHeader header; 112 uint8_t errorCode; 113 uint32_t subscriptionId; 114 } CHPP_PACKED_ATTR; 115 CHPP_PACKED_END 116 117 /** 118 * Data structure used by the NAN service canceled callback. 119 */ 120 CHPP_PACKED_START 121 struct ChppWifiNanSubscriptionCanceledResponse { 122 struct ChppAppHeader header; 123 uint8_t errorCode; 124 uint32_t subscriptionId; 125 } CHPP_PACKED_ATTR; 126 CHPP_PACKED_END 127 128 /** 129 * Data structure used by the NAN identifier event 130 */ 131 132 /** 133 * Commands used by the WiFi (WLAN) Service. 134 */ 135 enum ChppWifiCommands { 136 //! Initializes the service. 137 CHPP_WIFI_OPEN = 0x0000, 138 139 //! Deinitializes the service. 140 CHPP_WIFI_CLOSE = 0x0001, 141 142 //! Retrieves a set of flags indicating supported features. 143 CHPP_WIFI_GET_CAPABILITIES = 0x0002, 144 145 //! Configures whether scanEventCallback receives unsolicited scan results. 146 CHPP_WIFI_CONFIGURE_SCAN_MONITOR_ASYNC = 0x0003, 147 148 //! Request that the WiFi chipset perform a scan, or deliver cached results. 149 CHPP_WIFI_REQUEST_SCAN_ASYNC = 0x0004, 150 151 //! Request that the WiFi chipset perform RTT ranging. 152 CHPP_WIFI_REQUEST_RANGING_ASYNC = 0x0005, 153 154 //! Request that the WiFi chipset perform a NAN subscription. 155 CHPP_WIFI_REQUEST_NAN_SUB = 0x0006, 156 157 //! Request that the WiFi chipset cancel a NAN subscription. 158 CHPP_WIFI_REQUEST_NAN_SUB_CANCEL = 0x0007, 159 160 //! Request that the WiFi chipset perform NAN ranging. 161 CHPP_WIFI_REQUEST_NAN_RANGING_ASYNC = 0x0008, 162 163 //! Indicates that a subscribing service be informed that a publisher 164 //! matching its desired configuration has been discovered. 165 CHPP_WIFI_NOTIFICATION_NAN_SERVICE_DISCOVERY = 0x0009, 166 167 //! Indication if the connection to a NAN service was lost. 168 CHPP_WIFI_NOTIFICATION_NAN_SERVICE_LOST = 0x000a, 169 170 //! Indication if a NAN service subscription was terminated. 171 CHPP_WIFI_NOTIFICATION_NAN_SERVICE_TERMINATED = 0x000b, 172 }; 173 #define CHPP_WIFI_CLIENT_REQUEST_MAX CHPP_WIFI_REQUEST_NAN_RANGING_ASYNC 174 175 #ifdef __cplusplus 176 } 177 #endif 178 179 #endif // CHPP_WIFI_COMMON_H_ 180