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 CALL_MANAGER_HISYSEVENT_H 17 #define CALL_MANAGER_HISYSEVENT_H 18 19 #include <string> 20 21 #include "telephony_hisysevent.h" 22 23 namespace OHOS { 24 namespace Telephony { 25 static const int64_t NORMAL_DIAL_TIME = 500; // dial time (ms) 26 static const int64_t NORMAL_INCOMING_TIME = 100; // incoming time (ms) 27 static const int64_t NORMAL_ANSWER_TIME = 300; // answer time (ms) 28 29 enum class IncomingCallType { 30 IMS_VOICE_INCOMING = 0, 31 IMS_VIDEO_INCOMING, 32 CS_VOICE_INCOMING, 33 }; 34 35 class CallManagerHisysevent : public TelephonyHiSysEvent { 36 public: 37 static void WriteCallStateBehaviorEvent(const int32_t slotId, const int32_t state, const int32_t index); 38 static void WriteIncomingCallBehaviorEvent(const int32_t slotId, int32_t callType, int32_t callMode); 39 static void WriteIncomingCallFaultEvent(const int32_t slotId, const int32_t callType, const int32_t videoState, 40 const int32_t errCode, const std::string &desc); 41 static void WriteDialCallFaultEvent(const int32_t slotId, const int32_t callType, const int32_t videoState, 42 const int32_t errCode, const std::string &desc); 43 static void WriteAnswerCallFaultEvent(const int32_t slotId, const int32_t callId, const int32_t videoState, 44 const int32_t errCode, const std::string &desc); 45 static void WriteHangUpFaultEvent( 46 const int32_t slotId, const int32_t callId, const int32_t errCode, const std::string &desc); 47 void GetErrorDescription(const int32_t errCode, std::string &errordesc); 48 void SetDialStartTime(); 49 void SetIncomingStartTime(); 50 void SetAnswerStartTime(); 51 void JudgingDialTimeOut(const int32_t slotId, const int32_t callType, const int32_t videoState); 52 void JudgingIncomingTimeOut(const int32_t slotId, const int32_t callType, const int32_t videoState); 53 void JudgingAnswerTimeOut(const int32_t slotId, const int32_t callId, const int32_t videoState); 54 55 private: 56 static int32_t ErrorCodeConversion(const int32_t errCode, CallErrorCode &eventValue); 57 static int32_t CallDataErrorCodeConversion(const int32_t errCode, CallErrorCode &eventValue); 58 static int32_t CallInterfaceErrorCodeConversion(const int32_t errCode, CallErrorCode &eventValue); 59 static int32_t TelephonyErrorCodeConversion(const int32_t errCode, CallErrorCode &eventValue); 60 61 private: 62 int64_t dialStartTime_ = 0; 63 int64_t incomingStartTime_ = 0; 64 int64_t answerStartTime_ = 0; 65 }; 66 } // namespace Telephony 67 } // namespace OHOS 68 69 #endif // CALL_MANAGER_HISYSEVENT_H 70