• 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_MEDIALIBRARY_DEVICE_OPERATIONS_H
17 #define OHOS_MEDIALIBRARY_DEVICE_OPERATIONS_H
18 
19 #include <string>
20 #include <variant>
21 #include <grp.h>
22 #include <securec.h>
23 #include <stdlib.h>
24 #include <unistd.h>
25 
26 #include "album_asset.h"
27 #include "device_manager.h"
28 #include "dm_device_info.h"
29 #include "medialibrary_data_manager_utils.h"
30 #include "medialibrary_db_const.h"
31 #include "medialibrary_device_db.h"
32 #include "medialibrary_device_info.h"
33 #include "rdb_store.h"
34 #include "values_bucket.h"
35 
36 namespace OHOS {
37 namespace Media {
38 class MediaLibraryDeviceOperations {
39 public:
40     MediaLibraryDeviceOperations() = delete;
41     ~MediaLibraryDeviceOperations() = delete;
42 
43     static bool InsertDeviceInfo(const std::shared_ptr<NativeRdb::RdbStore> &rdbStore,
44         const OHOS::Media::MediaLibraryDeviceInfo &deviceInfo, const std::string &bundleName);
45     static bool UpdateDeviceInfo(const std::shared_ptr<NativeRdb::RdbStore> &rdbStore,
46         const OHOS::Media::MediaLibraryDeviceInfo &deviceInfo, const std::string &bundleName);
47     static bool DeleteDeviceInfo(const std::shared_ptr<NativeRdb::RdbStore> &rdbStore, const std::string &udid);
48     static bool UpdateSyncStatus(const std::shared_ptr<NativeRdb::RdbStore> &rdbStore, const std::string &udid,
49         int32_t syncStatus);
50     static bool GetSyncStatusById(const std::shared_ptr<NativeRdb::RdbStore> &rdbStore, const std::string &udid,
51         int32_t &syncStatus);
52     static bool QueryDeviceTable(const std::shared_ptr<NativeRdb::RdbStore> &rdbStore,
53         std::map<std::string, std::set<int>> &excludeMap);
54     static bool GetAllDeviceData(const std::shared_ptr<NativeRdb::RdbStore> &rdbStore,
55         std::vector<MediaLibraryDeviceInfo> &outDeviceList);
56     static bool GetAgingDeviceData(const std::shared_ptr<RdbStore> &rdbStore,
57         std::vector<MediaLibraryDeviceInfo> &outDeviceList);
58     static bool GetAllDeviceUdid(const std::shared_ptr<RdbStore> &rdbStore,
59         std::vector<string> &deviceUdids);
60 };
61 } // namespace Media
62 } // namespace OHOS
63 #endif // OHOS_MEDIALIBRARY_DEVICE_OPERATIONS_H
64