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_conn_callback_observer.h"
17 #include "ntp_update_time.h"
18 #include "time_common.h"
19
20 using namespace OHOS::NetManagerStandard;
21
22 namespace OHOS {
23 namespace MiscServices {
NetAvailable(sptr<NetHandle> & netHandle)24 int32_t NetConnCallbackObserver::NetAvailable(sptr<NetHandle> &netHandle)
25 {
26 return 0;
27 }
28
NetCapabilitiesChange(sptr<NetHandle> & netHandle,const sptr<NetAllCapabilities> & netAllCap)29 int32_t NetConnCallbackObserver::NetCapabilitiesChange(sptr<NetHandle> &netHandle,
30 const sptr<NetAllCapabilities> &netAllCap)
31 {
32 TIME_HILOGD(TIME_MODULE_SERVICE, "Observe net capabilities change. start");
33 if (netAllCap->netCaps_.count(NetCap::NET_CAPABILITY_INTERNET)) {
34 TIME_HILOGD(TIME_MODULE_SERVICE, "Net Capability Internet");
35 DelayedSingleton<NtpUpdateTime>::GetInstance()->SetSystemTime();
36 }
37 TIME_HILOGD(TIME_MODULE_SERVICE, "Observe net capabilities change. end");
38 return 0;
39 }
40
NetConnectionPropertiesChange(sptr<NetHandle> & netHandle,const sptr<NetLinkInfo> & info)41 int32_t NetConnCallbackObserver::NetConnectionPropertiesChange(sptr<NetHandle> &netHandle,
42 const sptr<NetLinkInfo> &info)
43 {
44 return 0;
45 }
46
NetLost(sptr<NetHandle> & netHandle)47 int32_t NetConnCallbackObserver::NetLost(sptr<NetHandle> &netHandle)
48 {
49 return 0;
50 }
51
NetUnavailable()52 int32_t NetConnCallbackObserver::NetUnavailable()
53 {
54 return 0;
55 }
56
NetBlockStatusChange(sptr<NetHandle> & netHandle,bool blocked)57 int32_t NetConnCallbackObserver::NetBlockStatusChange(sptr<NetHandle> &netHandle, bool blocked)
58 {
59 return 0;
60 }
61 } // namespace MiscServices
62 } // namespace OHOS
63