public class AndroidRouter extends RouterImpl
| Modifier and Type | Field and Description |
|---|---|
protected android.content.BroadcastReceiver |
broadcastReceiver |
protected android.net.wifi.WifiManager.MulticastLock |
multicastLock |
protected android.net.NetworkInfo |
networkInfo |
protected android.net.wifi.WifiManager.WifiLock |
wifiLock |
configuration, datagramIOs, enabled, multicastReceivers, networkAddressFactory, protocolFactory, readLock, routerLock, streamClient, streamServers, writeLock| Constructor and Description |
|---|
AndroidRouter(UpnpServiceConfiguration configuration,
ProtocolFactory protocolFactory,
android.content.Context context) |
| Modifier and Type | Method and Description |
|---|---|
protected android.content.BroadcastReceiver |
createConnectivityBroadcastReceiver() |
protected android.net.wifi.WifiManager.WifiLock |
createWiFiLock() |
boolean |
disable()
Unbinds all sockets and stops all listening threads for datagrams and streams.
|
boolean |
enable()
Initializes listening services: First an instance of
MulticastReceiver
is bound to each network interface. |
boolean |
enableWiFi() |
protected int |
getLockTimeoutMillis() |
android.net.NetworkInfo |
getNetworkInfo() |
protected void |
handleRouterExceptionOnNetworkTypeChange(RouterException ex)
Handles errors when network has been switched, during reception of
network switch broadcast.
|
boolean |
isEthernet() |
boolean |
isMobile() |
boolean |
isWifi() |
protected void |
onNetworkTypeChange(android.net.NetworkInfo oldNetwork,
android.net.NetworkInfo newNetwork)
Can be overriden by subclasses to do additional work.
|
protected void |
setWifiLock(boolean enable) |
protected void |
setWiFiMulticastLock(boolean enable) |
void |
shutdown()
Disables the router and releases all other resources.
|
void |
unregisterBroadcastReceiver() |
broadcast, disable, enable, getActiveStreamServers, getConfiguration, getProtocolFactory, handleStartFailure, isEnabled, lock, lock, received, received, send, send, startAddressBasedTransports, startInterfaceBasedTransports, unlockprotected android.net.wifi.WifiManager.MulticastLock multicastLock
protected android.net.wifi.WifiManager.WifiLock wifiLock
protected android.net.NetworkInfo networkInfo
protected android.content.BroadcastReceiver broadcastReceiver
public AndroidRouter(UpnpServiceConfiguration configuration, ProtocolFactory protocolFactory, android.content.Context context) throws InitializationException
InitializationExceptionprotected android.content.BroadcastReceiver createConnectivityBroadcastReceiver()
protected int getLockTimeoutMillis()
getLockTimeoutMillis in class RouterImplpublic void shutdown()
throws RouterException
Routershutdown in interface Routershutdown in class RouterImplRouterExceptionpublic boolean enable()
throws RouterException
RouterImplMulticastReceiver
is bound to each network interface. Then an instance of DatagramIO and
StreamServer is bound to each bind address returned by the network
address factory, respectively. There is only one instance of
StreamClient created and managed by this router.enable in interface Routerenable in class RouterImpltrue if the router was enabled. false if it's already running.RouterExceptionpublic boolean disable()
throws RouterException
Routerdisable in interface Routerdisable in class RouterImpltrue if the router was disabled. false if it wasn't running.RouterExceptionpublic android.net.NetworkInfo getNetworkInfo()
public boolean isMobile()
public boolean isWifi()
public boolean isEthernet()
public boolean enableWiFi()
public void unregisterBroadcastReceiver()
protected void setWiFiMulticastLock(boolean enable)
protected void setWifiLock(boolean enable)
protected android.net.wifi.WifiManager.WifiLock createWiFiLock()
protected void onNetworkTypeChange(android.net.NetworkInfo oldNetwork,
android.net.NetworkInfo newNetwork)
throws RouterException
oldNetwork - null when first called by constructor.RouterExceptionprotected void handleRouterExceptionOnNetworkTypeChange(RouterException ex)
Copyright © 2014 4th Line GmbH, Switzerland. All Rights Reserved.