1 /*
2 * Copyright (c) 2023 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 "networkvpn_hisysevent.h"
17 #include "net_event_report.h"
18
19 namespace OHOS {
20 namespace NetManagerStandard {
21
SendFaultEvent(const VpnEventType & isLegacy,const VpnEventOperator & operatorType,const VpnEventErrorType & errorCode,const std::string & errorMsg)22 void VpnHisysEvent::SendFaultEvent(const VpnEventType &isLegacy, const VpnEventOperator &operatorType,
23 const VpnEventErrorType &errorCode, const std::string &errorMsg)
24 {
25 VpnEventInfo eventInfo;
26 eventInfo.legacy = static_cast<int32_t>(isLegacy);
27 eventInfo.operatorType = static_cast<int32_t>(operatorType);
28 eventInfo.errorType = static_cast<int32_t>(errorCode);
29 eventInfo.errorMsg = errorMsg;
30 NetEventReport::SendVpnConnectEvent(eventInfo);
31 }
32
SendFaultEventConnSetting(const VpnEventType & isLegacy,const VpnEventErrorType & errorCode,const std::string & errorMsg)33 void VpnHisysEvent::SendFaultEventConnSetting(const VpnEventType &isLegacy, const VpnEventErrorType &errorCode,
34 const std::string &errorMsg)
35 {
36 VpnEventInfo eventInfo;
37 eventInfo.legacy = static_cast<int32_t>(isLegacy);
38 eventInfo.operatorType = static_cast<int32_t>(VpnEventOperator::OPERATION_CONNECT_SETTING);
39 eventInfo.errorType = static_cast<int32_t>(errorCode);
40 eventInfo.errorMsg = errorMsg;
41 NetEventReport::SendVpnConnectEvent(eventInfo);
42 }
43
SendFaultEventConnDestroy(const VpnEventType & isLegacy,const VpnEventErrorType & errorCode,const std::string & errorMsg)44 void VpnHisysEvent::SendFaultEventConnDestroy(const VpnEventType &isLegacy, const VpnEventErrorType &errorCode,
45 const std::string &errorMsg)
46 {
47 VpnEventInfo eventInfo;
48 eventInfo.legacy = static_cast<int32_t>(isLegacy);
49 eventInfo.operatorType = static_cast<int32_t>(VpnEventOperator::OPERATION_CONNECT_DESTROY);
50 eventInfo.errorType = static_cast<int32_t>(errorCode);
51 eventInfo.errorMsg = errorMsg;
52 NetEventReport::SendVpnConnectEvent(eventInfo);
53 }
54
55 } // namespace NetManagerStandard
56 } // namespace OHOS