Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
Lightsensor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Devices
Lightsensor
Commits
16737d50
Commit
16737d50
authored
Sep 11, 2015
by
aw613
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial commit
parents
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
311 additions
and
0 deletions
+311
-0
.classpath
.classpath
+7
-0
.gitignore
.gitignore
+1
-0
.project
.project
+18
-0
.settings/org.eclipse.jdt.core.prefs
.settings/org.eclipse.jdt.core.prefs
+11
-0
src/org/ws4d/smartsensor/device/GetLightAction.java
src/org/ws4d/smartsensor/device/GetLightAction.java
+59
-0
src/org/ws4d/smartsensor/device/GetTemperatureAction.java
src/org/ws4d/smartsensor/device/GetTemperatureAction.java
+86
-0
src/org/ws4d/smartsensor/device/HelloWorldDevice.java
src/org/ws4d/smartsensor/device/HelloWorldDevice.java
+43
-0
src/org/ws4d/smartsensor/device/HelloWorldService.java
src/org/ws4d/smartsensor/device/HelloWorldService.java
+52
-0
src/org/ws4d/smartsensor/device/mainclass.java
src/org/ws4d/smartsensor/device/mainclass.java
+34
-0
No files found.
.classpath
0 → 100644
View file @
16737d50
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry
kind=
"src"
path=
"src"
/>
<classpathentry
kind=
"con"
path=
"org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"
/>
<classpathentry
combineaccessrules=
"false"
kind=
"src"
path=
"/jmeds2.0-beta10"
/>
<classpathentry
kind=
"output"
path=
"bin"
/>
</classpath>
.gitignore
0 → 100644
View file @
16737d50
/bin/
.project
0 → 100644
View file @
16737d50
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>
SmartSensor
</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>
org.eclipse.jdt.core.javabuilder
</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>
org.eclipse.jdt.core.javanature
</nature>
<nature>
com.sysdeo.eclipse.tomcat.tomcatnature
</nature>
</natures>
</projectDescription>
.settings/org.eclipse.jdt.core.prefs
0 → 100644
View file @
16737d50
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
src/org/ws4d/smartsensor/device/GetLightAction.java
0 → 100644
View file @
16737d50
/**********************************************************************************
* Copyright (c) 2007 MATERNA Information & Communications and
* TU Dortmund, Dpt. of Computer Science, Chair 4, Distributed Systems
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
**********************************************************************************/
package
org.ws4d.smartsensor.device
;
import
java.io.IOException
;
import
org.ws4d.java.communication.CommunicationException
;
import
org.ws4d.java.schema.Element
;
import
org.ws4d.java.schema.SchemaUtil
;
import
org.ws4d.java.security.CredentialInfo
;
import
org.ws4d.java.service.InvocationException
;
import
org.ws4d.java.service.Operation
;
import
org.ws4d.java.service.parameter.ParameterValue
;
import
org.ws4d.java.service.parameter.ParameterValueManagement
;
/**
* The Temperature Action returns the current Temperature.
*
*
*/
public
class
GetLightAction
extends
Operation
{
public
static
final
String
ACT_HW_NAME
=
"LightAction"
;
//public static final String PARAM_HW_OUTPUT = "temperature";
public
static
final
String
PARAM_HW_OUTPUT
=
"light"
;
public
GetLightAction
()
{
super
(
ACT_HW_NAME
,
HelloWorldService
.
QN_PORTTYPE
);
Element
lightOutput
=
new
Element
(
PARAM_HW_OUTPUT
,
HelloWorldDevice
.
NAMESPACE
,
SchemaUtil
.
TYPE_INT
);
setOutput
(
lightOutput
);
}
@Override
protected
ParameterValue
invokeImpl
(
ParameterValue
parameterValue
,
CredentialInfo
credentialInfo
)
throws
InvocationException
,
CommunicationException
{
ParameterValue
luminescenceOutput
=
createOutputValue
();
ParameterValueManagement
.
setString
(
luminescenceOutput
,
PARAM_HW_OUTPUT
,
"80"
);
return
luminescenceOutput
;
}
}
src/org/ws4d/smartsensor/device/GetTemperatureAction.java
0 → 100644
View file @
16737d50
package
org.ws4d.smartsensor.device
;
/**********************************************************************************
* Copyright (c) 2007 MATERNA Information & Communications and
* TU Dortmund, Dpt. of Computer Science, Chair 4, Distributed Systems
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
**********************************************************************************/
import
java.io.IOException
;
import
org.ws4d.java.communication.CommunicationException
;
import
org.ws4d.java.schema.Element
;
import
org.ws4d.java.schema.SchemaUtil
;
import
org.ws4d.java.security.CredentialInfo
;
import
org.ws4d.java.service.InvocationException
;
import
org.ws4d.java.service.Operation
;
import
org.ws4d.java.service.parameter.ParameterValue
;
import
org.ws4d.java.service.parameter.ParameterValueManagement
;
/**
* The Temperature Action returns the current Temperature.
*
*
*/
public
class
GetTemperatureAction
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
PARAM_HW_OUTPUT
=
"temperature"
;
//public static final String PARAM_HW_OUTPUT2 = "light";
public
GetTemperatureAction
()
{
super
(
ACT_HW_NAME
,
HelloWorldService
.
QN_PORTTYPE
);
Element
temperatureOutput
=
new
Element
(
PARAM_HW_OUTPUT
,
HelloWorldDevice
.
NAMESPACE
,
SchemaUtil
.
TYPE_INT
);
//Parameter lightOutput = new Parameter(PARAM_HW_OUTPUT2, HelloWorldDevice.NAMESPACE, ParameterType.PARAMETER_TYPE_INT);
setOutput
(
temperatureOutput
);
// addOutputParameterDefinition(temperatureOutput);
//addOutputParameterDefinition(lightOutput);
}
@Override
protected
ParameterValue
invokeImpl
(
ParameterValue
parameterValue
,
CredentialInfo
credentialInfo
)
throws
InvocationException
,
CommunicationException
{
ParameterValue
temperatureOutput
=
createOutputValue
();
ParameterValueManagement
.
setString
(
temperatureOutput
,
PARAM_HW_OUTPUT
,
"20"
);
return
temperatureOutput
;
}
// protected ParameterValue invokeImpl() {
// try {
// ParameterValue temperatureOutput = createOutputValue(); //getOutputParameter(PARAM_HW_OUTPUT);
// //Parameter lightOutput = getOutputParameter(PARAM_HW_OUTPUT2);
//
// ParameterValueManagement.setString(temperatureOutput, PARAM_HW_OUTPUT, "20");
// // The DPWS stack handles all simple type parameters as strings. The developer is
// // responsible to check any constraints and to perform any necessary type conversions.
//
// // business logic
//// double temperature = tempSensor.getCelsius();
//// temperatureOutput.setValue(""+temperature);
//
// return temperatureOutput;
// //double light = lightSensor.getAverageValue();
// //lightOutput.setValue(""+light);
// }
// catch (IOException ex) {}
//}
}
src/org/ws4d/smartsensor/device/HelloWorldDevice.java
0 → 100644
View file @
16737d50
package
org.ws4d.smartsensor.device
;
import
org.ws4d.java.communication.DPWSCommunicationManager
;
import
org.ws4d.java.service.DefaultDevice
;
import
org.ws4d.java.types.LocalizedString
;
import
org.ws4d.java.types.QName
;
import
org.ws4d.java.types.QNameSet
;
/**
* HelloWorldDevice describes the SPOT as a DPWS hosting device.
*
* modified by Christin Groba
*
*/
public
class
HelloWorldDevice
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
()
{
super
(
DPWSCommunicationManager
.
COMMUNICATION_MANAGER_ID
);
// set PortType
this
.
setPortTypes
(
new
QNameSet
(
new
QName
(
PORTTYPE
,
NAMESPACE
)));
// add device name ( name is language specific )
this
.
addFriendlyName
(
"en -US"
,
"Sun SPOT - Sensor Device"
);
this
.
addFriendlyName
(
LocalizedString
.
LANGUAGE_DE
,
"Sun SPOT - Sensor Device"
);
// add device manufacturer ( manufacturer is language specific )
this
.
addManufacturer
(
LocalizedString
.
LANGUAGE_EN
,
"Test Inc."
);
this
.
addManufacturer
(
"de -DE"
,
" Test GmbH "
);
this
.
addModelName
(
LocalizedString
.
LANGUAGE_EN
,
"Sun Spot"
);
}
}
src/org/ws4d/smartsensor/device/HelloWorldService.java
0 → 100644
View file @
16737d50
package
org.ws4d.smartsensor.device
;
import
org.ws4d.java.communication.DPWSCommunicationManager
;
import
org.ws4d.java.service.DefaultDevice
;
import
org.ws4d.java.service.DefaultService
;
import
org.ws4d.java.types.QName
;
import
org.ws4d.java.types.URI
;
/**
* HelloWorldService describes the service that is hosted by the SPOT.
* In particular the service has one method HelloWorldAction.
*
*/
public
class
HelloWorldService
extends
DefaultService
{
// global settings
public
static
final
String
NAMESPACE
=
HelloWorldDevice
.
NAMESPACE
;
public
static
final
String
PORTTYPE
=
"SensorInterface"
;
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
()
{
super
(
DPWSCommunicationManager
.
COMMUNICATION_MANAGER_ID
);
// Set the property
// Properties.getInstance().setServiceProperty(this, Properties.PROP_SERVICE_SECURED, false);
this
.
setServiceId
(
DOCU_EXAMPLE_SERVICE_ID
);
// if endpoint not set, port type is use
// setEndpointPath(ENDPOINT_PATH);
// -- hello world action --
//HelloWorldAction helloWorldAct = new HelloWorldAction ();
//addAction(helloWorldAct);
// -- getTemperatureAction --
GetTemperatureAction
getTemperatureAct
=
new
GetTemperatureAction
();
addOperation
(
getTemperatureAct
);
// -- getValuesAction --
GetLightAction
getLightAct
=
new
GetLightAction
();
addOperation
(
getLightAct
);
// -- getValuesAction --
//GetValuesAction getValuesAct = new GetValuesAction();
//addAction(getValuesAct);
}
}
src/org/ws4d/smartsensor/device/mainclass.java
0 → 100644
View file @
16737d50
package
org.ws4d.smartsensor.device
;
import
java.io.IOException
;
import
org.ws4d.java.CoreFramework
;
import
org.ws4d.java.configuration.FrameworkProperties
;
import
org.ws4d.java.configuration.Properties
;
public
class
mainclass
{
public
static
void
main
(
String
[]
args
)
{
CoreFramework
.
start
(
args
);
HelloWorldDevice
device
=
new
HelloWorldDevice
();
// create service
HelloWorldService
service
=
new
HelloWorldService
();
// 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
);
// start device
try
{
device
.
start
();
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
return
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment