Presence: add device identity fields

This commit is contained in:
Peter Steinberger
2025-12-17 21:17:51 +01:00
parent 6148f862b9
commit e9502768af
19 changed files with 206 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
package com.steipete.clawdis.node
import android.content.Context
import android.os.Build
import com.steipete.clawdis.node.bridge.BridgeDiscovery
import com.steipete.clawdis.node.bridge.BridgeEndpoint
import com.steipete.clawdis.node.bridge.BridgePairingClient
@@ -182,6 +183,8 @@ class NodeRuntime(context: Context) {
token = null,
platform = "Android",
version = "dev",
deviceFamily = "Android",
modelIdentifier = Build.MODEL,
),
)
} else {
@@ -204,6 +207,8 @@ class NodeRuntime(context: Context) {
token = authToken,
platform = "Android",
version = "dev",
deviceFamily = "Android",
modelIdentifier = Build.MODEL,
),
)
}

View File

@@ -24,6 +24,8 @@ class BridgePairingClient {
val token: String?,
val platform: String?,
val version: String?,
val deviceFamily: String?,
val modelIdentifier: String?,
)
data class PairResult(val ok: Boolean, val token: String?, val error: String? = null)
@@ -55,6 +57,8 @@ class BridgePairingClient {
hello.token?.let { put("token", JsonPrimitive(it)) }
hello.platform?.let { put("platform", JsonPrimitive(it)) }
hello.version?.let { put("version", JsonPrimitive(it)) }
hello.deviceFamily?.let { put("deviceFamily", JsonPrimitive(it)) }
hello.modelIdentifier?.let { put("modelIdentifier", JsonPrimitive(it)) }
},
)
@@ -76,6 +80,8 @@ class BridgePairingClient {
hello.displayName?.let { put("displayName", JsonPrimitive(it)) }
hello.platform?.let { put("platform", JsonPrimitive(it)) }
hello.version?.let { put("version", JsonPrimitive(it)) }
hello.deviceFamily?.let { put("deviceFamily", JsonPrimitive(it)) }
hello.modelIdentifier?.let { put("modelIdentifier", JsonPrimitive(it)) }
},
)

View File

@@ -39,6 +39,8 @@ class BridgeSession(
val token: String?,
val platform: String?,
val version: String?,
val deviceFamily: String?,
val modelIdentifier: String?,
)
data class InvokeRequest(val id: String, val command: String, val paramsJson: String?)
@@ -191,6 +193,8 @@ class BridgeSession(
hello.token?.let { put("token", JsonPrimitive(it)) }
hello.platform?.let { put("platform", JsonPrimitive(it)) }
hello.version?.let { put("version", JsonPrimitive(it)) }
hello.deviceFamily?.let { put("deviceFamily", JsonPrimitive(it)) }
hello.modelIdentifier?.let { put("modelIdentifier", JsonPrimitive(it)) }
},
)

View File

@@ -46,6 +46,8 @@ class BridgePairingClientTest {
token = "token-123",
platform = "Android",
version = "test",
deviceFamily = "Android",
modelIdentifier = "SM-X000",
),
)
assertTrue(res.ok)
@@ -91,6 +93,8 @@ class BridgePairingClientTest {
token = null,
platform = "Android",
version = "test",
deviceFamily = "Android",
modelIdentifier = "SM-X000",
),
)
assertTrue(res.ok)
@@ -98,4 +102,3 @@ class BridgePairingClientTest {
server.await()
}
}