org.universAAL.support.utils.service.top
Class UtilSensorCallee

Package class diagram package UtilSensorCallee
java.lang.Object
  extended by org.universAAL.middleware.bus.member.BusMember
      extended by org.universAAL.middleware.bus.member.Callee
          extended by org.universAAL.middleware.service.ServiceCallee
              extended by org.universAAL.support.utils.service.top.UtilSensorCallee

public abstract class UtilSensorCallee
extends ServiceCallee

This is an abstract class for those who want to use the typical services of an sensor (get status) over an ontological service. Classes extending this abstract class will be ServiceCallees which handle by default these 1 services. Those considering using UtilSensor could take advantage of this class if they want only to handle those 1 typical services profiles and no more.

Author:
alfiva

Field Summary
 
Fields inherited from class org.universAAL.middleware.bus.member.BusMember
busResourceURI, owner, theBus
 
Constructor Summary
UtilSensorCallee(ModuleContext context, String namespace, Sensor sensor)
          Default constructor of the class.
 
Method Summary
abstract  boolean executeGet()
          When a GET STATUS service request is received, this method is called automatically.
 ServiceResponse handleCall(ServiceCall call)
          The actual service method of the ServiceCallee.
 
Methods inherited from class org.universAAL.middleware.service.ServiceCallee
addNewServiceProfiles, busDyingOut, communicationChannelBroken, getMyID, handleRequest, removeMatchingProfiles
 
Methods inherited from class org.universAAL.middleware.bus.member.BusMember
close, getType, getURI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UtilSensorCallee

public UtilSensorCallee(ModuleContext context,
                        String namespace,
                        Sensor sensor)
                 throws InvalidOntologyUtilException
Default constructor of the class. Takes the same parameters needed by a UtilSensor profile method, in addition to the ModuleContext.

BE CAREFUL: This will only work with sensors that have StatusValue as HAS_VALUE property. Others, like DimmerSensor, will throw an exception.

Parameters:
context - The Module Context of uAAL
namespace - The namespace of your server, ending with the character #
sensor - The ontology instance of the sensor you are controlling. The more properties it has set, the better.
Throws:
InvalidOntologyUtilException - when an sensor is passed that is does not have StatusValue as type restriction of its HAS_VALUE property.
Method Detail

handleCall

public ServiceResponse handleCall(ServiceCall call)
Description copied from class: ServiceCallee
The actual service method of the ServiceCallee. It is called by the bus whenever there is a call that need to be serviced by this ServiceCallee.

Specified by:
handleCall in class ServiceCallee
Parameters:
call - the call that needs to be serviced.
Returns:
the result of the call execution.

executeGet

public abstract boolean executeGet()
When a GET STATUS service request is received, this method is called automatically.

Returns:
The Boolean value representing the measured value property of the sensor.


Copyright © 2014 universAAL Consortium. All Rights Reserved.