Exemple #1
0
 public void sendSituation() {
   // 10 situation
   PanicButtonSensor p10 = new PanicButtonSensor(URIROOT + "panic10");
   p10.setProperty(PhysicalThing.PROP_CARRIED_BY, new User(URIROOT + "user1"));
   p10.setProperty(PhysicalThing.PROP_IS_PORTABLE, new Boolean(true));
   p10.setLocation(new Location(URIROOT + "location10"));
   this.publish(new ContextEvent(p10, PhysicalThing.PROP_PHYSICAL_LOCATION));
 }
Exemple #2
0
 // I cant have a preset collection of events because timestamp and URI are
 // set at construction
 public static ContextEvent getSample(int sample) {
   switch (sample) {
     case 0:
       // 1 User is awake
       User u1 = new User(URIROOT + "user1");
       u1.setProperty(Profilable.PROP_HAS_PROFILE, new UserProfile(URIROOT + "user1Profile"));
       return new ContextEvent(u1, Profilable.PROP_HAS_PROFILE);
     case 1:
       // 2 Blind is open
       BlindController b2 = new BlindController(URIROOT + "blind4");
       b2.setProperty(BlindController.PROP_HAS_VALUE, new Integer(100));
       return new ContextEvent(b2, BlindController.PROP_HAS_VALUE);
     case 2:
       // 3 chair is in place
       Furniture f3 = new Furniture(URIROOT + "furniture5");
       f3.setFurnitureType(FurnitureType.Chair);
       f3.setLocation(new Location(URIROOT + "location" + new Integer(6)));
       return new ContextEvent(f3, Furniture.PROP_PHYSICAL_LOCATION);
     case 3:
       // 4 light is on
       LightController ls4 = new LightController(URIROOT + "light6");
       ls4.setValue(new Integer(100));
       return new ContextEvent(ls4, LightController.PROP_HAS_VALUE);
     case 4:
       // 7 socket at 50%
       DimmerController ss5 = new DimmerController(URIROOT + "socket7");
       ss5.setValue(new Integer(100));
       return new ContextEvent(ss5, DimmerController.PROP_HAS_VALUE);
     case 5:
       // 6 temperature measured
       TemperatureSensor ts6 = new TemperatureSensor(URIROOT + "tempsensor8");
       ts6.setValue(30);
       return new ContextEvent(ts6, TemperatureSensor.PROP_HAS_VALUE);
     case 6:
       // 7 window closed
       WindowController w7 = new WindowController(URIROOT + "window9");
       w7.setValue(StatusValue.Activated);
       return new ContextEvent(w7, WindowController.PROP_HAS_VALUE);
     default:
       // 10 situation
       PanicButtonSensor p10 = new PanicButtonSensor(URIROOT + "panic10");
       p10.setProperty(PhysicalThing.PROP_CARRIED_BY, new User(URIROOT + "user" + new Integer(5)));
       p10.setProperty(PhysicalThing.PROP_IS_PORTABLE, new Boolean(true));
       p10.setLocation(new Location(URIROOT + "location" + new Integer(10)));
       return new ContextEvent(p10, PhysicalThing.PROP_PHYSICAL_LOCATION);
   }
 }