/**
* Generated by DragonFly
*
*/
package flickruppr.servicetracker;
import org.osgi.framework.BundleContext;
import com.buglabs.application.AbstractServiceTracker;
import com.buglabs.bug.module.camera.pub.ICameraDevice;
import com.buglabs.bug.module.gps.pub.IPositionProvider;
import com.buglabs.bug.module.lcd.pub.IModuleDisplay;
import com.buglabs.bug.module.motion.pub.IMotionSubject;
import flickruppr.ui.FlickrUpprApp;
/**
* Service tracker for the BugApp Bundle.
* Most of it was generated by the Bug Application Wizard.
* Alterations were maid to member variables, doStart(),
* and doStop() methods.
* @author Dragonfly - Bug Application Wizard
* @author Angel Roman - Angel.Roman@mdesystems.com
*/
public class FlickrUpprServiceTracker extends AbstractServiceTracker {
private IMotionSubject motion;
private IPositionProvider position;
private ICameraDevice cam;
private IModuleDisplay display;
public FlickrUpprServiceTracker(BundleContext context) {
super(context);
}
/**
* Determines if the application can start.
*/
public boolean canStart() {
return super.canStart();
}
/**
* Obtains handles to all service dependencies.
* Creates the FlickrUpprApp and displays it.
*/
public void doStart() {
motion = (IMotionSubject) getService(IMotionSubject.class);
position = (IPositionProvider) getService(IPositionProvider.class);
cam = (ICameraDevice) getService(ICameraDevice.class);
display = (IModuleDisplay) getService(IModuleDisplay.class);
FlickrUpprApp ffa = new FlickrUpprApp(display, motion, cam, position);
ffa.createUI();
ffa.show();
}
/**
* Called when a service that this application depends is unregistered.
*/
public void doStop() {
System.out.println("FlickrUpprServiceTracker: stop");
}
/**
* Allows the user to set the service dependencies by
* adding them to services list returned by getServices().
* i.e. getServices().add(MyService.class.getName());
*/
public void initServices() {
getServices().add("com.buglabs.bug.module.camera.pub.ICameraDevice");
getServices().add("com.buglabs.bug.module.gps.pub.IPositionProvider");
getServices().add("com.buglabs.bug.module.motion.pub.IMotionSubject");
getServices().add("com.buglabs.bug.module.lcd.pub.IModuleDisplay");
}
}