Skip to content

Commit

Permalink
add watch details to log dump
Browse files Browse the repository at this point in the history
  • Loading branch information
crc-32 committed Jun 13, 2024
1 parent eee9d18 commit 262db20
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions android/app/src/main/kotlin/io/rebble/cobble/log/LogSendingTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.os.Build
import androidx.core.content.FileProvider
import io.rebble.cobble.CobbleApplication
import io.rebble.cobble.bluetooth.watchOrNull
import io.rebble.libpebblecommon.metadata.WatchHardwarePlatform
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -36,8 +37,17 @@ private fun generateDebugInfo(context: Context, rwsId: String): String {

val inj = (context.applicationContext as CobbleApplication).component
val connectionLooper = inj.createConnectionLooper()
val watchMetadataStore = inj.createWatchMetadataStore()
val connectionState = connectionLooper.connectionState.value

val watchMeta = watchMetadataStore.lastConnectedWatchMetadata.value
val watchModel = watchMeta?.running?.hardwarePlatform?.get()?.let {
WatchHardwarePlatform.fromProtocolNumber(it)
}
val watchVersionTag = watchMeta?.running?.versionTag?.get()
val watchIsRecovery = watchMeta?.running?.isRecovery?.get()


val associatedDevices = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val deviceManager = context.getSystemService(CompanionDeviceManager::class.java)
deviceManager.associations
Expand All @@ -52,6 +62,9 @@ private fun generateDebugInfo(context: Context, rwsId: String): String {
Manufacturer: $manufacturer
Connection State: $connectionState
Associated devices: $associatedDevices
Watch Model: $watchModel
Watch Version Tag: $watchVersionTag
Watch Is Recovery: $watchIsRecovery
RWS ID:
$rwsId
""".trimIndent()
Expand Down

0 comments on commit 262db20

Please sign in to comment.