Android: advertise device model to bridge
parent
fca6e466b1
commit
df4e4534f4
|
|
@ -1,6 +1,7 @@
|
||||||
package com.steipete.clawdis.node
|
package com.steipete.clawdis.node
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.os.Build
|
||||||
import com.steipete.clawdis.node.bridge.BridgeDiscovery
|
import com.steipete.clawdis.node.bridge.BridgeDiscovery
|
||||||
import com.steipete.clawdis.node.bridge.BridgeEndpoint
|
import com.steipete.clawdis.node.bridge.BridgeEndpoint
|
||||||
import com.steipete.clawdis.node.bridge.BridgePairingClient
|
import com.steipete.clawdis.node.bridge.BridgePairingClient
|
||||||
|
|
@ -175,6 +176,10 @@ class NodeRuntime(context: Context) {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
_statusText.value = "Connecting…"
|
_statusText.value = "Connecting…"
|
||||||
val storedToken = prefs.loadBridgeToken()
|
val storedToken = prefs.loadBridgeToken()
|
||||||
|
val modelIdentifier = listOfNotNull(Build.MANUFACTURER, Build.MODEL)
|
||||||
|
.joinToString(" ")
|
||||||
|
.trim()
|
||||||
|
.ifEmpty { null }
|
||||||
val resolved =
|
val resolved =
|
||||||
if (storedToken.isNullOrBlank()) {
|
if (storedToken.isNullOrBlank()) {
|
||||||
_statusText.value = "Pairing…"
|
_statusText.value = "Pairing…"
|
||||||
|
|
@ -191,6 +196,8 @@ class NodeRuntime(context: Context) {
|
||||||
token = null,
|
token = null,
|
||||||
platform = "Android",
|
platform = "Android",
|
||||||
version = "dev",
|
version = "dev",
|
||||||
|
deviceFamily = "Android",
|
||||||
|
modelIdentifier = modelIdentifier,
|
||||||
caps = caps,
|
caps = caps,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
@ -214,6 +221,8 @@ class NodeRuntime(context: Context) {
|
||||||
token = authToken,
|
token = authToken,
|
||||||
platform = "Android",
|
platform = "Android",
|
||||||
version = "dev",
|
version = "dev",
|
||||||
|
deviceFamily = "Android",
|
||||||
|
modelIdentifier = modelIdentifier,
|
||||||
caps =
|
caps =
|
||||||
buildList {
|
buildList {
|
||||||
add("canvas")
|
add("canvas")
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ class BridgePairingClient {
|
||||||
val token: String?,
|
val token: String?,
|
||||||
val platform: String?,
|
val platform: String?,
|
||||||
val version: String?,
|
val version: String?,
|
||||||
|
val deviceFamily: String?,
|
||||||
|
val modelIdentifier: String?,
|
||||||
val caps: List<String>?,
|
val caps: List<String>?,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -57,6 +59,8 @@ class BridgePairingClient {
|
||||||
hello.token?.let { put("token", JsonPrimitive(it)) }
|
hello.token?.let { put("token", JsonPrimitive(it)) }
|
||||||
hello.platform?.let { put("platform", JsonPrimitive(it)) }
|
hello.platform?.let { put("platform", JsonPrimitive(it)) }
|
||||||
hello.version?.let { put("version", JsonPrimitive(it)) }
|
hello.version?.let { put("version", JsonPrimitive(it)) }
|
||||||
|
hello.deviceFamily?.let { put("deviceFamily", JsonPrimitive(it)) }
|
||||||
|
hello.modelIdentifier?.let { put("modelIdentifier", JsonPrimitive(it)) }
|
||||||
hello.caps?.let { put("caps", JsonArray(it.map(::JsonPrimitive))) }
|
hello.caps?.let { put("caps", JsonArray(it.map(::JsonPrimitive))) }
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
@ -79,6 +83,8 @@ class BridgePairingClient {
|
||||||
hello.displayName?.let { put("displayName", JsonPrimitive(it)) }
|
hello.displayName?.let { put("displayName", JsonPrimitive(it)) }
|
||||||
hello.platform?.let { put("platform", JsonPrimitive(it)) }
|
hello.platform?.let { put("platform", JsonPrimitive(it)) }
|
||||||
hello.version?.let { put("version", JsonPrimitive(it)) }
|
hello.version?.let { put("version", JsonPrimitive(it)) }
|
||||||
|
hello.deviceFamily?.let { put("deviceFamily", JsonPrimitive(it)) }
|
||||||
|
hello.modelIdentifier?.let { put("modelIdentifier", JsonPrimitive(it)) }
|
||||||
hello.caps?.let { put("caps", JsonArray(it.map(::JsonPrimitive))) }
|
hello.caps?.let { put("caps", JsonArray(it.map(::JsonPrimitive))) }
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,8 @@ class BridgeSession(
|
||||||
val token: String?,
|
val token: String?,
|
||||||
val platform: String?,
|
val platform: String?,
|
||||||
val version: String?,
|
val version: String?,
|
||||||
|
val deviceFamily: String?,
|
||||||
|
val modelIdentifier: String?,
|
||||||
val caps: List<String>?,
|
val caps: List<String>?,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -193,6 +195,8 @@ class BridgeSession(
|
||||||
hello.token?.let { put("token", JsonPrimitive(it)) }
|
hello.token?.let { put("token", JsonPrimitive(it)) }
|
||||||
hello.platform?.let { put("platform", JsonPrimitive(it)) }
|
hello.platform?.let { put("platform", JsonPrimitive(it)) }
|
||||||
hello.version?.let { put("version", JsonPrimitive(it)) }
|
hello.version?.let { put("version", JsonPrimitive(it)) }
|
||||||
|
hello.deviceFamily?.let { put("deviceFamily", JsonPrimitive(it)) }
|
||||||
|
hello.modelIdentifier?.let { put("modelIdentifier", JsonPrimitive(it)) }
|
||||||
hello.caps?.let { put("caps", JsonArray(it.map(::JsonPrimitive))) }
|
hello.caps?.let { put("caps", JsonArray(it.map(::JsonPrimitive))) }
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue