applicationbasic

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 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 applicationbasic is the generated definition of the Matter ApplicationBasic cluster (0x050D, revision 1), from the matter.js model at b25ed96 (Matter 1.6.1).

It declares the cluster's ids, typed enums, bitmaps and structs with their TLV codecs, the command and event payloads, and Definition, the metadata the cluster/spec runtime derives lists, privileges and write checks from. Importing the package registers the definition with spec.Register, so the bridge decodes the cluster's request payloads.

Index

Constants

View Source
const (
	ClusterID uint32 = 0x050D
	Name             = "ApplicationBasic"
	Revision  uint16 = 1
)

Cluster identity.

View Source
const (
	AttrVendorName         uint32 = 0x0000 // string, O, R V, F
	AttrVendorId           uint32 = 0x0001 // vendor-id, O, R V, F
	AttrApplicationName    uint32 = 0x0002 // string, M, R V, F
	AttrProductId          uint32 = 0x0003 // uint16, O, R V, F
	AttrApplication        uint32 = 0x0004 // ApplicationStruct, M, R V, F
	AttrStatus             uint32 = 0x0005 // ApplicationStatusEnum, M, R V
	AttrApplicationVersion uint32 = 0x0006 // string, M, R V, F
	AttrAllowedVendorList  uint32 = 0x0007 // list[vendor-id], M, R A, F
)

Attribute ids.

Variables

View Source
var ApplicationStatusEnumDef = &spec.Enum{Name: "ApplicationStatusEnum", Bits: 8, Values: []spec.EnumValue{
	{Value: 0, Name: "Stopped", Conformance: spec.Conformance{Text: "M", Op: spec.ConfMandatory}},
	{Value: 1, Name: "ActiveVisibleFocus", Conformance: spec.Conformance{Text: "M", Op: spec.ConfMandatory}},
	{Value: 2, Name: "ActiveHidden", Conformance: spec.Conformance{Text: "M", Op: spec.ConfMandatory}},
	{Value: 3, Name: "ActiveVisibleNotFocus", Conformance: spec.Conformance{Text: "M", Op: spec.ConfMandatory}},
}}

ApplicationStatusEnumDef describes ApplicationStatusEnum.

fabric:reachable:reason="generated: referenced from Definition and the generated test; a package-level initializer, which RTA does not follow"

View Source
var ApplicationStructDef = &spec.Struct{Name: "ApplicationStruct", Fields: []spec.Field{
	{ID: 0, Name: "CatalogVendorId", Type: spec.Type{Name: "uint16", Kind: spec.KindUint, Bits: 16}, Conformance: spec.Conformance{Text: "M", Op: spec.ConfMandatory}},
	{ID: 1, Name: "ApplicationId", Type: spec.Type{Name: "string", Kind: spec.KindString}, Conformance: spec.Conformance{Text: "M", Op: spec.ConfMandatory}},
}}

ApplicationStructDef describes ApplicationStruct.

fabric:reachable:reason="generated: referenced from Definition and the generated test; a package-level initializer, which RTA does not follow"

