{
  "name": "LED",
  "status": "stable",
  "shortId": "led",
  "camelName": "led",
  "shortName": "led",
  "extends": [
    "_base"
  ],
  "notes": {
    "short": "A controller for displays of individually controlled RGB LEDs.\n\nFor 64 or less LEDs, the service should support the pack the pixels in the pixels register.\nBeyond this size, the register should return an empty payload as the amount of data exceeds\nthe size of a packet. Typically services that use more than 64 LEDs\nwill run on the same MCU and will maintain the pixels buffer internally."
  },
  "classIdentifier": 369743088,
  "enums": {
    "Variant": {
      "name": "Variant",
      "storage": 1,
      "members": {
        "Strip": 1,
        "Ring": 2,
        "Stick": 3,
        "Jewel": 4,
        "Matrix": 5
      }
    }
  },
  "constants": {
    "max_pixels_length": {
      "value": 64,
      "hex": false
    }
  },
  "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": "pixels",
      "identifier": 2,
      "description": "A buffer of 24bit RGB color entries for each LED, in R, G, B order.\nWhen writing, if the buffer is too short, the remaining pixels are set to `#000000`;\nIf the buffer is too long, the write may be ignored, or the additional pixels may be ignored.\nIf the number of pixels is greater than `max_pixels_length`, the read should return an empty payload.",
      "fields": [
        {
          "name": "_",
          "type": "bytes",
          "storage": 0,
          "isSimpleType": true
        }
      ],
      "identifierName": "value",
      "packFormat": "b"
    },
    {
      "kind": "rw",
      "name": "brightness",
      "identifier": 1,
      "description": "Set the luminosity of the strip.\nAt `0` the power to the strip is completely shut down.",
      "fields": [
        {
          "name": "_",
          "unit": "/",
          "shift": 8,
          "type": "u0.8",
          "storage": 1,
          "defaultValue": 0.05
        }
      ],
      "identifierName": "intensity",
      "packFormat": "u0.8"
    },
    {
      "kind": "ro",
      "name": "actual_brightness",
      "identifier": 384,
      "description": "This is the luminosity actually applied to the strip.\nMay be lower than `brightness` if power-limited by the `max_power` register.\nIt will rise slowly (few seconds) back to `brightness` is limits are no longer required.",
      "fields": [
        {
          "name": "_",
          "unit": "/",
          "shift": 8,
          "type": "u0.8",
          "storage": 1
        }
      ],
      "packFormat": "u0.8"
    },
    {
      "kind": "const",
      "name": "num_pixels",
      "identifier": 386,
      "description": "Specifies the number of pixels in the strip.",
      "fields": [
        {
          "name": "_",
          "unit": "#",
          "type": "u16",
          "storage": 2,
          "isSimpleType": true
        }
      ],
      "packFormat": "u16"
    },
    {
      "kind": "const",
      "name": "num_columns",
      "identifier": 387,
      "description": "If the LED pixel strip is a matrix, specifies the number of columns.",
      "fields": [
        {
          "name": "_",
          "unit": "#",
          "type": "u16",
          "storage": 2,
          "isSimpleType": true
        }
      ],
      "optional": true,
      "packFormat": "u16"
    },
    {
      "kind": "rw",
      "name": "max_power",
      "identifier": 7,
      "description": "Limit the power drawn by the light-strip (and controller).",
      "fields": [
        {
          "name": "_",
          "unit": "mA",
          "type": "u16",
          "storage": 2,
          "isSimpleType": true,
          "defaultValue": 200
        }
      ],
      "optional": true,
      "identifierName": "max_power",
      "packFormat": "u16"
    },
    {
      "kind": "const",
      "name": "leds_per_pixel",
      "identifier": 388,
      "description": "If known, specifies the number of LEDs in parallel on this device.\nThe actual number of LEDs is `num_pixels * leds_per_pixel`.",
      "fields": [
        {
          "name": "_",
          "unit": "#",
          "type": "u16",
          "storage": 2,
          "isSimpleType": true
        }
      ],
      "optional": true,
      "packFormat": "u16"
    },
    {
      "kind": "const",
      "name": "wave_length",
      "identifier": 389,
      "description": "If monochrome LED, specifies the wave length of the LED.\nRegister is missing for RGB LEDs.",
      "fields": [
        {
          "name": "_",
          "unit": "nm",
          "type": "u16",
          "storage": 2,
          "isSimpleType": true,
          "typicalMin": 365,
          "typicalMax": 885
        }
      ],
      "optional": true,
      "packFormat": "u16"
    },
    {
      "kind": "const",
      "name": "luminous_intensity",
      "identifier": 390,
      "description": "The luminous intensity of all the LEDs, at full brightness, in micro candella.",
      "fields": [
        {
          "name": "_",
          "unit": "mcd",
          "type": "u16",
          "storage": 2,
          "isSimpleType": true,
          "typicalMin": 10,
          "typicalMax": 5000
        }
      ],
      "optional": true,
      "packFormat": "u16"
    },
    {
      "kind": "const",
      "name": "variant",
      "identifier": 263,
      "description": "Specifies the shape of the light strip.",
      "fields": [
        {
          "name": "_",
          "type": "Variant",
          "storage": 1
        }
      ],
      "optional": true,
      "identifierName": "variant",
      "packFormat": "u8"
    }
  ],
  "tags": [],
  "group": "Light"
}