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