org.teleal.cling.android
Class AndroidWifiSwitchableRouter

java.lang.Object
  extended by org.teleal.cling.transport.SwitchableRouterImpl
      extended by org.teleal.cling.android.AndroidWifiSwitchableRouter
All Implemented Interfaces:
Router, SwitchableRouter

public class AndroidWifiSwitchableRouter
extends SwitchableRouterImpl

Switches the network transport layer on/off by monitoring WiFi connectivity.

This implementation listens to connectivity changes in an Android environment. Register the getBroadcastReceiver() instance with intent android.net.conn.CONNECTIVITY_CHANGE.

Author:
Christian Bauer

Constructor Summary
AndroidWifiSwitchableRouter(UpnpServiceConfiguration configuration, ProtocolFactory protocolFactory, android.net.wifi.WifiManager wifiManager, android.net.ConnectivityManager connectivityManager)
           
 
Method Summary
 boolean disable()
           
 boolean enable()
           
 android.content.BroadcastReceiver getBroadcastReceiver()
           
protected  android.net.ConnectivityManager getConnectivityManager()
           
protected  android.net.wifi.WifiManager getWifiManager()
           
 void handleStartFailure(InitializationException ex)
          Called by the SwitchableRouter.enable() method before it returns.
 
Methods inherited from class org.teleal.cling.transport.SwitchableRouterImpl
broadcast, getActiveStreamServers, getConfiguration, getNetworkAddressFactory, getProtocolFactory, isEnabled, received, received, send, send, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AndroidWifiSwitchableRouter

public AndroidWifiSwitchableRouter(UpnpServiceConfiguration configuration,
                                   ProtocolFactory protocolFactory,
                                   android.net.wifi.WifiManager wifiManager,
                                   android.net.ConnectivityManager connectivityManager)
Method Detail

getBroadcastReceiver

public android.content.BroadcastReceiver getBroadcastReceiver()

getWifiManager

protected android.net.wifi.WifiManager getWifiManager()

getConnectivityManager

protected android.net.ConnectivityManager getConnectivityManager()

enable

public boolean enable()
Specified by:
enable in interface SwitchableRouter
Overrides:
enable in class SwitchableRouterImpl
Returns:
true if the router was enabled. false if it's already running.

handleStartFailure

public void handleStartFailure(InitializationException ex)
Description copied from interface: SwitchableRouter
Called by the SwitchableRouter.enable() method before it returns.

Specified by:
handleStartFailure in interface SwitchableRouter
Overrides:
handleStartFailure in class SwitchableRouterImpl
Parameters:
ex - The cause of the failure.

disable

public boolean disable()
Specified by:
disable in interface SwitchableRouter
Overrides:
disable in class SwitchableRouterImpl
Returns:
true if the router was disabled. false if it wasn't running.


Copyright © 2011 Teleal GmbH, Switzerland. All Rights Reserved.