Created
January 15, 2026 22:07
-
-
Save LethalMaus/be82b343eec2288e7d1c1dc063dd269a to your computer and use it in GitHub Desktop.
publishControl.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun publishControl(controlStatus: ControlStatus) { | |
| _controlStatus.value = controlStatus | |
| scope.launch { | |
| val request = PutDataMapRequest.create(WearPaths.CONTROL).apply { | |
| dataMap.putString(WearKeys.HOLDER, controlStatus.holder.name) | |
| dataMap.putBoolean(WearKeys.EMERGENCY, controlStatus.emergency) | |
| dataMap.putLong(WearKeys.TIMESTAMP, controlStatus.timestamp) | |
| }.asPutDataRequest().setUrgent() | |
| runCatching { dataClient.putDataItem(request).await() } | |
| .onFailure { throwable -> | |
| Log.e(TAG, "Failed to publish control", throwable) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment