Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion server/core/protobuf_update.bat

This file was deleted.

2 changes: 1 addition & 1 deletion server/desktop/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ dependencies {

implementation("commons-cli:commons-cli:1.8.0")
implementation("org.apache.commons:commons-lang3:3.15.0")
implementation("com.google.protobuf:protobuf-java:3.21.12")
implementation("com.google.protobuf:protobuf-java:4.31.1")
implementation("net.java.dev.jna:jna:5.+")
implementation("net.java.dev.jna:jna-platform:5.+")
implementation("com.fazecast:jSerialComm:2.11.3") {
Expand Down
1 change: 1 addition & 0 deletions server/desktop/protobuf_update.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
protoc --proto_path=../../../SlimeVR-OpenVR-Driver/src/bridge --java_out=./src/main/java ProtobufMessages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import dev.slimevr.util.ann.VRServerThread
import io.eiren.util.ann.Synchronize
import io.eiren.util.ann.ThreadSafe
import io.eiren.util.collections.FastList
import io.eiren.util.logging.LogManager
import io.github.axisangles.ktmath.Quaternion
import io.github.axisangles.ktmath.Vector3
import java.util.Queue
Expand Down Expand Up @@ -44,6 +45,8 @@ abstract class ProtobufBridge(@JvmField protected val bridgeName: String) : ISte
@BridgeThread
protected abstract fun sendMessageReal(message: ProtobufMessage?): Boolean

private var remoteProtocolVersion: Int = 0

@BridgeThread
protected fun messageReceived(message: ProtobufMessage) {
inputQueue.add(message)
Expand Down Expand Up @@ -137,6 +140,8 @@ abstract class ProtobufBridge(@JvmField protected val bridgeName: String) : ISte
trackerAddedReceived(message.trackerAdded)
} else if (message.hasBattery()) {
batteryReceived(message.battery)
} else if (message.hasVersion()) {
versionReceived(message.version)
}
}

Expand Down Expand Up @@ -167,6 +172,16 @@ abstract class ProtobufBridge(@JvmField protected val bridgeName: String) : ISte
}
}

@VRServerThread
protected open fun versionReceived(versionMessage: Version) {
remoteProtocolVersion = versionMessage.protocolVersion
if (remoteProtocolVersion == PROTOCOL_VERSION) {
LogManager.info("[ProtobufBridge] Driver protocol version matches the server protocol version: $remoteProtocolVersion")
} else {
LogManager.warning("[ProtobufBridge] Driver protocol version ($remoteProtocolVersion) doesn't match the server protocol version ($PROTOCOL_VERSION)")
}
}

@VRServerThread
protected open fun batteryReceived(batteryMessage: Battery) {
return
Expand Down Expand Up @@ -274,5 +289,6 @@ abstract class ProtobufBridge(@JvmField protected val bridgeName: String) : ISte

companion object {
private const val resetSourceNamePrefix = "ProtobufBridge"
private const val PROTOCOL_VERSION = 1
}
}
Loading