...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<Def Name="PeripheralParams">
<String Name="Peripheral"/>
<String Name="InterfacePort"/>
<String Name="Interface"/>
<String Name="UniqueId" default="56789"/>
<String Name="Baudrate"/>
<String Name="Format" default="ascii"/>
<String Name="Operation"/>
<String Name="Payload"/>
</Def>
<ThingFacet Name="TempFacetSerial">
<String Name="InitSubscribers" default="false" KnownBy="InitSubAction"/>
<String Name="SensorData" update="auto" KnownBy="SensorDataReadAction"/>
<PeripheralParams Name="PerifParams"/>
<Action Name="SensorDataReadAction">
<Workflow Limit="1" Live="1" Timeout="-1">
<Task name="Main" while="true">
<Event name="Argument" as="ActionArgument"/>
<Invoke name="InvokeSerialRead" waitFor="Argument" get="perif://">
<Message>
<Value>
<InterfacePort>
"[%:Event.Argument.PerifParams.InterfacePort.Value:%]"
</InterfacePort>
<Baudrate>
"[%:Event.Argument.PerifParams.Baudrate.Value:%]"
</Baudrate>
<Interface>
"[%:Event.Argument.PerifParams.Interface.Value:%]"
</Interface>
<UniqueId>
"[%:Event.Argument.PerifParams.UniqueId.Value:%]"
</UniqueId>
<Operation>
"[%:Event.Argument.PerifParams.Operation.Value:%]"
</Operation>
<Peripheral>
"[%:Event.Argument.PerifParams.Peripheral.Value:%]"
</Peripheral>
<Payload>
"[%:Event.Argument.PerifParams.Payload.Value:%]"
</Payload>
<Format>
"[%:Event.Argument.PerifParams.Format.Value:%]"
</Format>
</Value>
</Message>
</Invoke>
<Output Name="Result" As="ActionResult">
<Value>
<SensorData>
[%:Invoke.InvokeSerialRead.Message.Value/normalize-space(received):%]
</SensorData>
</Value>
</Output>
</Task>
</Workflow>
</Action>
</ThingFacet>
<ThingModel Name="TempSensor" combines="TempFacetSerial">
<Sid Name="sensorId"/>
<Reference Name="ZoneID" Type="Zone" Cardinality="1"/>
</ThingModel> |
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<Query> <DeleteAll format="version,current"> <Grid> <GridID ne=""/> </Grid> </DeleteAll> <Create> <Grid> <GridName> Intel-Grid </GridName> <GridID> livegrid </GridID> <ZoneID> livezone </ZoneID> <GridLength> 1 </GridLength> <GridWidth> 1 </GridWidth> <GridNSPosition> N1 </GridNSPosition> <GridWEPosition> E2 </GridWEPosition> <GridLocation> <Vertex1> 1 </Vertex1> <Vertex2> 1 </Vertex2> <Vertex3> 1 </Vertex3> <Vertex4> 1 </Vertex4> </GridLocation> <SoilMoisture> 53 </SoilMoisture> <AmbientLight> 0 </AmbientLight> </Grid> </Create> </Query> |
...