Methods Summary |
---|
public synchronized void | addListener(com.aelitis.net.upnp.UPnPListener listener)
listeners.add( listener );
if ( root_device == null ){
if ( listeners.size() == 1 && !started ){
started = true;
start();
}
}else{
listener.rootDeviceFound( root_device );
}
|
public boolean | isEnabled()
return( enabled );
|
public synchronized void | removeListener(com.aelitis.net.upnp.UPnPListener listener)
listeners.remove( listener );
|
protected void | search()
if ( !enabled ){
return;
}
if ( root_device != null ){
return;
}
try{
boolean found = nat_device.connect();
if ( found ){
root_device = new NatPMPUPnPRootDeviceImpl(upnp, nat_device );
for (int i=0;i<listeners.size();i++){
try{
((UPnPListener)listeners.get(i)).rootDeviceFound( root_device );
}catch( Throwable e ){
Debug.printStackTrace(e);
}
}
}
}catch( Throwable e ){
Debug.printStackTrace(e);
}
|
public void | setEnabled(boolean _enabled)
enabled = _enabled;
|
protected void | start()
SimpleTimer.addPeriodicEvent(
"NATPMP:search",
60*1000,
new TimerEventPerformer()
{
public void
perform(
TimerEvent event )
{
search();
}
});
search();
|