2 * Copyright (C) 2016 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef WIFICOND_OFFLOAD_SERVICE_UTILS_H_
17 #define WIFICOND_OFFLOAD_SERVICE_UTILS_H_
19 #include <android/hardware/wifi/offload/1.0/IOffload.h>
20 #include "wificond/scanning/offload/offload_callback.h"
21 #include "wificond/scanning/offload/offload_callback_handlers.h"
26 typedef std::function<void(uint64_t)> OffloadDeathRecipientHandler;
28 class OffloadDeathRecipient : public android::hardware::hidl_death_recipient {
30 OffloadDeathRecipient(OffloadDeathRecipientHandler handler);
34 const android::wp<android::hidl::base::V1_0::IBase>& who) override {
35 this->handler_(cookie);
39 OffloadDeathRecipientHandler handler_;
42 // Provides methods to get Offload HAL service and create callback
43 class OffloadServiceUtils {
45 OffloadServiceUtils() = default;
46 virtual ~OffloadServiceUtils() = default;
47 virtual android::sp<android::hardware::wifi::offload::V1_0::IOffload>
49 virtual android::sp<OffloadCallback> GetOffloadCallback(
50 OffloadCallbackHandlers* handlers);
51 virtual OffloadDeathRecipient* GetOffloadDeathRecipient(
52 OffloadDeathRecipientHandler handler);
55 } // namespace wificond
56 } // namespace android
58 #endif // WIFICOND_OFFLOAD_SERVICE_UTILS_H