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 #ifndef WIFICOND_AP_INTERFACE_BINDER_H_ 18 #define WIFICOND_AP_INTERFACE_BINDER_H_ 19 20 #include <android-base/macros.h> 21 22 #include "wificond/net/netlink_manager.h" 23 24 #include "android/net/wifi/nl80211/BnApInterface.h" 25 #include "android/net/wifi/nl80211/IApInterfaceEventCallback.h" 26 27 using android::net::wifi::nl80211::IApInterfaceEventCallback; 28 using android::net::wifi::nl80211::NativeWifiClient; 29 30 namespace android { 31 namespace wificond { 32 33 class ApInterfaceImpl; 34 35 class ApInterfaceBinder : public android::net::wifi::nl80211::BnApInterface { 36 public: 37 explicit ApInterfaceBinder(ApInterfaceImpl* impl); 38 ~ApInterfaceBinder() override; 39 40 // Called by |impl_| on its destruction. 41 // This informs the binder proxy that no future manipulations of |impl_| 42 // by remote processes are possible. NotifyImplDead()43 void NotifyImplDead() { impl_ = nullptr; } 44 45 // Called by |impl_| every time the access point's connected clients change. 46 void NotifyConnectedClientsChanged(const NativeWifiClient client, bool isConnected); 47 48 // Called by |impl_| on every channel switch event. 49 void NotifySoftApChannelSwitched(int frequency, 50 ChannelBandwidth channel_bandwidth); 51 52 binder::Status registerCallback( 53 const sp<IApInterfaceEventCallback>& callback, 54 bool* out_success) override; 55 binder::Status getInterfaceName(std::string* out_name) override; 56 57 private: 58 ApInterfaceImpl* impl_; 59 60 android::sp<IApInterfaceEventCallback> 61 ap_interface_event_callback_; 62 63 DISALLOW_COPY_AND_ASSIGN(ApInterfaceBinder); 64 }; 65 66 } // namespace wificond 67 } // namespace android 68 69 #endif // WIFICOND_AP_INTERFACE_BINDER_H_ 70