interface MessagesBehavior {
    [reference]: Datasource<StateType>;
    agent: Agent;
    cluster: never;
    context: ActionContext;
    endpoint: Endpoint<Empty>;
    env: Environment;
    events: EventEmitter & Omit<ClusterEvents<Of<{
        attributes: {};
        commands: {};
        events: {};
        id: 0;
        name: "Unknown";
        revision: 0;
    }>, typeof ClusterBehavior>, never> & {
        activeMessageIDs$Changing: ClusterEvents.AttributeObservable<Attribute<Uint8Array[], any>>;
        messages$Changing: ClusterEvents.AttributeObservable<FabricScopedAttribute<TypeFromFields<{
            duration: FieldType<null | number | bigint>;
            fabricIndex: FieldType<FabricIndex>;
            messageControl: FieldType<TypeFromPartialBitSchema<{
                confirmationRequired: BitFlag;
                messageConfirmed: BitFlag;
                messageProtected: BitFlag;
                replyMessage: BitFlag;
                responseRequired: BitFlag;
            }>>;
            messageId: FieldType<Uint8Array>;
            messageText: FieldType<string>;
            priority: FieldType<Messages.MessagePriority>;
            responses: OptionalFieldType<TypeFromFields<{
                label: ...;
                messageResponseId: ...;
            }>[]>;
            startTime: FieldType<null | number>;
        }>[], any>>;
    } & {} & {
        activeMessageIDs$Changed: ClusterEvents.AttributeObservable<Attribute<Uint8Array[], any>>;
        messages$Changed: ClusterEvents.AttributeObservable<FabricScopedAttribute<TypeFromFields<{
            duration: FieldType<null | number | bigint>;
            fabricIndex: FieldType<FabricIndex>;
            messageControl: FieldType<TypeFromPartialBitSchema<{
                confirmationRequired: BitFlag;
                messageConfirmed: BitFlag;
                messageProtected: BitFlag;
                replyMessage: BitFlag;
                responseRequired: BitFlag;
            }>>;
            messageId: FieldType<Uint8Array>;
            messageText: FieldType<string>;
            priority: FieldType<Messages.MessagePriority>;
            responses: OptionalFieldType<TypeFromFields<{
                label: ...;
                messageResponseId: ...;
            }>[]>;
            startTime: FieldType<null | number>;
        }>[], any>>;
    } & {} & {
        messageComplete: ClusterEvents.EventObservable<Event<TypeFromFields<{
            fabricIndex: FieldType<FabricIndex>;
            futureMessagesPreference: FieldType<null | Messages.FutureMessagePreference>;
            messageId: FieldType<Uint8Array>;
            reply: OptionalFieldType<null | string>;
            responseId: OptionalFieldType<null | number>;
        }>, any>>;
        messagePresented: ClusterEvents.EventObservable<Event<TypeFromFields<{
            fabricIndex: FieldType<FabricIndex>;
            messageId: FieldType<Uint8Array>;
        }>, any>>;
        messageQueued: ClusterEvents.EventObservable<Event<TypeFromFields<{
            fabricIndex: FieldType<FabricIndex>;
            messageId: FieldType<Uint8Array>;
        }>, any>>;
    } & {};
    features: TypeFromBitSchema<{}> & TypeFromBitSchema<{
        confirmationReply: BitFlag;
        confirmationResponse: BitFlag;
        protectedMessages: BitFlag;
        receivedConfirmation: BitFlag;
    }>;
    session: SecureSession;
    state: Omit<ClusterState.Type<Of<{
        attributes: {};
        commands: {};
        events: {};
        id: 0;
        name: "Unknown";
        revision: 0;
    }>, typeof ClusterBehavior>, never> & {
        activeMessageIDs: Uint8Array[];
        messages: TypeFromFields<{
            duration: FieldType<null | number | bigint>;
            fabricIndex: FieldType<FabricIndex>;
            messageControl: FieldType<TypeFromPartialBitSchema<{
                confirmationRequired: BitFlag;
                messageConfirmed: BitFlag;
                messageProtected: BitFlag;
                replyMessage: BitFlag;
                responseRequired: BitFlag;
            }>>;
            messageId: FieldType<Uint8Array>;
            messageText: FieldType<string>;
            priority: FieldType<Messages.MessagePriority>;
            responses: OptionalFieldType<TypeFromFields<{
                label: FieldType<string>;
                messageResponseId: FieldType<number>;
            }>[]>;
            startTime: FieldType<null | number>;
        }>[];
    } & {} & {} & {};
    [asyncDispose](): MaybePromise;
    asAdmin(fn: (() => void)): void;
    assertAttributeEnabled<This, K>(this: This, attributeName: K): void;
    callback<A, R>(reactor: Reactor<A, R>, options?: Reactor.Options): ((...args: A) => undefined | R);
    cancelMessagesRequest(request: Messages.CancelMessagesRequest): MaybePromise;
    initialize(_options?: {}): MaybePromise;
    presentMessagesRequest(request: Messages.PresentMessagesRequest): MaybePromise;
    reactTo<O>(observable: O, reactor: Reactor<Parameters<O["emit"]>, ReturnType<O["emit"]>>, options?: Reactor.Options): void;
    requireAttributeEnabled<This, K>(this: This, attributeName: K): Exclude<This["state"][K], undefined>;
    toString(): string;
    State: any;
}