View Source
var Definition = &spec.Cluster{
	ID: ClusterID, Name: Name, Revision: Revision,
	Attributes: []spec.Attribute{
		{
			ID: AttrVendorName, Name: "VendorName",
			Type:        spec.Type{Name: "string", Kind: spec.KindString},
			Conformance: spec.Conformance{Text: "O", Op: spec.ConfOptional},
			Access:      spec.Access{RW: "R", Read: spec.PrivilegeView},
			Quality:     spec.Quality{Fixed: true},
			Constraint:  spec.Constraint{Text: "max 32", Max: &spec.Bound{Int: 32}},
		},
		{
			ID: AttrVendorId, Name: "VendorId",
			Type:        spec.Type{Name: "vendor-id", Kind: spec.KindUint, Bits: 16},
			Conformance: spec.Conformance{Text: "O", Op: spec.ConfOptional},
			Access:      spec.Access{RW: "R", Read: spec.PrivilegeView},
			Quality:     spec.Quality{Fixed: true},
		},
		{
			ID: AttrApplicationName, Name: "ApplicationName",
			Type:        spec.Type{Name: "string", Kind: spec.KindString},
			Conformance: spec.Conformance{Text: "M", Op: spec.ConfMandatory},
			Access:      spec.Access{RW: "R", Read: spec.PrivilegeView},
			Quality:     spec.Quality{Fixed: true},
			Constraint:  spec.Constraint{Text: "max 256", Max: &spec.Bound{Int: 256}},
		},
		{
			ID: AttrProductId, Name: "ProductId",
			Type:        spec.Type{Name: "uint16", Kind: spec.KindUint, Bits: 16},
			Conformance: spec.Conformance{Text: "O", Op: spec.ConfOptional},
			Access:      spec.Access{RW: "R", Read: spec.PrivilegeView},
			Quality:     spec.Quality{Fixed: true},
		},
		{
			ID: AttrApplication, Name: "Application",
			Type:        spec.Type{Name: "ApplicationStruct", Kind: spec.KindStruct, Struct: ApplicationStructDef},
			Conformance: spec.Conformance{Text: "M", Op: spec.ConfMandatory},
			Access:      spec.Access{RW: "R", Read: spec.PrivilegeView},
			Quality:     spec.Quality{Fixed: true},
			Constraint:  spec.Constraint{Text: "desc", Desc: true},
			Decode:      decodeAttrApplication,
		},
		{
			ID: AttrStatus, Name: "Status",
			Type:        spec.Type{Name: "ApplicationStatusEnum", Kind: spec.KindEnum, Bits: 8, Enum: ApplicationStatusEnumDef},
			Conformance: spec.Conformance{Text: "M", Op: spec.ConfMandatory},
			Access:      spec.Access{RW: "R", Read: spec.PrivilegeView},
			Constraint:  spec.Constraint{Text: "desc", Desc: true},
		},
		{
			ID: AttrApplicationVersion, Name: "ApplicationVersion",
			Type:        spec.Type{Name: "string", Kind: spec.KindString},
			Conformance: spec.Conformance{Text: "M", Op: spec.ConfMandatory},
			Access:      spec.Access{RW: "R", Read: spec.PrivilegeView},
			Quality:     spec.Quality{Fixed: true},
			Constraint:  spec.Constraint{Text: "max 32", Max: &spec.Bound{Int: 32}},
		},
		{
			ID: AttrAllowedVendorList, Name: "AllowedVendorList",
			Type:        spec.Type{Name: "list", Kind: spec.KindList, Entry: &spec.Field{Name: "entry", Type: spec.Type{Name: "vendor-id", Kind: spec.KindUint, Bits: 16}}},
			Conformance: spec.Conformance{Text: "M", Op: spec.ConfMandatory},
			Access:      spec.Access{RW: "R", Read: spec.PrivilegeAdminister, Write: spec.PrivilegeAdminister},
			Quality:     spec.Quality{Fixed: true},
		},
	},
}

Definition is the ApplicationBasic cluster definition.

Functions

This section is empty.

Types

type ApplicationStatusEnum

type ApplicationStatusEnum uint8

ApplicationStatusEnum is the ApplicationStatusEnum enum8.

fabric:reachable:reason="generated: referenced from Definition and the generated test; a package-level initializer, which RTA does not follow"

const (
	ApplicationStatusStopped               ApplicationStatusEnum = 0 // M
	ApplicationStatusActiveVisibleFocus    ApplicationStatusEnum = 1 // M
	ApplicationStatusActiveHidden          ApplicationStatusEnum = 2 // M
	ApplicationStatusActiveVisibleNotFocus ApplicationStatusEnum = 3 // M
)

ApplicationStatusEnum values.

type ApplicationStruct

