/* * * Copyright (c) 2020 Project CHIP Authors * Copyright (c) 2019 Nest Labs, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* this file behaves like a config.h, comes first */ #include #include #include #include #include #include #include #include #include #include #if INET_CONFIG_ENABLE_TCP_ENDPOINT #include #endif #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE #include #endif #if CHIP_DEVICE_CONFIG_ENABLE_THREAD #include #endif #include "filogic.h" #include "mdns.h" #include "mt7933_pos.h" using namespace ::chip; using namespace ::chip::Inet; using namespace ::chip::System; using namespace ::chip::DeviceLayer::Internal; namespace chip { namespace DeviceLayer { #if CHIP_DEVICE_CONFIG_ENABLE_WIFI ConnectivityManagerImpl ConnectivityManagerImpl::sInstance; #endif CHIP_ERROR ConnectivityManagerImpl::_Init() { CHIP_ERROR err = CHIP_NO_ERROR; // Initialize the generic base classes that require it. #if CHIP_DEVICE_CONFIG_ENABLE_THREAD GenericConnectivityManagerImpl_Thread::_Init(); #endif #if CHIP_DEVICE_CONFIG_ENABLE_WIFI err = WiFiInit(); SuccessOrExit(err); #endif exit: return err; } void ConnectivityManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) { ChipLogProgress(DeviceLayer, "%s", __func__); // Forward the event to the generic base classes as needed. #if CHIP_DEVICE_CONFIG_ENABLE_THREAD GenericConnectivityManagerImpl_Thread::_OnPlatformEvent(event); #endif #if CHIP_DEVICE_CONFIG_ENABLE_WIFI _OnWiFiPlatformEvent(event); #endif OnInternetConnectivityChangeEvent(event); } void ConnectivityManagerImpl::OnInternetConnectivityChangeEvent(const ChipDeviceEvent * event) { if (event->Type != DeviceEventType::kInternetConnectivityChange) return; ChipLogProgress(DeviceLayer, "%s", __func__); // chip::app::DnssdServer::Instance().StartServer(); // if (event->InternetConnectivityChange.IPv4 == kConnectivity_Established || // event->InternetConnectivityChange.IPv6 == kConnectivity_Established) { mdns_update_interface(); } } } // namespace DeviceLayer } // namespace chip