@glassly/bluetooth-sdk 0.1.0-dev.99 → 0.2.8-dev.445
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -6
- package/android/build.gradle +7 -7
- package/android/lc3Lib/build.gradle +2 -2
- package/android/src/main/assets/G2Firmware/README.md +27 -2
- package/android/src/main/assets/G2Firmware/{g2-stock-2.2.9.22.evenota.bin → g2-glassly-cfw-2.3.0.24.evenota.bin} +0 -0
- package/android/src/main/assets/G2Firmware/{g2-glassly-cfw-2.2.9.22.evenota.bin → g2-stock-2.3.0.24.evenota.bin} +0 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/BluetoothSdk.kt +38 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/BluetoothSdkModule.kt +50 -14
- package/android/src/main/java/com/glassly/bluetoothsdk/Bridge.kt +18 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/DeviceManager.kt +139 -10
- package/android/src/main/java/com/glassly/bluetoothsdk/DeviceStore.kt +28 -1
- package/android/src/main/java/com/glassly/bluetoothsdk/DisplayPacer.kt +199 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/GeneratedChangelogCatalog.kt +10 -1
- package/android/src/main/java/com/glassly/bluetoothsdk/GeneratedReleaseMetadata.kt +4 -4
- package/android/src/main/java/com/glassly/bluetoothsdk/GlassesNotifications.kt +155 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2.kt +1065 -255
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2BleLink.kt +119 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2CfwClassification.kt +29 -28
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2CfwRenderer.kt +138 -33
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2CfwScene.kt +673 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2CfwTextureCache.kt +235 -162
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2CfwTransport.kt +402 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2DisplayDiagnostics.kt +84 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2FlashProtocol.kt +3 -3
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2Flasher.kt +9 -9
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2Keyboard.kt +689 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2KeyboardBridge.kt +452 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2KeyboardHid.kt +208 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2NotificationFile.kt +181 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2RingBattery.kt +20 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2Sensors.kt +67 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2TouchInput.kt +39 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/MentraLive.kt +5 -5
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/MentraNex.kt +14 -14
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/{GlasslyBle.java → NexProto.java} +6462 -7618
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/NotificationMessageIds.kt +58 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/SGCManager.kt +77 -2
- package/android/src/main/java/com/glassly/bluetoothsdk/speakerid/SpeakerIdEngine.kt +1 -1
- package/android/src/main/java/com/glassly/bluetoothsdk/status/DeviceStatus.kt +55 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/stt/STTTools.kt +1 -1
- package/android/src/main/java/com/glassly/bluetoothsdk/stt/SherpaOnnxTranscriber.kt +1 -1
- package/android/src/main/java/com/glassly/bluetoothsdk/tts/TTSTools.kt +1 -1
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/NexSGCUtils.kt +24 -149
- package/android/src/test/java/com/glassly/bluetoothsdk/DisplayPacerTest.kt +277 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/G2BleLinkTest.kt +70 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2CfwClassificationTest.kt +45 -56
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2CfwRendererTest.kt +78 -5
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2CfwSceneTest.kt +489 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2CfwTextureCacheTest.kt +100 -43
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2CfwTransportTest.kt +252 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2DisplayDiagnosticsTest.kt +64 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2KeyboardTest.kt +271 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2NotificationFileTest.kt +204 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2RingBatteryTest.kt +56 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2SensorsTest.kt +56 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2TouchInputTest.kt +60 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/NexProtoDescriptorTest.kt +32 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/NotificationMessageIdsTest.kt +58 -0
- package/build/BluetoothSdk.types.d.ts +209 -20
- package/build/BluetoothSdk.types.d.ts.map +1 -1
- package/build/BluetoothSdk.types.js.map +1 -1
- package/build/_internal.d.ts +1 -1
- package/build/_internal.d.ts.map +1 -1
- package/build/_internal.js.map +1 -1
- package/build/_private/BluetoothSdkModule.d.ts +30 -1
- package/build/_private/BluetoothSdkModule.d.ts.map +1 -1
- package/build/_private/BluetoothSdkModule.js.map +1 -1
- package/build/generated/changelogCatalog.d.ts +28 -1
- package/build/generated/changelogCatalog.d.ts.map +1 -1
- package/build/generated/changelogCatalog.js +37 -1
- package/build/generated/changelogCatalog.js.map +1 -1
- package/build/generated/releaseMetadata.js +4 -4
- package/build/generated/releaseMetadata.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +14 -0
- package/build/index.js.map +1 -1
- package/ios/BluetoothSdkModule.swift +102 -13
- package/ios/GlasslyBluetoothSDK.podspec +1 -1
- package/ios/Packages/SherpaOnnx/SherpaOnnx.swift +8 -3
- package/ios/Source/BluetoothSDK.swift +53 -0
- package/ios/Source/BluetoothSdkDefaults.swift +1 -1
- package/ios/Source/Bridge.swift +13 -0
- package/ios/Source/DeviceManager.swift +151 -33
- package/ios/Source/DeviceStore.swift +28 -14
- package/ios/Source/DisplayPacer.swift +180 -0
- package/ios/Source/GeneratedChangelogCatalog.swift +10 -1
- package/ios/Source/GeneratedReleaseMetadata.swift +4 -4
- package/ios/Source/GlassesNotifications.swift +181 -0
- package/ios/Source/ObservableStore.swift +14 -2
- package/ios/Source/Resources/G2Firmware/README.md +27 -2
- package/ios/Source/Resources/G2Firmware/{g2-stock-2.2.9.22.evenota.bin → g2-glassly-cfw-2.3.0.24.evenota.bin} +0 -0
- package/ios/Source/Resources/G2Firmware/{g2-glassly-cfw-2.2.9.22.evenota.bin → g2-stock-2.3.0.24.evenota.bin} +0 -0
- package/ios/Source/controllers/R1.swift +0 -1
- package/ios/Source/internal/BluetoothAvailability.swift +31 -0
- package/ios/Source/sgcs/G2.swift +1420 -495
- package/ios/Source/sgcs/G2AncsRelay.swift +268 -0
- package/ios/Source/sgcs/G2BleLink.swift +102 -0
- package/ios/Source/sgcs/G2CfwClassification.swift +45 -27
- package/ios/Source/sgcs/G2CfwRenderer.swift +166 -33
- package/ios/Source/sgcs/G2CfwScene.swift +779 -0
- package/ios/Source/sgcs/G2CfwTextureCache.swift +244 -117
- package/ios/Source/sgcs/G2CfwTransport.swift +485 -0
- package/ios/Source/sgcs/G2DisplayDiagnostics.swift +154 -0
- package/ios/Source/sgcs/G2FlashProtocol.swift +2 -2
- package/ios/Source/sgcs/G2Flasher.swift +9 -9
- package/ios/Source/sgcs/G2Keyboard.swift +780 -0
- package/ios/Source/sgcs/G2KeyboardBridge.swift +438 -0
- package/ios/Source/sgcs/G2KeyboardHid.swift +290 -0
- package/ios/Source/sgcs/G2NotificationTuning.swift +24 -0
- package/ios/Source/sgcs/G2RingBattery.swift +22 -0
- package/ios/Source/sgcs/G2Sensors.swift +75 -0
- package/ios/Source/sgcs/G2TouchInput.swift +51 -0
- package/ios/Source/sgcs/G2WritePacing.swift +18 -0
- package/ios/Source/sgcs/MentraNex.swift +44 -44
- package/ios/Source/sgcs/SGCManager.swift +120 -13
- package/ios/Source/sgcs/{glassly_ble.pb.swift → nex_ble.pb.swift} +405 -465
- package/ios/Source/speakerid/SpeakerIdEngine.swift +2 -2
- package/ios/Source/status/DeviceStatus.swift +27 -0
- package/ios/Source/stt/SherpaOnnxTranscriber.swift +15 -14
- package/ios/Source/utils/Enums.swift +0 -1
- package/ios/Source/utils/G1Text.swift +0 -1
- package/ios/Source/utils/G2NotifyFile.swift +20 -10
- package/ios/Source/utils/JSCExperiment.swift +6 -6
- package/ios/Source/utils/Models.swift +0 -1
- package/ios/Tests/BluetoothSDKTests/BluetoothAvailabilityTests.swift +29 -0
- package/ios/Tests/BluetoothSDKTests/DisplayPacerTests.swift +255 -0
- package/ios/Tests/BluetoothSDKTests/G2AncsRelayTests.swift +186 -0
- package/ios/Tests/BluetoothSDKTests/G2BleLinkTests.swift +52 -0
- package/ios/Tests/BluetoothSDKTests/G2CfwClassificationTests.swift +46 -51
- package/ios/Tests/BluetoothSDKTests/G2CfwRendererTests.swift +164 -5
- package/ios/Tests/BluetoothSDKTests/G2CfwSceneTests.swift +497 -0
- package/ios/Tests/BluetoothSDKTests/G2CfwTextureCacheTests.swift +108 -44
- package/ios/Tests/BluetoothSDKTests/G2CfwTransportTests.swift +259 -0
- package/ios/Tests/BluetoothSDKTests/G2DisplayDiagnosticsTests.swift +89 -0
- package/ios/Tests/BluetoothSDKTests/G2FlashProtocolTests.swift +3 -2
- package/ios/Tests/BluetoothSDKTests/G2ImageAckTests.swift +104 -0
- package/ios/Tests/BluetoothSDKTests/G2KeyboardTests.swift +274 -0
- package/ios/Tests/BluetoothSDKTests/G2NotifyFileTests.swift +21 -5
- package/ios/Tests/BluetoothSDKTests/G2RingBatteryTests.swift +56 -0
- package/ios/Tests/BluetoothSDKTests/G2SensorsTests.swift +56 -0
- package/ios/Tests/BluetoothSDKTests/G2TouchInputTests.swift +71 -0
- package/ios/Tests/BluetoothSDKTests/G2WritePacingTests.swift +35 -0
- package/ios/Tests/BluetoothSDKTests/GlassesNotificationTests.swift +95 -0
- package/package.json +1 -1
- package/plugin/build/withAndroid.js +2 -2
- package/plugin/build/withIos.js +1 -1
- package/scripts/gen-nex-proto.sh +12 -0
- package/scripts/inject-ios-sdk-version.mjs +1 -1
- package/src/BluetoothSdk.types.ts +214 -19
- package/src/_internal.ts +1 -1
- package/src/_private/BluetoothSdkModule.ts +40 -0
- package/src/generated/changelogCatalog.ts +37 -1
- package/src/generated/releaseMetadata.ts +4 -4
- package/src/index.ts +24 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
package com.glassly.bluetoothsdk
|
|
2
|
+
|
|
3
|
+
/** One app the wearer allows, for firmware whose filter is an allowlist. */
|
|
4
|
+
data class AllowedApp(val id: String, val name: String) {
|
|
5
|
+
fun toMap(): Map<String, Any> = mapOf("id" to id, "name" to name)
|
|
6
|
+
|
|
7
|
+
companion object {
|
|
8
|
+
fun fromMap(map: Map<String, Any?>): AllowedApp? {
|
|
9
|
+
val id = map["id"] as? String ?: return null
|
|
10
|
+
if (id.isEmpty()) return null
|
|
11
|
+
return AllowedApp(id, map["name"] as? String ?: id)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Desired on-glass notification behaviour in driver-neutral terms. Drivers map
|
|
18
|
+
* it onto their protocol and snap values their firmware cannot take.
|
|
19
|
+
*/
|
|
20
|
+
data class GlassesNotificationConfig(
|
|
21
|
+
val enabled: Boolean,
|
|
22
|
+
val popups: Boolean,
|
|
23
|
+
/** 0 lets the firmware choose. */
|
|
24
|
+
val popupSeconds: Int,
|
|
25
|
+
val holdDuringApps: Boolean,
|
|
26
|
+
/** Android package names or iOS bundle ids the wearer blocked. */
|
|
27
|
+
val blockedApps: List<String>,
|
|
28
|
+
val allowedApps: List<AllowedApp>
|
|
29
|
+
) {
|
|
30
|
+
init {
|
|
31
|
+
require(popupSeconds in 0..60) { "popupSeconds must be 0..60, got $popupSeconds" }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
fun toMap(): Map<String, Any> =
|
|
35
|
+
mapOf(
|
|
36
|
+
"enabled" to enabled,
|
|
37
|
+
"popups" to popups,
|
|
38
|
+
"popupSeconds" to popupSeconds,
|
|
39
|
+
"holdDuringApps" to holdDuringApps,
|
|
40
|
+
"blockedApps" to blockedApps,
|
|
41
|
+
"allowedApps" to allowedApps.map { it.toMap() }
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
companion object {
|
|
45
|
+
fun fromMap(map: Map<String, Any?>): GlassesNotificationConfig {
|
|
46
|
+
// JS numbers arrive as Double across the bridge.
|
|
47
|
+
val seconds = (map["popupSeconds"] as? Number)?.toInt() ?: 0
|
|
48
|
+
val blocked =
|
|
49
|
+
(map["blockedApps"] as? List<*>)?.mapNotNull { it as? String }?.filter { it.isNotEmpty() }
|
|
50
|
+
?: emptyList()
|
|
51
|
+
val allowed =
|
|
52
|
+
(map["allowedApps"] as? List<*>)?.mapNotNull { entry ->
|
|
53
|
+
@Suppress("UNCHECKED_CAST")
|
|
54
|
+
(entry as? Map<String, Any?>)?.let { AllowedApp.fromMap(it) }
|
|
55
|
+
}
|
|
56
|
+
?: emptyList()
|
|
57
|
+
return GlassesNotificationConfig(
|
|
58
|
+
enabled = map["enabled"] as? Boolean ?: false,
|
|
59
|
+
popups = map["popups"] as? Boolean ?: true,
|
|
60
|
+
popupSeconds = seconds.coerceIn(0, 60),
|
|
61
|
+
holdDuringApps = map["holdDuringApps"] as? Boolean ?: true,
|
|
62
|
+
blockedApps = blocked,
|
|
63
|
+
allowedApps = allowed
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** How the connected glasses obtain the phone's notifications. */
|
|
70
|
+
object GlassesNotificationFeeds {
|
|
71
|
+
const val PHONE_UPLOAD = "phone_upload"
|
|
72
|
+
const val ANCS = "ancs"
|
|
73
|
+
const val NONE = "none"
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
object GlassesNotificationAccess {
|
|
77
|
+
const val GRANTED = "granted"
|
|
78
|
+
const val DENIED = "denied"
|
|
79
|
+
const val UNKNOWN = "unknown"
|
|
80
|
+
const val NOT_NEEDED = "not_needed"
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
object GlassesNotificationPhases {
|
|
84
|
+
const val IDLE = "idle"
|
|
85
|
+
const val APPLYING = "applying"
|
|
86
|
+
const val APPLIED = "applied"
|
|
87
|
+
const val STALE = "stale"
|
|
88
|
+
const val ERROR = "error"
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
data class GlassesNotificationStatus(
|
|
92
|
+
val supported: Boolean,
|
|
93
|
+
val feed: String,
|
|
94
|
+
val access: String,
|
|
95
|
+
/** `applied` means written to the link, not acknowledged. */
|
|
96
|
+
val phase: String,
|
|
97
|
+
val config: GlassesNotificationConfig?,
|
|
98
|
+
val error: String?
|
|
99
|
+
) {
|
|
100
|
+
fun toMap(): Map<String, Any?> =
|
|
101
|
+
mapOf(
|
|
102
|
+
"supported" to supported,
|
|
103
|
+
"feed" to feed,
|
|
104
|
+
"access" to access,
|
|
105
|
+
"phase" to phase,
|
|
106
|
+
"config" to config?.toMap(),
|
|
107
|
+
"error" to error
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
companion object {
|
|
111
|
+
fun unsupported(): GlassesNotificationStatus =
|
|
112
|
+
GlassesNotificationStatus(
|
|
113
|
+
supported = false,
|
|
114
|
+
feed = GlassesNotificationFeeds.NONE,
|
|
115
|
+
access = GlassesNotificationAccess.NOT_NEEDED,
|
|
116
|
+
phase = GlassesNotificationPhases.IDLE,
|
|
117
|
+
config = null,
|
|
118
|
+
error = null
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** One phone notification handed to glasses that present content themselves. */
|
|
124
|
+
data class PhoneNotificationUpload(
|
|
125
|
+
val notificationId: String,
|
|
126
|
+
val packageName: String,
|
|
127
|
+
val appName: String,
|
|
128
|
+
val title: String,
|
|
129
|
+
val subtitle: String,
|
|
130
|
+
val body: String,
|
|
131
|
+
val timestampMs: Long
|
|
132
|
+
) {
|
|
133
|
+
companion object {
|
|
134
|
+
fun fromMap(map: Map<String, Any?>): PhoneNotificationUpload {
|
|
135
|
+
val packageName = map["packageName"] as? String ?: ""
|
|
136
|
+
return PhoneNotificationUpload(
|
|
137
|
+
notificationId = map["notificationId"] as? String ?: "",
|
|
138
|
+
packageName = packageName,
|
|
139
|
+
appName = (map["appName"] as? String)?.takeIf { it.isNotEmpty() } ?: packageName,
|
|
140
|
+
title = map["title"] as? String ?: "",
|
|
141
|
+
subtitle = map["subtitle"] as? String ?: "",
|
|
142
|
+
body = map["body"] as? String ?: "",
|
|
143
|
+
timestampMs = (map["timestampMs"] as? Number)?.toLong() ?: 0L
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** Upload outcomes reported back by id only; content never crosses back. */
|
|
150
|
+
object NotificationUploadOutcomes {
|
|
151
|
+
const val SENT = "sent"
|
|
152
|
+
const val FAILED = "failed"
|
|
153
|
+
const val CANCELLED = "cancelled"
|
|
154
|
+
const val DROPPED = "dropped"
|
|
155
|
+
}
|