Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "IoT/M2MIWG/Machine-to-machine model"
< IoT
(New page: {{:DocumentationGuidelines/DraftHeader}}) |
|||
Line 1: | Line 1: | ||
{{:DocumentationGuidelines/DraftHeader}} | {{:DocumentationGuidelines/DraftHeader}} | ||
+ | |||
+ | |||
+ | = Examples = | ||
+ | |||
+ | == Application model == | ||
+ | |||
+ | <source lang="lua"> | ||
+ | -- author: Benjamin Cabé | ||
+ | -- revision: 1.0 | ||
+ | Application "HomeAutomation" | ||
+ | |||
+ | |||
+ | CommunicationCapabilities { | ||
+ | |||
+ | } | ||
+ | |||
+ | |||
+ | Data { | ||
+ | Rooms | ||
+ | Room1 | ||
+ | TempSensor1 | ||
+ | value (int) | ||
+ | batteryLevel (int) | ||
+ | macAddress (string) | ||
+ | Curtain1 | ||
+ | position (int) | ||
+ | macAddress (string) | ||
+ | Room2 | ||
+ | TempSensor1 (WavenisTemperatureSensor) | ||
+ | } | ||
+ | |||
+ | Events { | ||
+ | TemperatureTooHot | ||
+ | Intrusion, ACK | ||
+ | } | ||
+ | |||
+ | Settings { | ||
+ | ???? | ||
+ | } | ||
+ | |||
+ | Commands { | ||
+ | ToggleCurtains(OPEN=default|CLOSE) | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | |||
+ | |||
+ | == typedef model == | ||
+ | |||
+ | <source lang="lua"> | ||
+ | -- author: Benjamin Cabé | ||
+ | -- revision 1.0 | ||
+ | include 'tcpip' | ||
+ | |||
+ | Type "WavenisSensor" { | ||
+ | serialNumber: string, | ||
+ | macAddress: tcpip.MacAddress, | ||
+ | batteryLevel: float, | ||
+ | [...] | ||
+ | } | ||
+ | |||
+ | Type "WavenisTemperatureSensor" extends "WavenisSensor"{ | ||
+ | temperature: float | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | |||
+ | == rules model == | ||
+ | |||
+ | <source lang="lua"> | ||
+ | -- author: Benjamin Cabé | ||
+ | -- revision 1.0 | ||
+ | Rules for application "HomeAutomation" v1.0 | ||
+ | |||
+ | rule "trigger TemperatureTooHot" | ||
+ | when | ||
+ | (Rooms/Room1/TempSensor1 + Rooms/Room2/TempSensor1) / 2 > 25.0 | ||
+ | then | ||
+ | TemperatureTooHot() | ||
+ | end | ||
+ | </source> | ||
+ | |||
+ | |||
+ | |||
+ | == i18n model == | ||
+ | |||
+ | <source lang="lua"> | ||
+ | -- author: Benjamin Cabé | ||
+ | -- revision 1.0 | ||
+ | i18n for application "HomeAutomation" v1.0 | ||
+ | |||
+ | en: | ||
+ | Data/Rooms=House rooms | ||
+ | Data/Rooms/Room1=Living Room | ||
+ | Data/Rooms/Room1/TempSensor1=Temperature | ||
+ | [...] | ||
+ | |||
+ | fr_FR: | ||
+ | Data/Rooms=Pièces de la maison | ||
+ | Data/Rooms/Room1=Salon | ||
+ | Data/Rooms/Room1/TempSensor1=Température | ||
+ | [...] | ||
+ | </source> |
Revision as of 12:17, 8 September 2011
Examples
Application model
-- author: Benjamin Cabé -- revision: 1.0 Application "HomeAutomation" CommunicationCapabilities { } Data { Rooms Room1 TempSensor1 value (int) batteryLevel (int) macAddress (string) Curtain1 position (int) macAddress (string) Room2 TempSensor1 (WavenisTemperatureSensor) } Events { TemperatureTooHot Intrusion, ACK } Settings { ???? } Commands { ToggleCurtains(OPEN=default|CLOSE) }
typedef model
-- author: Benjamin Cabé -- revision 1.0 include 'tcpip' Type "WavenisSensor" { serialNumber: string, macAddress: tcpip.MacAddress, batteryLevel: float, [...] } Type "WavenisTemperatureSensor" extends "WavenisSensor"{ temperature: float }
rules model
-- author: Benjamin Cabé -- revision 1.0 Rules for application "HomeAutomation" v1.0 rule "trigger TemperatureTooHot" when (Rooms/Room1/TempSensor1 + Rooms/Room2/TempSensor1) / 2 > 25.0 then TemperatureTooHot() end
i18n model
-- author: Benjamin Cabé -- revision 1.0 i18n for application "HomeAutomation" v1.0 en: Data/Rooms=House rooms Data/Rooms/Room1=Living Room Data/Rooms/Room1/TempSensor1=Temperature [...] fr_FR: Data/Rooms=Pièces de la maison Data/Rooms/Room1=Salon Data/Rooms/Room1/TempSensor1=Température [...]