Skip to content

Commit

Permalink
Fixing style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
pgregorr-amazon committed May 31, 2024
1 parent ce99a83 commit ae50b93
Show file tree
Hide file tree
Showing 4 changed files with 233 additions and 235 deletions.
Original file line number Diff line number Diff line change
@@ -1,131 +1,135 @@
/**
* Copyright (c) 2024 Project CHIP Authors
* All rights reserved.
* Copyright (c) 2024 Project CHIP Authors All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* <p>Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.matter.casting.support;

import android.util.Log;

/**
* Represents the Commissioner Declaration message sent by a User Directed Commissioning server (Casting Player) to a UDC client (tv-casting-app).
* Represents the Commissioner Declaration message sent by a User Directed Commissioning server
* (Casting Player) to a UDC client (tv-casting-app).
*/
public class CommissionerDeclaration {
static final String TAG = CommissionerDeclaration.class.getSimpleName();

public enum CdError {
kNoError(0),
kCommissionableDiscoveryFailed(1),
kPaseConnectionFailed(2),
kPaseAuthFailed(3),
kDacValidationFailed(4),
kAlreadyOnFabric(5),
kOperationalDiscoveryFailed(6),
kCaseConnectionFailed(7),
kCaseAuthFailed(8),
kConfigurationFailed(9),
kBindingConfigurationFailed(10),
kCommissionerPasscodeNotSupported(11),
kInvalidIdentificationDeclarationParams(12),
kAppInstallConsentPending(13),
kAppInstalling(14),
kAppInstallFailed(15),
kAppInstalledRetryNeeded(16),
kCommissionerPasscodeDisabled(17),
kUnexpectedCommissionerPasscodeReady(18);
private final int value;
CdError(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}

private CdError mErrorCode = CdError.kNoError;
private boolean mNeedsPasscode = false;
private boolean mNoAppsFound = false;
private boolean mPasscodeDialogDisplayed = false;
private boolean mCommissionerPasscode = false;
private boolean mQRCodeDisplayed = false;

public CommissionerDeclaration(int errorCode, boolean needsPasscode, boolean noAppsFound,
boolean passcodeDialogDisplayed, boolean commissionerPasscode, boolean qrCodeDisplayed) {
mErrorCode = CdError.values()[errorCode];
mNeedsPasscode = needsPasscode;
mNoAppsFound = noAppsFound;
mPasscodeDialogDisplayed = passcodeDialogDisplayed;
mCommissionerPasscode = commissionerPasscode;
mQRCodeDisplayed = qrCodeDisplayed;
}

public void setErrorCode(CdError newValue) {
mErrorCode = newValue;
}

public CdError getErrorCode() {
return mErrorCode;
}

public void setNeedsPasscode(boolean newValue) {
mNeedsPasscode = newValue;
}

public boolean getNeedsPasscode() {
return mNeedsPasscode;
}

public void setNoAppsFound(boolean newValue) {
mNoAppsFound = newValue;
}

public boolean getNoAppsFound() {
return mNoAppsFound;
}

public void setPasscodeDialogDisplayed(boolean newValue) {
mPasscodeDialogDisplayed = newValue;
}

public boolean getPasscodeDialogDisplayed() {
return mPasscodeDialogDisplayed;
}

public void setCommissionerPasscode(boolean newValue) {
mCommissionerPasscode = newValue;
}

public boolean getCommissionerPasscode() {
return mCommissionerPasscode;
}

public void setQRCodeDisplayed(boolean newValue) {
mQRCodeDisplayed = newValue;
}

public boolean getQRCodeDisplayed() {
return mQRCodeDisplayed;
static final String TAG = CommissionerDeclaration.class.getSimpleName();

public enum CdError {
kNoError(0),
kCommissionableDiscoveryFailed(1),
kPaseConnectionFailed(2),
kPaseAuthFailed(3),
kDacValidationFailed(4),
kAlreadyOnFabric(5),
kOperationalDiscoveryFailed(6),
kCaseConnectionFailed(7),
kCaseAuthFailed(8),
kConfigurationFailed(9),
kBindingConfigurationFailed(10),
kCommissionerPasscodeNotSupported(11),
kInvalidIdentificationDeclarationParams(12),
kAppInstallConsentPending(13),
kAppInstalling(14),
kAppInstallFailed(15),
kAppInstalledRetryNeeded(16),
kCommissionerPasscodeDisabled(17),
kUnexpectedCommissionerPasscodeReady(18);
private final int value;

CdError(int value) {
this.value = value;
}

public void logDetail() {
Log.d(TAG, "CommissionerDeclaration::logDetail() - java");
Log.d(TAG, "CommissionerDeclaration::mErrorCode: " + mErrorCode.name());
Log.d(TAG, "CommissionerDeclaration::mNeedsPasscode: " + mNeedsPasscode);
Log.d(TAG, "CommissionerDeclaration::mNoAppsFound: " + mNoAppsFound);
Log.d(TAG, "CommissionerDeclaration::mPasscodeDialogDisplayed: " + mPasscodeDialogDisplayed);
Log.d(TAG, "CommissionerDeclaration::mCommissionerPasscode: " + mCommissionerPasscode);
Log.d(TAG, "CommissionerDeclaration::mQRCodeDisplayed: " + mQRCodeDisplayed);
public int getValue() {
return value;
}
}

private CdError mErrorCode = CdError.kNoError;
private boolean mNeedsPasscode = false;
private boolean mNoAppsFound = false;
private boolean mPasscodeDialogDisplayed = false;
private boolean mCommissionerPasscode = false;
private boolean mQRCodeDisplayed = false;

public CommissionerDeclaration(
int errorCode,
boolean needsPasscode,
boolean noAppsFound,
boolean passcodeDialogDisplayed,
boolean commissionerPasscode,
boolean qrCodeDisplayed) {
mErrorCode = CdError.values()[errorCode];
mNeedsPasscode = needsPasscode;
mNoAppsFound = noAppsFound;
mPasscodeDialogDisplayed = passcodeDialogDisplayed;
mCommissionerPasscode = commissionerPasscode;
mQRCodeDisplayed = qrCodeDisplayed;
}

public void setErrorCode(CdError newValue) {
mErrorCode = newValue;
}

public CdError getErrorCode() {
return mErrorCode;
}

public void setNeedsPasscode(boolean newValue) {
mNeedsPasscode = newValue;
}

public boolean getNeedsPasscode() {
return mNeedsPasscode;
}

public void setNoAppsFound(boolean newValue) {
mNoAppsFound = newValue;
}

public boolean getNoAppsFound() {
return mNoAppsFound;
}

public void setPasscodeDialogDisplayed(boolean newValue) {
mPasscodeDialogDisplayed = newValue;
}

public boolean getPasscodeDialogDisplayed() {
return mPasscodeDialogDisplayed;
}

public void setCommissionerPasscode(boolean newValue) {
mCommissionerPasscode = newValue;
}

public boolean getCommissionerPasscode() {
return mCommissionerPasscode;
}

public void setQRCodeDisplayed(boolean newValue) {
mQRCodeDisplayed = newValue;
}

public boolean getQRCodeDisplayed() {
return mQRCodeDisplayed;
}

public void logDetail() {
Log.d(TAG, "CommissionerDeclaration::logDetail() - java");
Log.d(TAG, "CommissionerDeclaration::mErrorCode: " + mErrorCode.name());
Log.d(TAG, "CommissionerDeclaration::mNeedsPasscode: " + mNeedsPasscode);
Log.d(TAG, "CommissionerDeclaration::mNoAppsFound: " + mNoAppsFound);
Log.d(TAG, "CommissionerDeclaration::mPasscodeDialogDisplayed: " + mPasscodeDialogDisplayed);
Log.d(TAG, "CommissionerDeclaration::mCommissionerPasscode: " + mCommissionerPasscode);
Log.d(TAG, "CommissionerDeclaration::mQRCodeDisplayed: " + mQRCodeDisplayed);
}
}
Original file line number Diff line number Diff line change
@@ -1,44 +1,32 @@
/**
* Copyright (c) 2024 Project CHIP Authors
* All rights reserved.
* Copyright (c) 2024 Project CHIP Authors All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* <p>http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* <p>Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.matter.casting.support;

import com.matter.casting.support.CommissionerDeclaration;
import com.matter.casting.support.MatterCallback;
import com.matter.casting.support.MatterError;

/**
* @brief A container struct for User Directed Commissioning (UDC) callbacks.
*/
/** @brief A container struct for User Directed Commissioning (UDC) callbacks. */
public class ConnectionCallbacks {

/**
* The callback called when the connection is established successfully.
*/
/** The callback called when the connection is established successfully. */
public final MatterCallback<Void> onSuccess;

/**
* The callback called with MatterError when the connection is fails to establish.
*/
/** The callback called with MatterError when the connection is fails to establish. */
public final MatterCallback<MatterError> onFailure;

/**
* The callback called when the Commissionee receives a CommissionerDeclaration message from the Commissioner.
*/
/**
* The callback called when the Commissionee receives a CommissionerDeclaration message from the
* Commissioner.
*/
public MatterCallback<CommissionerDeclaration> onCommissionerDeclaration;

public ConnectionCallbacks(
Expand Down
Loading

0 comments on commit ae50b93

Please sign in to comment.