1 /* 2 * Copyright (C) 2014 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 __WIFI_HAL_GSCAN_EVENT_HANDLE_H__ 18 #define __WIFI_HAL_GSCAN_EVENT_HANDLE_H__ 19 20 #include "common.h" 21 #include "cpp_bindings.h" 22 #include "gscancommand.h" 23 24 #ifdef __cplusplus 25 extern "C" 26 { 27 #endif /* __cplusplus */ 28 29 class GScanCommandEventHandler: public WifiVendorCommand 30 { 31 private: 32 // TODO: derive 3 other command event handler classes from this base and separate 33 // the data member vars 34 wifi_scan_result *mHotlistApFoundResults; 35 wifi_scan_result *mHotlistApLostResults; 36 u32 mHotlistApFoundNumResults; 37 u32 mHotlistApLostNumResults; 38 bool mHotlistApFoundMoreData; 39 bool mHotlistApLostMoreData; 40 wifi_significant_change_result **mSignificantChangeResults; 41 u32 mSignificantChangeNumResults; 42 bool mSignificantChangeMoreData; 43 GScanCallbackHandler mHandler; 44 int mRequestId; 45 u32 mHotlistSsidFoundNumResults; 46 bool mHotlistSsidFoundMoreData; 47 u32 mHotlistSsidLostNumResults; 48 bool mHotlistSsidLostMoreData; 49 wifi_scan_result *mHotlistSsidFoundResults; 50 wifi_scan_result *mHotlistSsidLostResults; 51 wifi_scan_result *mPnoNetworkFoundResults; 52 u32 mPnoNetworkFoundNumResults; 53 bool mPnoNetworkFoundMoreData; 54 wifi_scan_result *mPasspointNetworkFoundResult; 55 byte *mPasspointAnqp; 56 int mPasspointAnqpLen; 57 int mPasspointNetId; 58 59 /* Needed because mSubcmd gets overwritten in 60 * WifiVendorCommand::handleEvent() 61 */ 62 u32 mSubCommandId; 63 bool mEventHandlingEnabled; 64 65 public: 66 GScanCommandEventHandler(wifi_handle handle, int id, u32 vendor_id, 67 u32 subcmd, GScanCallbackHandler nHandler); 68 virtual ~GScanCommandEventHandler(); 69 virtual int create(); 70 virtual int get_request_id(); 71 virtual void set_request_id(int request_id); 72 virtual int handleEvent(WifiEvent &event); 73 void enableEventHandling(); 74 void disableEventHandling(); 75 bool isEventHandlingEnabled(); 76 void setCallbackHandler(GScanCallbackHandler handler); 77 wifi_error gscan_parse_hotlist_ap_results( 78 u32 num_results, 79 wifi_scan_result *results, 80 u32 starting_index, 81 struct nlattr **tb_vendor); 82 wifi_error gscan_parse_hotlist_ssid_results( 83 u32 num_results, 84 wifi_scan_result *results, 85 u32 starting_index, 86 struct nlattr **tb_vendor); 87 wifi_error gscan_parse_passpoint_network_result( 88 struct nlattr **tb_vendor); 89 wifi_error gscan_parse_pno_network_results( 90 u32 numResults, 91 wifi_scan_result *mPnoNetworkFoundResults, 92 u32 startingIndex, 93 struct nlattr **tbVendor); 94 }; 95 96 #ifdef __cplusplus 97 } 98 #endif /* __cplusplus */ 99 #endif 100