• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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 
17 #ifndef OHOS_MEDIA_DFX_DATABASE_UTILS_H
18 #define OHOS_MEDIA_DFX_DATABASE_UTILS_H
19 
20 #include <string>
21 #include <vector>
22 
23 #include "rdb_helper.h"
24 #include "result_set.h"
25 #include "rdb_predicates.h"
26 #include "dfx_const.h"
27 
28 namespace OHOS {
29 namespace Media {
30 #define EXPORT __attribute__ ((visibility ("default")))
31 
32 struct QuerySizeAndResolution;
33 
34 class DfxDatabaseUtils {
35 public:
36     EXPORT static int32_t QueryFromPhotos(int32_t mediaType, int32_t position);
37     EXPORT static AlbumInfo QueryAlbumInfoBySubtype(int32_t albumSubtype);
38     EXPORT static std::vector<PhotoInfo> QueryDirtyCloudPhoto();
39     EXPORT static int32_t QueryAnalysisVersion(const std::string &table, const std::string &column);
40     EXPORT static int32_t QueryDownloadedAndGeneratedThumb(int32_t& downloadedThumb, int32_t& generatedThumb);
41     EXPORT static int32_t QueryTotalCloudThumb(int32_t& totalDownload);
42     EXPORT static int32_t QueryDbVersion();
43     EXPORT static int32_t QueryPhotoRecordInfo(PhotoRecordInfo &photoRecordInfo);
44     EXPORT static int32_t QueryASTCThumb(bool isLocal);
45     EXPORT static int32_t QueryLCDThumb(bool isLocal);
46     EXPORT static int32_t QueryOperationRecordInfo(OperationRecordInfo &operationRecordInfo);
47     EXPORT static int32_t QueryPhotoErrorCount();
48     EXPORT static void GetPhotoMimeType(std::string &photoMimeType);
49     EXPORT static bool GetSizeAndResolutionInfo(QuerySizeAndResolution &queryInfo);
50 
51 private:
52     static int32_t QueryInt(const NativeRdb::AbsRdbPredicates &predicates, const std::vector<std::string> &columns,
53         const std::string &queryColumn, int32_t &value);
54     static int32_t QueryDouble(const NativeRdb::AbsRdbPredicates &predicates, const std::vector<std::string> &columns,
55         const std::string &queryColumn, double &value);
56     static bool CheckChargingAndScreenOff(bool isReported);
57 };
58 } // namespace Media
59 } // namespace OHOS
60 
61 #endif  // OHOS_MEDIA_DFX_DATABASE_UTILS_H