[
https://issues.apache.org/jira/browse/FELIX-642?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Felsing updated FELIX-642:
---------------------------------
Description:
Ok...overall problem is as follows:
upnp event delivery to OSGi event listeners fails on random devices after a
certain period of time
Overall Environment Setup
-------------------------
- i have two hosts A and B => A is a Bridge exporting about 20 devices at the
moment (will get more - it's a X10 like system), B acts as a central server for
the devices (Smart Home implementation)
- A is a SensorBridge...and B a central controlpoint importing all those devices
- both ends use upnpbasedriver 0.8 and extra bundle from felix project
- the two hosts are connected through a Gigabit Switch (NO WIRELESS USED!)
- all the devices on the server (so the central smart home controller) that get
imported get refined. They subscribe to the upnp device it refines to get
notified on event change.
- on the central server (Host B) i subscribe to UPnP Devices exported by Host
A using UPnPSubscriber Helper class of the extra bundle
Issues
------
- "SOMETIMES" on initial subscription not all devices get notified about the
initial status (devices get found properly though)
- after some time of operation random devices begin to fail - that means..they
do not get notified about event changes anymore, but devices are still present
(so they are still there as UPnPDevice instances in the central server)....
=> i had debug enabled....and as i see i still receive the event-change
notifies on my Host B (=central server)....if i "resubscribe" to the event
listener of the failed device everything works again (i dont need to restart
the whole basedriver or osgi framework to let it work again - just my refining
driver must be restarted which does the subscription to the devices using
UPnPSubscriber class) ...
Tests:
-----------------
- yes - every device exported by the upnpsensorbridge (=Host A) gets found by
the central server (=Host B)
- upnp tester of felix project experiences same issues
- the REFINED devices on the SERVER themselves are using the felix helper class
to subscribe to the events:
// create upnp listener - if evented is true
subscriber = new UPnPSubscriber(bundleContext, this);
subscriber.subscribeAllServicesOf(super.getUPnPDeviceUDN());
- i also tried: EventListener test = new EventListener();
servReg =
context.registerService(UPnPEventListener.class.getName(), test, null);
(so not using UPnPSubscriber) => same problem...so UPnPSubscriber may not be
the root of the problem
- the upnp device implementation on the host exporting the upnp devices ( =Host
A, sensorbridge) are using the following line to expose event notifier
// setup event notifier
notify_switch = new UPnPEventNotifier(context, this,
switchdevswitchservice, switchDev);
if you need something else please contact me! :)
was:
Is it possible that my issue is connected to this one mentioned in the
cyberlink forum?
Stefano answered to it in the cyberlink forum!!
http://sourceforge.net/forum/forum.php?thread_id=1952657&forum_id=258158
----------------------------------------------------------------------------------------------------------------------------
Some other valuable information:
Hi Daniel,
let's try to summarize this long thread, so that we can get a clear vision on
what is going on, and you can correct my wrong understanding
Overall Environment Setup
-------------------------
- You have two computer connected togheter by means of a switch. And they are
the only two computer on the network
- The first computer runs Felix + UPnP Base Driver
- The second computer runs Equinox + UPnP Base Driver + *your* Sensor Base
Driver + Sensor2UPnP Bridge
Issues
------
- If you subscribe from the PC running Felix to all the UPnP Device exported
by the UPnP Base Driver running on Equinox and created by your Sensor2UPnP
bridge you miss some of the notification.
Questions & Tests
-----------------
- Can you create a JIRA issue for your issue, so that it will easy to track
and you will be able to post your code as zip file, instead of copy & paste
- During your testing have you always discovered all the device exported by
the Equinox computer in the Felix computer?
- Do you miss notification even on the Equinox computer?
Ciao,
Stefano "Kismet" Lenzi
Overall Environment Setup:
--------------------------
- yes, connected by a switch
- the first computer is a UPnP Bridge for a X10 "like" system..i wrote a
basedriver and upnpbridgedriver (bridgedriver is creating upnp devices for
every x10 base device). It is using felix + upnpbasedriver
- the second computer acts as a server (central control point for a smart home
system implementation) it's using felix also (but for developing eclipse
equinox since it's more comfortable to develop) This second computer uses
basedriver to import the devices xposed by the first computer...and a
refinement driver is creating new objects for every upnp device found (e.g. a
light device and so on)
Issues:
------
- all the devices on the server (so the central smart home controller) that get
imported get refined. They subscribe to the upnp device it refines to get
notified on event change.
Problem is: not all devices refined devices which act as listeners on the
SERVER get notified on INITIAL subscription (when i subscribe the device with
felix tester also no notification is delivered....)...when this happens and i
actually change the state of a sensor a notification is sent (to the device and
upnp felix tester) and everything begins to work properly.
Question & Tests:
-----------------
- yes i can :)
- yes - every device exported by the upnpsensorbridge (=Felix Computer) gets
found by the central server (=equinox computer) It is really just an issue with
single "upnpservices". Here i saw something strange. When i restart the
bridgeDriver on Felix computer (exporting my upnp devices) The
"getCurrentValue()" methods get called more and more often the more often i
restart the "bridgeDriver". Is this a normal behavior? It seems to me as state
variables Of the services get mixed up or not cancelled when unregistering or
something.
- i have only one computer where i test the notification -> on the central
equinox server computer.
On the felix computer exporting my upnp devices i am justwondering about the
strange calls to "getCurrentValue" i described you
some code parts that may be for particular interest:
---------------------------------------------------------------------
UPnP Event Tester code on the SERVER side (central server importing the upnp
devices from the second one)
public class Activator implements BundleActivator {
private ServiceRegistration servReg;
/*
* (non-Javadoc)
* @see
org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
EventListener test = new EventListener();
servReg =
context.registerService(UPnPEventListener.class.getName(), test, null);
}
/*
* (non-Javadoc)
* @see
org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
servReg.unregister();
}
}
public class EventListener implements UPnPEventListener {
private ArrayList<String> knownDevs = new ArrayList<String>();
@Override
public synchronized void notifyUPnPEvent(String deviceId, String
serviceId, Dictionary events) {
String output = "";
output += deviceId + " " + serviceId;
Enumeration eventit = events.keys();
while (eventit.hasMoreElements()) {
String key = (String) eventit.nextElement();
output += key + " " + events.get(key) + "\n";
}
if (!knownDevs.contains(deviceId)) {
knownDevs.add(deviceId);
}
System.err.println(output + "#diff Devices:" +
knownDevs.size());
System.err.flush();
}
}
the REFINED devices on the SERVER themselves are using the felix helper class
to subscribe to the events:
// create upnp listener - if evented is true
subscriber = new UPnPSubscriber(bundleContext, this);
subscriber.subscribeAllServicesOf(super.getUPnPDeviceUDN());
the upnp device implementation on the host exporting the upnp devices are using
the following line to expose event notifier
// setup event notifier
notify_switch = new UPnPEventNotifier(context, this,
switchdevswitchservice, switchDev);
if you need something else please contact me! :)
Summary: upnp event delivery to OSGi event listeners fails on random
devices after a certain period of time (was: initial event delivery for new
event listeners fails random devices)
> upnp event delivery to OSGi event listeners fails on random devices after a
> certain period of time
> --------------------------------------------------------------------------------------------------
>
> Key: FELIX-642
> URL: https://issues.apache.org/jira/browse/FELIX-642
> Project: Felix
> Issue Type: Bug
> Components: UPnP Subproject
> Affects Versions: upnp-basedriver-0.8.0
> Reporter: Daniel Felsing
> Priority: Blocker
> Fix For: upnp-basedriver-0.8.0
>
>
> Ok...overall problem is as follows:
> upnp event delivery to OSGi event listeners fails on random devices after a
> certain period of time
> Overall Environment Setup
> -------------------------
> - i have two hosts A and B => A is a Bridge exporting about 20 devices at the
> moment (will get more - it's a X10 like system), B acts as a central server
> for the devices (Smart Home implementation)
> - A is a SensorBridge...and B a central controlpoint importing all those
> devices
> - both ends use upnpbasedriver 0.8 and extra bundle from felix project
> - the two hosts are connected through a Gigabit Switch (NO WIRELESS USED!)
> - all the devices on the server (so the central smart home controller) that
> get imported get refined. They subscribe to the upnp device it refines to get
> notified on event change.
> - on the central server (Host B) i subscribe to UPnP Devices exported by
> Host A using UPnPSubscriber Helper class of the extra bundle
> Issues
> ------
> - "SOMETIMES" on initial subscription not all devices get notified about the
> initial status (devices get found properly though)
> - after some time of operation random devices begin to fail - that
> means..they do not get notified about event changes anymore, but devices are
> still present (so they are still there as UPnPDevice instances in the central
> server)....
> => i had debug enabled....and as i see i still receive the event-change
> notifies on my Host B (=central server)....if i "resubscribe" to the event
> listener of the failed device everything works again (i dont need to restart
> the whole basedriver or osgi framework to let it work again - just my
> refining driver must be restarted which does the subscription to the devices
> using UPnPSubscriber class) ...
> Tests:
> -----------------
> - yes - every device exported by the upnpsensorbridge (=Host A) gets found by
> the central server (=Host B)
> - upnp tester of felix project experiences same issues
> - the REFINED devices on the SERVER themselves are using the felix helper
> class to subscribe to the events:
> // create upnp listener - if evented is true
> subscriber = new UPnPSubscriber(bundleContext, this);
> subscriber.subscribeAllServicesOf(super.getUPnPDeviceUDN());
> - i also tried: EventListener test = new EventListener();
> servReg =
> context.registerService(UPnPEventListener.class.getName(), test, null);
> (so not using UPnPSubscriber) => same problem...so UPnPSubscriber may not be
> the root of the problem
> - the upnp device implementation on the host exporting the upnp devices (
> =Host A, sensorbridge) are using the following line to expose event notifier
> // setup event notifier
> notify_switch = new UPnPEventNotifier(context, this,
> switchdevswitchservice, switchDev);
> if you need something else please contact me! :)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.