Skip to content

Commit

Permalink
Expose docs for websocket Matter/Thread functions (#3579)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpelgrom committed Jun 19, 2023
1 parent 5d1801c commit 4c75490
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,38 @@ interface WebSocketRepository {
suspend fun getTemplateUpdates(template: String): Flow<TemplateUpdatedEvent>?
suspend fun getNotifications(): Flow<Map<String, Any>>?
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<ThreadDatasetResponse>?

/**
* 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

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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<ThreadDatasetResponse>? {
val response = sendMessage(
mapOf(
Expand All @@ -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(
Expand All @@ -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(
Expand Down

0 comments on commit 4c75490

Please sign in to comment.