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 "telephony_hisysevent.h" 23 24 namespace OHOS { 25 namespace Telephony { 26 static const int32_t DATA_ACTIVATE_TIME = 1000; 27 static const int32_t SWITCH_ON = 1; 28 static const int32_t SWITCH_OFF = 0; 29 30 enum class DataDisconnectCause { 31 ON_THE_NETWORK_SIDE = 0, 32 BY_USER, 33 HIGN_PRIORITY_NETWORK, 34 LOST_CONNECTION, 35 }; 36 37 class CellularDataHiSysEvent : public TelephonyHiSysEvent { 38 public: 39 static void WriteDataDeactiveBehaviorEvent(const int32_t slotId, const DataDisconnectCause type); 40 static void WriteDataConnectStateBehaviorEvent(const int32_t state); 41 static void WriteRoamingConnectStateBehaviorEvent(const int32_t state); 42 static void WriteDataActivateFaultEvent(const int32_t slotId, const int32_t switchState, 43 const CellularDataErrorCode errorType, const std::string &errorMsg); 44 void SetCellularDataActivateStartTime(); 45 void JudgingDataActivateTimeOut(const int32_t slotId, const int32_t switchState); 46 47 private: 48 int64_t dataActivateStartTime_ = 0L; 49 }; 50 } // namespace Telephony 51 } // namespace OHOS 52 53 #endif // CELLULAR_DATA_HISYSEVENT_H 54