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/BnApInterface.h" 25 #include "android/net/wifi/IApInterfaceEventCallback.h" 26 27 namespace android { 28 namespace wificond { 29 30 class ApInterfaceImpl; 31 32 class ApInterfaceBinder : public android::net::wifi::BnApInterface { 33 public: 34 explicit ApInterfaceBinder(ApInterfaceImpl* impl); 35 ~ApInterfaceBinder() override; 36 37 // Called by |impl_| on its destruction. 38 // This informs the binder proxy that no future manipulations of |impl_| 39 // by remote processes are possible. 40 void NotifyImplDead() { impl_ = nullptr; } 41 42 // Called by |impl_| everytime number of associated stations changes. 43 void NotifyNumAssociatedStationsChanged(int num_stations); 44 45 // Called by |impl_| on every channel switch event. 46 void NotifySoftApChannelSwitched(int frequency, 47 ChannelBandwidth channel_bandwidth); 48 49 binder::Status startHostapd( 50 const sp<net::wifi::IApInterfaceEventCallback>& callback, 51 bool* out_success) override; 52 binder::Status stopHostapd(bool* out_success) override; 53 binder::Status getInterfaceName(std::string* out_name) override; 54 binder::Status getNumberOfAssociatedStations( 55 int* out_num_of_stations) override; 56 57 private: 58 ApInterfaceImpl* impl_; 59 60 android::sp<net::wifi::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