[zb4osgi-changeset] [scm] ZigBee 4 OSGi repository change: r457 - /projects/zb4osgi/sandbox/manlio.bacco/org.aaloa.osgi.zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/Activator.java

scm-notify at zb4osgi.aaloa.org scm-notify at zb4osgi.aaloa.org
Mon Sep 24 17:15:20 CEST 2012


Author: manlio.bacco
Date: Mon Sep 24 17:15:20 2012
New Revision: 457

Log:
added Eventing bundle

Modified:
    projects/zb4osgi/sandbox/manlio.bacco/org.aaloa.osgi.zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/Activator.java

Modified: projects/zb4osgi/sandbox/manlio.bacco/org.aaloa.osgi.zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/Activator.java
==============================================================================
--- projects/zb4osgi/sandbox/manlio.bacco/org.aaloa.osgi.zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/Activator.java (original)
+++ projects/zb4osgi/sandbox/manlio.bacco/org.aaloa.osgi.zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/Activator.java Mon Sep 24 17:15:20 2012
@@ -22,6 +22,7 @@
 
 package it.cnr.isti.zigbee.basedriver;
 
+import it.cnr.isti.zb4osgi.api.Eventing;
 import it.cnr.isti.zigbee.api.ZigBeeDevice;
 import it.cnr.isti.zigbee.basedriver.api.impl.ZigBeeDeviceImpl;
 import it.cnr.isti.zigbee.basedriver.communication.SimpleDriverServiceTracker;
@@ -36,6 +37,7 @@
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.cm.ManagedService;
 
@@ -69,12 +71,13 @@
         ArrayList<ServiceRegistration> devicesOnNode = devices.get(node.getIEEEAddress());
         ServiceRegistration registration = devicesOnNode.get( 0 );
         ZigBeeDeviceImpl dev = (ZigBeeDeviceImpl) 
-            Activator.getBundleContext().getService( registration.getReference() );
+        Activator.getBundleContext().getService( registration.getReference() );
 	 * </pre></code> 
 	 */
-	public static final HashMap<String, ArrayList<ServiceRegistration> > devices = new HashMap<String, ArrayList<ServiceRegistration> >();
+	public static final HashMap<String, ArrayList<ServiceRegistration> > devices = new HashMap<String, ArrayList<ServiceRegistration>>();
 
 	private SimpleDriverServiceTracker tracker;	
+	public static Eventing ev;
 
 	private void registerConfigurableService(){
 
@@ -99,6 +102,20 @@
 		}
 		registerConfigurableService();
 		registerSimpleDriverTracker();
+		registerEventingService();
+	}
+
+	private void registerEventingService(){
+
+		ev = null;
+		try{
+			ServiceReference g = Activator.getBundleContext().getServiceReference(Eventing.class.getName());
+			if(g != null)
+				ev = (Eventing) Activator.getBundleContext().getService(g);
+		}
+		catch(Exception ex){
+			ex.printStackTrace();
+		}
 	}
 
 	private void registerSimpleDriverTracker() {
@@ -137,6 +154,9 @@
 		}
 	}
 
+	public static Eventing getEventingService(){
+		return ev;
+	}
 	/**
 	 * <b>DO NOT USE!! IT IS NEEDED ONLY FOR TEST UNIT PURPOSE</b><br>
 	 * 
@@ -162,4 +182,4 @@
 			return context;
 		}		
 	}	
-}
+}




More information about the Commit mailing list