type ApplicationStruct struct {
	CatalogVendorId uint16 // 0: uint16, M
	ApplicationId   string // 1: string, M
}

ApplicationStruct is the ApplicationStruct struct.

func (*ApplicationStruct) DecodeTLV

func (v *ApplicationStruct) DecodeTLV(n spec.Node) error

DecodeTLV decodes the structure n into v.

func (ApplicationStruct) EncodeTLV

func (v ApplicationStruct) EncodeTLV(enc *tlv.Encoder, tag tlv.Tag)

EncodeTLV implements spec.Encodable.

type Declare added in v0.10.0

type Declare struct {
	// Initial is the state the server starts with, over the device
	// type's defaults; an optional attribute it sets is served.
	Initial Patch
	// OnWrite vetoes a controller's write before it is stored
	// (Server.OnWrite); it runs inline.
	OnWrite func(ctx context.Context, next State, attrID uint32) error
	// HostServer is the host's own server for the cluster, mounted in
	// place of the kit's — also for a cluster the device type does not
	// list. The hooks above go on it; Initial, Features and the ports are
	// the kit's server's and are refused beside it.
	HostServer contract.ClusterServer
}

Declare is the declaration of the ApplicationBasic cluster on a device: device.New<Type> and device.FromSpec take it, and every field is optional — the zero value mounts the cluster (an optional one too) with the kit's default server and the device type's defaults. A device takes one Declare per cluster.

func (Declare) ClusterDeclaration added in v0.10.0

func (d Declare) ClusterDeclaration() spec.ClusterDeclaration

ClusterDeclaration implements device.Declaration: the declaration in the form the device kit applies it.

func (Declare) ClusterID added in v0.10.0

func (Declare) ClusterID() uint32

ClusterID implements device.Declaration: the cluster declared.

type Feature

type Feature uint32

Feature is a ApplicationBasic FeatureMap bit.

fabric:reachable:reason="generated: referenced from Definition and the generated test; a package-level initializer, which RTA does not follow"

type Patch added in v0.10.0

type Patch struct {
	VendorName         *string                // attribute 0x0000
	VendorId           *uint16                // attribute 0x0001
	ApplicationName    *string                // attribute 0x0002
	ProductId          *uint16                // attribute 0x0003
	Application        *ApplicationStruct     // attribute 0x0004
	Status             *ApplicationStatusEnum // attribute 0x0005
	ApplicationVersion *string                // attribute 0x0006
	AllowedVendorList  *[]uint16              // attribute 0x0007
}

Patch is a change to the ApplicationBasic state: each non-nil field is set, the others are left as they are.

func (Patch) AttributeValues added in v0.10.0

func (p Patch) AttributeValues() map[uint32]any

AttributeValues implements spec.PatchValuer: the attributes p sets, by id, in their stored form — a list of a structure as its spec.List — and nil for each id in Null.

type Server added in v0.10.0

type Server struct{ spec.Wrapper }

Server is the typed ApplicationBasic server over the cluster's server — the generated spec.Server or a self-held one (Underlying) — with a typed state, typed change reports, a write veto, typed command handlers and typed events. It adds no behavior: each method reaches the server's own. It is not a contract.ClusterServer: mount the underlying server, not this one.

func Wrap added in v0.10.0

func Wrap(srv contract.ClusterServer) *Server

Wrap returns srv as the typed server; nil for nil. A typed server is no contract.ClusterServer, so it is never wrapped twice. Its asynchronous callbacks need a queue: WrapOn.

func WrapOn added in v0.10.0

func WrapOn(srv contract.ClusterServer, q spec.Queue) *Server

WrapOn is Wrap with the queue the typed server's asynchronous callbacks (OnChangedAsync) run on — a device's, which its typed accessors pass; nil for a nil srv.

func (*Server) Get added in v0.10.0

func (s *Server) Get() State

Get returns the state, each attribute as the server reads it.

func (*Server) MarkChanged added in v0.10.8