Hierarchy (view full)

Properties

[reference]: Datasource<StateType>
agent: Agent
cluster: never

The implemented cluster.

context: ActionContext
endpoint: Endpoint<Empty>
events: EventEmitter & Omit<ClusterEvents<Of<{
    attributes: {};
    commands: {};
    events: {};
    id: 0;
    name: "Unknown";
    revision: 0;
}>, typeof ClusterBehavior>, never> & {
    activeMessageIDs$Changing: ClusterEvents.AttributeObservable<Attribute<Uint8Array[], any>>;
    messages$Changing: ClusterEvents.AttributeObservable<FabricScopedAttribute<TypeFromFields<{
        duration: FieldType<null | number | bigint>;
        fabricIndex: FieldType<FabricIndex>;
        messageControl: FieldType<TypeFromPartialBitSchema<{
            confirmationRequired: BitFlag;
            messageConfirmed: BitFlag;
            messageProtected: BitFlag;
            replyMessage: BitFlag;
            responseRequired: BitFlag;
        }>>;
        messageId: FieldType<Uint8Array>;
        messageText: FieldType<string>;
        priority: FieldType<Messages.MessagePriority>;
        responses: OptionalFieldType<TypeFromFields<{
            label: ...;
            messageResponseId: ...;
        }>[]>;
        startTime: FieldType<null | number>;
    }>[], any>>;
} & {} & {
    activeMessageIDs$Changed: ClusterEvents.AttributeObservable<Attribute<Uint8Array[], any>>;
    messages$Changed: ClusterEvents.AttributeObservable<FabricScopedAttribute<TypeFromFields<{
        duration: FieldType<null | number | bigint>;
        fabricIndex: FieldType<FabricIndex>;
        messageControl: FieldType<TypeFromPartialBitSchema<{
            confirmationRequired: BitFlag;
            messageConfirmed: BitFlag;
            messageProtected: BitFlag;
            replyMessage: BitFlag;
            responseRequired: BitFlag;
        }>>;
        messageId: FieldType<Uint8Array>;
        messageText: FieldType<string>;
        priority: FieldType<Messages.MessagePriority>;
        responses: OptionalFieldType<TypeFromFields<{
            label: ...;
            messageResponseId: ...;
        }>[]>;
        startTime: FieldType<null | number>;
    }>[], any>>;
} & {} & {
    messageComplete: ClusterEvents.EventObservable<Event<TypeFromFields<{
        fabricIndex: FieldType<FabricIndex>;
        futureMessagesPreference: FieldType<null | Messages.FutureMessagePreference>;
        messageId: FieldType<Uint8Array>;
        reply: OptionalFieldType<null | string>;
        responseId: OptionalFieldType<null | number>;
    }>, any>>;
    messagePresented: ClusterEvents.EventObservable<Event<TypeFromFields<{
        fabricIndex: FieldType<FabricIndex>;
        messageId: FieldType<Uint8Array>;
    }>, any>>;
    messageQueued: ClusterEvents.EventObservable<Event<TypeFromFields<{
        fabricIndex: FieldType<FabricIndex>;
        messageId: FieldType<Uint8Array>;
    }>, any>>;
} & {}

Access the behavior's events.

Type declaration

features: TypeFromBitSchema<{}> & TypeFromBitSchema<{
    confirmationReply: BitFlag;
    confirmationResponse: BitFlag;
    protectedMessages: BitFlag;
    receivedConfirmation: BitFlag;
}>

Supported features as a flag object.

session: SecureSession
state: Omit<ClusterState.Type<Of<{
    attributes: {};
    commands: {};
    events: {};
    id: 0;
    name: "Unknown";
    revision: 0;
}>, typeof ClusterBehavior>, never> & {
    activeMessageIDs: Uint8Array[];
    messages: TypeFromFields<{
        duration: FieldType<null | number | bigint>;
        fabricIndex: FieldType<FabricIndex>;
        messageControl: FieldType<TypeFromPartialBitSchema<{
            confirmationRequired: BitFlag;
            messageConfirmed: BitFlag;
            messageProtected: BitFlag;
            replyMessage: BitFlag;
            responseRequired: BitFlag;
        }>>;
        messageId: FieldType<Uint8Array>;
        messageText: FieldType<string>;
        priority: FieldType<Messages.MessagePriority>;
        responses: OptionalFieldType<TypeFromFields<{
            label: FieldType<string>;
            messageResponseId: FieldType<number>;
        }>[]>;
        startTime: FieldType<null | number>;
    }>[];
} & {} & {} & {}

Access the behavior's state.

Type declaration

  • ReadonlyactiveMessageIDs: Uint8Array[]

    Indicates a list of the MessageIDs of the Messages currently being presented. If this list is empty, no messages are currently being presented.

    This list shall NOT be fabric-scoped; it shall contain MessageIDs for all Messages being presented, no matter what fabric the client that queued them is on.

    MatterSpecification.v13.Cluster § 1.16.6.2

  • Readonlymessages: TypeFromFields<{
        duration: FieldType<null | number | bigint>;
        fabricIndex: FieldType<FabricIndex>;
        messageControl: FieldType<TypeFromPartialBitSchema<{
            confirmationRequired: BitFlag;
            messageConfirmed: BitFlag;
            messageProtected: BitFlag;
            replyMessage: BitFlag;
            responseRequired: BitFlag;
        }>>;
        messageId: FieldType<Uint8Array>;
        messageText: FieldType<string>;
        priority: FieldType<Messages.MessagePriority>;
        responses: OptionalFieldType<TypeFromFields<{
            label: FieldType<string>;
            messageResponseId: FieldType<number>;
        }>[]>;
        startTime: FieldType<null | number>;
    }>[]

    Indicates a list of queued messages.

    In addition to filtering based upon fabric, to preserve user privacy, the server may further limit the set of messages returned in a read request. At minimum, the server shall return to a client those messages that the client itself created/submitted.

    MatterSpecification.v13.Cluster § 1.16.6.1

Methods

  • Release resources. This is the public API for releasing application resources held by behaviors in internal state.

    Returns MaybePromise

  • Execute logic with elevated privileges.

    The provided function executes with privileges escalated to offline mode. This is not commonly necessary.

    Elevated logic effectively ignores ACLs so should be used with care.

    Note that interactions with the behavior will remain elevated until the synchronous completion of this call. You should only elevate privileges for synchronous logic.

    Parameters

    • fn: (() => void)

      the elevated logic

        • (): void
        • Returns void

    Returns void

  • Type Parameters

    • This extends Behavior
    • K extends string | number | symbol

    Parameters

    • this: This
    • attributeName: K

    Returns void

  • Create a generic callback function that has the same properties as a Reactor.

    Like a reactor, the callback's "this" will be bound to an active Behavior instance. Because of this: The reactor MUST be a real JS function - arrow functions will not work!

    Type Parameters

    • A extends any[]
    • R

    Parameters

    Returns ((...args: A) => undefined | R)

      • (...args): undefined | R
      • Parameters

        • Rest...args: A

        Returns undefined | R

  • Parameters

    Returns MaybePromise

    MatterSpecification.v13.Cluster § 1.16.7.2

  • Behaviors are ephemeral and should not perform initialization in their constructor. They can override this method instead.

    This method may be synchronous or asyncronous. If asynchronous, the behavior will not be available for external use until initialization completes.

    Parameters

    • Optional_options: {}

      Returns MaybePromise

    • Upon receipt, this shall cause the message in the passed fields to be appended to the Messages attribute.

      If appending the message would cause the number of messages to be greater than the capacity of the list, the device shall NOT append any message to Messages, and shall return a status code of RESOURCE_EXHAUSTED.

      When displaying a message in response to this command, an indication (ex. visual) of the origin node of the command shall be provided. This could be in the form of a friendly name label which uniquely identifies the node to the user. This friendly name label is typically assigned by the Matter Admin at the time of commissioning and, when it’s a device, is often editable by the user. It might be a combination of a company name and friendly name, for example, ”Acme” or “Acme Streaming Service on Alice’s Phone”.

      NOTE

      It is currently not specified where the friendly name label can be found on the node, meaning that clients SHOULD NOT rely on a certain method they happen to observe in a particular server instance, since other instances could employ a different method.

      The device SHOULD make it possible for the user to view which nodes have access to this cluster and to individually remove privileges for each node.

      Parameters

      Returns MaybePromise

      MatterSpecification.v13.Cluster § 1.16.7.1

    • Install a Reactor.

      Important: The reactor MUST be a real JS function - arrow functions will not work!

      Type Parameters

      Parameters

      Returns void

    • Type Parameters

      • This extends Behavior
      • K extends string | number | symbol

      Parameters

      • this: This
      • attributeName: K

      Returns Exclude<This["state"][K], undefined>

    • Description used in diagnostic messages.

      Returns string