1 / 12

Department of Computer Science

Basics of OSGi and Phidgets May 24, 2007. Department of Computer Science. Guillermo Hernandez, Jose Reyes Alamo. Understanding the basics of OSGi and Phidgets Programming. Smart Home Lab Iowa State University.

borka
Download Presentation

Department of Computer Science

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Basics of OSGi and Phidgets • May 24, 2007 Department of Computer Science Guillermo Hernandez, Jose Reyes Alamo Understanding the basics of OSGi and Phidgets Programming Smart Home Lab Iowa State University

  2. Definition - User-friendly system available for controlling and sensing the environment from your computer. No hardware knowledge needed, just a matter of plugging into the USB port on your computer and use Phidgets software libraries to access these devices. • Basics of OSGi and Phidgets • May 24, 2007 Phidgets Department of Computer Science Guillermo Hernández, José M. Reyes Álamo

  3. Connect one end of a USB cable to the phidget and the other end to the computer. (Optional) If the phidget requires power make sure to plug it to a power source. • Basics of OSGi and Phidgets • May 24, 2007 Phidgets Hardware Installation Department of Computer Science Guillermo Hernández, José M. Reyes Álamo

  4. Go to www.phidget.com and click on downloads. Click on the link for Phidget21 Downloads Download the file PHIDGET.MSI Install the PHIDGET.MSI. This file allows your OS to easily interact with the Phidgets. Download Java JNI Library - Phidget21 to a known location. This is a .jar file that will be used later for application development. • Basics of OSGi and Phidgets • May 24, 2007 Phidgets Software Intallation Department of Computer Science Guillermo Hernández, José M. Reyes Álamo

  5. Open Eclipse and go to File NewProject and select Java Project Click Next and give an appropriate name to the project and click Finish. RIGHT click under you project name and click on Properties On the menu to the left, click on Java Build Path On the Tab Menu click on Libraries Click on Add External JARs. Locate the file called phidget21.jar (just downloaded) Create a new Class Import the following packages: com.phidget.* and com.phidget.event.* • Basics of OSGi and Phidgets • May 24, 2007 Using Phidgets – RFID Project Department of Computer Science Guillermo Hernández, José M. Reyes Álamo

  6. import com.phidgets.*; import com.phidgets.event.*; public class RFIDExample{ public static final void main(String args[]) throws Exception { RFIDPhidget rfid; rfid = new RFIDPhidget(); rfid.addTagGainListener(new TagGainListener(){ public void tagGained(TagGainEvent oe){ System.out.println(oe); } }); rfid.openAny(); rfid.waitForAttachment(); System.out.println("Serial: " + rfid.getSerialNumber()); System.out.println("Outputs: " + rfid.getOutputCount()); rfid.setAntennaOn(true); rfid.setLEDOn(true); System.in.read(); rfid.close(); rfid = null; } } • Basics of OSGi and Phidgets • May 24, 2007 Department of Computer Science Guillermo Hernández, José M. Reyes Álamo

  7. What is OSGi? OSGi stands for Open Services Gateway Initiative. It is an open standards organization composed of companies like Sun Microsystems, IBM, Motorola among many others. Provides a Java based service platform that can be remotely managed. • Basics of OSGi and Phidgets • May 24, 2007 OSGi Department of Computer Science Guillermo Hernández, José M. Reyes Álamo

  8. Key terms in OSGi Bundle- a java JAR file that contains service definition and implementation. Service- a function provided by a bundle. (e.g. reading the temperature of a temperature sensor). Framework- the central component of OSGi. It is the execution environment for services and bundles. • Basics of OSGi and Phidgets • May 24, 2007 OSGi Department of Computer Science Guillermo Hernández, José M. Reyes Álamo

  9. Basics of OSGi and Phidgets • May 24, 2007 OSGi Department of Computer Science Guillermo Hernández, José M. Reyes Álamo Figure 1- OSGi Framework

  10. Basics of OSGi and Phidgets • May 24, 2007 OSGi Department of Computer Science Guillermo Hernández, José M. Reyes Álamo Figure 2- Service Oriented Framework

  11. Basics of OSGi and Phidgets • May 24, 2007 OSGi Department of Computer Science Guillermo Hernández, José M. Reyes Álamo Code Demonstration • How to create a bundle • How to create and publish a service • How to use a service

  12. Basics of OSGi and Phidgets • May 24, 2007 Department of Computer Science Guillermo Hernández, José M. Reyes Álamo Questions

More Related