• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 CELLULAR_DATA_HISYSEVENT_H
17 #define CELLULAR_DATA_HISYSEVENT_H
18 
19 #include <stdint.h>
20 
21 #include "iosfwd"
22 #include "apn_item.h"
23 #include "telephony_hisysevent.h"
24 
25 namespace OHOS {
26 namespace Telephony {
27 static const int32_t DATA_ACTIVATE_TIME = 1000;
28 static const int32_t SWITCH_ON = 1;
29 static const int32_t SWITCH_OFF = 0;
30 
31 enum class DataDisconnectCause {
32     ON_THE_NETWORK_SIDE = 0,
33     BY_USER,
34     HIGN_PRIORITY_NETWORK,
35     LOST_CONNECTION,
36 };
37 
38 class CellularDataHiSysEvent : public TelephonyHiSysEvent {
39 public:
40     static void WriteDataDeactiveBehaviorEvent(const int32_t slotId, const DataDisconnectCause type,
41         const std::string &apnType = "default");
42     static void WriteDataConnectStateBehaviorEvent(const int32_t slotId, const std::string &apnType,
43         const uint64_t capability, const int32_t state);
44     static void WriteRoamingConnectStateBehaviorEvent(const int32_t state);
45     static void WriteCellularRequestBehaviorEvent(
46         const uint32_t uid, const std::string name, const uint64_t type, const int32_t state);
47     static void WriteDataActivateFaultEvent(const int32_t slotId, const int32_t switchState,
48         const CellularDataErrorCode errorType, const std::string &errorMsg);
49     static void WriteApnInfoBehaviorEvent(const int32_t slotId, struct PdpProfile &apnData);
50     void SetCellularDataActivateStartTime();
51     void JudgingDataActivateTimeOut(const int32_t slotId, const int32_t switchState);
52 
53 private:
54     int64_t dataActivateStartTime_ = 0L;
55 };
56 } // namespace Telephony
57 } // namespace OHOS
58 
59 #endif // CELLULAR_DATA_HISYSEVENT_H
60