Commit 1f39d543 authored by aw613's avatar aw613

merged the services for temperature an light to one smart sensor service

parent 8d04e5e3
......@@ -40,7 +40,7 @@ public class GetLightOperation extends Operation
public static Tsl2561 sensor;
public GetLightOperation () {
super(ACT_HW_NAME, LightService.QN_PORTTYPE);
super(ACT_HW_NAME, SmartSensorService.QN_PORTTYPE_BRIGHT);
I2CBus bus;
try {
......
......@@ -40,7 +40,7 @@ public class GetTemperatureOperation extends Operation
public GetTemperatureOperation () {
super(ACT_HW_NAME, TempService.QN_PORTTYPE);
super(ACT_HW_NAME, SmartSensorService.QN_PORTTYPE_TEMP);
sensor = new PhySensor("28-0000045157c3"); //Sensor Thread is started in background
......
package org.ws4d.smartsensor.device;
import org.ws4d.java.communication.DPWSCommunicationManager;
import org.ws4d.java.service.DefaultService;
import org.ws4d.java.types.QName;
import org.ws4d.java.types.URI;
public class SmartSensorService extends DefaultService {
// global settings
public static final String NAMESPACE = "http://www.demo.com/bbsr";//HelloWorldDevice.NAMESPACE;
// public static final String PORTTYPE = "TemperatureInterface";
public static final String PORTTYPE_BRIGHT = "Brightness";
public static final String PORTTYPE_TEMP = "TemperatureInterface";
public static final String ENDPOINT_PATH = "/SunSPOTSensor";
public static final QName QN_PORTTYPE_BRIGHT = new QName(PORTTYPE_BRIGHT, NAMESPACE);
public static final QName QN_PORTTYPE_TEMP = new QName(PORTTYPE_TEMP, NAMESPACE);
public final static URI DOCU_EXAMPLE_SERVICE_ID = new URI(NAMESPACE + ENDPOINT_PATH);
public SmartSensorService() {
super(DPWSCommunicationManager.COMMUNICATION_MANAGER_ID);
// Set the property
// Properties.getInstance().setServiceProperty(this, Properties.PROP_SERVICE_SECURED, false);
this.setServiceId(DOCU_EXAMPLE_SERVICE_ID);
// -- getTemperatureAction --
GetTemperatureOperation getTemperatureAct = new GetTemperatureOperation();
addOperation(getTemperatureAct);
// -- getValuesAction --
GetLightOperation getLightAct = new GetLightOperation();
addOperation(getLightAct);
}
}
\ No newline at end of file
......@@ -19,14 +19,17 @@ public class mainclass {
SensorDevice device = new SensorDevice();
// create service
LightService service = new LightService();
TempService tempservice = new TempService();
SmartSensorService service = new SmartSensorService();
// LightService service = new LightService();
//
// TempService tempservice = new TempService();
// set device properties
// Properties.getInstance().setDeviceProperty(device, Properties.PROP_DEVICE_UUID, "urn:uuid:df0794e0-40d5-11dc-9999-40f84sunspot" );
// add service to device
device.addService(service);
device.addService(tempservice);
// device.addService(tempservice);
// start device
try {
device.start();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment