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_CLIENT_INTERFACE_BINDER_H_
18 #define WIFICOND_CLIENT_INTERFACE_BINDER_H_
19 
20 #include <android-base/macros.h>
21 #include <binder/Status.h>
22 
23 #include "android/net/wifi/nl80211/BnClientInterface.h"
24 #include "android/net/wifi/nl80211/ISendMgmtFrameEvent.h"
25 
26 namespace android {
27 namespace wificond {
28 
29 class ClientInterfaceImpl;
30 
31 class ClientInterfaceBinder : public android::net::wifi::nl80211::BnClientInterface {
32  public:
33   explicit ClientInterfaceBinder(ClientInterfaceImpl* impl);
34   ~ClientInterfaceBinder() override;
35 
36   // Called by |impl_| its destruction.
37   // This informs the binder proxy that no future manipulations of |impl_|
38   // by remote processes are possible.
NotifyImplDead()39   void NotifyImplDead() { impl_ = nullptr; }
40 
41   ::android::binder::Status getPacketCounters(
42       std::vector<int32_t>* out_packet_counters) override;
43   ::android::binder::Status signalPoll(
44       std::vector<int32_t>* out_signal_poll_results) override;
45   ::android::binder::Status getMacAddress(
46       std::vector<uint8_t>* out_mac_address) override;
47   ::android::binder::Status getInterfaceName(std::string* out_name) override;
48   ::android::binder::Status getWifiScannerImpl(
49       ::android::sp<::android::net::wifi::nl80211::IWifiScannerImpl>* out_wifi_scanner_impl) override;
50   ::android::binder::Status SendMgmtFrame(
51       const ::std::vector<uint8_t>& frame,
52       const sp<::android::net::wifi::nl80211::ISendMgmtFrameEvent>& callback,
53       int32_t mcs) override;
54  private:
55   ClientInterfaceImpl* impl_;
56 
57   DISALLOW_COPY_AND_ASSIGN(ClientInterfaceBinder);
58 };
59 
60 }  // namespace wificond
61 }  // namespace android
62 
63 #endif  // WIFICOND_CLIENT_INTERFACE_BINDER_H_
64