<filename>SensorPropsResURI.swagger.json
{
  "swagger": "2.0",
  "info": {
    "title": "Sensor Properties",
    "version": "20190215",
    "license": {
      "name": "OCF Data Model License",
      "url": "https://github.com/openconnectivityfoundation/core/blob/e28a9e0a92e17042ba3e83661e4c0fbce8bdc4ba/LICENSE.md",
      "x-copyright": "copyright 2016-2017, 2019 Open Connectivity Foundation, Inc. All rights reserved."
    },
    "termsOfService": "https://openconnectivityfoundation.github.io/core/DISCLAIMER.md"
  },
  "schemes": ["http"],
  "consumes": ["application/json"],
  "produces": ["application/json"],
  "paths": {
    "/SensorPropsResURI" : {
      "get": {
        "description": "This Ressource describes the properties which guide the reporting of a state change of a Sensor.\nThe Property \"silenttime\" represents the period after which a state change report was sent where the Sensor state change is not reported.\nThe Property \"sensitivity\" represents the level at which the sensor detects a state change.\nThese values are completely dependend on the type of Sensor and the manufacturer capability, so no range restrictions are used.\nThe Properties \"range\", \"step\" and \"precision\" are only applied to the \"sensitivity\" Property.",
        "parameters": [
          {"$ref": "#/parameters/interface"}
        ],
        "responses": {
            "200": {
              "description" : "Gets current Sensor Property values.",
              "x-example":
                {
                  "rt": ["oic.r.sensor.props"],
                  "if": ["oic.if.rw", "oic.if.baseline"],
                  "silenttime": 10,
                  "sensitivity": 20.5
                },
              "schema": { "$ref": "#/definitions/SensorProps" }
            }
        }
      },
      "post": {
        "description": "Sets Sensor Property values\n",
        "parameters": [
          {"$ref": "#/parameters/interface"},
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": { "$ref": "#/definitions/SensorProps" },
            "x-example":
              {
                "silenttime": 20,
                "sensitivity": 10.75
              }
          }
        ],
        "responses": {
            "200": {
              "description" : "",
              "x-example":
                {
                  "silenttime": 20,
                  "sensitivity": 10.75
                },
              "schema": { "$ref": "#/definitions/SensorProps" }
            }
        }
      }
    }
  },
  "parameters": {
    "interface": {
      "in": "query",
      "name": "if",
      "type": "string",
      "enum": ["oic.if.rw", "oic.if.baseline"]
    }
  },
  "definitions": {
    "SensorProps" : {
      "properties": {
        "rt": {
          "description": "The Resource Type.",
          "items": {
            "enum": ["oic.r.sensor.props"],
            "maxLength": 64,
            "type": "string"
          },
          "minItems": 1,
          "uniqueItems": true,
          "readOnly": true,
          "type": "array"
        },
        "silenttime": {
          "description": "The time in seconds from the previous report that the Sensor restrains from sending a state change. This is used to avoid repeated state change reports.",
          "type": "integer"
        },
        "sensitivity": {
          "description": "The level of the detection accuracy of the Sensor. This is used to control the level at which the Senor detects a state change. The \"range\" Property should be specified per manufacturer device capabilities.",
          "type": "number"
        },
        "n": {
            "$ref": "https://openconnectivityfoundation.github.io/core/schemas/oic.common.properties.core-schema.json#/definitions/n"
        },
        "id": {
            "$ref": "https://openconnectivityfoundation.github.io/core/schemas/oic.common.properties.core-schema.json#/definitions/id"
        },
        "range": {
            "$ref": "https://openconnectivityfoundation.github.io/IoTDataModels/schemas/oic.baseresource.properties-schema.json#/definitions/range_number"
        },
        "step": {
            "$ref": "https://openconnectivityfoundation.github.io/IoTDataModels/schemas/oic.baseresource.properties-schema.json#/definitions/step_number"
        },
        "precision": {
          "$ref": "https://openconnectivityfoundation.github.io/IoTDataModels/schemas/oic.baseresource.properties-schema.json#/definitions/precision"
        },
        "if": {
          "description": "The OCF Interface set supported by this Resource.",
          "items": {
            "enum": [
              "oic.if.rw",
              "oic.if.baseline"
            ],
            "type": "string"
          },
          "minItems": 2,
          "uniqueItems": true,
          "readOnly": true,
          "type": "array"
        }
      },
      "type": "object",
      "required": ["silenttime", "sensitivity"]
    }
  }
}
