Versions Compared

Key

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

...

Definition

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

...

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

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

...

Note that there is Status returned for every attribute that gets created.

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

...

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

Code Block
languagexmlruby
themeEmacs
titleFind PhidgetSensor ThingModel Instance
linenumberstrue
#
Query: 
  Find format: "all"):
    PhidgetSensors: 
      SensorURL(ne : "")

...