schema

package
v0.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

func GlobalAttributeID(name string) (uint32, bool)

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

type BitmapMember struct {
	Name       string
	Bit, Width int
}

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

func ClusterByID(id uint32) *Cluster

ClusterByID is the cluster with id, or nil for one the snapshot does not know (a manufacturer cluster).

func ClusterByName

func ClusterByName(name string) *Cluster

ClusterByName is the cluster with name, compared without regard to case, or nil.

func Clusters

func Clusters() []*Cluster

Clusters are the snapshot's clusters, in its order.

func (*Cluster) Attribute

func (c *Cluster) Attribute(id uint32) *Attribute

Attribute is the cluster's attribute with id, or nil.

func (*Cluster) AttributeByName

func (c *Cluster) AttributeByName(name string) *Attribute

AttributeByName is the cluster's attribute with name (or property name), compared without regard to case, or nil.

func (*Cluster) Command

func (c *Cluster) Command(id uint32) *Command

Command is the cluster's request command with id, or nil.

func (*Cluster) CommandByName

func (c *Cluster) CommandByName(name string) *Command

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) Event

func (c *Cluster) Event(id uint32) *Event

Event is the cluster's event with id, or nil.

func (*Cluster) Response

func (c *Cluster) Response(id uint32) *Command

Response is the cluster's response command with id, or nil.

func (*Cluster) ResponseByName

func (c *Cluster) ResponseByName(name string) *Command

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

type DeviceType struct {
	ID       uint32
	Name     string
	Revision uint16
}

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 Enum

type Enum struct {
	Name   string
	Values []EnumValue
}

Enum is an enum datatype.

type EnumValue

type EnumValue struct {
	Value uint64
	Name  string
}

EnumValue is one value of an enum.

type Event

type Event struct {
	ID             uint32
	Name, Property string
	Priority       string
	Fields         []Field
}

Event is a cluster event.

type Feature

type Feature struct {
	Name, Title string
	Bit         int
}

Feature is a FeatureMap bit.

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

type GlobalAttribute struct {
	ID   uint32
	Name string
}

GlobalAttribute is an attribute id every cluster has (FeatureMap, ClusterRevision, …), as the snapshot names it.

type Meta

type Meta uint8

Meta is the encoded shape of a value — the snapshot's metatype.

const (
	// MetaAny is a value the snapshot gives no type: it is rendered as
	// decoded from the TLV.
	MetaAny Meta = iota
	MetaBool
	MetaUint
	MetaInt
	MetaFloat
	MetaDouble
	MetaString
	MetaBytes
	MetaEnum
	MetaBitmap
	MetaStruct
	MetaList
)

Value shapes.

type Struct

type Struct struct {
	Name   string
	Fields []Field
}

Struct is a struct datatype.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL