This is the default server implementation of GeneralDiagnosticsBehavior.

The implementation provides convenience methods to register and clear hardware, radio, and network faults and to handle test Event triggers.

To handle test Event triggers please override the triggerTestEvent method. If these test events are used in certification please also set the EnableKey in the enhanced state as deviceTestEnableKey.

To register or clear hardware, radio, and network faults, please use the provided convenience methods:

  • registerHardwareFault and clearHardwareFault
  • registerRadioFault and clearRadioFault
  • registerNetworkFault and clearNetworkFault If you want to send events when faults are registered or cleared you need to enable these events when the Root Endpoint gets initialized.

Hierarchy

  • Base
    • GeneralDiagnosticsServer

Constructors

Properties

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

The implemented cluster.

context: ActionContext
endpoint: Endpoint<Empty>
events: EventEmitter & Omit<ClusterEvents<GeneralDiagnostics.Cluster, Type<Of<{
    attributes: {};
    commands: {};
    events: {};
    id: 0;
    name: "Unknown";
    revision: 0;
}>, typeof ClusterBehavior, GeneralDiagnosticsInterface>>,
    | "bootReason"
    | "hardwareFaultChange"
    | "radioFaultChange"
    | "networkFaultChange"
    | "networkInterfaces$Changing"
    | "rebootCount$Changing"
    | "upTime$Changing"
    | "testEventTriggersEnabled$Changing"
    | "totalOperationalHours$Changing"
    | "bootReason$Changing"
    | "activeHardwareFaults$Changing"
    | "activeRadioFaults$Changing"
    | "activeNetworkFaults$Changing"
    | "networkInterfaces$Changed"
    | "rebootCount$Changed"
    | "upTime$Changed"
    | "testEventTriggersEnabled$Changed"
    | "totalOperationalHours$Changed"
    | "bootReason$Changed"
    | "activeHardwareFaults$Changed"
    | "activeRadioFaults$Changed"
    | "activeNetworkFaults$Changed"> & {
    networkInterfaces$Changing: ClusterEvents.AttributeObservable<Attribute<TypeFromFields<{
        hardwareAddress: FieldType<Uint8Array>;
        iPv4Addresses: FieldType<Uint8Array[]>;
        iPv6Addresses: FieldType<Uint8Array[]>;
        isOperational: FieldType<boolean>;
        name: FieldType<string>;
        offPremiseServicesReachableIPv4: FieldType<null | boolean>;
        offPremiseServicesReachableIPv6: FieldType<null | boolean>;
        type: FieldType<GeneralDiagnostics.InterfaceType>;
    }>[], any>>;
    rebootCount$Changing: ClusterEvents.AttributeObservable<Attribute<number, any>>;
    testEventTriggersEnabled$Changing: ClusterEvents.AttributeObservable<Attribute<boolean, any>>;
    upTime$Changing: ClusterEvents.AttributeObservable<Attribute<number | bigint, any>>;
} & {
    activeHardwareFaults$Changing: undefined | ClusterEvents.AttributeObservable<OptionalAttribute<GeneralDiagnostics.HardwareFault[], any>>;
    activeNetworkFaults$Changing: undefined | ClusterEvents.AttributeObservable<OptionalAttribute<GeneralDiagnostics.NetworkFault[], any>>;
    activeRadioFaults$Changing: undefined | ClusterEvents.AttributeObservable<OptionalAttribute<GeneralDiagnostics.RadioFault[], any>>;
    bootReason$Changing: undefined | ClusterEvents.AttributeObservable<OptionalAttribute<GeneralDiagnostics.BootReason, any>>;
    totalOperationalHours$Changing: undefined | ClusterEvents.AttributeObservable<OptionalAttribute<number, any>>;
} & {
    networkInterfaces$Changed: ClusterEvents.AttributeObservable<Attribute<TypeFromFields<{
        hardwareAddress: FieldType<Uint8Array>;
        iPv4Addresses: FieldType<Uint8Array[]>;
        iPv6Addresses: FieldType<Uint8Array[]>;
        isOperational: FieldType<boolean>;
        name: FieldType<string>;
        offPremiseServicesReachableIPv4: FieldType<null | boolean>;
        offPremiseServicesReachableIPv6: FieldType<null | boolean>;
        type: FieldType<GeneralDiagnostics.InterfaceType>;
    }>[], any>>;
    rebootCount$Changed: ClusterEvents.AttributeObservable<Attribute<number, any>>;
    testEventTriggersEnabled$Changed: ClusterEvents.AttributeObservable<Attribute<boolean, any>>;
    upTime$Changed: ClusterEvents.AttributeObservable<Attribute<number | bigint, any>>;
} & {
    activeHardwareFaults$Changed: undefined | ClusterEvents.AttributeObservable<OptionalAttribute<GeneralDiagnostics.HardwareFault[], any>>;
    activeNetworkFaults$Changed: undefined | ClusterEvents.AttributeObservable<OptionalAttribute<GeneralDiagnostics.NetworkFault[], any>>;
    activeRadioFaults$Changed: undefined | ClusterEvents.AttributeObservable<OptionalAttribute<GeneralDiagnostics.RadioFault[], any>>;
    bootReason$Changed: undefined | ClusterEvents.AttributeObservable<OptionalAttribute<GeneralDiagnostics.BootReason, any>>;
    totalOperationalHours$Changed: undefined | ClusterEvents.AttributeObservable<OptionalAttribute<number, any>>;
} & {
    bootReason: ClusterEvents.EventObservable<Event<TypeFromFields<{
        bootReason: FieldType<GeneralDiagnostics.BootReason>;
    }>, any>>;
} & {
    hardwareFaultChange?: ClusterEvents.EventObservable<OptionalEvent<TypeFromFields<{
        current: FieldType<GeneralDiagnostics.HardwareFault[]>;
        previous: FieldType<GeneralDiagnostics.HardwareFault[]>;
    }>, any>>;
    networkFaultChange?: ClusterEvents.EventObservable<OptionalEvent<TypeFromFields<{
        current: FieldType<GeneralDiagnostics.NetworkFault[]>;
        previous: FieldType<GeneralDiagnostics.NetworkFault[]>;
    }>, any>>;
    radioFaultChange?: ClusterEvents.EventObservable<OptionalEvent<TypeFromFields<{
        current: FieldType<GeneralDiagnostics.RadioFault[]>;
        previous: FieldType<GeneralDiagnostics.RadioFault[]>;
    }>, any>>;
}

