53 #include "ndn-cxx-config.hpp"
55 #ifdef NDN_CXX_HAVE_COREFOUNDATION_COREFOUNDATION_H
65 , m_cfLoopEvent(m_scheduler)
82 CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
83 static_cast<void*>(
this),
84 &Impl::afterNotificationCenterEvent,
85 CFSTR(
"com.apple.system.config.network_change"),
87 CFNotificationSuspensionBehaviorDeliverImmediately);
90 NetworkMonitor::Impl::~Impl()
92 CFNotificationCenterRemoveEveryObserver(CFNotificationCenterGetDarwinNotifyCenter(),
93 static_cast<void*>(
this));
97 NetworkMonitor::Impl::afterNotificationCenterEvent(CFNotificationCenterRef center,
101 CFDictionaryRef userInfo)
103 static_cast<Impl*
>(observer)->m_nm.onNetworkStateChanged();
107 NetworkMonitor::Impl::scheduleCfLoop()
110 m_cfLoopEvent = m_scheduler.scheduleEvent(time::seconds(1), bind(&Impl::pollCfLoop,
this));
114 NetworkMonitor::Impl::pollCfLoop()
117 CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0,
true);
125 #endif // NDN_CXX_HAVE_COREFOUNDATION_COREFOUNDATION_H
Impl(NetworkMonitor &nm, boost::asio::io_service &io)
Copyright (c) 2013-2016 Regents of the University of California.