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 = 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

  • 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

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