1 /* 2 * Copyright (C) 2022 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 TELEPHONY_HISYSEVENT_H 17 #define TELEPHONY_HISYSEVENT_H 18 19 #include <string> 20 21 #include "hisysevent.h" 22 23 namespace OHOS { 24 namespace Telephony { 25 using EventType = OHOS::HiviewDFX::HiSysEvent::EventType; 26 static constexpr const char *DOMAIN_NAME = "TELEPHONY"; 27 static const int32_t INVALID_PARAMETER = -1; 28 29 enum class CallErrorCode { 30 CALL_ERROR_NONE = 0, 31 CALL_ERROR_PERMISSION_ERR = 1, 32 CALL_ERROR_PHONE_NUMBER_EMPTY, 33 CALL_ERROR_NUMBER_OUT_OF_RANGE, 34 CALL_ERROR_CALL_LOCAL_PTR_NULL, 35 CALL_ERROR_UNKNOW_DIAL_TYPE, 36 CALL_ERROR_INVALID_SLOT_ID, 37 CALL_ERROR_UNKNOW_CALL_TYPE, 38 CALL_ERROR_INVALID_DIAL_SCENE, 39 CALL_ERROR_INVALID_VIDEO_STATE, 40 CALL_ERROR_INVALID_CALLID, 41 CALL_ERROR_DIAL_IS_BUSY = 11, 42 CALL_ERROR_DIAL_TIME_OUT, 43 CALL_ERROR_INCOMING_TIME_OUT, 44 CALL_ERROR_ANSWER_TIME_OUT, 45 CALL_ERROR_SYSTEM_EVENT_HANDLE_FAILURE, 46 CALL_ERROR_INVALID_FDN_NUMBER, 47 CALL_ERROR_DEVICE_NOT_DIALING, 48 CALL_ERROR_MEMSET_FAIL, 49 CALL_ERROR_MEMCPY_FAIL, 50 CALL_ERROR_IPC_CONNECT_STUB_FAIL, 51 CALL_ERROR_IPC_WRITE_DESCRIPTOR_TOKEN_FAIL = 21, 52 CALL_ERROR_IPC_WRITE_DATA_FAIL, 53 CALL_ERROR_IPC_SEND_REQUEST_FAIL, 54 CALL_ERROR_ILLEGAL_CALL_OPERATION, 55 CALL_ERROR_PHONE_CALLSTATE_NOTIFY_FAILED, 56 CALL_ERROR_CALL_ALREADY_EXISTS, 57 CALL_ERROR_UNSUPPORTED_NETWORK_TYPE, 58 CALL_ERROR_CREATE_REQUEST_FAIL, 59 CALL_ERROR_SEND_REQUEST_FAIL, 60 CALL_ERROR_CALL_OBJECT_IS_NULL, 61 CALL_ERROR_UNEXPECTED_SRVCC_STATE = 31, 62 CALL_ERROR_CALL_COUNTS_EXCEED_LIMIT, 63 CALL_ERROR_GET_RADIO_STATE_FAILED, 64 CALL_ERROR_RESOURCE_UNAVAILABLE, 65 CALL_ERROR_CALL_CONNECTION_NOT_EXIST, 66 CALL_ERROR_ARGUMENT_INVALID, 67 CALL_ERROR_IMS_SERVICE_NOT_EXIST, 68 CALL_ERROR_RADIO_RESPONSEINFO_ERROR, 69 }; 70 71 enum class SmsMmsErrorCode { 72 SMS_ERROR_PERMISSION_ERROR = 100, 73 SMS_ERROR_NULL_POINTER, 74 SMS_ERROR_EMPTY_INPUT_PARAMETER, 75 SMS_ERROR_UNKNOWN_NETWORK_TYPE, 76 SMS_ERROR_PDU_ENCODEING_FAIL, 77 SMS_ERROR_EXCEED_MAX_SEGMENT_NUM, 78 SMS_ERROR_SENDSMS_NOT_IN_SERVICE, 79 SMS_ERROR_SMS_CAPABLE_UNSUPPORTED, 80 SMS_ERROR_ADD_TO_DATABASE_FAIL, 81 SMS_ERROR_REPEATED_ERROR, 82 SMS_ERROR_PUBLISH_COMMON_EVENT_FAIL, 83 SMS_ERROR_PDU_DECODE_FAIL, 84 SMS_ERROR_CELL_BROADCAST_PUD_ANALYSIS_FAIL, 85 SMS_ERROR_CREATE_REQUEST_FAIL, 86 SMS_ERROR_SEND_REQUEST_FAIL, 87 SMS_ERROR_MESSAGE_READ_FAIL, 88 SMS_ERROR_BROADCAST_TIME_OUT, 89 }; 90 91 enum class CellularDataErrorCode { 92 DATA_ERROR_PERMISSION_ERROR = 200, 93 DATA_ERROR_DATABASE_WRITE_ERROR, 94 DATA_ERROR_PS_NOT_ATTACH, 95 DATA_ERROR_SIM_NOT_READY, 96 DATA_ERROR_CELLULAR_DATA_SLOT_ID_MISMATCH, 97 DATA_ERROR_ROAMING_SWITCH_OFF_AND_ROAMING, 98 DATA_ERROR_CALL_AND_DATA_NOT_CONCURRENCY, 99 DATA_ERROR_HAS_HIGHER_PRIORITY_CONNECTION, 100 DATA_ERROR_PDP_ACTIVATE_FAIL, 101 DATA_ERROR_PDP_DEACTIVATE_FAIL, 102 DATA_ERROR_DATA_ACTIVATE_TIME_OUT, 103 DATA_ERROR_RADIO_RESPONSEINFO_ERROR, 104 }; 105 106 class TelephonyHiSysEvent { 107 public: 108 template<typename... Types> HiWriteBehaviorEvent(const std::string & eventName,Types...args)109 static void HiWriteBehaviorEvent(const std::string &eventName, Types... args) 110 { 111 OHOS::HiviewDFX::HiSysEvent::Write(DOMAIN_NAME, eventName, EventType::BEHAVIOR, args...); 112 } 113 114 template<typename... Types> HiWriteFaultEvent(const std::string & eventName,Types...args)115 static void HiWriteFaultEvent(const std::string &eventName, Types... args) 116 { 117 OHOS::HiviewDFX::HiSysEvent::Write(DOMAIN_NAME, eventName, EventType::FAULT, args...); 118 } 119 }; 120 } // namespace Telephony 121 } // namespace OHOS 122 #endif // TELEPHONY_HISYSEVENT_H 123