Skip to content

Commit b4776ad

Browse files
authored
Remove Android updateDevice API (#22093)
1 parent 83e1bbf commit b4776ad

File tree

4 files changed

+1
-49
lines changed

4 files changed

+1
-49
lines changed

src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/AddressUpdateFragment.kt

+1-16
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import com.google.chip.chiptool.R
1313
import com.google.chip.chiptool.util.DeviceIdUtil
1414
import kotlinx.android.synthetic.main.address_update_fragment.deviceIdEd
1515
import kotlinx.android.synthetic.main.address_update_fragment.fabricIdEd
16-
import kotlinx.android.synthetic.main.address_update_fragment.view.updateAddressBtn
1716

1817
/** Fragment for updating the address of a device given its fabric and node ID. */
1918
class AddressUpdateFragment: Fragment() {
@@ -28,9 +27,7 @@ class AddressUpdateFragment: Fragment() {
2827
container: ViewGroup?,
2928
savedInstanceState: Bundle?
3029
): View {
31-
return inflater.inflate(R.layout.address_update_fragment, container, false).apply {
32-
updateAddressBtn.setOnClickListener { updateAddressClick() }
33-
}
30+
return inflater.inflate(R.layout.address_update_fragment, container, false).apply { }
3431
}
3532

3633
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@@ -40,16 +37,4 @@ class AddressUpdateFragment: Fragment() {
4037
fabricIdEd.setText(compressedFabricId.toULong().toString(16).padStart(16, '0'))
4138
deviceIdEd.setText(DeviceIdUtil.getLastDeviceId(requireContext()).toString())
4239
}
43-
44-
private fun updateAddressClick() {
45-
try {
46-
deviceController.updateDevice(
47-
fabricIdEd.text.toString().toULong(16).toLong(),
48-
deviceIdEd.text.toString().toULong().toLong()
49-
)
50-
Toast.makeText(requireContext(), "Address update started", Toast.LENGTH_SHORT).show()
51-
} catch (ex: Exception) {
52-
Toast.makeText(requireContext(), "Address update failed: $ex", Toast.LENGTH_SHORT).show()
53-
}
54-
}
5540
}

src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/SensorClientFragment.kt

-13
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ class SensorClientFragment : Fragment() {
6666
ChipClient.getDeviceController(requireContext()).setCompletionListener(null)
6767
deviceIdEd.setOnEditorActionListener { textView, actionId, _ ->
6868
if (actionId == EditorInfo.IME_ACTION_DONE) {
69-
updateAddress(textView.text.toString())
7069
resetSensorGraph() // reset the graph on device change
7170
}
7271
actionId == EditorInfo.IME_ACTION_DONE
@@ -116,25 +115,13 @@ class SensorClientFragment : Fragment() {
116115
override fun onStart() {
117116
super.onStart()
118117
deviceIdEd.setText(DeviceIdUtil.getLastDeviceId(requireContext()).toString())
119-
updateAddress(deviceIdEd.text.toString())
120118
}
121119

122120
override fun onStop() {
123121
resetSensorGraph() // reset the graph on fragment exit
124122
super.onStop()
125123
}
126124

127-
private fun updateAddress(deviceId: String) {
128-
try {
129-
ChipClient.getDeviceController(requireContext()).updateDevice(
130-
/* fabric ID */ 5544332211,
131-
deviceId.toULong().toLong()
132-
)
133-
} catch (ex: Exception) {
134-
showMessage(R.string.update_device_address_failure, ex.toString())
135-
}
136-
}
137-
138125
private fun resetSensorGraph() {
139126
watchSensorBtn.isChecked = false
140127
sensorGraph.visibility = View.INVISIBLE

src/android/CHIPTool/app/src/main/res/layout/address_update_fragment.xml

-14
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,4 @@
3232
android:layout_height="wrap_content"
3333
app:barrierDirection="bottom"
3434
app:constraint_referenced_ids="fabricIdEd,deviceIdEd" />
35-
36-
<Button
37-
android:id="@+id/updateAddressBtn"
38-
android:layout_width="match_parent"
39-
android:layout_height="wrap_content"
40-
android:layout_margin="16dp"
41-
android:layout_below="@id/deviceIdEd"
42-
android:padding="16dp"
43-
android:text="@string/update_device_address_btn_text"
44-
app:layout_constraintBottom_toBottomOf="parent"
45-
app:layout_constraintEnd_toEndOf="parent"
46-
app:layout_constraintStart_toStartOf="parent"
47-
app:layout_constraintTop_toBottomOf="@id/barrier"
48-
app:layout_constraintVertical_bias="0.0" />
4935
</androidx.constraintlayout.widget.ConstraintLayout>

src/controller/java/src/chip/devicecontroller/ChipDeviceController.java

-6
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,6 @@ public long getCompressedFabricId() {
397397
*/
398398
public native long generateCompressedFabricId(byte[] rcac, byte[] noc);
399399

400-
public void updateDevice(long fabricId, long deviceId) {
401-
updateDevice(deviceControllerPtr, fabricId, deviceId);
402-
}
403-
404400
/**
405401
* Get commmissionible Node. Commmissionible Node results are able to get using {@link
406402
* ChipDeviceController.getDiscoveredDevice}.
@@ -639,8 +635,6 @@ private native void getConnectedDevicePointer(
639635

640636
private native long getCompressedFabricId(long deviceControllerPtr);
641637

642-
private native void updateDevice(long deviceControllerPtr, long fabricId, long deviceId);
643-
644638
private native void discoverCommissionableNodes(long deviceControllerPtr);
645639

646640
private native DiscoveredDevice getDiscoveredDevice(long deviceControllerPtr, int idx);

0 commit comments

Comments
 (0)