• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 #ifndef OHOS_CLOUD_SYNC_SERVICE_DATA_SYNC_CONST_H
16 #define OHOS_CLOUD_SYNC_SERVICE_DATA_SYNC_CONST_H
17 
18 #include <set>
19 #include <string>
20 namespace OHOS::FileManagement::CloudSync {
21 
22 enum CleanAction {
23     RETAIN_DATA = 0,
24     CLEAR_DATA
25 };
26 
27 enum AlbumSource {
28     ALBUM_FROM_LOCAL = 1,
29     ALBUM_FROM_CLOUD = 2
30 };
31 
32 enum class SyncTriggerType : int32_t {
33     APP_TRIGGER,
34     CLOUD_TRIGGER,
35     PENDING_TRIGGER,
36     BATTERY_OK_TRIGGER,
37     NETWORK_AVAIL_TRIGGER,
38     TASK_TRIGGER,
39     SYSTEM_LOAD_TRIGGER,
40 };
41 
42 enum class ThumbState : int32_t {
43     DOWNLOADED,
44     LCD_TO_DOWNLOAD,
45     THM_TO_DOWNLOAD,
46     TO_DOWNLOAD,
47 };
48 
49 struct LocalInfo {
50     std::string parentCloudId;
51     std::string fileName;
52     int64_t mdirtyTime;
53     int64_t fdirtyTime;
54     int64_t recycledTime;
55     int64_t rowId;
56     int32_t thm_flag;
57     int32_t lcd_flag;
58 };
59 
60 struct BundleNameUserInfo {
61     std::string bundleName;
62     int32_t userId;
63     int32_t pid;
64 };
65 
66 const int32_t POSITION_LOCAL = 1;
67 const int32_t POSITION_CLOUD = 2;
68 const int32_t POSITION_BOTH = 3;
69 
70 const int32_t NO_THM_TO_DOWNLOAD = 2;
71 const int32_t TO_DOWNLOAD_THM = 1;
72 const int32_t DOWNLOADED_THM = 0;
73 
74 const int32_t FILE = 0;
75 const int32_t DIRECTORY = 1;
76 
77 const int32_t MILLISECOND_TO_SECOND = 1000;
78 const int32_t SECOND_TO_MILLISECOND = 1000;
79 const int64_t MILLISECOND_TO_NANOSECOND = 1e6;
80 
81 const int32_t NOT_IN_TRASH = 0;
82 const int32_t NOT_IN_PENDING = 0;
83 const int32_t NOT_HIDDEN = 0;
84 const int32_t NOT_TEMP_FILE = 0;
85 const int32_t IS_BURST_COVER = 1;
86 
87 const std::string GALLERY_BUNDLE_NAME = "com.ohos.photos";
88 const std::string MEDIALIBRARY_BUNDLE_NAME = "com.ohos.medialibrary.medialibrarydata";
89 
90 static const std::string CLOUDSYNC_STATUS_KEY = "persist.kernel.cloudsync.status";
91 static const std::string CLOUDSYNC_STATUS_LOGOUT = "0";
92 static const std::string CLOUDSYNC_STATUS_START = "1";
93 static const std::string CLOUDSYNC_STATUS_INC_SYNC = "2";
94 static const std::string CLOUDSYNC_STATUS_FULL_SYNC = "3";
95 static const std::string CLOUDSYNC_STATUS_FINISH = "4";
96 static const std::string CLOUDSYNC_STATUS_SWITCHOFF = "5";
97 
GetCurrentTimeStamp()98 static inline uint64_t GetCurrentTimeStamp()
99 {
100     struct timespec t;
101     clock_gettime(CLOCK_REALTIME, &t);
102     return t.tv_sec * MILLISECOND_TO_NANOSECOND + t.tv_nsec / SECOND_TO_MILLISECOND;
103 }
104 } // namespace OHOS::FileManagement::CloudSync
105 #endif // OHOS_CLOUD_SYNC_SERVICE_DATA_SYNC_CONST_H
106