1 /* 2 * Copyright (C) 2016 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 #include "wificond/client_interface_binder.h" 18 19 #include <vector> 20 21 #include <binder/Status.h> 22 23 #include "wificond/client_interface_impl.h" 24 25 using android::binder::Status; 26 using android::net::wifi::IANQPDoneCallback; 27 using android::net::wifi::IWifiScannerImpl; 28 using std::vector; 29 30 namespace android { 31 namespace wificond { 32 ClientInterfaceBinder(ClientInterfaceImpl * impl)33ClientInterfaceBinder::ClientInterfaceBinder(ClientInterfaceImpl* impl) 34 : impl_(impl) { 35 } 36 ~ClientInterfaceBinder()37ClientInterfaceBinder::~ClientInterfaceBinder() { 38 } 39 enableSupplicant(bool * success)40Status ClientInterfaceBinder::enableSupplicant(bool* success) { 41 *success = impl_ && impl_->EnableSupplicant(); 42 return Status::ok(); 43 } 44 disableSupplicant(bool * success)45Status ClientInterfaceBinder::disableSupplicant(bool* success) { 46 *success = impl_ && impl_->DisableSupplicant(); 47 return Status::ok(); 48 } 49 getPacketCounters(vector<int32_t> * out_packet_counters)50Status ClientInterfaceBinder::getPacketCounters( 51 vector<int32_t>* out_packet_counters) { 52 if (impl_ == nullptr) { 53 return Status::ok(); 54 } 55 impl_->GetPacketCounters(out_packet_counters); 56 return Status::ok(); 57 } 58 signalPoll(vector<int32_t> * out_signal_poll_results)59Status ClientInterfaceBinder::signalPoll( 60 vector<int32_t>* out_signal_poll_results) { 61 if (impl_ == nullptr) { 62 return Status::ok(); 63 } 64 impl_->SignalPoll(out_signal_poll_results); 65 return Status::ok(); 66 } 67 getMacAddress(vector<uint8_t> * out_mac_address)68Status ClientInterfaceBinder::getMacAddress(vector<uint8_t>* out_mac_address) { 69 if (impl_ == nullptr) { 70 return Status::ok(); 71 } 72 *out_mac_address = impl_->GetMacAddress(); 73 return Status::ok(); 74 } 75 getInterfaceName(std::string * out_name)76Status ClientInterfaceBinder::getInterfaceName(std::string* out_name) { 77 if (impl_ == nullptr) { 78 return Status::ok(); 79 } 80 *out_name = impl_->GetInterfaceName(); 81 return Status::ok(); 82 } 83 getWifiScannerImpl(sp<IWifiScannerImpl> * out_wifi_scanner_impl)84Status ClientInterfaceBinder::getWifiScannerImpl( 85 sp<IWifiScannerImpl>* out_wifi_scanner_impl) { 86 if (impl_ == nullptr) { 87 *out_wifi_scanner_impl = nullptr; 88 return Status::ok(); 89 } 90 *out_wifi_scanner_impl = impl_->GetScanner(); 91 return Status::ok(); 92 } 93 requestANQP(const vector<uint8_t> & bssid,const sp<IANQPDoneCallback> & callback,bool * out_success)94Status ClientInterfaceBinder::requestANQP( 95 const vector<uint8_t>& bssid, 96 const sp<IANQPDoneCallback>& callback, 97 bool* out_success) { 98 if (impl_ == nullptr) { 99 *out_success = false; 100 return Status::ok(); 101 } 102 *out_success = impl_->requestANQP(bssid, callback); 103 return Status::ok(); 104 } 105 106 } // namespace wificond 107 } // namespace android 108