1 /* 2 * Copyright (C) 2017 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 CHRE_PLATFORM_PLATFORM_WIFI_H_ 18 #define CHRE_PLATFORM_PLATFORM_WIFI_H_ 19 20 #include "chre/target_platform/platform_wifi_base.h" 21 22 namespace chre { 23 24 class PlatformWifi : public PlatformWifiBase { 25 public: 26 /** 27 * Performs platform-specific deinitialization of the PlatformWifi instance. 28 */ 29 ~PlatformWifi(); 30 31 /** 32 * Initializes the platform-specific WiFi implementation. This is potentially 33 * called at a later stage of initialization than the constructor, so platform 34 * implementations are encouraged to put any blocking initialization here. 35 */ 36 void init(); 37 38 /** 39 * Returns the set of WiFi capabilities that the platform has exposed. This 40 * may return CHRE_WIFI_CAPABILITIES_NONE if wifi is not supported. 41 * 42 * @return the WiFi capabilities exposed by this platform. 43 */ 44 uint32_t getCapabilities(); 45 46 /** 47 * Configures the scan monitoring function of the platform Wifi. For more info 48 * see the WiFi PAL documentation. The result of this operation is 49 * asynchronous and must be delivered to CHRE by invoking the 50 * WifiRequestManager::handleScanMonitorStateChange method. 51 * 52 * @param enable true to enable listening for scan results. 53 * 54 * @return true to indicate that the request was accepted. 55 */ 56 bool configureScanMonitor(bool enable); 57 58 /** 59 * Requests that the WiFi chipset perform RTT ranging. Refer to the 60 * {@link chrePalWifiApi} struct of the PAL API which includes further 61 * documentation. Note that the implementation of this method may be supplied 62 * by the CHRE PAL but is not required to be. The semantics of this 63 * implementation, however, must be the same those of the requestRanging PAL 64 * API. 65 * 66 * @param params Parameters for the ranging request. 67 * 68 * @return true to indicate that the request was accepted. 69 */ 70 bool requestRanging(const struct chreWifiRangingParams *params); 71 72 /** 73 * Requests that the WiFi chipset perform an active wifi scan. Refer to the 74 * {@link chrePalWifiApi} struct which includes further documentation. Note 75 * that the implementation of this method may be supplied by the CHRE PAL but 76 * is not required to be. The semantics of this implementation, however, must 77 * be the same those of the requestScan PAL API. 78 * 79 * @param params The configuration of the wifi scan. 80 * 81 * @return true to indicate that the request was accepted. 82 */ 83 bool requestScan(const struct chreWifiScanParams *params); 84 85 /** 86 * Releases a previously published WiFi RTT ranging result event. Refer to the 87 * {@link chrePalWifiApi} struct of the PAL API for further documentation. 88 * 89 * @param event A pointer to an event to be released. 90 */ 91 void releaseRangingEvent(struct chreWifiRangingEvent *event); 92 93 /** 94 * Releases a previously published wifi scan event. Refer to the 95 * {@link chrePalWifiApi} struct of the PAL API for further documentation. 96 * 97 * @param event A pointer to an event to be released. 98 */ 99 void releaseScanEvent(struct chreWifiScanEvent *event); 100 }; 101 102 } // namespace chre 103 104 #endif // CHRE_PLATFORM_PLATFORM_WIFI_H_ 105