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