mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-06-02 06:24:16 +02:00
feat: handle AdminResult.RateLimited from SDK, update MeshTopology API
- Add AdminException.RateLimited to domain exception hierarchy - Handle AdminResult.RateLimited in SdkRadioController.unwrap() - Update MeshTopologyService for SDK's new suspend API: topology.nodes → topology.nodes(), topology.edgeCount → edgeCount() Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
+2
-2
@@ -56,7 +56,7 @@ class MeshTopologyService {
|
||||
mutex.withLock {
|
||||
topology.addNeighborInfo(info)
|
||||
_edges.value = topology.allEdges()
|
||||
_nodeCount.value = topology.nodes.size
|
||||
_nodeCount.value = topology.nodes().size
|
||||
}
|
||||
Logger.d { "[Topology] Ingested neighbors from ${info.nodeId}: ${info.neighbors.size} edges" }
|
||||
}
|
||||
@@ -66,7 +66,7 @@ class MeshTopologyService {
|
||||
mutex.withLock {
|
||||
topology.removeNode(nodeId)
|
||||
_edges.value = topology.allEdges()
|
||||
_nodeCount.value = topology.nodes.size
|
||||
_nodeCount.value = topology.nodes().size
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -405,6 +405,7 @@ class SdkRadioController(
|
||||
is AdminResult.Unauthorized -> throw AdminException.Unauthorized()
|
||||
is AdminResult.NodeUnreachable -> throw AdminException.NodeUnreachable()
|
||||
is AdminResult.SessionKeyExpired -> throw AdminException.SessionKeyExpired()
|
||||
is AdminResult.RateLimited -> throw AdminException.RateLimited()
|
||||
is AdminResult.Failed -> throw AdminException.RoutingError(routingError.name)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,4 +39,7 @@ sealed class AdminException(message: String) : Exception(message) {
|
||||
|
||||
/** Device reported a routing error not covered by the other subtypes. */
|
||||
class RoutingError(val errorName: String) : AdminException("Routing error: $errorName")
|
||||
|
||||
/** Device rate-limited the request; back off before retrying. */
|
||||
class RateLimited : AdminException("Rate limit exceeded")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user