1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @addtogroup HdfPartitionSlot
18 *
19 * @brief Provides APIs for the partionton slot service.
20 *
21 * The PartitionSlot module provides a unified interface for PartitionSlot service.
22 * After obtaining the driver object or proxy, the realted APIs can be used to
23 * obtain current booting partition slot, update current booting partition slot,
24 * or set partition slot as unbootable.
25 * @since 3.1
26 */
27
28/**
29 * @file IPartitionSlot.idl
30 *
31 * @brief Declares common APIs of the PartitionSlot service.
32 * These APIs can be used to obtain current booting partition slot,
33 * or update current booting partition slot, or set partition slot as unbootable.
34 * @since 3.1
35 */
36
37/**
38 * @brief Defines the basic operations that can be performed on PartitionSlot.
39 *
40 * The operations include getting and setting current booting partition slot,
41 */
42
43package ohos.hdi.partitionslot.v1_0;
44
45interface IPartitionSlot {
46    /**
47     * @brief Obtains current booting partition slot.
48     *
49     * @param numOfSlots number of slots supported. 1 means no AB partition; 2 means AB, > 2 means multiple slots
50     * @return Returns <b>-1</b> if the board does not support AB Parittion.
51     * @return Returns <b>0</b> if the board is booting from partition slot A.
52     * @return Returns <b>1</b> if the board is booting from partition slot B.
53     * @return Returns <b>N</b> if the board is booting from partition slot N.
54     *
55     * @since 3.1
56     */
57    GetCurrentSlot([out] int currentSlot, [out] int numOfSlots);
58
59    /**
60     * @brief Obtains slot suffix string from slot id
61     *
62     * @param slot slot index.
63     * @param suffix slot suffix string.
64     * @return Returns <b>-1</b> if the board does not support AB Parittion.
65     * @return Returns <b>0</b> if the operation is successful.
66     *
67     * @since 3.1
68     */
69    GetSlotSuffix([in] int slot, [out] String suffix);
70
71    /**
72     * @brief Set current active boot partition slot
73     *
74     * @param slot slot index.
75     * @return Returns <b>0</b> if the operation is successful.
76     * @return Returns a negative value if the operation fails.
77     *
78     * @since 3.1
79     */
80    SetActiveSlot([in] int slot);
81
82    /**
83     * @brief Set boot partition slot unbootable
84     *
85     * @param slot slot index.
86     * @return Returns <b>0</b> if the operation is successful.
87     * @return Returns a negative value if the operation fails.
88     *
89     * @since 3.1
90     */
91    SetSlotUnbootable([in] int slot);
92}