1 /* 2 * Copyright (C) 2024 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 OHOS_IP_QOS_MONITOR_H 17 #define OHOS_IP_QOS_MONITOR_H 18 19 #include "self_cure_service.h" 20 #include "wifi_netlink.h" 21 #include "wifi_net_observer.h" 22 23 namespace OHOS { 24 namespace Wifi { 25 class IpQosMonitor { 26 public: 27 static IpQosMonitor &GetInstance(); 28 void StartMonitor(int32_t arg = 0); 29 void QueryPackets(int32_t arg = 0); 30 void HandleTcpReportMsgComplete(const std::vector<int64_t> &elems, int32_t cmd); 31 void ParseTcpReportMsg(const std::vector<int64_t> &elems, int32_t cmd); 32 void HandleTcpPktsResp(const std::vector<int64_t> &elems); 33 bool ParseNetworkInternetGood(const std::vector<int64_t> &elems); 34 private: 35 bool AllowSelfCureNetwork(int32_t currentRssi); 36 int32_t mInstId = 0; 37 bool mInternetSelfCureAllowed = true; 38 bool mHttpDetectedAllowed = true; 39 int64_t mLastTcpTxCounter = 0; 40 int64_t mLastTcpRxCounter = 0; 41 int32_t mInternetFailedCounter = 0; 42 sptr<NetStateObserver> mNetWorkDetect; 43 }; 44 45 } // namespace Wifi 46 } // namespace OHOS 47 #endif // OHOS_IP_QOS_MONITOR_H