• 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 "data_ability_helper.h"
28 #include "device_manager.h"
29 #include "dm_device_info.h"
30 #include "media_data_ability_const.h"
31 #include "media_log.h"
32 #include "medialibrary_data_ability_utils.h"
33 #include "medialibrary_device_db.h"
34 #include "medialibrary_device_info.h"
35 #include "rdb_store.h"
36 #include "values_bucket.h"
37 
38 namespace OHOS {
39 namespace Media {
40 class MediaLibraryDeviceOperations {
41 public:
42     MediaLibraryDeviceOperations();
~MediaLibraryDeviceOperations()43     ~MediaLibraryDeviceOperations() {}
44 
45     bool InsertDeviceInfo(const std::shared_ptr<NativeRdb::RdbStore> &rdbStore,
46                           const OHOS::Media::MediaLibraryDeviceInfo &deviceInfo, const std::string &bundleName);
47     bool UpdateDeviceInfo(const std::shared_ptr<NativeRdb::RdbStore> &rdbStore,
48                           const OHOS::Media::MediaLibraryDeviceInfo &deviceInfo, const std::string &bundleName);
49     bool DeleteDeviceInfo(const std::shared_ptr<NativeRdb::RdbStore> &rdbStore, const std::string &deviceId);
50     bool UpdateSyncStatus(const std::shared_ptr<NativeRdb::RdbStore> &rdbStore, const std::string &deviceId,
51                           int32_t syncStatus, const std::string &bundleName);
52     bool GetSyncStatusById(const std::shared_ptr<NativeRdb::RdbStore> &rdbStore, const std::string &deviceId,
53                            int32_t &syncStatus, const std::string &bundleName);
54     bool QueryDeviceTable(const std::shared_ptr<NativeRdb::RdbStore> &rdbStore,
55                           std::map<std::string, std::set<int>> &excludeMap);
56     bool GetAllDeviceDatas(const std::shared_ptr<NativeRdb::RdbStore> &rdbStore,
57                            vector<MediaLibraryDeviceInfo> &outDeviceList);
58 };
59 } // namespace Media
60 } // namespace OHOS
61 #endif // OHOS_MEDIALIBRARY_DEVICE_OPERATIONS_H