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