Commit 8d04e5e3 authored by aw613's avatar aw613

- a lot of renaming

parent 912a6c35
......@@ -31,16 +31,16 @@ import com.pi4j.io.i2c.I2CFactory;
*
*
*/
public class GetLightAction extends Operation
public class GetLightOperation extends Operation
{
public static final String ACT_HW_NAME = "LightAction";
public static final String ACT_HW_NAME = "LightOperation";
//public static final String PARAM_HW_OUTPUT = "temperature";
public static final String PARAM_HW_OUTPUT = "light";
public static Tsl2561 sensor;
public GetLightAction () {
super(ACT_HW_NAME, HelloWorldService.QN_PORTTYPE);
public GetLightOperation () {
super(ACT_HW_NAME, LightService.QN_PORTTYPE);
I2CBus bus;
try {
......@@ -51,7 +51,7 @@ public class GetLightAction extends Operation
e.printStackTrace();
}
Element lightOutput = new Element(PARAM_HW_OUTPUT, HelloWorldDevice.NAMESPACE, SchemaUtil.TYPE_INT);
Element lightOutput = new Element(PARAM_HW_OUTPUT, SensorDevice.NAMESPACE, SchemaUtil.TYPE_INT);
setOutput(lightOutput);
......
......@@ -27,24 +27,24 @@ import org.ws4d.java.service.parameter.ParameterValueManagement;
*
*
*/
public class GetTemperatureAction extends Operation
public class GetTemperatureOperation extends Operation
{
// private ITemperatureInput tempSensor = (ITemperatureInput) Resources.lookup(ITemperatureInput.class);
//private ILightSensor lightSensor = (ILightSensor) Resources.lookup(ILightSensor.class);
public static final String ACT_HW_NAME = "TemperatureAction";
public static final String ACT_HW_NAME = "TemperatureOperation";
public static final String PARAM_HW_OUTPUT = "temperature";
//public static final String PARAM_HW_OUTPUT2 = "light";
public PhySensor sensor;
public GetTemperatureAction () {
public GetTemperatureOperation () {
super(ACT_HW_NAME, HelloWorldService.QN_PORTTYPE);
super(ACT_HW_NAME, TempService.QN_PORTTYPE);
sensor = new PhySensor("28-0000045157c3"); //Sensor Thread is started in background
Element temperatureOutput = new Element(PARAM_HW_OUTPUT, HelloWorldDevice.NAMESPACE, SchemaUtil.TYPE_INT);
Element temperatureOutput = new Element(PARAM_HW_OUTPUT, SensorDevice.NAMESPACE, SchemaUtil.TYPE_INT);
//Parameter lightOutput = new Parameter(PARAM_HW_OUTPUT2, HelloWorldDevice.NAMESPACE, ParameterType.PARAMETER_TYPE_INT);
setOutput(temperatureOutput);
......
......@@ -11,17 +11,18 @@ import org.ws4d.java.types.URI;
* In particular the service has one method HelloWorldAction.
*
*/
public class HelloWorldService extends DefaultService {
public class LightService extends DefaultService {
// global settings
public static final String NAMESPACE = HelloWorldDevice.NAMESPACE;
public static final String PORTTYPE = "SensorInterface";
public static final String NAMESPACE = "http://www.demo.com/bbsr";//HelloWorldDevice.NAMESPACE;
// public static final String PORTTYPE = "TemperatureInterface";
public static final String PORTTYPE = "Brightness";
public static final String ENDPOINT_PATH = "/SunSPOTSensor";
public static final QName QN_PORTTYPE = new QName(PORTTYPE, NAMESPACE);
public final static URI DOCU_EXAMPLE_SERVICE_ID = new URI(NAMESPACE + ENDPOINT_PATH);
public HelloWorldService() {
public LightService() {
super(DPWSCommunicationManager.COMMUNICATION_MANAGER_ID);
// Set the property
// Properties.getInstance().setServiceProperty(this, Properties.PROP_SERVICE_SECURED, false);
......@@ -34,11 +35,11 @@ public class HelloWorldService extends DefaultService {
//addAction(helloWorldAct);
// -- getTemperatureAction --
GetTemperatureAction getTemperatureAct = new GetTemperatureAction();
addOperation(getTemperatureAct);
// GetTemperatureOperation getTemperatureAct = new GetTemperatureOperation();
// addOperation(getTemperatureAct);
// -- getValuesAction --
GetLightAction getLightAct = new GetLightAction();
GetLightOperation getLightAct = new GetLightOperation();
addOperation(getLightAct);
// -- getValuesAction --
......@@ -48,5 +49,8 @@ public class HelloWorldService extends DefaultService {
}
}
......@@ -13,13 +13,13 @@ import org.ws4d.java.types.QNameSet;
* modified by Christin Groba
*
*/
public class HelloWorldDevice extends DefaultDevice{
public class SensorDevice extends DefaultDevice{
public static final String NAMESPACE = "http://www.demo.com/bbsr";
public static final String PORTTYPE = "Sensor";
public static final String LOCALE_EN = "en_GB";
public HelloWorldDevice() {
public SensorDevice() {
super(DPWSCommunicationManager.COMMUNICATION_MANAGER_ID);
......
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 TempService 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 = "TemperatureInterface";
public static final String ENDPOINT_PATH = "/SunSPOTSensor1";
public static final QName QN_PORTTYPE = new QName(PORTTYPE, NAMESPACE);
public final static URI DOCU_EXAMPLE_SERVICE_ID = new URI(NAMESPACE + ENDPOINT_PATH);
public TempService() {
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);
}
}
......@@ -17,13 +17,16 @@ public class mainclass {
CoreFramework.start(args);
HelloWorldDevice device = new HelloWorldDevice();
SensorDevice device = new SensorDevice();
// create service
HelloWorldService service = new HelloWorldService();
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);
// 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