1 /* 2 * Copyright (c) 2021 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 #ifndef OHOS_STORAGE_MANAGER_VOLUME_CORE_H 17 #define OHOS_STORAGE_MANAGER_VOLUME_CORE_H 18 19 #include "parcel.h" 20 21 namespace OHOS { 22 namespace StorageManager { 23 enum VolumeType { 24 EMULATED = 1, 25 EXTERNAL, 26 }; 27 enum VolumeState { 28 UNMOUNTED = 0, 29 CHECKING, 30 MOUNTED, 31 EJECTING, 32 REMOVED, 33 BAD_REMOVAL 34 }; 35 class VolumeCore : public Parcelable { 36 public: 37 VolumeCore(); 38 VolumeCore(std::string id, int32_t type, std::string diskId); 39 VolumeCore(std::string id, int32_t type, std::string diskId, int32_t state); 40 41 std::string GetId(); 42 int32_t GetType(); 43 std::string GetDiskId(); 44 int32_t GetState(); 45 void SetState(int32_t state); 46 47 bool Marshalling(Parcel &parcel) const override; 48 static std::unique_ptr<VolumeCore> Unmarshalling(Parcel &parcel); 49 private: 50 std::string id_; 51 int32_t type_ {}; 52 std::string diskId_; 53 int32_t state_ = UNMOUNTED; 54 bool errorFlag_ = false; 55 }; 56 } // StorageManager 57 } // OHOS 58 59 #endif // OHOS_STORAGE_MANAGER_VOLUME_CORE_H