OSDN Git Service

Merge "Support signal poll for wificond" am: 5abb163c9f am: a3fa0eb48e
[android-x86/system-connectivity-wificond.git] / client_interface_binder.cpp
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 std::vector;
27
28 namespace android {
29 namespace wificond {
30
31 ClientInterfaceBinder::ClientInterfaceBinder(ClientInterfaceImpl* impl)
32     : impl_(impl) {
33 }
34
35 ClientInterfaceBinder::~ClientInterfaceBinder() {
36 }
37
38 Status ClientInterfaceBinder::enableSupplicant(bool* success) {
39   *success = impl_ && impl_->EnableSupplicant();
40   return Status::ok();
41 }
42
43 Status ClientInterfaceBinder::disableSupplicant(bool* success) {
44   *success = impl_ && impl_->DisableSupplicant();
45   return Status::ok();
46 }
47
48 Status ClientInterfaceBinder::getPacketCounters(
49     vector<int32_t>* out_packet_counters) {
50   if (impl_ == nullptr) {
51     return Status::ok();
52   }
53   impl_->GetPacketCounters(out_packet_counters);
54   return Status::ok();
55 }
56
57 Status ClientInterfaceBinder::signalPoll(
58     vector<int32_t>* out_signal_poll_results) {
59   if (impl_ == nullptr) {
60     return Status::ok();
61   }
62   impl_->SignalPoll(out_signal_poll_results);
63   return Status::ok();
64 }
65
66 Status ClientInterfaceBinder::getMacAddress(vector<uint8_t>* out_mac_address) {
67   if (impl_ == nullptr) {
68     return Status::ok();
69   }
70   *out_mac_address = impl_->GetMacAddress();
71   return Status::ok();
72 }
73
74 }  // namespace wificond
75 }  // namespace android