• 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 #include "net_common_event_test.h"
17 
18 namespace OHOS {
19 namespace NetManagerStandard {
NetCommonEventTest(const EventFwk::CommonEventSubscribeInfo & sp)20 NetCommonEventTest::NetCommonEventTest(const EventFwk::CommonEventSubscribeInfo &sp) : CommonEventSubscriber(sp) {}
21 
~NetCommonEventTest()22 NetCommonEventTest::~NetCommonEventTest()
23 {
24     std::cout << "~NetCommonEventTest" << std::endl;
25 }
26 
OnReceiveEvent(const EventFwk::CommonEventData & eventData)27 void NetCommonEventTest::OnReceiveEvent(const EventFwk::CommonEventData &eventData)
28 {
29     const auto &action = eventData.GetWant().GetAction();
30     const auto &data = eventData.GetData();
31     const auto &code = eventData.GetCode();
32     std::cout << "OnReceiveEvent action:" << action << " , data:" << data << ", code:" << code << std::endl;
33     if (action == EventFwk::CommonEventSupport::COMMON_EVENT_HTTP_PROXY_CHANGE) {
34         std::string param = eventData.GetWant().GetStringParam("HttpProxy");
35         std::cout << "Received global httpProxy changed,http proxy info:" << param << std::endl;
36     }
37 }
38 } // namespace NetManagerStandard
39 } // namespace OHOS
40