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 #include "native_call_manager_hisysevent.h"
17
18 namespace OHOS {
19 namespace Telephony {
20 // EVENT
21 static const std::string VOIP_CALL_MANAGER = "VOIP_CALL_MANAGER";
22
23 // KEY
24 static const std::string CALL_ID_KEY = "CALL_ID";
25 static const std::string BUNDL_NAME_KEY = "BUNDL_NAME";
26 static const std::string SCENARIOS_KEY = "SCENARIOS";
27 static const std::string ERR_CODE_KEY = "ERR_CODE";
28 static const std::string ERROR_MSG_KEY = "ERROR_MSG";
29 static const std::string CALL_TYPE_KEY = "CALL_TYPE";
30 static const std::string CALL_STATE_KEY = "CALL_STATE";
31 static const std::string CALL_DIRECTION_KEY = "CALL_DIRECTION";
32 static const std::string TIMESTAMP_KEY = "TIMESTAMP";
33
34 //VALUE
35
WriteVoipCallEvent(const std::string & callId,const std::string & bundleName,const int32_t scenario,const int32_t errCode,const std::string & errorMsg,const int32_t callType,const int32_t callState,const int32_t callDirection)36 void NativeCallManagerHisysevent::WriteVoipCallEvent(const std::string &callId, const std::string &bundleName,
37 const int32_t scenario, const int32_t errCode, const std::string &errorMsg, const int32_t callType,
38 const int32_t callState, const int32_t callDirection)
39 {
40 time_t currentTime = time(0);
41 HiSysEventWrite(DOMAIN_NAME, VOIP_CALL_MANAGER, EventType::FAULT, CALL_ID_KEY, callId, BUNDL_NAME_KEY, bundleName,
42 SCENARIOS_KEY, scenario, ERR_CODE_KEY, errCode, ERROR_MSG_KEY, errorMsg, CALL_TYPE_KEY, callType,
43 CALL_STATE_KEY, callState, CALL_DIRECTION_KEY, callDirection, TIMESTAMP_KEY, static_cast<int64_t>(currentTime));
44 }
45
46 } // namespace Telephony
47 } // namespace OHOS
48