SHV Type Info

❗ This document is in DRAFT stage

TypeInfo =
<"version": 4> {
  "devicePaths": {
    DevicePath: DeviceName*
  }
  "deviceDescriptions": {
    DeviceName: DeviceDescription*
  }
  "types": {
    DefinedTypeName: TypeDescription*
  }
}

DevicePath = String

DeviceName = String

DevicePath = {   "properties": [     PropertyDescription*   ]? }

DeviceDescription = {
  "properties": [
    PropertyDescription*
  ]?
}

PropertyDescription = {
  "name": String
  "typeName": TypeName
  "label": String?
  "description": String?
  "methods": [
    MethodDescription*
  ]?
  "autoload": Bool?
  "monitored": Bool?
}

MethodDescription = {
  "name": String
  "accessGrant": ("bws" | "rd" | "wr" | "cmd" | "cfg" | "svc" | "ssvc" | "dev" | "su")
  "flags": MethodFlags
  "signature": MethodSignature
  "description": String?
  "tags": {
    TagName: Value*
  }?
}

MethodFlags = bitfield
  Signal = 1
  Getter = 2
  Setter = 4
  LargeResultHint = 8

MethodSignature = enum
  VoidVoid = 0
  VoidParam = 1
  RetVoid = 2
  RetParam = 3

TypeName = String
(PrimitiveTypeName | DefinedTypeName)

TypeDescription = {
  "typeName": (TypeName | "Enum" | "BitField")
  "fields": [
    FieldDescription*
  ]? // only for Enum and BitField types
}

FieldDescription = {
  "name": String
  "typeName": TypeName? // default is Bool
  "label": String?
  "description": String?
  "value": (EnumFieldValue | BitFieldFieldIntValue | BitFieldFieldRangeValue)
}

EnumFieldValue = Int

BitFieldFieldIntValue = Int // bit index

BitFieldFieldRangeValue = [
  StartIndex = Int // index of LSB
  EndIndex = Int // index of MSB
]