UnitTestingTrait

struct UnitTestingTrait

A cluster used for testing purposes.

  • List of the event types that are supported by UnitTestingTrait.

    Declaration

    Swift

    static let supportedEventTypes: [any Event.Type]
  • List of the commands that are supported by UnitTestingTrait.

    Declaration

    Swift

    static let supportedCommandTypes: [any Command.Type]
  • The trait identifier.

    Declaration

    Swift

    static let identifier: String
  • Metadata about this Trait.

    Declaration

    Swift

    let metadata: TraitMetadata
  • List of attributes for the UnitTestingTrait.

    Declaration

    Swift

    let attributes: Matter.UnitTestingTrait.Attributes
  • Creates a new Trait instance using data read from the given TraitDecoder.

    Throws

    HomeError.parseError when parsing fails.

    Declaration

    Swift

    init(decoder: TraitDecoder, interactionProxy: (any InteractionProxy)?, metadata: TraitMetadata) throws

    Parameters

    decoder

    The raw data representing this Trait.

    interactionProxy

    Proxy to the Interaction Client.

    metadata

    Metadata about this Trait.

  • Writes this object to the given TraitEncoder. Throws HomeError.encodingFailed if the data could not be encoded.

    Declaration

    Swift

    func encode(with encoder: TraitEncoder) throws
  • This API provides the ability to invalidate state retrieved through subscriptions to the target device in the cases where state is not being reported correctly, either intentionally (e.g attributes in Matter traits with the “C” quality) or unintentionally due to poor implementations.

    When successful, this API will result in a forced read of the convening scope as specified by the sub-class and return the result through existing Trait subscriptions if present and active.

    This API is to be used sparingly as it can impact the performance and battery life of the target device. As such, this API may be throttled by the platform. Callers SHALL be prepared to deal with HomeErrors thrown by this call.

    Declaration

    Swift

    func forceRead() async throws
  • Attributes for the UnitTestingTrait.

    Declaration

    Swift

    struct Attributes
  • Returns a Boolean value indicating whether two values are equal.

    Equality is the inverse of inequality. For any values a and b, a == b implies that a != b is false.

    Declaration

    Swift

    static func == (lhs: Matter.UnitTestingTrait, rhs: Matter.UnitTestingTrait) -> Bool

    Parameters

    lhs

    A value to compare.

    rhs

    Another value to compare.

  • Hashes the essential components of this value by feeding them into the given hasher.

    Implement this method to conform to the Hashable protocol. The components used for hashing must be the same as the components compared in your type’s == operator implementation. Call hasher.combine(_:) with each of these components.

    Important

    In your implementation of hash(into:), don’t call finalize() on the hasher instance provided, or replace it with a different instance. Doing so may become a compile-time error in the future.

    Declaration

    Swift

    func hash(into hasher: inout Hasher)
  • SimpleStruct

    Declaration

    Swift

    struct SimpleStruct
  • TestFabricScoped

    Declaration

    Swift

    struct TestFabricScoped
  • NullablesAndOptionalsStruct`.

    Declaration

    Swift

    struct NullablesAndOptionalsStruct
  • NestedStruct

    Declaration

    Swift

    struct NestedStruct
  • NestedStructList

    Declaration

    Swift

    struct NestedStructList
  • DoubleNestedStructList

    Declaration

    Swift

    struct DoubleNestedStructList
  • TestListStructOctet

    Declaration

    Swift

    struct TestListStructOctet
  • Whether the device supports the test command for this trait.

    Declaration

    Swift

    var supportsTestCommand: Bool { get }
  • Simple command without any parameters and without a specific response.

    Declaration

    Swift

    func test() async throws
  • The batchable version of test command above.

    See also

    test

    Declaration

    Swift

    func testBatchable() throws -> BatchableCommand<Void>
  • Whether the device supports the testNotHandled command for this trait.

    Declaration

    Swift

    var supportsTestNotHandledCommand: Bool { get }
  • Simple command without any parameters and without a specific response not handled by the server.

    Declaration

    Swift

    func testNotHandled() async throws
  • The batchable version of testNotHandled command above.

    See also

    testNotHandled

    Declaration

    Swift

    func testNotHandledBatchable() throws -> BatchableCommand<Void>
  • Whether the device supports the testSpecific command for this trait.

    Declaration

    Swift

    var supportsTestSpecificCommand: Bool { get }
  • Simple command without any parameters and with a specific response.

    Declaration

    Swift

    func testSpecific() async throws -> Matter.UnitTestingTrait.TestSpecificCommandResponse
  • The batchable version of testSpecific command above.

    See also

    testSpecific

    Declaration

    Swift

    func testSpecificBatchable() throws -> BatchableCommand<Matter.UnitTestingTrait.TestSpecificCommandResponse>
  • Whether the device supports the testUnknownCommand command for this trait.

    Declaration

    Swift

    var supportsTestUnknownCommandCommand: Bool { get }
  • Simple command that should not be added to the server.

    Declaration

    Swift

    func testUnknownCommand() async throws
  • The batchable version of testUnknownCommand command above.

    See also

    testUnknownCommand

    Declaration

    Swift

    func testUnknownCommandBatchable() throws -> BatchableCommand<Void>
  • Whether the device supports the testAddArguments command for this trait.

    Declaration

    Swift

    var supportsTestAddArgumentsCommand: Bool { get }
  • Simple command that adds the two arguments passed to it.

    Declaration

    Swift

    func testAddArguments(arg1: UInt8, arg2: UInt8) async throws -> Matter.UnitTestingTrait.TestAddArgumentsCommandResponse

    Parameters

    arg1

    Unsigned 8-bit integer argument. The [int8u][UnitTestingTrait.Attributes.int8u] attribute could be used for this.

    arg2

    Unsigned 8-bit integer argument.

  • The batchable version of testAddArguments command above.

    See also

    testAddArguments

    Declaration

    Swift

    func testAddArgumentsBatchable(arg1: UInt8, arg2: UInt8) throws -> BatchableCommand<Matter.UnitTestingTrait.TestAddArgumentsCommandResponse>
  • Whether the device supports the testSimpleArgumentRequest command for this trait.

    Declaration

    Swift

    var supportsTestSimpleArgumentRequestCommand: Bool { get }
  • Command that takes a boolean argument.

    Declaration

    Swift

    func testSimpleArgumentRequest(arg1: Bool) async throws -> Matter.UnitTestingTrait.TestSimpleArgumentRequestCommandResponse

    Parameters

    arg1

    Boolean argument.

  • The batchable version of testSimpleArgumentRequest command above.

    See also

    testSimpleArgumentRequest

    Declaration

    Swift

    func testSimpleArgumentRequestBatchable(arg1: Bool) throws -> BatchableCommand<Matter.UnitTestingTrait.TestSimpleArgumentRequestCommandResponse>
  • Whether the device supports the testStructArrayArgumentRequest command for this trait.

    Declaration

    Swift

    var supportsTestStructArrayArgumentRequestCommand: Bool { get }
  • Command that takes various arguments that are arrays, including an array of structs which have a list member.

    Declaration

    Swift

    func testStructArrayArgumentRequest(arg1: [Matter.UnitTestingTrait.NestedStructList], arg2: [Matter.UnitTestingTrait.SimpleStruct], arg3: [Matter.UnitTestingTrait.SimpleEnum], arg4: [Bool], arg5: Matter.UnitTestingTrait.SimpleEnum, arg6: Bool) async throws -> Matter.UnitTestingTrait.TestStructArrayArgumentRequestCommandResponse

    Parameters

    arg1

    NestedStructList list argument.

    arg2

    SimpleStruct list argument.

    arg3

    SimpleEnum list argument.

    arg4

    boolean list argument.

    arg5

    SimpleEnum argument.

    arg6

    Boolean argument.

  • The batchable version of testStructArrayArgumentRequest command above.

    See also

    testStructArrayArgumentRequest

    Declaration

    Swift

    func testStructArrayArgumentRequestBatchable(arg1: [Matter.UnitTestingTrait.NestedStructList], arg2: [Matter.UnitTestingTrait.SimpleStruct], arg3: [Matter.UnitTestingTrait.SimpleEnum], arg4: [Bool], arg5: Matter.UnitTestingTrait.SimpleEnum, arg6: Bool) throws -> BatchableCommand<Matter.UnitTestingTrait.TestStructArrayArgumentRequestCommandResponse>
  • Whether the device supports the testStructArgumentRequest command for this trait.

    Declaration

    Swift

    var supportsTestStructArgumentRequestCommand: Bool { get }
  • Unit test command.

    Declaration

    Swift

    func testStructArgumentRequest(arg1: Matter.UnitTestingTrait.SimpleStruct) async throws -> Matter.UnitTestingTrait.TestStructArgumentRequestCommandResponse

    Parameters

    arg1

    SimpleStruct argument.

  • The batchable version of testStructArgumentRequest command above.

    See also

    testStructArgumentRequest

    Declaration

    Swift

    func testStructArgumentRequestBatchable(arg1: Matter.UnitTestingTrait.SimpleStruct) throws -> BatchableCommand<Matter.UnitTestingTrait.TestStructArgumentRequestCommandResponse>
  • Whether the device supports the testNestedStructArgumentRequest command for this trait.

    Declaration

    Swift

    var supportsTestNestedStructArgumentRequestCommand: Bool { get }
  • Unit test command.

    Declaration

    Swift

    func testNestedStructArgumentRequest(arg1: Matter.UnitTestingTrait.NestedStruct) async throws -> Matter.UnitTestingTrait.TestNestedStructArgumentRequestCommandResponse

    Parameters

    arg1

    NestedStruct argument.

  • The batchable version of testNestedStructArgumentRequest command above.

    See also

    testNestedStructArgumentRequest

    Declaration

    Swift

    func testNestedStructArgumentRequestBatchable(arg1: Matter.UnitTestingTrait.NestedStruct) throws -> BatchableCommand<Matter.UnitTestingTrait.TestNestedStructArgumentRequestCommandResponse>
  • Whether the device supports the testListStructArgumentRequest command for this trait.

    Declaration

    Swift

    var supportsTestListStructArgumentRequestCommand: Bool { get }
  • Unit test command.

    Declaration

    Swift

    func testListStructArgumentRequest(arg1: [Matter.UnitTestingTrait.SimpleStruct]) async throws -> Matter.UnitTestingTrait.TestListStructArgumentRequestCommandResponse

    Parameters

    arg1

    SimpleStruct list argument.

  • The batchable version of testListStructArgumentRequest command above.

    See also

    testListStructArgumentRequest

    Declaration

    Swift

    func testListStructArgumentRequestBatchable(arg1: [Matter.UnitTestingTrait.SimpleStruct]) throws -> BatchableCommand<Matter.UnitTestingTrait.TestListStructArgumentRequestCommandResponse>
  • Whether the device supports the testListInt8UArgumentRequest command for this trait.

    Declaration

    Swift

    var supportsTestListInt8UArgumentRequestCommand: Bool { get }
  • Unit test command.

    Declaration

    Swift

    func testListInt8UArgumentRequest(arg1: [UInt8]) async throws -> Matter.UnitTestingTrait.TestListInt8UArgumentRequestCommandResponse

    Parameters

    arg1

    Unsigned 8-bit integer list argument.

  • The batchable version of testListInt8UArgumentRequest command above.

    See also

    testListInt8UArgumentRequest

    Declaration

    Swift

    func testListInt8UArgumentRequestBatchable(arg1: [UInt8]) throws -> BatchableCommand<Matter.UnitTestingTrait.TestListInt8UArgumentRequestCommandResponse>
  • Whether the device supports the testNestedStructListArgumentRequest command for this trait.

    Declaration

    Swift

    var supportsTestNestedStructListArgumentRequestCommand: Bool { get }
  • Unit test command.

    Declaration

    Swift

    func testNestedStructListArgumentRequest(arg1: Matter.UnitTestingTrait.NestedStructList) async throws -> Matter.UnitTestingTrait.TestNestedStructListArgumentRequestCommandResponse

    Parameters

    arg1

    NestedStructList argument.

  • The batchable version of testNestedStructListArgumentRequest command above.

    See also

    testNestedStructListArgumentRequest

    Declaration

    Swift

    func testNestedStructListArgumentRequestBatchable(arg1: Matter.UnitTestingTrait.NestedStructList) throws -> BatchableCommand<Matter.UnitTestingTrait.TestNestedStructListArgumentRequestCommandResponse>
  • Whether the device supports the testListNestedStructListArgumentRequest command for this trait.

    Declaration

    Swift

    var supportsTestListNestedStructListArgumentRequestCommand: Bool { get }
  • Unit test command.

    Declaration

    Swift

    func testListNestedStructListArgumentRequest(arg1: [Matter.UnitTestingTrait.NestedStructList]) async throws -> Matter.UnitTestingTrait.TestListNestedStructListArgumentRequestCommandResponse

    Parameters

    arg1

    NestedStructList argument.

  • The batchable version of testListNestedStructListArgumentRequest command above.

    See also

    testListNestedStructListArgumentRequest

    Declaration

    Swift

    func testListNestedStructListArgumentRequestBatchable(arg1: [Matter.UnitTestingTrait.NestedStructList]) throws -> BatchableCommand<Matter.UnitTestingTrait.TestListNestedStructListArgumentRequestCommandResponse>
  • Whether the device supports the testListInt8UReverseRequest command for this trait.

    Declaration

    Swift

    var supportsTestListInt8UReverseRequestCommand: Bool { get }
  • Unit test command.

    Declaration

    Swift

    func testListInt8UReverseRequest(arg1: [UInt8]) async throws -> Matter.UnitTestingTrait.TestListInt8UReverseRequestCommandResponse

    Parameters

    arg1

    Unsigned 8-bit integer list argument.

  • The batchable version of testListInt8UReverseRequest command above.

    See also

    testListInt8UReverseRequest

    Declaration

    Swift

    func testListInt8UReverseRequestBatchable(arg1: [UInt8]) throws -> BatchableCommand<Matter.UnitTestingTrait.TestListInt8UReverseRequestCommandResponse>
  • Whether the device supports the testEnumsRequest command for this trait.

    Declaration

    Swift

    var supportsTestEnumsRequestCommand: Bool { get }
  • Unit test command.

    Declaration

    Swift

    func testEnumsRequest(arg1: UInt16, arg2: Matter.UnitTestingTrait.SimpleEnum) async throws -> Matter.UnitTestingTrait.TestEnumsRequestCommandResponse

    Parameters

    arg1

    Unsigned 16-bit integer argument.

    arg2

    SimpleEnum argument.

  • The batchable version of testEnumsRequest command above.

    See also

    testEnumsRequest

    Declaration

    Swift

    func testEnumsRequestBatchable(arg1: UInt16, arg2: Matter.UnitTestingTrait.SimpleEnum) throws -> BatchableCommand<Matter.UnitTestingTrait.TestEnumsRequestCommandResponse>
  • Whether the device supports the testNullableOptionalRequest command for this trait.

    Declaration

    Swift

    var supportsTestNullableOptionalRequestCommand: Bool { get }
  • Unit test command.

    Declaration

    Swift

    func testNullableOptionalRequest(optionalArgsProvider: ((Matter.UnitTestingTrait.TestNullableOptionalRequestCommand.OptionalArgs) -> Void)? = nil) async throws -> Matter.UnitTestingTrait.TestNullableOptionalRequestCommandResponse
  • The batchable version of testNullableOptionalRequest command above.

    See also

    testNullableOptionalRequest

    Declaration

    Swift

    func testNullableOptionalRequestBatchable(optionalArgsProvider: ((Matter.UnitTestingTrait.TestNullableOptionalRequestCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Matter.UnitTestingTrait.TestNullableOptionalRequestCommandResponse>
  • Whether the device supports the testComplexNullableOptionalRequest command for this trait.

    Declaration

    Swift

    var supportsTestComplexNullableOptionalRequestCommand: Bool { get }
  • Unit test command.

    Declaration

    Swift

    func testComplexNullableOptionalRequest(nullableInt: UInt16?, nullableString: String?, nullableStruct: Matter.UnitTestingTrait.SimpleStruct?, nullableList: [Matter.UnitTestingTrait.SimpleEnum]?, optionalArgsProvider: ((Matter.UnitTestingTrait.TestComplexNullableOptionalRequestCommand.OptionalArgs) -> Void)? = nil) async throws -> Matter.UnitTestingTrait.TestComplexNullableOptionalRequestCommandResponse

    Parameters

    nullableInt

    Unsigned 16-bit integer argument.

    nullableString

    String argument.

    nullableStruct

    SimpleStruct argument.

    nullableList

    SimpleEnum list argument.

  • The batchable version of testComplexNullableOptionalRequest command above.

    See also

    testComplexNullableOptionalRequest

    Declaration

    Swift

    func testComplexNullableOptionalRequestBatchable(nullableInt: UInt16?, nullableString: String?, nullableStruct: Matter.UnitTestingTrait.SimpleStruct?, nullableList: [Matter.UnitTestingTrait.SimpleEnum]?, optionalArgsProvider: ((Matter.UnitTestingTrait.TestComplexNullableOptionalRequestCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Matter.UnitTestingTrait.TestComplexNullableOptionalRequestCommandResponse>
  • Whether the device supports the simpleStructEchoRequest command for this trait.

    Declaration

    Swift

    var supportsSimpleStructEchoRequestCommand: Bool { get }
  • Unit test command.

    Declaration

    Swift

    func simpleStructEchoRequest(arg1: Matter.UnitTestingTrait.SimpleStruct) async throws -> Matter.UnitTestingTrait.SimpleStructEchoRequestCommandResponse

    Parameters

    arg1

    SimpleStruct argument.

  • The batchable version of simpleStructEchoRequest command above.

    See also

    simpleStructEchoRequest

    Declaration

    Swift

    func simpleStructEchoRequestBatchable(arg1: Matter.UnitTestingTrait.SimpleStruct) throws -> BatchableCommand<Matter.UnitTestingTrait.SimpleStructEchoRequestCommandResponse>
  • Whether the device supports the timedInvokeRequest command for this trait.

    Declaration

    Swift

    var supportsTimedInvokeRequestCommand: Bool { get }
  • TimedInvokeRequest command

    Declaration

    Swift

    func timedInvokeRequest() async throws
  • The batchable version of timedInvokeRequest command above.

    See also

    timedInvokeRequest

    Declaration

    Swift

    func timedInvokeRequestBatchable() throws -> BatchableCommand<Void>
  • Whether the device supports the testSimpleOptionalArgumentRequest command for this trait.

    Declaration

    Swift

    var supportsTestSimpleOptionalArgumentRequestCommand: Bool { get }
  • Unit test command.

    Declaration

    Swift

    func testSimpleOptionalArgumentRequest(optionalArgsProvider: ((Matter.UnitTestingTrait.TestSimpleOptionalArgumentRequestCommand.OptionalArgs) -> Void)? = nil) async throws
  • The batchable version of testSimpleOptionalArgumentRequest command above.

    See also

    testSimpleOptionalArgumentRequest

    Declaration

    Swift

    func testSimpleOptionalArgumentRequestBatchable(optionalArgsProvider: ((Matter.UnitTestingTrait.TestSimpleOptionalArgumentRequestCommand.OptionalArgs) -> Void)? = nil) throws -> BatchableCommand<Void>
  • Whether the device supports the testEmitTestEventRequest command for this trait.

    Declaration

    Swift

    var supportsTestEmitTestEventRequestCommand: Bool { get }
  • Unit test command.

    Declaration

    Swift

    func testEmitTestEventRequest(arg1: UInt8, arg2: Matter.UnitTestingTrait.SimpleEnum, arg3: Bool) async throws -> Matter.UnitTestingTrait.TestEmitTestEventRequestCommandResponse

    Parameters

    arg1

    Unsigned 8-bit integer argument.

    arg2

    SimpleEnum argument.

    arg3

    Boolean argument.

  • The batchable version of testEmitTestEventRequest command above.

    See also

    testEmitTestEventRequest

    Declaration

    Swift

    func testEmitTestEventRequestBatchable(arg1: UInt8, arg2: Matter.UnitTestingTrait.SimpleEnum, arg3: Bool) throws -> BatchableCommand<Matter.UnitTestingTrait.TestEmitTestEventRequestCommandResponse>
  • Whether the device supports the testEmitTestFabricScopedEventRequest command for this trait.

    Declaration

    Swift

    var supportsTestEmitTestFabricScopedEventRequestCommand: Bool { get }
  • Unit test command.

    Declaration

    Swift

    func testEmitTestFabricScopedEventRequest(arg1: UInt8) async throws -> Matter.UnitTestingTrait.TestEmitTestFabricScopedEventRequestCommandResponse

    Parameters

    arg1

    Unsigned 8-bit integer argument.

  • The batchable version of testEmitTestFabricScopedEventRequest command above.

    See also

    testEmitTestFabricScopedEventRequest

    Declaration

    Swift

    func testEmitTestFabricScopedEventRequestBatchable(arg1: UInt8) throws -> BatchableCommand<Matter.UnitTestingTrait.TestEmitTestFabricScopedEventRequestCommandResponse>
  • Whether the device supports the testBatchHelperRequest command for this trait.

    Declaration

    Swift

    var supportsTestBatchHelperRequestCommand: Bool { get }
  • The batchable version of testBatchHelperRequest command above.

    See also

    testBatchHelperRequest

    Declaration

    Swift

    func testBatchHelperRequestBatchable(sleepBeforeResponseTimeMs: UInt16, sizeOfResponseBuffer: UInt16, fillCharacter: UInt8) throws -> BatchableCommand<Matter.UnitTestingTrait.TestBatchHelperRequestCommandResponse>
  • Whether the device supports the testSecondBatchHelperRequest command for this trait.

    Declaration

    Swift

    var supportsTestSecondBatchHelperRequestCommand: Bool { get }
  • The batchable version of testSecondBatchHelperRequest command above.

    See also

    testSecondBatchHelperRequest

    Declaration

    Swift

    func testSecondBatchHelperRequestBatchable(sleepBeforeResponseTimeMs: UInt16, sizeOfResponseBuffer: UInt16, fillCharacter: UInt8) throws -> BatchableCommand<Matter.UnitTestingTrait.TestSecondBatchHelperRequestCommandResponse>
  • Whether the device supports the stringEchoRequest command for this trait.

    Declaration

    Swift

    var supportsStringEchoRequestCommand: Bool { get }
  • The batchable version of stringEchoRequest command above.

    See also

    stringEchoRequest

    Declaration

    Swift

    func stringEchoRequestBatchable(payload: Data) throws -> BatchableCommand<Matter.UnitTestingTrait.StringEchoRequestCommandResponse>
  • Whether the device supports the globalEchoRequest command for this trait.

    Declaration

    Swift

    var supportsGlobalEchoRequestCommand: Bool { get }
  • The batchable version of globalEchoRequest command above.

    See also

    globalEchoRequest

    Declaration

    Swift

    func globalEchoRequestBatchable(field1: Matter.UnitTestingTrait.TestGlobalStruct, field2: Matter.UnitTestingTrait.TestGlobalEnum) throws -> BatchableCommand<Matter.UnitTestingTrait.GlobalEchoRequestCommandResponse>
  • Whether the device supports the testDifferentVendorMeiRequest command for this trait.

    Declaration

    Swift

    var supportsTestDifferentVendorMeiRequestCommand: Bool { get }
  • The batchable version of testDifferentVendorMeiRequest command above.

    See also

    testDifferentVendorMeiRequest

    Declaration

    Swift

    func testDifferentVendorMeiRequestBatchable(arg1: UInt8) throws -> BatchableCommand<Matter.UnitTestingTrait.TestDifferentVendorMeiRequestCommandResponse>
  • A simple enum, as used by commands such as TestEmitTestEventRequestCommand and TestComplexNullableOptionalRequestCommand.

    Declaration

    Swift

    enum SimpleEnum
  • Bitmap16MaskMap

    Declaration

    Swift

    struct Bitmap16MaskMap
  • Bitmap32MaskMap. Could be used with [nullableBitmap32][UnitTestingTrait.Attributes.nullableBitmap64].

    Declaration

    Swift

    struct Bitmap32MaskMap
  • Bitmap64MaskMap. Could be used with [nullableBitmap64].

    Declaration

    Swift

    struct Bitmap64MaskMap
  • Bitmap8MaskMap

    Declaration

    Swift

    struct Bitmap8MaskMap
  • SimpleBitmap

    Declaration

    Swift

    struct SimpleBitmap