Access the behavior's events.

Type declaration

Type declaration

features: TypeFromBitSchema<{}> & TypeFromBitSchema<{
    dataModelTest: BitFlag;
}>

Supported features as a flag object.

internal: Internal
schema: Schema
session: SecureSession
state: State

Access the behavior's state.

Base cluster state include all attribute values but may be extended by subclasses.

defaults: ClusterState.Type<WithFeatures<GeneralDiagnostics.Cluster, readonly [DataModelTest]>, Type<GeneralDiagnostics.Cluster, Type<Of<{
    attributes: {};
    commands: {};
    events: {};
    id: 0;
    name: "Unknown";
    revision: 0;
}>, typeof ClusterBehavior, GeneralDiagnosticsInterface>, GeneralDiagnosticsInterface>>
dependencies?: Iterable<Type, any, any>
early: boolean
Events: ClusterEvents.Type<WithFeatures<GeneralDiagnostics.Cluster, readonly [DataModelTest]>, Type<GeneralDiagnostics.Cluster, Type<Of<{
    attributes: {};
    commands: {};
    events: {};
    id: 0;
    name: "Unknown";
    revision: 0;
}>, typeof ClusterBehavior, GeneralDiagnosticsInterface>, GeneralDiagnosticsInterface>>
id

The behavior ID for ClusterBehaviors is the name of the cluster.

name: string
schema?: Schema
supervisor: RootSupervisor
supports: ((other: Type) => boolean)

Type declaration

    • (other): boolean
    • Does this behavior support functionality of a specific implementation?

      Parameters

      Returns boolean

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

  • Clear a hardware fault. This convenience method updates the activeHardwareFaults attribute and sends out the HardwareFaultChanged event.

    Parameters

    Returns void

  • Clear a network fault. This convenience method updates the activeNetworkFaults attribute and sends out the NetworkFaultChanged event.

    Parameters

    Returns void

  • Clear a radio fault. This convenience method updates the activeRadioFaults attribute and sends out the RadioFaultChanged event.

    Parameters

    Returns void

  • 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.

    Returns void

  • This command provides a means for certification tests or manufacturer’s internal tests to validate particular command handling and encoding constraints by generating a response of a given size.

    This command shall use the same EnableKey behavior as the TestEventTrigger command, whereby processing of the command is only enabled when the TestEventTriggersEnabled field is true, which shall NOT be true outside of certification testing or manufacturer’s internal tests.

    The fields for the PayloadTestRequest command are as follows:

    Parameters

    Returns GeneralDiagnostics.PayloadTestResponse

    MatterSpecification.v13.Core § 11.12.7.4

  • Install a Reactor.

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

    Type Parameters

    Parameters

    Returns void

  • Register a hardware fault. This convenience method updates the activeHardwareFaults attribute and sends out the HardwareFaultChanged event. Make sure to clear the fault when it is resolved. This method requires that the activeHardwareFaults attribute is activated when the cluster gets initialized.

    Parameters

    Returns void

  • Register a network fault. This convenience method updates the activeNetworkFaults attribute and sends out the NetworkFaultChanged event. Make sure to clear the fault when it is resolved. This method requires that the activeNetworkFaults attribute is activated when the cluster gets initialized.

    Parameters

    Returns void

  • Register a radio fault. This convenience method updates the activeRadioFaults attribute and sends out the RadioFaultChanged event. Make sure to clear the fault when it is resolved. This method requires that the activeRadioFaults attribute is activated when the cluster gets initialized.

    Parameters

    Returns void

  • Type Parameters

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

    Parameters

    • this: This
    • attributeName: K

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

  • This command shall be supported to provide a means for certification tests to trigger some test- plan-specific events, necessary to assist in automation of device interactions for some certification test cases. This command shall NOT cause any changes to the state of the device that persist after the last fabric is removed.

    The fields for the TestEventTrigger command are as follows:

    Parameters

    Returns void

    MatterSpecification.v13.Core § 11.12.7.1

  • This command may be used by a client to obtain a correlated view of both System Time, and, if currently synchronized and supported, "wall clock time" of the server. This can help clients establish

    time correlation between their concept of time and the server’s concept of time. This is especially useful when processing event histories where some events only contain System Time.

    Upon command invocation, the server shall respond with a TimeSnapshotResponse.

    Returns {
        posixTimeMs: number;
        systemTimeMs: number;
    }

    • posixTimeMs: number
    • systemTimeMs: number

    MatterSpecification.v13.Core § 11.12.7.2

  • Description used in diagnostic messages.

    Returns string

  • Parameters

    • eventTrigger: number | bigint

    Returns void

  • Type Parameters

    Parameters

    Returns This