Documentation
¶
Overview ¶
Package schema is the data model of the protocol, generated from go-fabric's snapshot of the matter.js model (parity/schema.json, read through go-fabric's parity package): every cluster with its attributes, commands, events and datatypes, every device type, by id and by name. The generator is internal/gen; tables_gen.go and schema.json are its committed output, and a test fails when they are stale.
Nothing here is written by hand from Matter knowledge: the ids, names, types and value names are the snapshot's. The hand-written part is the shape of the tables (this file) and their lookups (lookup.go).
Index ¶
- Constants
- func DeclarationSchema() []byte
- func GlobalAttributeID(name string) (uint32, bool)
- func JSONSchema() []byte
- type Attribute
- type Bitmap
- type BitmapMember
- type Cluster
- func (c *Cluster) Attribute(id uint32) *Attribute
- func (c *Cluster) AttributeByName(name string) *Attribute
- func (c *Cluster) Command(id uint32) *Command
- func (c *Cluster) CommandByName(name string) *Command
- func (c *Cluster) Event(id uint32) *Event
- func (c *Cluster) Response(id uint32) *Command
- func (c *Cluster) ResponseByName(name string) *Command
- type Command
- type DeviceType
- type Enum
- type EnumValue
- type Event
- type Feature
- type Field
- type GlobalAttribute
- type Meta
- type Struct
- type Type
Constants ¶
const ( // GoFabricVersion is the go-fabric module the tables were generated from. GoFabricVersion = "v0.22.2" // MatterRevision is the Matter revision of the snapshot. MatterRevision = "1.6.1" // SourceCommit is the matter.js commit the snapshot was extracted at. SourceCommit = "db021da06bafe6766cd1a05d505cea03b9ec5081" )
Provenance of the tables.
Variables ¶
This section is empty.
Functions ¶
func DeclarationSchema ¶ added in v0.2.0
func DeclarationSchema() []byte
DeclarationSchema is the JSON Schema (draft 2020-12) of the bridge half's declaration document and of a set's patch, as GET /schema/declaration serves it. The caller must not modify it.
func GlobalAttributeID ¶
GlobalAttributeID is the id of the global attribute the snapshot names name ("FeatureMap"); false when it names none.
func JSONSchema ¶
func JSONSchema() []byte
JSONSchema is the JSON Schema (draft 2020-12) of the node data values, as GET /schema serves it. The caller must not modify it.
Types ¶
type Attribute ¶
type Attribute struct {
ID uint32
Name, Property string
Type Type
Nullable bool
Writable bool
// Timed is a write that must be timed.
Timed bool
}
Attribute is a cluster attribute.
type Bitmap ¶
type Bitmap struct {
Name string
Members []BitmapMember
}
Bitmap is a bitmap datatype.
type BitmapMember ¶
BitmapMember is a bit, or a run of bits, of a bitmap: Width bits from Bit.
type Cluster ¶
type Cluster struct {
ID uint32
Name string
Revision uint16
Features []Feature
Attributes []Attribute
Commands []Command
Events []Event
}
Cluster is a cluster of the snapshot.
func ClusterByID ¶
ClusterByID is the cluster with id, or nil for one the snapshot does not know (a manufacturer cluster).
func ClusterByName ¶
ClusterByName is the cluster with name, compared without regard to case, or nil.
func (*Cluster) AttributeByName ¶
AttributeByName is the cluster's attribute with name (or property name), compared without regard to case, or nil.
func (*Cluster) CommandByName ¶
CommandByName is the cluster's request command with name, compared without regard to case ("on", "On", "moveToLevelWithOnOff"), or nil — matterjs-server camelizes command_name and looks it up the same way (WebSocketControllerHandler.ts:1783).
func (*Cluster) ResponseByName ¶
ResponseByName is the cluster's response command with name, or nil.
type Command ¶
type Command struct {
ID uint32
Name, Property string
Request bool
// Response names the response command of a request, "status" for one
// answered with a status only.
Response string
// Timed is a request that must be invoked timed.
Timed bool
Fields []Field
}
Command is a cluster command: a request (client to server) or a response.
type DeviceType ¶
DeviceType is a device type of the snapshot.
func DeviceTypeByID ¶
func DeviceTypeByID(id uint32) *DeviceType
DeviceTypeByID is the device type with id, or nil.
func DeviceTypeByName ¶
func DeviceTypeByName(name string) *DeviceType
DeviceTypeByName is the device type with name, compared without regard to case, or nil.
type Field ¶
type Field struct {
ID uint32
// Name is the snapshot's name ("NewPosition"), Property the camelCase
// property name matter.js gives it ("newPosition").
Name, Property string
Type Type
Nullable bool
// Mandatory is conformance "M".
Mandatory bool
}
Field is a member of a struct or of a command or event payload.
type GlobalAttribute ¶
GlobalAttribute is an attribute id every cluster has (FeatureMap, ClusterRevision, …), as the snapshot names it.
type Type ¶
type Type struct {
// Name is the type the snapshot states ("uint8", "epoch-s",
// "DeviceTypeStruct", "list").
Name string
Meta Meta
// Bits is the width of an integer, enum or bitmap.
Bits int
// Struct, Enum and Bitmap describe a named datatype, when the snapshot
// defines it.
Struct *Struct
Enum *Enum
Bitmap *Bitmap
// Entry is the entry type of a list.
Entry *Type
}
Type is a value's type.