diff --git a/server/core/src/main/java/dev/slimevr/resets/module.kt b/server/core/src/main/java/dev/slimevr/resets/module.kt index a73a9477c..1fceb417d 100644 --- a/server/core/src/main/java/dev/slimevr/resets/module.kt +++ b/server/core/src/main/java/dev/slimevr/resets/module.kt @@ -101,7 +101,7 @@ class ResetsManager( * resetSourceName is used for logging * If bodyParts is null, resets all trackers. */ - suspend fun scheduleReset(resetSourceName: String, resetType: ResetType, delay: Float = 0f, bodyParts: List? = null) { + suspend fun scheduleReset(resetSourceName: String, resetType: ResetType, delay: Float = 0f, bodyParts: List? = null, solarXRBridgeId: Int? = null, txId: UInt? = null) { val method = settings.context.state.value.data.resetsConfig.mountingMethod.takeIf { resetType == ResetType.MOUNTING } if (method == MountingMethod.UNKNOWN || method == MountingMethod.MANUAL) { AppLogger.resets.info("Ignoring mounting reset from $resetSourceName: the mounting method is $method") @@ -127,7 +127,7 @@ class ResetsManager( } resetJob.cancelAndJoin() - resetJob = context.scope.launch { runReset(resetSourceName, resetType, method, delay, bodyParts) } + resetJob = context.scope.launch { runReset(resetSourceName, resetType, method, delay, bodyParts, solarXRBridgeId, txId) } } suspend fun cancel() { @@ -135,7 +135,7 @@ class ResetsManager( resetJob.cancelAndJoin() } - private suspend fun runReset(resetSourceName: String, resetType: ResetType, method: MountingMethod?, delaySeconds: Float, bodyParts: List?) { + private suspend fun runReset(resetSourceName: String, resetType: ResetType, method: MountingMethod?, delaySeconds: Float, bodyParts: List?, solarXRBridgeId: Int?, txId: UInt?) { val delayMs = (delaySeconds * 1000).toInt() var lastDetail: ResetDetail = CountdownDetail(0, delayMs) @@ -143,7 +143,9 @@ class ResetsManager( lastDetail = detail val status = ResetStatusResponse(resetType, lifecycle, bodyParts, detail) context.dispatch(ResetsActions.SetStatus(status)) - server.sendSolarxrRpc(status) + server.context.state.value.solarxr.values.forEach { bridge -> + bridge.sendRpc(status, if (bridge.id == solarXRBridgeId) txId else null) + } } try { diff --git a/server/core/src/main/java/dev/slimevr/solarxr/rpc/session-calibration.kt b/server/core/src/main/java/dev/slimevr/solarxr/rpc/session-calibration.kt index 90b39fc90..c2bbcb0b0 100644 --- a/server/core/src/main/java/dev/slimevr/solarxr/rpc/session-calibration.kt +++ b/server/core/src/main/java/dev/slimevr/solarxr/rpc/session-calibration.kt @@ -12,8 +12,8 @@ class SessionCalibrationBehaviour( ) : SolarXRBridgeBehaviour { override fun observe(receiver: SolarXRBridge) { // Reset request - receiver.rpcDispatcher.on { req -> - resetsManager.scheduleReset(receiver.context.name, req.resetType, req.delay ?: 0f, req.bodyParts) + receiver.onRpc { req, txId -> + resetsManager.scheduleReset(receiver.context.name, req.resetType, req.delay ?: 0f, req.bodyParts, receiver.id, txId) }.launchIn(receiver.context.scope) receiver.rpcDispatcher.on {