Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove pair step before calling any cluster API #30968

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,13 @@ class PairOnNetworkLongImInvokeCommand(
DiscoveryFilterType.LONG_DISCRIMINATOR
) {
override fun runCommand() {
yufengwangca marked this conversation as resolved.
Show resolved Hide resolved
currentCommissioner()
.pairDevice(
getNodeId(),
getRemoteAddr().address.hostAddress,
MATTER_PORT,
getDiscriminator(),
getSetupPINCode(),
)
currentCommissioner().setCompletionListener(this)
waitCompleteMs(getTimeoutMillis())

runBlocking {
try {
val identifyTime: UShort = 1u
val identifyCluster = IdentifyCluster(controller = currentCommissioner(), endpointId = 0u)

// By running command identify, we are implicitly requesting CASE to be established if it's
// not already present.
identifyCluster.identify(identifyTime)
logger.log(Level.INFO, "Invoke command succeeded")
} catch (ex: Exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,14 @@ class PairOnNetworkLongImReadCommand(controller: MatterController, credsIssue: C
DiscoveryFilterType.LONG_DISCRIMINATOR
) {
override fun runCommand() {
currentCommissioner()
.pairDevice(
getNodeId(),
getRemoteAddr().address.hostAddress,
MATTER_PORT,
getDiscriminator(),
getSetupPINCode(),
)
currentCommissioner().setCompletionListener(this)
waitCompleteMs(getTimeoutMillis())

runBlocking {
try {
val basicInformationCluster =
BasicInformationCluster(controller = currentCommissioner(), endpointId = DEFAULT_ENDPOINT)
val vendorName = basicInformationCluster.readVendorNameAttribute()

// By running command readVendorIDAttribute, we are implicitly requesting CASE to be
// established if it's not already present.
val vendorId = basicInformationCluster.readVendorIDAttribute()
logger.log(Level.INFO, "Read command succeeded, Verdor Name:${vendorName} (ID:${vendorId})")
} catch (ex: Exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,13 @@ class PairOnNetworkLongImWriteCommand(
DiscoveryFilterType.LONG_DISCRIMINATOR
) {
override fun runCommand() {
currentCommissioner()
.pairDevice(
getNodeId(),
getRemoteAddr().address.hostAddress,
MATTER_PORT,
getDiscriminator(),
getSetupPINCode(),
)
currentCommissioner().setCompletionListener(this)
waitCompleteMs(getTimeoutMillis())

runBlocking {
try {
val basicInformationCluster =
BasicInformationCluster(controller = currentCommissioner(), endpointId = DEFAULT_ENDPOINT)

// By running command writeNodeLabelAttribute, we are implicitly requesting CASE to be
// established if it's not already present.
basicInformationCluster.writeNodeLabelAttribute("Test Node Label")
logger.log(Level.INFO, "Write command succeeded")

Expand Down
Loading