diff --git a/common/src/main/java/io/homeassistant/companion/android/common/data/websocket/WebSocketRepository.kt b/common/src/main/java/io/homeassistant/companion/android/common/data/websocket/WebSocketRepository.kt index 9f019a1720..408128e752 100644 --- a/common/src/main/java/io/homeassistant/companion/android/common/data/websocket/WebSocketRepository.kt +++ b/common/src/main/java/io/homeassistant/companion/android/common/data/websocket/WebSocketRepository.kt @@ -44,10 +44,38 @@ interface WebSocketRepository { suspend fun getTemplateUpdates(template: String): Flow? suspend fun getNotifications(): Flow>? suspend fun ackNotification(confirmId: String): Boolean + + /** + * Request the server to add a Matter device to the network and commission it. + * @return [MatterCommissionResponse] detailing the server's response, or `null` if the server + * did not return a response. + */ suspend fun commissionMatterDevice(code: String): MatterCommissionResponse? + + /** + * Request the server to commission a Matter device that is already on the network. + * @return [MatterCommissionResponse] detailing the server's response, or `null` if the server + * did not return a response. + */ suspend fun commissionMatterDeviceOnNetwork(pin: Long): MatterCommissionResponse? + + /** + * Return a list of all Thread datasets known to the server. + * @return List with [ThreadDatasetResponse]s, or `null` if not an admin or no response. + */ suspend fun getThreadDatasets(): List? + + /** + * Return the TLV value for a dataset. + * @return [ThreadDatasetTlvResponse] for the Thread dataset, or `null` if not found, not an + * admin or no response. + */ suspend fun getThreadDatasetTlv(datasetId: String): ThreadDatasetTlvResponse? + + /** + * Add a new set of Thread network credentials to the server. + * @return `true` if the server indicated success + */ suspend fun addThreadDataset(tlv: ByteArray): Boolean /** diff --git a/common/src/main/java/io/homeassistant/companion/android/common/data/websocket/impl/WebSocketRepositoryImpl.kt b/common/src/main/java/io/homeassistant/companion/android/common/data/websocket/impl/WebSocketRepositoryImpl.kt index 4ad24656ad..1b739c1020 100644 --- a/common/src/main/java/io/homeassistant/companion/android/common/data/websocket/impl/WebSocketRepositoryImpl.kt +++ b/common/src/main/java/io/homeassistant/companion/android/common/data/websocket/impl/WebSocketRepositoryImpl.kt @@ -370,11 +370,6 @@ class WebSocketRepositoryImpl @AssistedInject constructor( return response?.success == true } - /** - * Request the server to add a Matter device to the network and commission it - * @return [MatterCommissionResponse] detailing the server's response, or `null` if the server - * did not return a response - */ override suspend fun commissionMatterDevice(code: String): MatterCommissionResponse? { val response = sendMessage( WebSocketRequest( @@ -400,11 +395,6 @@ class WebSocketRepositoryImpl @AssistedInject constructor( } } - /** - * Request the server to commission a Matter device that is already on the network - * @return [MatterCommissionResponse] detailing the server's response, or `null` if the server - * did not return a response - */ override suspend fun commissionMatterDeviceOnNetwork(pin: Long): MatterCommissionResponse? { val response = sendMessage( WebSocketRequest( @@ -430,10 +420,6 @@ class WebSocketRepositoryImpl @AssistedInject constructor( } } - /** - * Return a list of all Thread datasets known to the server. - * @return List with [ThreadDatasetResponse]s, or `null` if not an admin or no response. - */ override suspend fun getThreadDatasets(): List? { val response = sendMessage( mapOf( @@ -447,11 +433,6 @@ class WebSocketRepositoryImpl @AssistedInject constructor( } } - /** - * Return the TLV value for a dataset. - * @return [ThreadDatasetTlvResponse] for the Thread dataset, or `null` if not found, not an - * admin or no response. - */ override suspend fun getThreadDatasetTlv(datasetId: String): ThreadDatasetTlvResponse? { val response = sendMessage( mapOf( @@ -463,10 +444,6 @@ class WebSocketRepositoryImpl @AssistedInject constructor( return mapResponse(response) } - /** - * Add a new set of Thread network credentials to the server. - * @return `true` if the server indicated success - */ override suspend fun addThreadDataset(tlv: ByteArray): Boolean { val response = sendMessage( mapOf(