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 #ifndef DISTRIBUTEDDATAMGR_RDB_RADAR_REPORTER_H 17 #define DISTRIBUTEDDATAMGR_RDB_RADAR_REPORTER_H 18 19 #include <string> 20 #include <mutex> 21 namespace OHOS::NativeRdb { 22 23 enum Scene : int { 24 SCENE_SYNC = 1, 25 }; 26 27 enum State : int { 28 STATE_START = 1, 29 STATE_FINISH = 2, 30 }; 31 32 enum SyncStage : int { 33 SYNC_STAGE_RUN = 1, 34 }; 35 36 enum StageRes : int { 37 RES_IDLE = 0, 38 RES_SUCCESS = 1, 39 RES_FAILED = 2, 40 RES_CANCELLED = 3, 41 RES_UNKNOW = 4, 42 }; 43 44 class RdbRadar { 45 public: 46 RdbRadar(Scene scene, const char *funcName, std::string bundleName); 47 ~RdbRadar(); 48 49 RdbRadar &operator=(int x); 50 operator int() const; 51 52 private: 53 int errCode_{ 0 }; 54 Scene scene_; 55 const char* funcName_; 56 std::string bundleName_; 57 58 static std::string hostPkg_; 59 static std::mutex mutex_; 60 61 void LocalReport(int bizSence, const char *funcName, int state, int errCode = 0); 62 std::string GetHostPkgInfo(); 63 }; 64 } // namespace OHOS::NativeRdb 65 #endif //DISTRIBUTEDDATAMGR_RDB_RADAR_REPORTER_H 66