device_types

The device_types database contains information about a type of devices (whereas the devices database contains info about a specific instance of a device). This Database is important because it contains info on what commands are available for the device, and what microservices and endpoints are used in the use of these commands.

Sample CouchDB Entry for Raspberry Pi device-type:

{
  "_id": "Pi3", (1)
  "_rev": "9-9a60c267a9cad92da3fb85p35cbb757d", (1)
  "description": "A Raspberry Pi 3", (1)
  "display_name": "Pi", (1)
  "roles": [ (2)
    {
      "_id": "ControlProcessor",
      "description": "Acts as a device to control the AV-API in a room"
    },
    {
      "_id": "Touchpanel",
      "description": "A device with a touchscreen interface"
    },
    {
      "_id": "EventRouter",
      "description": "Acts as a device that routes events through the room to other devices"
    }
  ],
  "commands": [ (3)
    {
      "_id": "GenericPassthroughADCP", (4)
      "description": "GenericPassthroughADCP", (5)
      "microservice": { (6)
        "_id": "generic-gateway-Adcp", (7)
        "description": "used to serialize requests to and ADCP device", (8)
        "address": "http://:gateway:8012" (9)
      },
      "endpoint": { (10)
        "_id": "Generic Gateway", (11)
        "description": "A generic Gateway for use in base case where microservice exists outside of the pi issuing the requests.", (12)
        "path": "/:path" (13)
      },
      "priority": 1 (14)
    }
  ]
}
  1. These fields are identical to the fields mentioned in detail in previous examples.

  2. "roles": The roles of the device, described in detail in previous examples.

  3. "commands": The list of commands that can be sent to this device.

  4. "_id": the unique identifier for the command.

  5. "description": for your own use to save info about the command.

  6. "microservice": The info for the microservice used in making the command.

  7. "_id": the unique identifier for the microservice.

  8. "description": for your own use to save info about the microservice.

  9. "address": is where the microservice is running including the port it is running on.

  10. "endpoint": The API endpoint on the microservice that corresponds to the command.

  11. "_id": is the unique identifier for the enpoint.

  12. "description": for your own use to save info about the endpoint.

  13. "path": is the path to the endpoint.

  14. "priority": This is used to help determine which events are more important and need to be executed first.

Sample CouchDB Entry for SONY XBR device-type:

{
  "_id": "SonyXBR", (1)
  "_rev": "15-8f26e6d80867548a39675c73619663bc", (1)
  "description": "The Sony XBR TV line.", (1)
  "display_name": "Sony XBR TV", (1)
  "output": true, (2)
  "destination": true, (3)
  "default-name": "D", (1)
  "default-icon": "tv", (1)
  "roles": [ (1)
    {
      "_id": "AudioOut",
      "description": "Acts as an audio output device"
    },
    {
      "_id": "VideoOut",
      "description": "Acts as a video output device"
    }
  ],
  "power_states": [ (4)
    {
      "_id": "On",
      "description": "On",
      "tags": []
    },
    {
      "_id": "Standby",
      "description": "Standby",
      "tags": []
    }
  ],
  "ports": [ (1)
    {
      "_id": "hdmi!1",
      "friendly_name": "HDMI 1",
      "description": "SonyTV HDMI input 1",
      "tags": [
        "port-in",
        "video"
      ]
    },
    ...//there are additional ports not included
  ],
  "commands": [ (1)
    {
      "_id": "Standby",
      "description": "Standby",
      "microservice": {
        "_id": "sony-control-microservice",
        "description": "",
        "address": "http://localhost:8007"
      },
      "endpoint": {
        "_id": "Standby",
        "description": "Standard standby endpoint.",
        "path": "/:address/power/standby"
      },
      "priority": 100
    }
    ...//there are additional commands not included
  ]
}
  1. These fields are identical to the fields mentioned in detail in previous examples. The ones above are an example of the implementation of these fields for a SonyXBR

  2. "output": This field designates if the device is an output device.

  3. "destination": This field designates if the device is a destination device.

  4. "power_states": This field lists the different power states of the device.

Up Next: