Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Vorto / Describing Devices / Functionblocks"
< Vorto | Describing Devices
m |
|||
(5 intermediate revisions by the same user not shown) | |||
Line 8: | Line 8: | ||
*Operations | *Operations | ||
− | The following examples give an overview how the DSL | + | The following examples give an overview how the DSL looks like and how simple functionblocks can be modeled. Please note that in the RGBColorPicker Example the RGBColor datatype is reused. |
'''Example: Dimmer''' | '''Example: Dimmer''' | ||
+ | namespace vorto.examples.functionblocks | ||
+ | version 1.0.0 | ||
+ | |||
functionblock Dimmer { | functionblock Dimmer { | ||
displayname "Dimmer" | displayname "Dimmer" | ||
description "Function block model for a standard dimmer" | description "Function block model for a standard dimmer" | ||
− | |||
category example | category example | ||
− | |||
status{ | status{ | ||
Line 27: | Line 28: | ||
} | } | ||
} | } | ||
+ | |||
'''Example: RGBColorPicker''' | '''Example: RGBColorPicker''' | ||
+ | namespace vorto.examples.functionblocks | ||
+ | version 1.0.0 | ||
+ | using vorto.examples.color.RGBColor; 1.0.0 | ||
+ | |||
functionblock RGBColorPicker { | functionblock RGBColorPicker { | ||
displayname "RGBColorPicker" | displayname "RGBColorPicker" | ||
description "Function block model selecting RGB colors." | description "Function block model selecting RGB colors." | ||
− | |||
category example | category example | ||
− | |||
status{ | status{ | ||
Line 44: | Line 48: | ||
} | } | ||
} | } | ||
+ | |||
'''Example: Switch''' | '''Example: Switch''' | ||
+ | namespace vorto.examples.functionblocks | ||
+ | version 1.0.0 | ||
+ | |||
functionblock Switch { | functionblock Switch { | ||
displayname "Switch" | displayname "Switch" | ||
description "Function block model for a standard switch" | description "Function block model for a standard switch" | ||
− | |||
category example | category example | ||
− | |||
status{ | status{ | ||
Line 58: | Line 64: | ||
operations{ | operations{ | ||
− | on() | + | on() "switches the device unit on" |
− | off() | + | off() "switches the device unit off" |
− | toggle() | + | toggle() "switches the device unit on or off" |
} | } | ||
} | } |
Latest revision as of 21:12, 9 July 2015
Functionblocks are reusable descriptions of device components. A functionblock is typically structured as follows:
- Properties
- Status
- Configuration
- Fault
- Events
- Operations
The following examples give an overview how the DSL looks like and how simple functionblocks can be modeled. Please note that in the RGBColorPicker Example the RGBColor datatype is reused.
Example: Dimmer
namespace vorto.examples.functionblocks version 1.0.0 functionblock Dimmer { displayname "Dimmer" description "Function block model for a standard dimmer" category example status{ mandatory percent as int } operations{ increase(percent as int) decrease(percent as int) } }
Example: RGBColorPicker
namespace vorto.examples.functionblocks version 1.0.0 using vorto.examples.color.RGBColor; 1.0.0 functionblock RGBColorPicker { displayname "RGBColorPicker" description "Function block model selecting RGB colors." category example status{ mandatory color as RGBColor } operations{ setColor(color as RGBColor) } }
Example: Switch
namespace vorto.examples.functionblocks version 1.0.0 functionblock Switch { displayname "Switch" description "Function block model for a standard switch" category example status{ mandatory on as boolean } operations{ on() "switches the device unit on" off() "switches the device unit off" toggle() "switches the device unit on or off" } }