Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
titlePhidgetSensor Thing Model
linenumberstrue
<ThingFacet#
ThingFacet(Name=: "PhidgetSensorFacet">):
  <Integer Name=Integer(Name: "SensorValue", Update=: "auto", KnownBy=: "PhidgetSensorAction"/>)
  <String Name=String(Name: "SensorURL", Default=: "phid://"/>)
  <String Name=String(Name: "SensorInterfaceIndex"/>)
  <String Name=String(Name: "SensorType"/>)
  <String Name=String(Name: "SensorInterfaceType"/>)
  <String Name=String(Name: "SensorValueFormat"/>)
  <String Name=String(Name: "Simulated"/>
</ThingFacet>
<ThingModel Name=)
ThingModel(Name: "PhidgetSensorModel", Combines=: "PhidgetSensorFacet">):
  <Sid Name=Sid(Name: "phidId"/>
</ThingModel>)

Create model instances

The model instances of PhidgetSensorModel is created using a Create TQL Query. 

Code Block
languagexml
titleCreate PhidgetSensor ThingModel Instance
linenumberstrue
<Query>#
Query: 
  Create: 
 <Create>   PhidgetSensors: 
<PhidgetSensors>      SensorURL: <SensorURL>phidphid://</SensorURL> 
      SensorType: Rotation 
 <SensorType>Rotation</SensorType>     SensorInterfaceType: PhidgetInterfaceKit 
<SensorInterfaceType>PhidgetInterfaceKit</SensorInterfaceType>      SensorValueFormat: Raw <SensorValueFormat>Raw</SensorValueFormat>
      <SensorInterfaceIndex>0</SensorInterfaceIndex>SensorInterfaceIndex: 0 
     <SensorValue SensorValue(value=: "$Null()", version=: "1"/>);
      <Simulated>true</Simulated>
    </PhidgetSensors>
  </Create>
</Query>Simulated: true

The result of model instance creation is below.

...

Code Block
languagexml
titleCreate PhidgetSensor ThingModel Instance Result
linenumberstrue
<Create#
Create(Status=: "Success">):
  <PhidgetSensors>PhidgetSensors: 
    <phidId>KNUBPHLOAAAAUAABA6EJCI75</phidId>phidId: KNUBPHLOAAAAUAABA6EJCI75
   <SensorValue SensorValue(Status=: "Success+Created:1:1457740291438;", Value=: "", Version=: "1"/>)
    <SensorURL Status=SensorURL(Status: "Success+Created:1:1457740291442;", Value=: "phid://", Version=: "1"/>)
    <SensorInterfaceIndex Status=SensorInterfaceIndex(Status: "Success+Created:1:1457740291443;", Value=: "0", Version=: "1"/>)
    <SensorType Status=SensorType(Status: "Success+Created:1:1457740291444;", Value=: "Rotation", Version=: "1"/>)
    <SensorInterfaceType Status=SensorInterfaceType(Status: "Success+Created:1:1457740291444;", Value=: "PhidgetInterfaceKit", Version=: "1"/>)
    <SensorValueFormat Status=SensorValueFormat(Status: "Success+Created:1:1457740291445;", Value=: "Raw", Version=: "1"/>)
    <Simulated Status=Simulated(Status: "Success+Created:1:1457740291445;", Value=: "true", Version=: "1"/>
  </PhidgetSensors>
</Create>)

Find Model Instances

After model instances are created, you can read them using Find Query with constraints.

Code Block
languagexml
titleFind PhidgetSensor ThingModel Instance
linenumberstrue
<Query>#
Query: 
  <FindFind format=: "all">):
    <PhidgetSensors>PhidgetSensors: 
     <SensorURL SensorURL(ne : =""/>
    </PhidgetSensors>
  </Find>
</Query>)

Find Query Result

Code Block
languageruby
themexmlEmacs
titleFind PhidgetSensor ThingModel Instance
linenumberstrue
<Find Status=#Find(Status: "Success", Format=: "all">):
	Result: 
<Result>
    <PhidgetSensors QName=		PhidgetSensors(QName: "SimpleModel.MyModels.PhidgetSensors">
      <phidId>KNUBPHLOAAAAUAABA6EJCI75</phidId>
      <SensorValue Value="" Known="60" Version="1" Timestamp="1457740291438" DateTime=):
			phidId: KNUBPHLOAAAAUAABA6EJCI75 
			SensorValue(Value: "", Known: "60", Version: "1", Timestamp: "1457740291438", DateTime: "2016-03-11 15:51:31.438", QName=: "SimpleModel.MyModels.PhidgetSensors.SensorValue", FName=: "SensorValue"/>
      <SensorURL Value=)
			SensorURL(Value: "phid://", Known=: "phid://", Version=: "1", Timestamp=: "1457740291442", DateTime=: "2016-03-11 15:51:31.442", QName=: "SimpleModel.MyModels.PhidgetSensors.SensorURL", FName=: "SensorURL"/>
      <SensorInterfaceType Value=)
			SensorInterfaceType(Value: "PhidgetInterfaceKit", Known=: "PhidgetInterfaceKit", Version=: "1", Timestamp=: "1457740291444", DateTime=: "2016-03-11 15:51:31.444", QName=: "SimpleModel.MyModels.PhidgetSensors.SensorInterfaceType", FName=: "SensorInterfaceType"/>
      <Simulated Value=)
			Simulated(Value: "true", Known=: "true", Version=: "1", Timestamp=: "1457740291445", DateTime=: "2016-03-11 15:51:31.445", QName=: "SimpleModel.MyModels.PhidgetSensors.Simulated", FName=: "Simulated"/>
      <SensorInterfaceIndex Value=)
			SensorInterfaceIndex(Value: "0", Known=: "0", Version=: "1", Timestamp=: "1457740291443", DateTime=: "2016-03-11 15:51:31.443", QName=: "SimpleModel.MyModels.PhidgetSensors.SensorInterfaceIndex", FName=: "SensorInterfaceIndex"/>
      <SensorType Value=)
			SensorType(Value: "Rotation", Known=: "Rotation", Version=: "1", Timestamp=: "1457740291444", DateTime=: "2016-03-11 15:51:31.444", QName=: "SimpleModel.MyModels.PhidgetSensors.SensorType", FName=: "SensorType"/>
      <SensorValueFormat Value=)
			SensorValueFormat(Value: "Raw", Known=: "Raw", Version=: "1", Timestamp=: "1457740291445", DateTime=: "2016-03-11 15:51:31.445", QName=: "SimpleModel.MyModels.PhidgetSensors.SensorValueFormat", FName=: "SensorValueFormat"/>
    </PhidgetSensors>
  </Result>
</Find>)


Note
iconfalse

The following system generated tags are for each attribute: 

Include Page
System generated tags for attributes
System generated tags for attributes

Go to page

...