Skip to content

Commit

Permalink
[Android] Fix write/invoke UI with text instead of number (#32364)
Browse files Browse the repository at this point in the history
  • Loading branch information
yunhanw-google authored Feb 29, 2024
1 parent 36f9ff6 commit 33119dc
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/java-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,15 @@ jobs:
--tool-args "onnetwork-long-im-invoke --nodeid 1 --setup-pin-code 20202021 --discriminator 3840 -t 1000" \
--factoryreset \
'
- name: Run IM Batch Invoke Test
- name: Run IM Extendable Invoke Test
run: |
scripts/run_in_python_env.sh out/venv \
'./scripts/tests/run_java_test.py \
--app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app \
--app-args "--discriminator 3840 --interface-id -1" \
--tool-path out/linux-x64-java-matter-controller \
--tool-cluster "im" \
--tool-args "onnetwork-long-im-batch-invoke --nodeid 1 --setup-pin-code 20202021 --discriminator 3840 -t 1000" \
--tool-args "onnetwork-long-im-extendable-invoke --nodeid 1 --setup-pin-code 20202021 --discriminator 3840 -t 1000" \
--factoryreset \
'
- name: Run IM Read Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:visibility="gone"
android:inputType="number" />
android:inputType="text" />

<TextView
android:id="@+id/writeValueTypeLabel"
Expand Down Expand Up @@ -235,7 +235,8 @@
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:visibility="gone"
android:inputType="number"/>
android:inputType="text"
android:hint="@string/wildcard_invoke_value_help_label"/>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/addLayout"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@
<string name="wildcard_write_value_text">Write Value</string>
<string name="wildcard_write_data_version_text">Data Version</string>
<string name="wildcard_write_data_version_help_label">optional</string>
<string name="wildcard_invoke_value_text">Invoke Value</string>
<string name="wildcard_invoke_value_text">Invoke Value(Json)</string>
<string name="wildcard_invoke_value_help_label">Example: {"0:UINT":1}</string>
<string name="wildcard_empty_error_toast_message">Please add it to the list using Add Button.</string>
<string name="wildcard_subscribe_established_toast_message">Subscription established</string>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class PairOnNetworkLongImExtendableInvokeCommand(
) :
PairingCommand(
controller,
"onnetwork-long-im-batch-invoke",
"onnetwork-long-im-extendable-invoke",
credsIssue,
PairingModeType.ON_NETWORK,
PairingNetworkType.NONE,
Expand Down
8 changes: 4 additions & 4 deletions scripts/tests/java/im_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def TestCmdOnnetworkLongImInvoke(self, nodeid, setuppin, discriminator, timeout)
return java_process.wait()

def TestCmdOnnetworkLongImExtendableInvoke(self, nodeid, setuppin, discriminator, timeout):
java_command = self.command + ['im', 'onnetwork-long-im-batch-invoke', nodeid, setuppin, discriminator, timeout]
java_command = self.command + ['im', 'onnetwork-long-im-extendable-invoke', nodeid, setuppin, discriminator, timeout]
logging.info(f"Execute: {java_command}")
java_process = subprocess.Popen(
java_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
Expand Down Expand Up @@ -109,11 +109,11 @@ def RunTest(self):
code = self.TestCmdOnnetworkLongImInvoke(self.nodeid, self.setup_pin_code, self.discriminator, self.timeout)
if code != 0:
raise Exception(f"Testing pairing onnetwork-long-im-invoke failed with error {code}")
elif self.command_name == 'onnetwork-long-im-batch-invoke':
logging.info("Testing pairing onnetwork-long-im-batch-invoke")
elif self.command_name == 'onnetwork-long-im-extendable-invoke':
logging.info("Testing pairing onnetwork-long-im-extendable-invoke")
code = self.TestCmdOnnetworkLongImExtendableInvoke(self.nodeid, self.setup_pin_code, self.discriminator, self.timeout)
if code != 0:
raise Exception(f"Testing pairing onnetwork-long-im-batch-invoke failed with error {code}")
raise Exception(f"Testing pairing onnetwork-long-im-extendable-invoke failed with error {code}")
elif self.command_name == 'onnetwork-long-im-write':
logging.info("Testing pairing onnetwork-long-im-write")
code = self.TestCmdOnnetworkLongImWrite(self.nodeid, self.setup_pin_code, self.discriminator, self.timeout)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package chip.devicecontroller.model;

import java.util.Locale;
import java.util.logging.Logger;

/** Class for tracking failed invoke response data. */
Expand All @@ -32,6 +33,10 @@ public Integer getCommandRef() {
return commandRef;
}

public String toString() {
return String.format(Locale.ENGLISH, "commandRef %s", commandRef.toString());
}

public static NoInvokeResponseData newInstance(int commandRef) {
return new NoInvokeResponseData(commandRef);
}
Expand Down

0 comments on commit 33119dc

Please sign in to comment.