MatterTraitImpl

abstract class MatterTraitImpl : MatterTrait, TraitStateInvalidation


Extends the Trait interface to add the implementation details needed for all traits.

Summary

Public constructors

Public functions

ObjectCommand
<REQUEST : Any?> createObjectCommand(
    commandId: ScopedCommandId,
    request: REQUEST,
    requestAdapter: StructAdapter<REQUEST>,
    useTimedCommand: Boolean
)

Create an ObjectCommand to be used for batching

suspend Unit
<REQUEST : Any?> sendCommand(
    commandId: ScopedCommandId,
    request: REQUEST,
    requestAdapter: StructAdapter<REQUEST>,
    useTimedCommand: Boolean
)

Send Command

suspend RESPONSE
<REQUEST : Any?, RESPONSE : Any?> sendCommand(
    commandId: ScopedCommandId,
    request: REQUEST,
    requestAdapter: StructAdapter<REQUEST>,
    responseAdapter: StructAdapter<RESPONSE>,
    useTimedCommand: Boolean
)

Send Command and parse the response

suspend Unit
<T : Any?> write(
    adapter: StructAdapter<T>,
    attributes: T,
    useTimedInteraction: Boolean
)

Public properties

MatterTraitClient

a client for sending data to a trait

open Trait.TraitMetadata

Inherited functions

From com.google.home.TraitStateInvalidation
open suspend Unit

Inherited properties

From com.google.home.Trait

Public constructors

MatterTraitImpl

MatterTraitImpl(metadata: Trait.TraitMetadata, client: MatterTraitClient)
Parameters
client: MatterTraitClient

a client for sending data to a trait

Public functions

createObjectCommand

fun <REQUEST : Any?> createObjectCommand(
    commandId: ScopedCommandId,
    request: REQUEST,
    requestAdapter: StructAdapter<REQUEST>,
    useTimedCommand: Boolean = false
): ObjectCommand

Create an ObjectCommand to be used for batching

Parameters
commandId: ScopedCommandId

The Command Your Batching

request: REQUEST

the request object

requestAdapter: StructAdapter<REQUEST>

the adapter to serialize the request

useTimedCommand: Boolean = false

Flag to indicate if a command is a Timed Command.

sendCommand

suspend fun <REQUEST : Any?> sendCommand(
    commandId: ScopedCommandId,
    request: REQUEST,
    requestAdapter: StructAdapter<REQUEST>,
    useTimedCommand: Boolean = false
): Unit

Send Command

Parameters
commandId: ScopedCommandId

The Command Your Sending

request: REQUEST

the request object

requestAdapter: StructAdapter<REQUEST>

the adapter to serialize the request

useTimedCommand: Boolean = false

Flag to indicate if a command is a Timed Command.

sendCommand

suspend fun <REQUEST : Any?, RESPONSE : Any?> sendCommand(
    commandId: ScopedCommandId,
    request: REQUEST,
    requestAdapter: StructAdapter<REQUEST>,
    responseAdapter: StructAdapter<RESPONSE>,
    useTimedCommand: Boolean = false
): RESPONSE

Send Command and parse the response

Parameters
commandId: ScopedCommandId

The Command Your Sending

request: REQUEST

the request object

requestAdapter: StructAdapter<REQUEST>

the adapter to serialize the request

responseAdapter: StructAdapter<RESPONSE>

the adapter to deserialize the response

useTimedCommand: Boolean = false

Flag to indicate if a command is a Timed Command.

Returns
RESPONSE

the response

write

suspend fun <T : Any?> write(
    adapter: StructAdapter<T>,
    attributes: T,
    useTimedInteraction: Boolean
): Unit

Public properties

client

val clientMatterTraitClient

a client for sending data to a trait

metadata

open val metadataTrait.TraitMetadata