{
  "name": "7-segment display",
  "status": "rc",
  "shortId": "sevensegmentdisplay",
  "camelName": "sevenSegmentDisplay",
  "shortName": "sevenSegmentDisplay",
  "extends": [
    "_base"
  ],
  "notes": {
    "short": "A 7-segment numeric display, with one or more digits."
  },
  "classIdentifier": 425810167,
  "enums": {},
  "constants": {},
  "packets": [
    {
      "kind": "report",
      "name": "command_not_implemented",
      "identifier": 3,
      "description": "This report may be emitted by a server in response to a command (action or register operation)\nthat it does not understand.\nThe `service_command` and `packet_crc` fields are copied from the command packet that was unhandled.\nNote that it's possible to get an ACK, followed by such an error report.",
      "fields": [
        {
          "name": "service_command",
          "type": "u16",
          "storage": 2,
          "isSimpleType": true
        },
        {
          "name": "packet_crc",
          "type": "u16",
          "storage": 2,
          "isSimpleType": true
        }
      ],
      "identifierName": "command_not_implemented",
      "packFormat": "u16 u16",
      "derived": "_base"
    },
    {
      "kind": "const",
      "name": "instance_name",
      "identifier": 265,
      "description": "A friendly name that describes the role of this service instance in the device.\nIt often corresponds to what's printed on the device:\nfor example, `A` for button A, or `S0` for servo channel 0.\nWords like `left` should be avoided because of localization issues (unless they are printed on the device).",
      "fields": [
        {
          "name": "_",
          "type": "string",
          "storage": 0
        }
      ],
      "optional": true,
      "identifierName": "instance_name",
      "packFormat": "s",
      "derived": "_base"
    },
    {
      "kind": "ro",
      "name": "status_code",
      "identifier": 259,
      "description": "Reports the current state or error status of the device. ``code`` is a standardized value from \nthe Jacdac status/error codes. ``vendor_code`` is any vendor specific error code describing the device\nstate. This report is typically not queried, when a device has an error, it will typically\nadd this report in frame along with the announce packet. If a service implements this register,\nit should also support the ``status_code_changed`` event defined below.",
      "fields": [
        {
          "name": "code",
          "type": "u16",
          "storage": 2,
          "isSimpleType": true
        },
        {
          "name": "vendor_code",
          "type": "u16",
          "storage": 2,
          "isSimpleType": true
        }
      ],
      "optional": true,
      "identifierName": "status_code",
      "packFormat": "u16 u16",
      "derived": "_base"
    },
    {
      "kind": "rw",
      "name": "client_variant",
      "identifier": 9,
      "description": "An optional register in the format of a URL query string where the client can provide hints how\nthe device twin should be rendered. If the register is not implemented, the client library can simulate the register client side.",
      "fields": [
        {
          "name": "_",
          "type": "string",
          "storage": 0
        }
      ],
      "optional": true,
      "identifierName": "client_variant",
      "packFormat": "s",
      "derived": "_base"
    },
    {
      "kind": "event",
      "name": "status_code_changed",
      "identifier": 4,
      "description": "Notifies that the status code of the service changed.",
      "fields": [
        {
          "name": "code",
          "type": "u16",
          "storage": 2,
          "isSimpleType": true
        },
        {
          "name": "vendor_code",
          "type": "u16",
          "storage": 2,
          "isSimpleType": true
        }
      ],
      "optional": true,
      "identifierName": "status_code_changed",
      "packFormat": "u16 u16",
      "derived": "_base"
    },
    {
      "kind": "rw",
      "name": "digits",
      "identifier": 2,
      "description": "Each byte encodes the display status of a digit using,\nwhere lowest bit 0 encodes segment `A`, bit 1 encodes segments `B`, ..., bit 6 encodes segments `G`, and bit 7 encodes the decimal point (if present).\nIf incoming `digits` data is smaller than `digit_count`, the remaining digits will be cleared.\nThus, sending an empty `digits` payload clears the screen.\n\n```text\nGFEDCBA DP\n - A -\n F   B\n |   |\n - G -\n |   |\n E   C   _\n |   |  |DP|\n - D -   -\n```",
      "fields": [
        {
          "name": "_",
          "encoding": "bitset",
          "type": "bytes",
          "storage": 0,
          "isSimpleType": true
        }
      ],
      "lowLevel": true,
      "identifierName": "value",
      "packFormat": "b"
    },
    {
      "kind": "rw",
      "name": "brightness",
      "identifier": 1,
      "description": "Controls the brightness of the LEDs. `0` means off.",
      "fields": [
        {
          "name": "_",
          "unit": "/",
          "shift": 16,
          "type": "u0.16",
          "storage": 2
        }
      ],
      "optional": true,
      "identifierName": "intensity",
      "packFormat": "u0.16"
    },
    {
      "kind": "rw",
      "name": "double_dots",
      "identifier": 128,
      "description": "Turn on or off the column LEDs (separating minutes from hours, etc.) in of the segment.\nIf the column LEDs is not supported, the value remains false.",
      "fields": [
        {
          "name": "_",
          "type": "bool",
          "storage": 1
        }
      ],
      "optional": true,
      "packFormat": "u8"
    },
    {
      "kind": "const",
      "name": "digit_count",
      "identifier": 384,
      "description": "The number of digits available on the display.",
      "fields": [
        {
          "name": "_",
          "type": "u8",
          "storage": 1,
          "isSimpleType": true
        }
      ],
      "packFormat": "u8"
    },
    {
      "kind": "const",
      "name": "decimal_point",
      "identifier": 385,
      "description": "True if decimal points are available (on all digits).",
      "fields": [
        {
          "name": "_",
          "type": "bool",
          "storage": 1
        }
      ],
      "optional": true,
      "packFormat": "u8"
    },
    {
      "kind": "command",
      "name": "set_number",
      "identifier": 128,
      "description": "Shows the number on the screen using the decimal dot if available.",
      "fields": [
        {
          "name": "value",
          "isFloat": true,
          "type": "f64",
          "storage": 8
        }
      ],
      "client": true,
      "packFormat": "f64"
    }
  ],
  "tags": [
    "8bit"
  ],
  "group": "Display"
}