diff options
Diffstat (limited to 'rtt/rtt_controller_impl.cpp')
-rw-r--r-- | rtt/rtt_controller_impl.cpp | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/rtt/rtt_controller_impl.cpp b/rtt/rtt_controller_impl.cpp deleted file mode 100644 index 197faca..0000000 --- a/rtt/rtt_controller_impl.cpp +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
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/rtt/rtt_controller_impl.h" | ||
18 | |||
19 | #include <android-base/logging.h> | ||
20 | |||
21 | #include "wificond/rtt/rtt_controller_binder.h" | ||
22 | |||
23 | using android::net::wifi::IRttClient; | ||
24 | using android::net::wifi::IRttController; | ||
25 | using android::sp; | ||
26 | |||
27 | namespace android { | ||
28 | namespace wificond { | ||
29 | |||
30 | RttControllerImpl::RttControllerImpl() | ||
31 | : binder_(new RttControllerBinder(this)) { | ||
32 | // TODO(nywang): create a HAL RttController object. | ||
33 | } | ||
34 | |||
35 | RttControllerImpl::~RttControllerImpl() { | ||
36 | binder_->NotifyImplDead(); | ||
37 | } | ||
38 | |||
39 | sp<IRttController> RttControllerImpl::GetBinder() const { | ||
40 | return binder_; | ||
41 | } | ||
42 | |||
43 | bool RttControllerImpl::RegisterRttClient(android::sp<IRttClient> client) { | ||
44 | for (auto& it : clients_) { | ||
45 | if (IRttClient::asBinder(client) == IRttClient::asBinder(it)) { | ||
46 | LOG(WARNING) << "Ignore duplicate RttClient registration"; | ||
47 | return false; | ||
48 | } | ||
49 | } | ||
50 | clients_.push_back(client); | ||
51 | return true; | ||
52 | |||
53 | } | ||
54 | |||
55 | bool RttControllerImpl::UnregisterRttClient(android::sp<IRttClient> client) { | ||
56 | for (auto it = clients_.begin(); it != clients_.end(); it++) { | ||
57 | if (IRttClient::asBinder(client) == IRttClient::asBinder(*it)) { | ||
58 | clients_.erase(it); | ||
59 | return true; | ||
60 | } | ||
61 | } | ||
62 | LOG(WARNING) << "Failed to find registered RttClient to unregister"; | ||
63 | return false; | ||
64 | } | ||
65 | |||
66 | size_t RttControllerImpl::GetClientCount() const { | ||
67 | return clients_.size(); | ||
68 | } | ||
69 | |||
70 | } // namespace wificond | ||
71 | } // namespace android | ||