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 #pragma once
18 
19 #include <hidl/MQDescriptor.h>
20 #include <hidl/Status.h>
21 
22 #include "BootControlShared.h"
23 
24 namespace android {
25 namespace hardware {
26 namespace boot {
27 namespace V1_2 {
28 namespace implementation {
29 
30 using ::android::hardware::Return;
31 using ::android::hardware::boot::V1_0::BoolResult;
32 
33 struct BootControl : public BootControlShared {
34     explicit BootControl(boot_control_module_t *module);
35 
36     // Methods from ::android::hardware::boot::V1_0::IBootControl follow.
37     Return<uint32_t> getNumberSlots() override;
38     Return<uint32_t> getCurrentSlot() override;
39     Return<void> markBootSuccessful(markBootSuccessful_cb _hidl_cb) override;
40     Return<void> setActiveBootSlot(uint32_t slot, setActiveBootSlot_cb _hidl_cb) override;
41     Return<void> setSlotAsUnbootable(uint32_t slot, setSlotAsUnbootable_cb _hidl_cb) override;
42     Return<BoolResult> isSlotBootable(uint32_t slot) override;
43     Return<BoolResult> isSlotMarkedSuccessful(uint32_t slot) override;
44     Return<void> getSuffix(uint32_t slot, getSuffix_cb _hidl_cb) override;
45 
46     // Methods from ::android::hardware::boot::V1_2::IBootControl follow.
47     Return<uint32_t> getActiveBootSlot() override;
48 
49   private:
50     boot_control_module_t *mModule;
51 };
52 
53 extern "C" IBootControl *HIDL_FETCH_IBootControl(const char *name);
54 
55 }  // namespace implementation
56 }  // namespace V1_2
57 }  // namespace boot
58 }  // namespace hardware
59 }  // namespace android
60