func (s *Server) MarkChanged(attrIDs ...uint32) error

MarkChanged reports attributes the host computes on read (served from a spec.Source, so no Set sees them change): the data version advances and the change is reported (spec.Server.MarkChanged, which refuses an empty list, an attribute not served and a changes-omitted or quieter one); spec.ErrNoMarkChanged for a server that is no spec.ChangeMarker.

func (*Server) OnChanged added in v0.10.0

func (s *Server) OnChanged(fn func(state State, change contract.Change)) (unsubscribe func())

OnChanged calls fn with the state and the change — the attributes that changed and its origin (contract.Origin) — after each change the server reports, inline: on the goroutine that made the change, before the write, command or Set that made it returns. It returns the unsubscribe function.

func (*Server) OnChangedAsync added in v0.10.0

func (s *Server) OnChangedAsync(fn func(state State, change contract.Change)) (unsubscribe func())

OnChangedAsync is OnChanged with fn queued: the state and the change are taken when the server reports it, and fn runs later on the device's goroutine, one call after the other. A server wrapped outside a device (Wrap) has no queue and delivers nothing, as a device not added delivers nothing. It returns the unsubscribe function.

func (*Server) OnWrite added in v0.10.0

func (s *Server) OnWrite(fn func(ctx context.Context, next State, attrID uint32) error) error

OnWrite installs fn as the host's veto of a controller's write (spec.ServerConfig.BeforeWrite): next is the state with the written value in place, attrID the attribute written. It runs behind the server's own rules and its comparison with the held value, so a write of the held value never reaches it. An error refuses the write — with the IM status it carries, FAILURE otherwise — and nothing is stored. nil removes the veto, never the server's own rule; spec.ErrNoWriteVeto for a server that takes none. Declare.OnWrite is the veto at construction; this setter changes it at run time.

func (*Server) Set added in v0.10.0

func (s *Server) Set(p Patch) error

Set applies p through the server's SetAttributes: every value is checked, and all of them are stored or none; spec.ErrNotSettable for a server without one.

type State added in v0.10.0

type State struct {
	VendorName         string                // attribute 0x0000: string, O, R V, F
	VendorId           uint16                // attribute 0x0001: vendor-id, O, R V, F
	ApplicationName    string                // attribute 0x0002: string, M, R V, F
	ProductId          uint16                // attribute 0x0003: uint16, O, R V, F
	Application        ApplicationStruct     // attribute 0x0004: ApplicationStruct, M, R V, F
	Status             ApplicationStatusEnum // attribute 0x0005: ApplicationStatusEnum, M, R V
	ApplicationVersion string                // attribute 0x0006: string, M, R V, F
	AllowedVendorList  []uint16              // attribute 0x0007: list[vendor-id], M, R A, F
}

State is the typed state of the ApplicationBasic cluster: one field per attribute of Definition, a nullable one a pointer (nil for null), a list a slice. Server.Get fills it from the stored values; an attribute the server does not serve stays at its zero value.

func StateFrom added in v0.10.3

func StateFrom(values spec.Values) (state State, absent []uint32)

StateFrom is the State of a peer's values of the ApplicationBasic cluster — a controller's client image of it (client.Cluster), one cluster of a report (client.Report.Values) — each attribute decoded by Definition and converted to its field's type as Server.Get converts a stored one (spec.StateFrom). absent lists the attributes of State the values do not hold; their fields stay at the zero value.

func (State) Clone

func (st State) Clone() State

Clone returns a deep copy of st: every list, octet string, nullable attribute and nested struct of the copy is its own, so a change to the copy does not reach st.

func (*State) FromAttributeValues added in v0.10.0

func (st *State) FromAttributeValues(read func(attrID uint32) (any, bool))

FromAttributeValues implements spec.StateReader: each field the value read answers for its attribute, converted to the field's type; an attribute read does not answer, or answers with a value the field cannot hold, leaves the field as it is.

Jump to

Keyboard shortcuts

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