12ee81decSopenharmony_ci/*
22ee81decSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
32ee81decSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
42ee81decSopenharmony_ci * you may not use this file except in compliance with the License.
52ee81decSopenharmony_ci * You may obtain a copy of the License at
62ee81decSopenharmony_ci *
72ee81decSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0
82ee81decSopenharmony_ci *
92ee81decSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
102ee81decSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
112ee81decSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
122ee81decSopenharmony_ci * See the License for the specific language governing permissions and
132ee81decSopenharmony_ci * limitations under the License.
142ee81decSopenharmony_ci */
152ee81decSopenharmony_ci
162ee81decSopenharmony_ci#include "dslm_bigdata.h"
172ee81decSopenharmony_ci#include "hisysevent.h"
182ee81decSopenharmony_ci
192ee81decSopenharmony_ci#ifdef __cplusplus
202ee81decSopenharmony_ciextern "C" {
212ee81decSopenharmony_ci#endif
222ee81decSopenharmony_cinamespace {
232ee81decSopenharmony_ciconstexpr char STR_EVENT_START_FAILED[] = "SERVICE_START_FAILED";
242ee81decSopenharmony_ciconstexpr char STR_EVENT_INIT_SELF_LEVEL_FAULT[] = "INIT_SELF_LEVEL_FAULT";
252ee81decSopenharmony_ciconstexpr char STR_EVENT_CALL_INTERFACE[] = "CALL_INTERFACE";
262ee81decSopenharmony_ciconstexpr char STR_EVENT_QUERY_INFO[] = "QUERY_INFO";
272ee81decSopenharmony_ciconstexpr char STR_ERROR_TYPE[] = "ERROR_TYPE";
282ee81decSopenharmony_ciconstexpr char STR_ERROR_STR[] = "ERROR_STR";
292ee81decSopenharmony_ciconstexpr char STR_USER_ID[] = "USER_ID";
302ee81decSopenharmony_ciconstexpr char STR_COST_TIME[] = "COST_TIME";
312ee81decSopenharmony_ciconstexpr char STR_RET_CODE[] = "RET_CODE";
322ee81decSopenharmony_ciconstexpr char STR_SEC_LEVEL[] = "SEC_LEVEL";
332ee81decSopenharmony_ciconstexpr char STR_RET_MODE[] = "RET_MODE";
342ee81decSopenharmony_ciconstexpr char STR_LOCAL_MODEL[] = "LOCAL_MODEL";
352ee81decSopenharmony_ciconstexpr char STR_TARGET_MODEL[] = "TARGET_MODEL";
362ee81decSopenharmony_ciconstexpr char STR_PKG_NAME[] = "PKG_NAME";
372ee81decSopenharmony_ciconstexpr char STR_LOCAL_VERSION[] = "LOCAL_VERSION";
382ee81decSopenharmony_ciconstexpr char STR_TARGET_VERSION[] = "TARGET_VERSION";
392ee81decSopenharmony_ciconstexpr char STR_CRED_TYPE[] = "CRED_TYPE";
402ee81decSopenharmony_ci} // namespace
412ee81decSopenharmony_civoid ReportServiceStartFailedEvent(const uint32_t errorType)
422ee81decSopenharmony_ci{
432ee81decSopenharmony_ci    HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::DSLM, STR_EVENT_START_FAILED,
442ee81decSopenharmony_ci        OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, STR_ERROR_TYPE, errorType);
452ee81decSopenharmony_ci}
462ee81decSopenharmony_ci
472ee81decSopenharmony_civoid ReportInitSelfFailedEvent(const char *errorString)
482ee81decSopenharmony_ci{
492ee81decSopenharmony_ci    HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::DSLM, STR_EVENT_INIT_SELF_LEVEL_FAULT,
502ee81decSopenharmony_ci        OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, STR_ERROR_STR, errorString);
512ee81decSopenharmony_ci}
522ee81decSopenharmony_ci
532ee81decSopenharmony_civoid ReportAppInvokeEvent(const AppInvokeEvent *event)
542ee81decSopenharmony_ci{
552ee81decSopenharmony_ci    if (event == nullptr) {
562ee81decSopenharmony_ci        return;
572ee81decSopenharmony_ci    }
582ee81decSopenharmony_ci
592ee81decSopenharmony_ci    HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::DSLM, STR_EVENT_CALL_INTERFACE,
602ee81decSopenharmony_ci        OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, STR_USER_ID, event->uid, STR_COST_TIME, event->costTime,
612ee81decSopenharmony_ci        STR_RET_CODE, event->retCode, STR_SEC_LEVEL, event->secLevel, STR_RET_MODE, event->retMode, STR_LOCAL_MODEL,
622ee81decSopenharmony_ci        event->localModel, STR_TARGET_MODEL, event->targetModel, STR_PKG_NAME, event->pkgName);
632ee81decSopenharmony_ci}
642ee81decSopenharmony_ci
652ee81decSopenharmony_civoid ReportSecurityInfoSyncEvent(const SecurityInfoSyncEvent *event)
662ee81decSopenharmony_ci{
672ee81decSopenharmony_ci    if (event == nullptr) {
682ee81decSopenharmony_ci        return;
692ee81decSopenharmony_ci    }
702ee81decSopenharmony_ci
712ee81decSopenharmony_ci    HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::DSLM, STR_EVENT_QUERY_INFO,
722ee81decSopenharmony_ci        OHOS::HiviewDFX::HiSysEvent::EventType::STATISTIC, STR_LOCAL_MODEL, event->localModel, STR_TARGET_MODEL,
732ee81decSopenharmony_ci        event->targetModel, STR_LOCAL_VERSION, event->localVersion, STR_TARGET_VERSION, event->targetVersion,
742ee81decSopenharmony_ci        STR_CRED_TYPE, event->credType, STR_RET_CODE, event->retCode, STR_COST_TIME, event->costTime, STR_SEC_LEVEL,
752ee81decSopenharmony_ci        event->secLevel);
762ee81decSopenharmony_ci}
772ee81decSopenharmony_ci
782ee81decSopenharmony_ci#ifdef __cplusplus
792ee81decSopenharmony_ci}
802ee81decSopenharmony_ci#endif
81