Search in sources :

Example 1 with MyCtrlPoint

use of org.apache.felix.upnp.basedriver.importer.core.MyCtrlPoint in project felix by apache.

the class Activator method doInitImporter.

/**
 * Method used for initilizing the Import component of the UPnP Base Driver
 *
 * @since 0.3
 */
private void doInitImporter() {
    boolean useImporter = Boolean.valueOf(configuration.getProperty(Constants.IMPORTER_ENABLED_PROP, "true")).booleanValue();
    if (!useImporter)
        return;
    // Setting up Base Driver Importer
    this.notifierQueue = new NotifierQueue();
    this.subQueue = new SubscriptionQueue();
    ctrl = new MyCtrlPoint(Activator.bc, subQueue, notifierQueue);
    // Enable CyberLink re-new for Event
    ctrl.setNMPRMode(true);
    this.monitor = new Monitor();
    this.notifier = new Notifier(notifierQueue, monitor);
    this.subScriber = new SubScriber(ctrl, subQueue, monitor);
    ctrl.start();
    subScriber.start();
    notifier.start();
}
Also used : SubscriptionQueue(org.apache.felix.upnp.basedriver.importer.core.event.structs.SubscriptionQueue) Monitor(org.apache.felix.upnp.basedriver.importer.core.event.structs.Monitor) NotifierQueue(org.apache.felix.upnp.basedriver.importer.core.event.structs.NotifierQueue) MyCtrlPoint(org.apache.felix.upnp.basedriver.importer.core.MyCtrlPoint) SubScriber(org.apache.felix.upnp.basedriver.importer.core.event.thread.SubScriber) Notifier(org.apache.felix.upnp.basedriver.importer.core.event.thread.Notifier)

Example 2 with MyCtrlPoint

use of org.apache.felix.upnp.basedriver.importer.core.MyCtrlPoint in project felix by apache.

the class Monitor method updateListener.

public synchronized void updateListener(ListenerModified msg, SubscriptionQueue subqueue, MyCtrlPoint ctrl) /*##renew, SidRenewer sidRenewer*/
{
    UPnPEventListener listener = msg.getListener();
    Vector newServices = msg.getNewServices();
    Vector subscribed = new Vector();
    Vector notSubscribed = new Vector();
    for (int i = 0; i < newServices.size(); i++) {
        Service ser = (Service) newServices.elementAt(i);
        if (ser.isSubscribed()) {
            subscribed.add(ser);
        } else {
            notSubscribed.add(ser);
        }
    }
    Vector oldSids = sidListSid.getSidsFromListener(listener);
    // check subscribed services
    if (oldSids == null)
        return;
    for (int i = 0; i < notSubscribed.size(); i++) {
        Service ser = (Service) notSubscribed.elementAt(i);
        subqueue.enqueue(new FirstMessage(ser, listener));
    }
    for (int i = 0; i < oldSids.size(); i++) {
        String oldSid = (String) oldSids.elementAt(i);
        if (!subscribed.contains(oldSid)) {
            // francesco-renew
            // to check -- Listner removal from sid2Listener
            unsubscribeListenerForSid(oldSid, listener, ctrl);
        }
    }
}
Also used : UPnPEventListener(org.osgi.service.upnp.UPnPEventListener) Service(org.cybergarage.upnp.Service) FirstMessage(org.apache.felix.upnp.basedriver.importer.core.event.message.FirstMessage) Vector(java.util.Vector) MyCtrlPoint(org.apache.felix.upnp.basedriver.importer.core.MyCtrlPoint)

Aggregations

MyCtrlPoint (org.apache.felix.upnp.basedriver.importer.core.MyCtrlPoint)2 Vector (java.util.Vector)1 FirstMessage (org.apache.felix.upnp.basedriver.importer.core.event.message.FirstMessage)1 Monitor (org.apache.felix.upnp.basedriver.importer.core.event.structs.Monitor)1 NotifierQueue (org.apache.felix.upnp.basedriver.importer.core.event.structs.NotifierQueue)1 SubscriptionQueue (org.apache.felix.upnp.basedriver.importer.core.event.structs.SubscriptionQueue)1 Notifier (org.apache.felix.upnp.basedriver.importer.core.event.thread.Notifier)1 SubScriber (org.apache.felix.upnp.basedriver.importer.core.event.thread.SubScriber)1 Service (org.cybergarage.upnp.Service)1 UPnPEventListener (org.osgi.service.upnp.UPnPEventListener)1