MatterEx.DeviceTypes (matter_ex v0.4.0)

Copy Markdown View Source

Matter Device Type registry.

Maps device type IDs to their metadata: name, required server clusters, and optional server clusters. Used by the Descriptor cluster to populate device_type_list and validate cluster requirements.

Reference: Matter Specification, Chapter 9 (Device Library).

Summary

Functions

Get device type definition by ID.

Get device type ID by name.

Returns the built-in device type names accepted by the Device DSL.

List all known device type IDs.

Get device type name by ID.

Check if a set of cluster IDs satisfies all required clusters for a device type.

Types

device_type()

@type device_type() :: %{
  id: non_neg_integer(),
  name: atom(),
  revision: non_neg_integer(),
  required_clusters: [non_neg_integer()],
  optional_clusters: [non_neg_integer()]
}

Functions

get(device_type_id)

@spec get(non_neg_integer()) :: device_type() | nil

Get device type definition by ID.

id_for_name(device_type_name)

@spec id_for_name(atom()) :: non_neg_integer() | nil

Get device type ID by name.

known_device_types()

@spec known_device_types() :: [{atom(), non_neg_integer()}]

Returns the built-in device type names accepted by the Device DSL.

The returned keyword list is sorted by device type name and maps each friendly DSL name to its Matter device type ID.

list()

@spec list() :: [non_neg_integer()]

List all known device type IDs.

name(device_type_id)

@spec name(non_neg_integer()) :: atom() | nil

Get device type name by ID.

validate(device_type_id, cluster_ids)

@spec validate(non_neg_integer(), [non_neg_integer()]) ::
  :ok | {:error, [non_neg_integer()]}

Check if a set of cluster IDs satisfies all required clusters for a device type.