• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 };
33 class VolumeCore : public Parcelable {
34 public:
35     VolumeCore();
36     VolumeCore(std::string id, int32_t type, std::string diskId);
37     VolumeCore(std::string id, int32_t type, std::string diskId, int32_t state);
38 
39     std::string GetId();
40     int32_t GetType();
41     std::string GetDiskId();
42     int32_t GetState();
43     void SetState(int32_t state);
44 
45     bool Marshalling(Parcel &parcel) const override;
46     static std::unique_ptr<VolumeCore> Unmarshalling(Parcel &parcel);
47 private:
48     std::string id_;
49     int32_t type_ {};
50     std::string diskId_;
51     int32_t state_ = UNMOUNTED;
52     bool errorFlag_ = false;
53 };
54 } // StorageManager
55 } // OHOS
56 
57 #endif // OHOS_STORAGE_MANAGER_VOLUME_CORE_H