• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 COMMUNICATIONNETSTACK_NETSTACK_CHR_REPORT_H
17 #define COMMUNICATIONNETSTACK_NETSTACK_CHR_REPORT_H
18 
19 #include <chrono>
20 #include "i_netstack_chr_client.h"
21 #include "want.h"
22 
23 namespace OHOS::NetStack::ChrClient {
24 
25 using namespace OHOS::NetStack::ChrClient;
26 
27 class NetStackChrReport {
28 public:
29     NetStackChrReport();
30     ~NetStackChrReport();
31 
32     int ReportCommonEvent(DataTransChrStats chrStats);
33 private:
34     std::chrono::system_clock::time_point lastReceivedTime_;
35     int ignoreReportTimes_ = 0;
36     std::mutex report_mutex_;
37 
38     void SetWantParam(AAFwk::Want& want, DataTransChrStats chrStats);
39     void SetHttpInfoJsonStr(DataTransHttpInfo httpInfo, std::string& httpInfoJsonStr);
40     void SetTcpInfoJsonStr(DataTransTcpInfo tcpInfo, std::string& tcpInfoJsonStr);
41 };
42 }  // namespace OHOS::NatStack::ChrClient
43 #endif // COMMUNICATIONNETSTACK_NETSTACK_CHR_REPORT_H