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 DMD_REPORT_H 17 #define DMD_REPORT_H 18 19 #include <map> 20 #include <mutex> 21 #include <string> 22 23 namespace OHOS { 24 namespace Sensors { 25 enum SensorEventId { 26 CLASS_NOT_FOUND = 951000107, 27 NATIVE_METHOD_REGISTER_EXCEPTION = 951000108, 28 MISC_SERVICE_EXCEPTION = 951000111, 29 MISC_SERVICE_IPC_EXCEPTION = 951000113, 30 LIGHT_HDF_SERVICE_EXCEPTION = 951000115, 31 VIBRATOR_HDF_SERVICE_EXCEPTION = 951000116, 32 }; 33 34 class DmdReport { 35 public: 36 DmdReport() = default; 37 virtual ~DmdReport() = default; 38 static void ReportException(int32_t eventId, const std::string &interfaceName, int32_t error); 39 40 private: 41 static std::mutex eventMutex_; 42 static std::map<int32_t, int64_t> eventMap_; 43 }; 44 } // namespace Sensors 45 } // namespace OHOS 46 #endif // DMD_REPORT_H 47