...
 
Commits (34)
Copyright 2018, oneM2M Partners Type 1
Copyright 2019, oneM2M Partners Type 1
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
......@@ -8,4 +8,4 @@ Redistribution and use in source and binary forms, with or without modification,
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Smart Device Template
Repository for the Smart Device Template (SDT).
Repository and documentation for the Smart Device Template (SDT).
**Version 4.0**
Note that this project runs under the 3-Clause BSD License. Read the [LICENSE](LICENSE) in this repository, or refer to [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause).
The Smart Device Template is available under the 3-Clause BSD License. Read the [LICENSE](LICENSE) in this repository, or refer to [https://opensource.org/licenses/BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause).
Any contributions made to this project must comply with the aforementioned license.
Any contributions made to the Smart Device Template format must comply with the aforementioned license. Models defined by using the Smart Device Template can be published under different licenses.
## Quick Introduction
The Smart Device Template (SDT) is a template which is used to model the capabilities, actions and events of connected devices. The intent of the SDT is to be able to model any type of connected device using a well accepted and standardised format. The main application of SDT is to enable a uniformly structured Application Programmer's Interface (API) to applications that need to interact with connected devices. Usually, these applications would communicate to devices using an Abstraction Layer as an intermediary logic. The Abstraction Layer "hides" the technology-specific, native language format of devices of different technology type from the applications.
![](SDT/schema4.0/docs/images/SDT_simplified.png)
The Smart Device Template (SDT) is a template which is used to model the capabilities, actions and events of connected devices. The intent of the SDT is to be able to model any type of connected device using a well accepted and standardised format. The main application of SDT is to enable a uniformly structured Application Programmer's Interface (API) to applications that need to interact with connected devices. Usually, these applications would communicate to devices using an abstraction layer as an intermediary logic. The abstraction layer "hides" the technology-specific, native language format of devices of different technology type from the applications.
[Read the full Introduction.](SDT/schema4.0/docs/Introduction.md)
## Quick Links
- ['domain.xsd' Version 4.0](SDT/schema4.0/src/domain.xsd)
- [UML Diagram of the SDT 4.0](SDT/schema4.0/docs/UML%20Diagram.md) ([source](SDT/schema4.0/docs/SDT_UML.uxf))
- [UML Diagram of the SDT 4.0](SDT/schema4.0/docs/UML%20Diagram.md) ([Umlet source](SDT/schema4.0/docs/SDT_UML.uxf)) : This UML diagram describes the various components of the SDT and their relations.
- ['domain.xsd' Version 4.0](SDT/schema4.0/src/domain.xsd) : This is the XSD schema file that defines the SDT XML Schema.
## Content
## Documentation
You can find further Information here:
- [Introduction to the SDT](SDT/schema4.0/docs/Introduction.md)
- [SDT Components](SDT/schema4.0/docs/SDT_Components.md)
- [JSON Serializatoin](SDT/schema4.0/docs/SDT_JSON.md)
- [SDT Build System](SDT/schema4.0/docs/SDT%20Build%20System.md)
- [JSON Serialization](SDT/schema4.0/docs/SDT_JSON.md) TODO
- [Examples](SDT/schema4.0/docs/Examples.md)
- [SDT Build System](SDT/schema4.0/docs/SDT%20Build%20System.md)
## Further Readings
- [Links & References](SDT/schema4.0/docs/Links.md)
- [Changelog](SDT/schema4.0/docs/Changelog.md)
- [SDT Build System Components and Licenses](SDT/schema4.0/docs/SDT%20Build%20System%20Components%20and%20Licenses.md)
- [LICENSE](LICENSE)
<?xml version="1.0" encoding="UTF-8" ?>
<!-- - HGI Device Abstraction Layer - - - - - - - - - - - - - - - - - - - - -->
<!-- SDT - Smart Device Template Build File -->
<!-- -->
<!-- Extends the standard build with targets for: -->
<!-- - generate XML schema the from Relax NG (xml) description -->
<!-- - validate DAL documents against the XML Schema -->
<!-- - generate HTML documentation from DAL documents -->
<!-- Extends the standard build with targets for: -->
<!-- - generate XML schema the from Relax NG (xml) description -->
<!-- - validate DAL documents against the XML Schema -->
<!-- - generate HTML documentation from DAL documents -->
<project name="importing" basedir="." default="schemas">
<import file="etc/common.xml"/>
......@@ -92,7 +92,7 @@
<schemavalidate warn="true">
<fileset dir="${basedir}/test" includes="*.xml"/>
<attribute name="http://apache.org/xml/features/xinclude" value="true"/>
<schema namespace="http://homegatewayinitiative.org/xml/dal/3.0"
<schema namespace="http://www.onem2m.org/xml/sdt/4.0"
file="${path.src}/domain.xsd" />
<schema namespace="http://www.w3.org/2001/XInclude"
file="${basedir}/etc/XInclude.xsd" />
......
# Changelog
## Changes in 4.0
- Rename 'Device' to 'DeviceClass' [(issue#2)](https://git.onem2m.org/MAS/SDT/issues/2)
- Remove 'Module' to simplify the SDT model [(issue#1)](https://git.onem2m.org/MAS/SDT/issues/1)
- Introduced 'Product' for concrete model definition of real products. [(issue#6)](https://git.onem2m.org/MAS/SDT/issues/6)
- Support JSON serialization [(issue#5)](https://git.onem2m.org/MAS/SDT/issues/5)
- Support inheritance of 'DeviceClass' [(issue#3)](https://git.onem2m.org/MAS/SDT/issues/3)
- Enum type ...
- Data Type Facets ... [(issue#4)](https://git.onem2m.org/MAS/SDT/issues/4)
- ...
*Editor's note: the current change log is just an examplary list (a projection), which lists some initial thoughts that the group is working on based on previous discussion. It needs to be revisited according to all implemented features before SDT4.0 publication.*
- Renamed ``<Device>`` to ``<DeviceClass``>.
- Removed ``<Module>`` to simplify the SDT model.
- Introduced ``<ProductClass`` for concrete model definition of real products.
- Introduced complex ``<EnumType>`` data type. Removed ``enum`` data type from ``BasicTypes``.
- Added ``void`` from ``BasicTypes``.
- Introduced inheritance / extending of ``<DataType>``.
- Added support for defining ``<DataType>`` on ``<Domain>`` level.
- Changed ``<Extend>`` mechanism. Now one can explicitly include or exclude certain sub-components from the parent.
- Added support of ``semanticURL`` attribute for all components.
- Added ``optional`` attribute to ``<Arg>``.
- Added ``default`` attribute to ``<Arg>``.
- Added ``default`` attribute to ``<DataPoint``.
- Unified all component identifiers, names etc to XSD type ``name``.
- Introduced JSON serialization guidelines.
- Changed case of ``<Imports>`` element.
- Added more test cases and example templates to the [test](../test) directory.
- Changed the license to [3-Clause BSD License](https://opensource.org/licenses/BSD-3-Clause).
## Changes in 3.0
- Renamed ``<RootDevice>``to ``<Device>`` and ``<Device>`` to ``<SubDevice>``,
......
# Examples and Contributions
[A simple example](#simpleExample)
[Multi Socket Electrical-Extension-Block](#mseeb)
## Table of Contents
1. [A simple example](#simpleExample)
2. [Multi Socket Electrical-Extension-Block](#mseeb)
<a name="simpleExample"></a>
## A very simple SDT example
In the ideal case, a large organization or SDO would define a widely-applicable set of [ModuleClasses](SDT_Components.md#ModuleClass), each of which could be used as needed to compose the description of a complex device. In order to show the appoach, this section will create a few example ModuleClasses based on - or inspired by - featues in the Echonet Lite protocol. Please note that the examples shown in this document are very "cut down" and by no means represent a true representation of Echonet Lite.
## A simple SDT example
In the ideal case, a large organization or SDO would define a widely-applicable set of [ModuleClasses](SDT_Components.md#ModuleClass), each of which could be used as needed to compose the description of a complex device. In order to show the appoach, this section will create a few example ModuleClasses based on - or inspired by - featues in the Echonet Lite protocol. Please note that the examples shown in this document are very "cut down" and by no means represent a true representation of Echonet Lite[^echonet].
The Echonet Consortium has standardized their specifications within IEC/ISO (IEC62394, ISO/IEC24767-1, ISO/IEC24767-2, IEC62480, ISO/IEC14543-4-1, ISO/IEC14543-4-2, IEC62457) and they provide a comprehensive collection of various types of home appliances relevant to SmartGrid applications as ECHONET Device objects (see [https://echonet.jp/spec_object_rf_en/](https://echonet.jp/spec_object_rf_en/) ).
[^echonet]: The Echonet Consortium has standardized their specifications within IEC/ISO (IEC62394, ISO/IEC24767-1, ISO/IEC24767-2, IEC62480, ISO/IEC14543-4-1, ISO/IEC14543-4-2, IEC62457) and they provide a comprehensive collection of various types of home appliances relevant to SmartGrid applications as ECHONET Device objects (see [https://echonet.jp/spec_object_rf_en/](https://echonet.jp/spec_object_rf_en/) ).
For the example in this document, to show re-use of ModuleClass definitions, two complex devices are chosen which have some common features and hence could be expected to both use some of the same ModuleClasses: an air conditioner and a washing machine.
For the example in this section, to show re-use of ModuleClass definitions, two complex devices are chosen which have some common features and hence could be expected to both use some of the same ModuleClasses: an air conditioner and a washing machine.
<table>
<tr><th>Funtionality</th><th>Air Conditioner</th><th>Washing Machine</th></tr>
<tr><td>operationStatus</td><td>operates on/off</td><td>operates on/off</td></tr>
<tr><td>measuredCumulativePowerConsumption</td><td>the cumulative power consumption</td><td>the cumulative power consumption</td></tr>
<tr><td>installationLocation</td><td>this sets/reads a string text describing the location (room) of the air-conditioner.</td><td>this sets/reads a string text describing the location (room) of the washing machine.</td></tr>
<tr><td>setTimer</td><td>(not applicable. there is no preset start for an air-conditioner)</td><td>This sets/reads use the on/off timer</td></tr>
</table>
|Funtionality | Air Conditioner | Washing Machine |
|:------------|:----------------|:----------------|
|operationStatus |operates on/off |operates on/off |
|measuredCumulativePowerConsumption |the cumulative power consumption |the cumulative power consumption |
|installationLocation |this sets/reads a string text describing the location (room) of the air-conditioner |this sets/reads a string text describing the location (room) of the washing machine |
|setTimer |(not applicable. there is no preset start for an air-conditioner) |This sets/reads use the on/off timer |
Based on the simplified example above, the two appliances will need the ModuleClasses below:
- *air-conditioner*: operationStatus, measuredCumulativePowerConsumption, installationLocation;
- *washing-machine*: operationStatus, measuredCumulativePowerConsumption, and setTimer.
<ModuleClass name="operationStatus">
<Data>
<DataPoint name="operationStatus" writable="true">
<Doc>This property sets/reads the ON/OFF status.</Doc>
<DataType>
<SimpleType type="boolean"/>
</DataType>
</DataPoint>
</Data>
<Events>
<Event name="operationStatus">
</Event>
</Events>
</ModuleClass>
<ModuleClass name="measuredCumulativePowerConsumption">
<Data>
<DataPoint name="measuredCumulativePowerConsumption" writable="false">
<Doc>This indicates cumulative power consumption of the device in increments of 0.001kWh.</Doc>
<DataType>
<SimpleType type="integer"/>
</DataType>
</DataPoint>
</Data>
</ModuleClass>
- *washing-machine*: operationStatus, measuredCumulativePowerConsumption, setTimer.
<ModuleClass name="installationLocation">
<Data>
<DataPoint name="installationLocation" writable="true">
<Doc>This property indicates the installation location</Doc>
<DataType>
<SimpleType type="string"/>
</DataType>
</DataPoint>
</Data>
<Events>
<Event name="installationLocation"> </Event>
</Events>
</ModuleClass>
<ModuleClass name="onTimerSetting">
<DataPoint name="onTimer" writable="true">
<Doc>Timer value (HH:MM)</Doc>
```XML
<ModuleClass name="operationStatus">
<Data>
<DataPoint name="operationStatus" writable="true">
<Doc>This property sets/reads the ON/OFF status.</Doc>
<DataType>
<SimpleType type="time"/>
<SimpleType type="boolean"/>
</DataType>
</DataPoint>
</ModuleClass>
</DataPoint>
</Data>
<Events>
<Event name="operationStatus">
</Event>
</Events>
</ModuleClass>
<ModuleClass name="measuredCumulativePowerConsumption">
<Data>
<DataPoint name="measuredCumulativePowerConsumption" writable="false">
<Doc>This indicates cumulative power consumption of the device in increments of 0.001kWh.</Doc>
<DataType>
<SimpleType type="integer"/>
</DataType>
</DataPoint>
</Data>
</ModuleClass>
<ModuleClass name="installationLocation">
<Data>
<DataPoint name="installationLocation" writable="true">
<Doc>This property indicates the installation location</Doc>
<DataType>
<SimpleType type="string"/>
</DataType>
</DataPoint>
</Data>
<Events>
<Event name="installationLocation"> </Event>
</Events>
</ModuleClass>
<ModuleClass name="onTimerSetting">
<DataPoint name="onTimer" writable="true">
<Doc>Timer value (HH:MM)</Doc>
<DataType>
<SimpleType type="time"/>
</DataType>
</DataPoint>
</ModuleClass>
```
The structure and the according SDT now looks like this:
<table>
<tr><td colspan="2" width="50%"><b>Example1.SDT</b></td></tr>
<tr><td> </td><td>Namespace information</td></tr>
<tr><td> </td><td>Modules (contains ModuleClasses)</td></tr>
<tr><td> </td><td>operationStatus<ul>
<li>measuredCumulativePowerConsumption</li>
<li>installationLocation</li>
<li>onTimerSetting</li></ul></td></tr>
</table>
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Example1 SDT inspired by some Echonet Lite examples -->
<Domain xmlns="http://homegatewayinitiative.org/xml/dal/3.0"
xmlns:xi="http://www.w3.org/2001/XInclude"
id="example1.SDT">
<Modules>
|Example1.SDT |
|:--------------|
|Namespace information |
|Modules (contains ModuleClasses) |
|operationStatus <ul><li>measuredCumulativePowerConsumption</li><li>installationLocation</li><li>onTimerSetting</li></ul> |
```xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Example1 SDT inspired by some Echonet Lite examples -->
<Domain xmlns="http://www.onem2m.org/xml/sdt/4.0"
xmlns:xi="http://www.w3.org/2001/XInclude"
id="example1.SDT">
<ModuleClasses>
<!-- Various examples for module classes -->
<ModuleClass name="operationStatus">
<Data>
<DataPoint name="operationStatus" writable="true">
......@@ -140,9 +141,12 @@ The structure and the according SDT now looks like this:
</DataType>
</DataPoint>
</ModuleClass>
</Modules>
</Domain>
</ModuleClasses>
</Domain>
```
TODO Implementation in Device
---
......
This diff is collapsed.
# Links & References
## Smart Device Template
- **SDT Repository** : [https://git.onem2m.org/MAS/SDT](https://git.onem2m.org/MAS/SDT)
## Further Information
- **TR-0039 Introduction to IPE and SDT** : [http://www.onem2m.org/tr-0039/ipe-and-sdt](http://www.onem2m.org/tr-0039/ipe-and-sdt)
- **The oneM2M Smart Device Template (SDT)** (BrightTALK) : [https://www.brighttalk.com/webcast/11949/340004/the-onem2m-smart-device-template-sdt](https://www.brighttalk.com/webcast/11949/340004/the-onem2m-smart-device-template-sdt)
## Organisations
- **oneM2M** : [http://www.onem2m.org](http://www.onem2m.org)
- **HGI** : [http://www.homegatewayinitiative.org](http://www.homegatewayinitiative.org)
## XML
## Tools
- **SDTTool** : [https://github.com/Homegateway/SDTTool](https://github.com/Homegateway/SDTTool)
SDTTool is a utility to read and convert SDT definitions.
- **RELAX NG** : [http://relaxng.org](http://relaxng.org)
- **RELAX NG Tutorial** : [http://relaxng.org/tutorial-20011203.html](http://relaxng.org/tutorial-20011203.html)
## Tools
- **UMLet** : [http://www.umlet.com](http://www.umlet.com)
The free UML drawing tool used to draw the UML file.
A free UML drawing tool used to draw the UML file.
- **Apache Ant** : [http://ant.apache.org](http://ant.apache.org)
Build tool
......
# Build System Libraries and Licenses
The following libraries are used in the build system for the SDT.
# SDT Build System Components and Licenses
The following third-party libraries and components are used in the build system for the Smart Device Template.
## Table of Contents
1. [trang.jar](#trang)
2. [Ant-Contrib Tasks](#antcontrib)
3. [antSetLogLevel.JAR](#antSetLogLevel)
<a name="trang"/></a>
## trang.jar
[http://www.thaiopensource.com/relaxng/trang-manual.html](http://www.thaiopensource.com/relaxng/trang-manual.html)
[https://relaxng.org/jclark/trang.html](https://relaxng.org/jclark/trang.html)
[https://github.com/relaxng/jing-trang](https://github.com/relaxng/jing-trang)
*Trang* takes as input a schema written in any of the following formats:
......@@ -45,6 +53,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<a name="antcontrib"/></a>
## Ant-Contrib Tasks
[http://ant-contrib.sourceforge.net](http://ant-contrib.sourceforge.net)
......@@ -55,6 +64,7 @@ The *Ant-Contrib* project is a collection of tasks (and at one point maybe types
This Software is distributed under the Apache Software License.
<a name="antSetLogLevel"/></a>
## antSetLogLevel.jar
GUI dialog for Ant tasks.
......
# SDT Build System
This document describes the SDT build system and how to build the SDT and validate new contributions.
This document describes the SDT build system and how to build the SDT and validate new templates and contributions.
The files referenced in this document point to version **4.0** of the SDT.
## Table of Contents
1. [Directory Structure and Important Files](#Structure)
2. [Installation](#Installation)
3. [Building](#Building)
1. [Building the Schema](#BuildingSchema)
2. [Validating SDT Templates](#BuildingValidate)
4. [Editing the Schema](#Editing)
<a name="Structure"/></a>
## Directory Structure and Important Files
- [SDT/schema4.0/](../..) : Base directory
- [SDT/schema4.0/src/](../src/) : Source files of the SDT.
- [domain.rng](../src/domain.rng) : RELAX NG file with the SDT schema definition. This is the source file that is converted to the actual schema definition *domain.xsd* during the build. See also [http://en.wikipedia.org/wiki/RELAX_NG](http://en.wikipedia.org/wiki/RELAX_NG).
**Only edit this file when one wants to make changes to the SDT!**
- [domain.xsd](../src/domain.xsd) : The SDT schema definition that is generated from *domain.rng*.
**Only edit this file when you want to make changes to the SDT!** See also [Editing the Schema](#Editing) below.
- [domain.xsd](../src/domain.xsd) : The actual SDT schema definition that is generated from *domain.rng*.
- [xml.xsd](../src/xml.xsd) : General schema definitions for the SDT
- [SDT/schema4.0/test/](../test/) : This directory contains all XML files with SDT definitions that should be validated whether they conform to the SDT schema. This could be example definitions or contributions.
- [SDT/schema4.0/test/](../test/) : This directory contains XML files with SDT definitions that should be validated whether they conform to the SDT schema.
This could be example definitions or new templates and contributions. If you want to validate your newly created template put it into this directory and follow the steps descripted in [Validating SDT Templates](#BuildingValidate) below.
- [SDT/schema4.0/build.xml](../build.xml) : This is the definition file for the ant build system.
- [SDT/schema4.0/etc/](../etc/), [SDT/schema4.0/style/](../style/) : internal directories for the build system. Please, don't make unnecessary changes to these files.
- [SDT/schema4.0/etc/](../etc), [SDT/schema4.0/style/](../style/) : internal directories for the build system. Please, don't make unnecessary changes to these files.
- [SDT/schema4.0/etc/dal.rnc](../etc/dal.rnc) : This file contains various configuration parameter to convert the file [domain.rng](../src/domain.rng) to schema file. **The important parameter to change when changing the namespace or the version number is**:
default namespace xsl = "http://homegatewayinitiative.org/xml/dal/3.0"
- [SDT/schema4.0/etc/schemas.xml](../etc/schemas.xml) : This file contains the header for the schema file. **This must be changed when changing the namespace or the version number.**
- [SDT/schema4.0/etc/](../etc/), [SDT/schema4.0/style/](../style/) : internal directories for the build system. Please, don't make changes to these files.
- [SDT/schema4.0/etc/](../etc), [SDT/schema4.0/style/](../style/) : internal directories for the build system. Only the following files should be changed if necessray. See the section [Editing the Schema](#Editing) below.
- [SDT/schema4.0/etc/dal.rnc](../etc/dal.rnc) : This file contains various configuration parameter to convert the file [domain.rng](../src/domain.rng) to schema file.
- [SDT/schema4.0/etc/schemas.xml](../etc/schemas.xml) : This file contains the header for the schema file.
- [SDT/schema4.0/etc/schema.xmlns](../etc/schema.xmlns) : This file defines the target namespace for the schema.
- [SDT/schema4.0/lib/](../lib/) : Tasks for the ant-based build system. See also [SDT Build System Components and Licenses](SDT%20Build%20System%20Components%20and%20Licenses.md).
<a name="Installation"/></a>
## Installation
- Install Java on your computer
- Download and install Apache ant from [http://ant.apache.org](http://ant.apache.org)
- Clone the SDT repository from GitHub:
$ git clone https://github.com/Homegateway/SmartDeviceTemplate.git
### Prerequisites
- Java
- Ant (at least version 1.8). See [http://ant.apache.org](http://ant.apache.org).
### Installing SDT
- Clone the SDT repository from oneM2M's GitLab:
$ git clone https://git.onem2m.org/MAS/SDT.git
<a name="Building"/></a>
## How to Use the Build System
After cloning the repository go to the directory *SDT/schema* and run commands depending on what you want to achieve.
After cloning the repository go to the directory *SDT/schema4.0* and run commands depending on what you want to achieve.
### Build the Schema
<a name="BuildingSchema"/></a>
### Building the Schema
Running *ant* without any parameter builds the schema definition from the rng-definition [SDT/schema4.0/src/domain.rng](../src/domain.rng) and writes it to [SDT/schema4.0/src/domain.xsd](../src/domain.xsd)
$ cd SDT/schema
$ cd SDT/schema4.0
$ ant
### Validate SDT Definitions
<a name="BuildingValidate"/></a>
### Validating SDT Templates
You can use the build system to validate new SDT definitions or changes made to existing ones by running the following command:
$ cd SDT/schema
$ cd SDT/schema4.0
$ ant validate
The output after a successful validation should look like this:
The output after a successful validation should look similar this:
>[schemavalidate] 2 file(s) have been successfully validated.
>BUILD SUCCESSFUL
......@@ -54,20 +70,30 @@ Otherwise you most likely receive a stack trace or some other error messages. Se
>[schemavalidate] /Users/someone/Sources/git/SmartDeviceTemplate/SDT/schema/test/mseeb.xml:66:18: cvc-elt.1: Cannot find the declaration of element 'Domain'.
>BUILD FAILED
---
<a name="Editing"/></a>
## Editing the Schema
As mentioned above, the actual schema definition is defined in the file [src/domain.rng](../src/domain.rng) and converted to the XML schema definition [src/domain.xsd](../src/domain.xsd) during the build process.
## Editing
As mentioned above, the actual schema definition is defined in the file [domain.rng](../src/domain.rng) and converted to the XML schema definition [domain.xsd](../src/domain.xsd) during the build process.
**All changes to the schema must therefore be made in [domain.rng](../src/domain.rng), NOT [domain.xsd](../src/domain.xsd) !**
**All changes to the schema must only be made to [src/domain.rng](../src/domain.rng), NOT [src/domain.xsd](../src/domain.xsd) !**
You may need to make additional changes in the following files, e.g. when the name space or the version number need to be adjusted.
PLEASE ONLY EDIT THESE FILES IF NECESSARY.
PLEASE EDIT THESE FILES ONLY IF NECESSARY.
- [SDT/schema4.0/build.xml](../build.xml)
e.g. in the *ant* target "validate"
e.g. change the *ant* target "validate" when you want to set another directory for the files for validation.
- [SDT/schema4.0/etc/dal.rnc](../etc/dal.rnc)
e.g. the entry "default namespace xsl"
- [SDT/schema4.0/etc/schema.xmlns](../etc/schema.xmlns)
- [SDT/schema4.0/etc/schemas.xml](../etc/schemas.xml)
The important parameter to update when changing the namespace or the version number is:
default namespace xsl = "http://www.onem2m.org/xml/sdt/4.0"
- [SDT/schema4.0/etc/schema.xmlns](../etc/schema.xmlns)
This file must be updated when changing the namespace or the version number:
targetNamespace="http://www.onem2m.org/xml/sdt/4.0"
xmlns="http://www.onem2m.org/xml/sdt/4.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
- [SDT/schema4.0/etc/schemas.xml](../etc/schemas.xml)
Upate the namespace when changing the namespace or the version number:
<namespace ns="http://www.onem2m.org/xml/sdt/4.0" typeId="DAL"/>
This diff is collapsed.
namespace local = ""
default namespace xsl = "http://homegatewayinitiative.org/xml/dal/3.0"
default namespace xsl = "http://www.onem2m.org/xml/sdt/4.0"
namespace xi = "http://www.w3.org/2001/XInclude"
version = "1.0"
......
......@@ -11,45 +11,33 @@ start = Domain
Domain =
element Domain {
attribute xml:base { xsd:anyURI }?,
attribute id { xsd:ID },
attribute id { xsd:Name },
attribute semanticURI { xsd:anyURI }?,
DocDef,
element Imports { Domain+ }?,
element Modules {
element ModuleClass { ModuleDef }+
}?,
element Devices {
element Device {
attribute id { xsd:Name },
DocDef,
PropertiesDef?,
Modules?,
element SubDevices {
element SubDevice {
attribute id { xsd:Name },
DocDef,
PropertiesDef?,
Modules?
}+
}?
}+
}?
element DataTypes { DataTypeDef+ }?,
ModuleClassesDef?,
DeviceClassesDef?,
ProductClassesDef?
}
PropertiesDef =
element Properties {
element Property {
attribute name { text },
attribute name { xsd:Name },
attribute optional { xsd:boolean }?,
attribute value { text }?,
attribute semanticURI { xsd:anyURI }?,
DocDef,
SimpleType
}+
}
DataTypeDef =
element DataType {
attribute name { text }?,
attribute name { xsd:Name }?,
attribute unitOfMeasure { text }?,
attribute semanticURI { xsd:anyURI }?,
DocDef,
(StructType | ArrayType | SimpleType),
(ExtendDef? | (StructType | ArrayType | SimpleType | EnumType)),
ConstraintsDef?
}
StructType = element Struct { DataTypeDef+ }
......@@ -58,6 +46,7 @@ SimpleType =
element SimpleType {
attribute type { BasicType }
}
EnumType = element Enum { EnumValueDef+ }
BasicType =
"integer"
| "boolean"
......@@ -65,18 +54,27 @@ BasicType =
| "byte"
| "float"
| "array"
| "enum"
| "date"
| "time"
| "datetime"
| "blob"
| "uri"
| "void"
EnumValueDef =
element EnumValue {
attribute name { xsd:Name },
attribute value { text },
attribute type { BasicType }?,
attribute semanticURI { xsd:anyURI }?,
DocDef
}
ConstraintsDef =
element Constraints {
element Constraint {
attribute name { text },
attribute name { xsd:Name },
attribute type { BasicType }?,
attribute value { text }?,
attribute semanticURI { xsd:anyURI }?,
DocDef
}+
}
......@@ -95,27 +93,60 @@ DocDef =
element caption { text }
})*
}?
ModuleDef =
attribute name { text },
attribute optional { xsd:boolean }?,
element extends {
attribute domain { xsd:IDREF },
attribute class { text }
}?,
DocDef,
PropertiesDef?,
Actions?,
Data?,
Events?
Modules =
element Modules {
element Module { ModuleDef }+
DeviceClassesDef =
element DeviceClasses {
element DeviceClass {
attribute id { xsd:Name },
attribute semanticURI { xsd:anyURI }?,
DocDef,
PropertiesDef?,
ModuleClassesDef?,
SubDevicesRef?
}+
}
SubDevicesRef =
element SubDevices {
element SubDevice {
attribute id { xsd:Name },
attribute semanticURI { xsd:anyURI }?,
DocDef,
PropertiesDef?,
ModuleClassesDef?
}+
}
ModuleClassesDef =
element ModuleClasses {
element ModuleClass {
attribute name { xsd:Name },
attribute optional { xsd:boolean }?,
attribute semanticURI { xsd:anyURI }?,
DocDef,
ExtendDef?,
PropertiesDef?,
Actions?,
Data?,
Events?
}+
}
ProductClassesDef =
element ProductClasses {
element ProductClass {
attribute id { xsd:Name },
attribute semanticURI { xsd:anyURI }?,
DocDef,
ExtendDef?,
PropertiesDef?,
ModuleClassesDef?,
SubDevicesRef?,
element DeviceClass { ExtendDef }?
}+
}
Actions =
element Actions {
element Action {
attribute name { text },
attribute name { xsd:Name },
attribute optional { xsd:boolean }?,
attribute semanticURI { xsd:anyURI }?,
DocDef,
DataTypeDef?,
ArgDef?
......@@ -124,7 +155,10 @@ Actions =
ArgDef =
element Args {
element Arg {
attribute name { text },
attribute name { xsd:Name },
attribute optional { xsd:boolean }?,
attribute default { text }?,
attribute semanticURI { xsd:anyURI }?,
DocDef,
DataTypeDef
}+
......@@ -132,11 +166,13 @@ ArgDef =
Data =
element Data {
element DataPoint {
attribute name { text },
attribute name { xsd:Name },
attribute optional { xsd:boolean }?,
attribute writable { xsd:boolean }?,
attribute readable { xsd:boolean }?,
attribute eventable { xsd:boolean }?,
attribute default { text }?,
attribute semanticURI { xsd:anyURI }?,
DocDef,
DataTypeDef
}+
......@@ -144,9 +180,31 @@ Data =
Events =
element Events {
element Event {
attribute name { text },
attribute name { xsd:Name },
attribute optional { xsd:boolean }?,
attribute semanticURI { xsd:anyURI }?,
DocDef,
Data?
}+
}
ExtendDef =
element Extend {
attribute domain { xsd:Name },
attribute entity { xsd:Name },
(element Exclude {
attribute name { xsd:Name },
attribute type { ExtendType }
}
| element Include {
attribute name { xsd:Name },
attribute type { ExtendType }
})?
}
ExtendType =
"action"
| "datapoint"
| "event"
| "moduleclass"
| "property"
| "device"
| "subdevice"
targetNamespace="http://homegatewayinitiative.org/xml/dal/3.0"
xmlns="http://homegatewayinitiative.org/xml/dal/3.0"
targetNamespace="http://www.onem2m.org/xml/sdt/4.0"
xmlns="http://www.onem2m.org/xml/sdt/4.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
<locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0">
<namespace ns="http://homegatewayinitiative.org/xml/dal/2.0" typeId="DAL"/>
<namespace ns="http://www.onem2m.org/xml/sdt/4.0" typeId="DAL"/>
<namespace ns="http://www.w3.org/2001/XInclude" typeId="XINC"/>
<typeId id="DAL" uri="dal.rnc"/>
......
......@@ -112,18 +112,21 @@
This property indicates whether the door/cover is open or closed.
Washing machine setting
This property indicates the current stage of the washing cycle.
......@@ -139,6 +142,7 @@
Reservation ON/OFF
......
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="ISO-8859-1"?><html xmlns:dal="http://www.onem2m.org/xml/sdt/4.0" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Domain action-test</title>
</head>
<body>
<h1>Domain action-test</h1>
<h2>Devices</h2>
<ul/>
</body>
</html>
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="ISO-8859-1"?><html xmlns:dal="http://www.onem2m.org/xml/sdt/4.0" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Domain arg-test</title>
</head>
<body>
<h1>Domain arg-test</h1>
<h2>Devices</h2>
<ul/>
</body>
</html>
<?xml version="1.0" encoding="ISO-8859-1"?>
BooleanState is the preferred module for modelling a
functionality corresponding to an underlying binary state. This
module should be used to abstract away from the actual datatype
and values in question. Note that the module does not define whether
the execution mode is blocking or non-blocking.
Obtain the current associated state.
BooleanState is the preferred module for modelling a
functionality corresponding to an underlying binary state. This
module should be used to abstract away from the actual datatype
and values in question. Note that the module does not define whether
the execution mode is blocking or non-blocking.
Obtain the current associated state.
Set the associated state to the specified value.
The desired value of the associated state.
Set the associated state to the specified value.
The desired value of the associated state.
<?xml version="1.0" encoding="ISO-8859-1"?>
PowerSwitch
Telekom Innovation Laboratories
This device is intended as a demonstration of how to use the
abstract modules defined in the HGI Core domain. The
vendor has provided a proprietry module with two operations
on and off. This is clearly a candidate for the
module class BooleanState.
The proprietry interface for turning the switch on and off.
Actions for setting the state to on or off
and for querying the state.
Turn the switch on.
Turn the switch off.
Query the state of the switch. Returns the string "on"
or "off".
An event that indicates the new state of the switch.
This device is intended as a demonstration of how to use the abstract modules defined in the HGI Core domain. The vendor has provided a proprietry module with two operations on and off. This is clearly a candidate for the module class BooleanState.
Original value: PowerSwitch
Original value: Telekom Innovation Laboratories
The proprietry interface for turning the switch on and off. Actions for setting the state to on or offand for querying the state.
Turn the switch on.
Turn the switch off.
Query the state of the switch. Returns the string "on" or "off".
An event that indicates the new state of the switch.
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="ISO-8859-1"?><html xmlns:dal="http://www.onem2m.org/xml/sdt/4.0" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Domain datapoint-test</title>
</head>
<body>
<h1>Domain datapoint-test</h1>
<h2>Devices</h2>
<ul/>
</body>
</html>
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="ISO-8859-1"?><html xmlns:dal="http://www.onem2m.org/xml/sdt/4.0" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Domain datatypes-test</title>
</head>
<body>
<h1>Domain datatypes-test</h1>
<h2>Devices</h2>
<ul/>
</body>
</html>
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="ISO-8859-1"?><html xmlns:dal="http://www.onem2m.org/xml/sdt/4.0" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Domain deviceClass.test</title>
</head>
<body>
<h1>Domain deviceClass.test</h1>
<h2>Devices</h2>
<ul/>
</body>
</html>
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="ISO-8859-1"?><html xmlns:dal="http://www.onem2m.org/xml/sdt/4.0" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Domain enumtype-test</title>
</head>
<body>
<h1>Domain enumtype-test</h1>
<h2>Devices</h2>
<ul/>
</body>
</html>
<?xml version="1.0" encoding="ISO-8859-1"?>
This property sets the ON/OFF status.
This property indicates the installation location
This indicates cumulative power consumption of the device in increments of 0.001kWh.
Timer value (HH:MM)
This reads the open=true or closed=false status of a door
<?xml version="1.0" encoding="ISO-8859-1"?><html xmlns:dal="http://www.onem2m.org/xml/sdt/4.0" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Domain example1.SDT</title>
</head>
<body>
<h1>Domain example1.SDT</h1>
<h2>Devices</h2>
<ul/>
</body>
</html>
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="ISO-8859-1"?><html xmlns:dal="http://www.onem2m.org/xml/sdt/4.0" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Domain example2.SDT</title>
</head>
<body>
<h1>Domain example2.SDT</h1>
<h2>Devices</h2>
<ul/>
</body>
</html>
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="ISO-8859-1"?><html xmlns:dal="http://www.onem2m.org/xml/sdt/4.0" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Domain example3.SDT</title>
</head>
<body>
<h1>Domain example3.SDT</h1>
<h2>Devices</h2>
<ul/>
</body>
</html>
<?xml version="1.0" encoding="ISO-8859-1"?><html xmlns:dal="http://www.onem2m.org/xml/sdt/4.0" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Domain extend-test</title>
</head>
<body>
<h1>Domain extend-test</h1>
<h2>Devices</h2>
<ul/>
</body>
</html>
<?xml version="1.0" encoding="ISO-8859-1"?>
......@@ -16,6 +16,9 @@
Obtain the current associated state.
......@@ -23,7 +26,12 @@
The desired value of the associated state.
The desired value of the associated state.
......@@ -32,6 +40,9 @@
......@@ -47,14 +58,29 @@
Multi Socket Electrical-Extension-Block
HGI
1.0
http://www.homegatewayinitative.org
1234.5
This device is intended as a demonstration of how to define a Root Device with multiple sub-devices.
This device is intended as a demonstration of how to define a Root Device with multiple sub-devices.
Original value: Multi Socket Electrical-Extension-Block
Original value: HGI
Original value: 1.0
Original value: http://www.homegatewayinitative.org
Original value: 1234.5
......@@ -62,23 +88,84 @@
The proprietry interface for turning all switches of the extension block on and off.
The action "BooleanState:get" returns "true" when any of the sub-devices is in the state "on", otherwise it returns "false".
Version for this ModuleClass
Get the power consumption.
This is an example simple data type with a minimum-value constraint.
The value must be equal or greater 0.0
Steps are 0.1
This datapoint represents the firmware version of the extension block.
This datapoint is an array of strings with the names of the contained devices.
......@@ -93,11 +180,15 @@
PowerSwitch 1
HGI
This sub device is intended as a demonstration of how to use the abstract modules defined in the HGI Core domain.
This sub device is intended as a demonstration of how to use the abstract modules defined in the HGI Core domain.
......@@ -110,11 +201,21 @@
PowerSwitch 2
HGI
This sub device is intended as a demonstration of how to use the abstract modules defined in the HGI Core domain.
This sub device is intended as a demonstration of how to use the abstract modules defined in the HGI Core domain.
......
<?xml version="1.0" encoding="ISO-8859-1"?>
This is a test product
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="ISO-8859-1"?><html xmlns:dal="http://www.onem2m.org/xml/sdt/4.0" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Domain productClass-test</title>
</head>
<body>
<h1>Domain productClass-test</h1>
<h2>Devices</h2>
<ul/>
</body>
</html>
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="ISO-8859-1"?><html xmlns:dal="http://www.onem2m.org/xml/sdt/4.0" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Domain semanticURI-test</title>
</head>
<body>
<h1>Domain semanticURI-test</h1>
<h2>Devices</h2>
<ul/>
</body>
</html>
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="ISO-8859-1"?><html xmlns:dal="http://www.onem2m.org/xml/sdt/4.0" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Domain void-test</title>
</head>
<body>
<h1>Domain void-test</h1>
<h2>Devices</h2>
<ul/>
</body>
</html>
This diff is collapsed.
This diff is collapsed.
......@@ -8,7 +8,7 @@
document ... -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"