mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-12-06 08:42:32 -08:00
More consistently consume txId for RPC messages
This commit is contained in:
23 files changed
+87
-81
No files matched your search
@@ -128,8 +128,8 @@ class BodyPartPrerequisitesBehaviour(
|
||||
::ikSolvedParts,
|
||||
).distinctUntilChanged().map(::buildResponse)
|
||||
|
||||
receiver.rpcDispatcher.on<BodyPartPrerequisitesRequest> {
|
||||
receiver.sendRpc(responses.first())
|
||||
receiver.onRpc<BodyPartPrerequisitesRequest> { _, txId ->
|
||||
receiver.sendRpc(responses.first(), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
responses
|
||||
|
||||
@@ -67,8 +67,8 @@ class BoneRoutingBehaviour(
|
||||
::buildResponse,
|
||||
).distinctUntilChanged()
|
||||
|
||||
receiver.rpcDispatcher.on<BoneRoutingSettingsRequest> {
|
||||
receiver.sendRpc(responses.first())
|
||||
receiver.onRpc<BoneRoutingSettingsRequest> { _, txId ->
|
||||
receiver.sendRpc(responses.first(), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
responses
|
||||
|
||||
@@ -32,8 +32,8 @@ class DriverSettingsBehaviour(
|
||||
private val settings: Settings get() = appContext.config.settings
|
||||
|
||||
override fun observe(receiver: SolarXRBridge) {
|
||||
receiver.rpcDispatcher.on<DriverSettingsRequest> {
|
||||
receiver.sendRpc(buildDriverSettingsResponse(settings.context.state.value.data.driverConfig))
|
||||
receiver.onRpc<DriverSettingsRequest> { _, txId ->
|
||||
receiver.sendRpc(buildDriverSettingsResponse(settings.context.state.value.data.driverConfig), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
settings.context.state
|
||||
|
||||
@@ -27,8 +27,8 @@ class ErrorReportingSettingsBehaviour(
|
||||
private val errorReporting: ErrorReportingManager,
|
||||
) : SolarXRBridgeBehaviour {
|
||||
override fun observe(receiver: SolarXRBridge) {
|
||||
receiver.rpcDispatcher.on<ErrorReportingSettingsRequest> {
|
||||
receiver.sendRpc(buildResponse(errorReporting.context.state.value))
|
||||
receiver.onRpc<ErrorReportingSettingsRequest> { _, txId ->
|
||||
receiver.sendRpc(buildResponse(errorReporting.context.state.value), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
errorReporting.context.state
|
||||
|
||||
@@ -20,8 +20,8 @@ class HIDSettingsBehaviour(
|
||||
private val settings: Settings,
|
||||
) : SolarXRBridgeBehaviour {
|
||||
override fun observe(receiver: SolarXRBridge) {
|
||||
receiver.rpcDispatcher.on<HIDSettingsRequest> {
|
||||
receiver.sendRpc(buildHidSettingsResponse(settings.context.state.value.data.hidConfig))
|
||||
receiver.onRpc<HIDSettingsRequest> { _, txId ->
|
||||
receiver.sendRpc(buildHidSettingsResponse(settings.context.state.value.data.hidConfig), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
settings.context.state
|
||||
|
||||
@@ -7,9 +7,9 @@ import solarxr_protocol.rpc.InstalledInfoResponse
|
||||
|
||||
class InstalledInfoBehaviour : SolarXRBridgeBehaviour {
|
||||
override fun observe(receiver: SolarXRBridge) {
|
||||
receiver.rpcDispatcher.on<InstalledInfoRequest> {
|
||||
val udevRulesInstalled = receiver.appContext.featureFlags.udevRulesInstalled ?: return@on
|
||||
receiver.sendRpc(InstalledInfoResponse(isUdevInstalled = udevRulesInstalled))
|
||||
receiver.onRpc<InstalledInfoRequest> { _, txId ->
|
||||
val udevRulesInstalled = receiver.appContext.featureFlags.udevRulesInstalled ?: return@onRpc
|
||||
receiver.sendRpc(InstalledInfoResponse(isUdevInstalled = udevRulesInstalled), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
}
|
||||
}
|
||||
@@ -52,8 +52,8 @@ class KeybindsBehaviour(
|
||||
support = receiver.appContext.featureFlags.keybindSupport,
|
||||
)
|
||||
|
||||
receiver.rpcDispatcher.on<KeybindRequest> {
|
||||
receiver.sendRpc(buildResponse(settings.context.state.value.data.keybinds))
|
||||
receiver.onRpc<KeybindRequest> { _, txId ->
|
||||
receiver.sendRpc(buildResponse(settings.context.state.value.data.keybinds), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
settings.context.state
|
||||
|
||||
@@ -62,7 +62,7 @@ class LogsBehaviour(private val sources: List<LogSourceProvider>) : SolarXRBridg
|
||||
override fun observe(receiver: SolarXRBridge) {
|
||||
var streamJob: Job? = null
|
||||
|
||||
receiver.rpcDispatcher.on<LogsRequest> {
|
||||
receiver.onRpc<LogsRequest> { _, txId ->
|
||||
val infos = sources.map { LogSourceInfo(source = it.source, live = it.events != null) }
|
||||
val files = withContext(Dispatchers.IO) {
|
||||
sources.flatMap { provider ->
|
||||
@@ -77,10 +77,10 @@ class LogsBehaviour(private val sources: List<LogSourceProvider>) : SolarXRBridg
|
||||
}
|
||||
}
|
||||
}
|
||||
receiver.sendRpc(LogsResponse(sources = infos, files = files))
|
||||
receiver.sendRpc(LogsResponse(sources = infos, files = files), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<LogStreamRequest> { req ->
|
||||
receiver.onRpc<LogStreamRequest> { req, txId ->
|
||||
streamJob?.cancelAndJoin()
|
||||
val requested = req.sources.orEmpty().toSet()
|
||||
val flows = sources.filter { it.source in requested }.mapNotNull { it.events }
|
||||
@@ -89,13 +89,13 @@ class LogsBehaviour(private val sources: List<LogSourceProvider>) : SolarXRBridg
|
||||
} else {
|
||||
receiver.context.scope.launch {
|
||||
batchByTime(flows.merge(), BATCH_WINDOW).collect { batch ->
|
||||
receiver.sendRpc(LogStreamResponse(events = batch))
|
||||
receiver.sendRpc(LogStreamResponse(events = batch), txId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<LogFileChunkRequest> { req ->
|
||||
receiver.onRpc<LogFileChunkRequest> { req, txId ->
|
||||
val entry = withContext(Dispatchers.IO) {
|
||||
sources.firstOrNull { it.source == req.source }?.files()?.firstOrNull { it.name == req.name }
|
||||
}
|
||||
@@ -108,6 +108,7 @@ class LogsBehaviour(private val sources: List<LogSourceProvider>) : SolarXRBridg
|
||||
data = data?.asList()?.map { it.toUByte() },
|
||||
eof = data == null || data.size < CHUNK_SIZE,
|
||||
),
|
||||
txId,
|
||||
)
|
||||
}.launchIn(receiver.context.scope)
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class MagBehaviour(
|
||||
.onEach { enable -> receiver.sendRpc(MagToggleResponse(trackerId = 0u, enable = enable)) }
|
||||
.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<ChangeMagToggleRequest> { req ->
|
||||
receiver.onRpc<ChangeMagToggleRequest> { req, txId ->
|
||||
val trackerId = req.trackerId.toInt()
|
||||
val enable = req.enable
|
||||
|
||||
@@ -65,24 +65,24 @@ class MagBehaviour(
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
receiver.sendRpc(MagToggleResponse(trackerId = 0u, enable = enable))
|
||||
return@on
|
||||
receiver.sendRpc(MagToggleResponse(trackerId = 0u, enable = enable), txId)
|
||||
return@onRpc
|
||||
}
|
||||
|
||||
val tracker = appContext.server.getTracker(trackerId) ?: return@on
|
||||
val tracker = appContext.server.getTracker(trackerId) ?: return@onRpc
|
||||
val trackerState = tracker.context.state.value
|
||||
if (trackerState.magStatus == MagnetometerStatus.NOT_SUPPORTED) return@on
|
||||
if (trackerState.magStatus == MagnetometerStatus.NOT_SUPPORTED) return@onRpc
|
||||
|
||||
when (trackerState.origin) {
|
||||
DeviceOrigin.UDP -> {
|
||||
if (!setUDPTrackerMag(trackerState.id, trackerState.deviceId, enable)) return@on
|
||||
if (!setUDPTrackerMag(trackerState.id, trackerState.deviceId, enable)) return@onRpc
|
||||
tracker.context.scope.launch {
|
||||
try {
|
||||
withTimeout(10.seconds) {
|
||||
tracker.context.state
|
||||
.distinctUntilChangedBy { it.magStatus }
|
||||
.first { it.magStatus == if (enable) MagnetometerStatus.ENABLED else MagnetometerStatus.DISABLED }
|
||||
receiver.sendRpc(MagToggleResponse(trackerId = trackerId.toUShort(), enable = enable))
|
||||
receiver.sendRpc(MagToggleResponse(trackerId = trackerId.toUShort(), enable = enable), txId)
|
||||
}
|
||||
} catch (_: TimeoutCancellationException) {
|
||||
AppLogger.solarxr.warn("Timeout waiting for mag toggle response from tracker")
|
||||
@@ -94,11 +94,11 @@ class MagBehaviour(
|
||||
// TODO: implement HID mag toggle
|
||||
}
|
||||
|
||||
else -> return@on
|
||||
else -> return@onRpc
|
||||
}
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<MagToggleRequest> { req ->
|
||||
receiver.onRpc<MagToggleRequest> { req, txId ->
|
||||
val trackerId = req.trackerId.toInt()
|
||||
|
||||
if (trackerId == 0) {
|
||||
@@ -107,16 +107,18 @@ class MagBehaviour(
|
||||
trackerId = 0u,
|
||||
enable = receiver.appContext.config.settings.context.state.value.data.trackersConfig.globalMagEnabled,
|
||||
),
|
||||
txId,
|
||||
)
|
||||
return@on
|
||||
return@onRpc
|
||||
}
|
||||
|
||||
val trackerState = appContext.server.getTracker(trackerId)?.context?.state?.value ?: return@on
|
||||
val trackerState = appContext.server.getTracker(trackerId)?.context?.state?.value ?: return@onRpc
|
||||
receiver.sendRpc(
|
||||
MagToggleResponse(
|
||||
trackerId = trackerId.toUShort(),
|
||||
enable = trackerState.magStatus == MagnetometerStatus.ENABLED,
|
||||
),
|
||||
txId,
|
||||
)
|
||||
}.launchIn(receiver.context.scope)
|
||||
}
|
||||
|
||||
@@ -39,21 +39,21 @@ class ProfilesBehaviour(
|
||||
.onEach(receiver::sendRpc)
|
||||
.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<SwitchProfileRequest> { req ->
|
||||
receiver.sendRpc(ProfileOperationResponse(config.switchProfile(req.kind, req.name.orEmpty())))
|
||||
receiver.onRpc<SwitchProfileRequest> { req, txId ->
|
||||
receiver.sendRpc(ProfileOperationResponse(config.switchProfile(req.kind, req.name.orEmpty())), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<CreateProfileRequest> { req ->
|
||||
receiver.onRpc<CreateProfileRequest> { req, txId ->
|
||||
val copyFrom = req.copyFrom?.takeIf { it.isNotEmpty() }
|
||||
receiver.sendRpc(ProfileOperationResponse(config.createProfile(req.kind, req.name.orEmpty(), copyFrom)))
|
||||
receiver.sendRpc(ProfileOperationResponse(config.createProfile(req.kind, req.name.orEmpty(), copyFrom)), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<RenameProfileRequest> { req ->
|
||||
receiver.sendRpc(ProfileOperationResponse(config.renameProfile(req.kind, req.name.orEmpty(), req.newName.orEmpty())))
|
||||
receiver.onRpc<RenameProfileRequest> { req, txId ->
|
||||
receiver.sendRpc(ProfileOperationResponse(config.renameProfile(req.kind, req.name.orEmpty(), req.newName.orEmpty())), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<DeleteProfileRequest> { req ->
|
||||
receiver.sendRpc(ProfileOperationResponse(config.deleteProfile(req.kind, req.name.orEmpty())))
|
||||
receiver.onRpc<DeleteProfileRequest> { req, txId ->
|
||||
receiver.sendRpc(ProfileOperationResponse(config.deleteProfile(req.kind, req.name.orEmpty())), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
}
|
||||
}
|
||||
@@ -33,8 +33,8 @@ class ResetsBehaviour(
|
||||
.launchIn(receiver.context.scope)
|
||||
|
||||
// Send config
|
||||
receiver.rpcDispatcher.on<ResetsSettingsRequest> {
|
||||
receiver.sendRpc(buildResetsSettingsResponse(settings.context.state.value.data.resetsConfig))
|
||||
receiver.onRpc<ResetsSettingsRequest> { _, txId ->
|
||||
receiver.sendRpc(buildResetsSettingsResponse(settings.context.state.value.data.resetsConfig), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
// Receive config
|
||||
|
||||
@@ -177,9 +177,10 @@ class SerialBehaviour(private val serialServer: SerialServer) : SolarXRBridgeBeh
|
||||
.onEach { ports -> receiver.sendRpc(SerialDevicesResponse(devices = ports.map { it.toSerialDevice() })) }
|
||||
.launchIn(scope)
|
||||
|
||||
receiver.rpcDispatcher.on<SerialDevicesRequest> {
|
||||
receiver.onRpc<SerialDevicesRequest> { _, txId ->
|
||||
receiver.sendRpc(
|
||||
SerialDevicesResponse(devices = sortPorts(serialServer.context.state.value.ports.values).map { it.toSerialDevice() }),
|
||||
txId,
|
||||
)
|
||||
}.launchIn(scope)
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ class ServerInfosBehaviour(
|
||||
private val serverInfos: ServerInfos,
|
||||
) : SolarXRBridgeBehaviour {
|
||||
override fun observe(receiver: SolarXRBridge) {
|
||||
receiver.rpcDispatcher.on<ServerInfosRequest> {
|
||||
receiver.sendRpc(ServerInfosResponse(localIp = serverInfos.localIp))
|
||||
receiver.onRpc<ServerInfosRequest> { _, txId ->
|
||||
receiver.sendRpc(ServerInfosResponse(localIp = serverInfos.localIp), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
}
|
||||
}
|
||||
@@ -38,8 +38,8 @@ private fun buildSettingsDefaultsResponse(): SettingsDefaultsResponse {
|
||||
|
||||
class SettingsDefaultsBehaviour : SolarXRBridgeBehaviour {
|
||||
override fun observe(receiver: SolarXRBridge) {
|
||||
receiver.rpcDispatcher.on<SettingsDefaultsRequest> {
|
||||
receiver.sendRpc(buildSettingsDefaultsResponse())
|
||||
receiver.onRpc<SettingsDefaultsRequest> { _, txId ->
|
||||
receiver.sendRpc(buildSettingsDefaultsResponse(), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
}
|
||||
}
|
||||
@@ -62,8 +62,8 @@ class SkeletonProportionsBehaviour(
|
||||
}
|
||||
.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<SkeletonProportionsRequest> {
|
||||
receiver.sendRpc(buildConfigResponse(skeleton.context.state.value.boneInputs))
|
||||
receiver.onRpc<SkeletonProportionsRequest> { _, txId ->
|
||||
receiver.sendRpc(buildConfigResponse(skeleton.context.state.value.boneInputs), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<ChangeUserHeightRequest> { req ->
|
||||
|
||||
@@ -49,8 +49,8 @@ class SkeletonSettingsBehaviour(
|
||||
) : SolarXRBridgeBehaviour {
|
||||
override fun observe(receiver: SolarXRBridge) {
|
||||
// Send config
|
||||
receiver.rpcDispatcher.on<SkeletonSettingsRequest> {
|
||||
receiver.sendRpc(buildSkeletonSettingsResponse(settings.context.state.value.data.skeletonConfig))
|
||||
receiver.onRpc<SkeletonSettingsRequest> { _, txId ->
|
||||
receiver.sendRpc(buildSkeletonSettingsResponse(settings.context.state.value.data.skeletonConfig), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
// Push config changes, including profile switches
|
||||
@@ -94,25 +94,27 @@ class SkeletonSettingsBehaviour(
|
||||
)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<SetPauseTrackingRequest> {
|
||||
receiver.onRpc<SetPauseTrackingRequest> { req, txId ->
|
||||
receiver.appContext.skeleton.context.dispatch(
|
||||
SkeletonActions.PauseTracking(
|
||||
it.pauseTracking,
|
||||
req.pauseTracking,
|
||||
),
|
||||
)
|
||||
|
||||
receiver.sendRpc(
|
||||
TrackingPauseStateResponse(
|
||||
trackingPaused = it.pauseTracking,
|
||||
trackingPaused = req.pauseTracking,
|
||||
),
|
||||
txId,
|
||||
)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<TrackingPauseStateRequest> {
|
||||
receiver.onRpc<TrackingPauseStateRequest> { _, txId ->
|
||||
receiver.sendRpc(
|
||||
TrackingPauseStateResponse(
|
||||
trackingPaused = receiver.appContext.skeleton.context.state.value.paused,
|
||||
),
|
||||
txId,
|
||||
)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
|
||||
@@ -118,13 +118,13 @@ class StayAlignedBehaviour(
|
||||
observeRecording(receiver)
|
||||
}
|
||||
|
||||
private suspend fun sendConfig(receiver: SolarXRBridge) {
|
||||
receiver.sendRpc(buildStayAlignedSettingsResponse(settings.context.state.value.data.stayAlignedConfig, userConfig.context.state.value.data))
|
||||
private suspend fun sendConfig(receiver: SolarXRBridge, txId: UInt?) {
|
||||
receiver.sendRpc(buildStayAlignedSettingsResponse(settings.context.state.value.data.stayAlignedConfig, userConfig.context.state.value.data), txId)
|
||||
}
|
||||
|
||||
private fun observeSettings(receiver: SolarXRBridge) {
|
||||
receiver.rpcDispatcher.on<StayAlignedSettingsRequest> {
|
||||
sendConfig(receiver)
|
||||
receiver.onRpc<StayAlignedSettingsRequest> { _, txId ->
|
||||
sendConfig(receiver, txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
// Push config changes, including profile switches
|
||||
@@ -138,7 +138,7 @@ class StayAlignedBehaviour(
|
||||
.onEach(receiver::sendRpc)
|
||||
.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<ChangeStayAlignedSettingsRequest> { req ->
|
||||
receiver.onRpc<ChangeStayAlignedSettingsRequest> { req, txId ->
|
||||
settings.context.dispatch(SettingsActions.Update { copy(stayAlignedConfig = StayAlignedConfig(enabled = req.enabled)) })
|
||||
userConfig.context.dispatch(
|
||||
UserConfigActions.Update {
|
||||
@@ -151,14 +151,14 @@ class StayAlignedBehaviour(
|
||||
copy(stayAlignedPoses = stayAlignedPoses + toggled)
|
||||
},
|
||||
)
|
||||
sendConfig(receiver)
|
||||
sendConfig(receiver, txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<ResetStayAlignedRelaxedPoseRequest> { req ->
|
||||
if (req.pose == StayAlignedRelaxedPose.UNKNOWN) return@on
|
||||
receiver.onRpc<ResetStayAlignedRelaxedPoseRequest> { req, txId ->
|
||||
if (req.pose == StayAlignedRelaxedPose.UNKNOWN) return@onRpc
|
||||
userConfig.context.dispatch(UserConfigActions.Update { copy(stayAlignedPoses = stayAlignedPoses - req.pose) })
|
||||
AppLogger.stayAligned.info("Reset relaxed pose ${req.pose}")
|
||||
sendConfig(receiver)
|
||||
sendConfig(receiver, txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ class TapDetectionBehaviour(
|
||||
) : SolarXRBridgeBehaviour {
|
||||
override fun observe(receiver: SolarXRBridge) {
|
||||
// Send config
|
||||
receiver.rpcDispatcher.on<TapDetectionSettingsRequest> {
|
||||
receiver.sendRpc(buildTapDetectionSettingsResponse(settings.context.state.value.data.tapDetectionConfig))
|
||||
receiver.onRpc<TapDetectionSettingsRequest> { _, txId ->
|
||||
receiver.sendRpc(buildTapDetectionSettingsResponse(settings.context.state.value.data.tapDetectionConfig), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
// Push config changes, including profile switches
|
||||
|
||||
@@ -23,8 +23,8 @@ class TimeoutSettingsBehaviour(
|
||||
) : SolarXRBridgeBehaviour {
|
||||
override fun observe(receiver: SolarXRBridge) {
|
||||
// Send config
|
||||
receiver.rpcDispatcher.on<TimeoutSettingsRequest> {
|
||||
receiver.sendRpc(buildTimeoutSettingsResponse(settings.context.state.value.data.trackersConfig))
|
||||
receiver.onRpc<TimeoutSettingsRequest> { _, txId ->
|
||||
receiver.sendRpc(buildTimeoutSettingsResponse(settings.context.state.value.data.trackersConfig), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
// Push config changes, including profile switches
|
||||
|
||||
@@ -66,8 +66,8 @@ class TrackingChecklistBehaviour(
|
||||
.onEach { response -> receiver.sendRpc(response) }
|
||||
.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<TrackingChecklistRequest> {
|
||||
receiver.sendRpc(buildResponse())
|
||||
receiver.onRpc<TrackingChecklistRequest> { _, txId ->
|
||||
receiver.sendRpc(buildResponse(), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<IgnoreTrackingChecklistStepRequest> { req ->
|
||||
|
||||
@@ -52,8 +52,8 @@ class VmcBehaviour(
|
||||
.launchIn(receiver.context.scope)
|
||||
|
||||
// Send VMC config
|
||||
receiver.rpcDispatcher.on<VMCOSCSettingsRequest> {
|
||||
receiver.sendRpc(buildVmcOscSettingsResponse(settings.context.state.value.data.vmcConfig))
|
||||
receiver.onRpc<VMCOSCSettingsRequest> { _, txId ->
|
||||
receiver.sendRpc(buildVmcOscSettingsResponse(settings.context.state.value.data.vmcConfig), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
// Push config changes, including profile switches
|
||||
@@ -64,13 +64,13 @@ class VmcBehaviour(
|
||||
.onEach(receiver::sendRpc)
|
||||
.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<VMCOSCStatusRequest> {
|
||||
receiver.sendRpc(buildStatusResponse(vmcManager.context.state.value.status))
|
||||
receiver.onRpc<VMCOSCStatusRequest> { _, txId ->
|
||||
receiver.sendRpc(buildStatusResponse(vmcManager.context.state.value.status), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
// Send VRM json
|
||||
receiver.rpcDispatcher.on<VRMSettingsRequest> {
|
||||
receiver.sendRpc(buildVrmSettingsResponse(settings.context.state.value.data.vmcConfig))
|
||||
receiver.onRpc<VRMSettingsRequest> { _, txId ->
|
||||
receiver.sendRpc(buildVrmSettingsResponse(settings.context.state.value.data.vmcConfig), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
// Push config changes, including profile switches
|
||||
|
||||
@@ -39,8 +39,8 @@ class VrcBehaviour(
|
||||
receiver.sendRpc(buildCurrentResponse())
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<VRCConfigStateRequest> {
|
||||
receiver.sendRpc(buildCurrentResponse())
|
||||
receiver.onRpc<VRCConfigStateRequest> { _, txId ->
|
||||
receiver.sendRpc(buildCurrentResponse(), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<VRCConfigSettingToggleMute> { req ->
|
||||
|
||||
@@ -48,8 +48,8 @@ internal class VrcOscBehaviour(
|
||||
.onEach { status -> receiver.sendRpc(buildStatusResponse(status)) }
|
||||
.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<VRCOSCSettingsRequest> {
|
||||
receiver.sendRpc(buildVrcOscSettingsResponse(settings.context.state.value.data.vrcOscConfig))
|
||||
receiver.onRpc<VRCOSCSettingsRequest> { _, txId ->
|
||||
receiver.sendRpc(buildVrcOscSettingsResponse(settings.context.state.value.data.vrcOscConfig), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
// Push config changes, including profile switches
|
||||
@@ -60,8 +60,8 @@ internal class VrcOscBehaviour(
|
||||
.onEach(receiver::sendRpc)
|
||||
.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<VRCOSCStatusRequest> {
|
||||
receiver.sendRpc(buildStatusResponse(vrcOscManager.context.state.value.status))
|
||||
receiver.onRpc<VRCOSCStatusRequest> { _, txId ->
|
||||
receiver.sendRpc(buildStatusResponse(vrcOscManager.context.state.value.status), txId)
|
||||
}.launchIn(receiver.context.scope)
|
||||
|
||||
receiver.rpcDispatcher.on<ChangeVRCOSCSettingsRequest> { req ->
|
||||
|
||||
Reference in new issue
Block a user