@glassly/bluetooth-sdk 0.1.0-dev.26
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 +563 -0
- package/android/build.gradle +450 -0
- package/android/gradle.properties.example +9 -0
- package/android/lc3Lib/CMakeLists.txt +6 -0
- package/android/lc3Lib/build.gradle +212 -0
- package/android/lc3Lib/proguard-rules.pro +33 -0
- package/android/lc3Lib/src/main/AndroidManifest.xml +2 -0
- package/android/lc3Lib/src/main/cpp/CMakeLists.txt +8 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/CMakeLists.txt +30 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/jni/CMakeLists.txt +7 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/jni/ogg_opus_encoder.cc +96 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/jni/ogg_opus_encoder.h +53 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/Makefile.am +6 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/config_types.h +26 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/config_types.h.in +26 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/ogg.h +209 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libogg/os_types.h +158 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus.h +981 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_custom.h +342 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_defines.h +799 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_multistream.h +660 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_projection.h +568 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/libopus/opus_types.h +166 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/ogg_opus_encoder.cc +268 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/ogg_opus_encoder.h +115 -0
- package/android/lc3Lib/src/main/cpp/google_opus_stuff/opus_tools/opus_header.h +59 -0
- package/android/lc3Lib/src/main/cpp/liblc3/CMakeLists.txt +38 -0
- package/android/lc3Lib/src/main/cpp/liblc3/include/lc3.h +309 -0
- package/android/lc3Lib/src/main/cpp/liblc3/include/lc3_private.h +162 -0
- package/android/lc3Lib/src/main/cpp/liblc3/include/rnnoise.h +114 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/CMakeLists.txt +19 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/attdet.c +92 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/attdet.h +44 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bits.c +375 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bits.h +315 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bwdet.c +129 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/bwdet.h +69 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/common.h +148 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/energy.c +70 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/energy.h +43 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/fastmath.h +158 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/lc3.c +702 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf.c +893 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf.h +111 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf_arm.h +506 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/ltpf_neon.h +281 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/makefile.mk +35 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/mdct.c +452 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/mdct.h +57 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/mdct_neon.h +296 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/meson.build +46 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/plc.c +61 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/plc.h +57 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/sns.c +880 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/sns.h +103 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/spec.c +904 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/spec.h +119 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tables.c +3457 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tables.h +94 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tns.c +457 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3/tns.h +99 -0
- package/android/lc3Lib/src/main/cpp/liblc3/liblc3.cpp +159 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/_kiss_fft_guts.h +182 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/arch.h +261 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/celt_lpc.c +279 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/celt_lpc.h +59 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/common.h +48 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/compile.sh +3 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/denoise.c +646 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/kiss_fft.c +601 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/kiss_fft.h +203 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/opus_types.h +159 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/pitch.c +526 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/pitch.h +149 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn.c +178 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn.h +69 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_data.c +11051 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_data.h +34 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_reader.c +168 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/rnn_train.py +66 -0
- package/android/lc3Lib/src/main/cpp/liblc3/rnnoise/tansig_table.h +45 -0
- package/android/lc3Lib/src/main/java/com/glassly/lc3Lib/Lc3Cpp.java +38 -0
- package/android/lc3Lib/third_party/CMakeLists.txt +23 -0
- package/android/lc3Lib/third_party/CMakeLists_libogg.txt +18 -0
- package/android/lc3Lib/third_party/CMakeLists_libopus.txt +18 -0
- package/android/lc3Lib/third_party/CMakeLists_opus-tools.txt +23 -0
- package/android/lc3Lib/third_party/opus_tools/src/AUTHORS +5 -0
- package/android/lc3Lib/third_party/opus_tools/src/CMakeLists.txt +4 -0
- package/android/lc3Lib/third_party/opus_tools/src/COPYING +371 -0
- package/android/lc3Lib/third_party/opus_tools/src/ChangeLog +3 -0
- package/android/lc3Lib/third_party/opus_tools/src/Makefile.am +42 -0
- package/android/lc3Lib/third_party/opus_tools/src/Makefile.unix +23 -0
- package/android/lc3Lib/third_party/opus_tools/src/NEWS +0 -0
- package/android/lc3Lib/third_party/opus_tools/src/README +0 -0
- package/android/lc3Lib/third_party/opus_tools/src/autogen.sh +115 -0
- package/android/lc3Lib/third_party/opus_tools/src/configure.ac +293 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/arch.h +239 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/audio-in.c +1046 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/diag_range.c +245 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/diag_range.h +28 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/info_opus.c +320 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/info_opus.h +51 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/lpc.c +157 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/lpc.h +27 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/opus_header.c +286 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/opus_header.h +59 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/opusdec.c +884 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/opusenc.c +1021 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/opusenc.h +101 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/opusinfo.c +639 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/opusinfo.h +51 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/os_support.h +167 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/resample.c +1137 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/speex_resampler.h +344 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/stack_alloc.h +115 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/wav_io.c +125 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/wav_io.h +62 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/wave_out.c +223 -0
- package/android/lc3Lib/third_party/opus_tools/src/src/wave_out.h +60 -0
- package/android/settings.gradle +4 -0
- package/android/silero/LICENSE.md +17 -0
- package/android/silero/build.gradle +50 -0
- package/android/silero/proguard-rules.pro +24 -0
- package/android/silero/src/androidTest/assets/hello.wav +0 -0
- package/android/silero/src/androidTest/java/com/konovalov/vad/silero/VadSileroTest.kt +79 -0
- package/android/silero/src/main/assets/LICENSE +21 -0
- package/android/silero/src/main/assets/silero_vad.onnx +0 -0
- package/android/silero/src/main/java/com/konovalov/vad/silero/Vad.kt +160 -0
- package/android/silero/src/main/java/com/konovalov/vad/silero/VadSilero.kt +449 -0
- package/android/silero/src/main/java/com/konovalov/vad/silero/config/FrameSize.kt +15 -0
- package/android/silero/src/main/java/com/konovalov/vad/silero/config/Mode.kt +14 -0
- package/android/silero/src/main/java/com/konovalov/vad/silero/config/SampleRate.kt +12 -0
- package/android/silero/src/main/java/com/konovalov/vad/silero/utils/AudioUtils.kt +47 -0
- package/android/silero/src/main/java/com/konovalov/vad/silero/utils/TensorMap.kt +41 -0
- package/android/silero/src/test/java/com/konovalov/vad/silero/utils/AudioUtilsTest.kt +44 -0
- package/android/src/main/AndroidManifest.xml +42 -0
- package/android/src/main/assets/G2Firmware/README.md +11 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/BluetoothSdk.kt +2325 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/BluetoothSdkAnalytics.kt +216 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/BluetoothSdkDebug.kt +14 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/BluetoothSdkDefaults.kt +7 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/BluetoothSdkModule.kt +1088 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/Bridge.kt +953 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/DeviceManager.kt +2528 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/DeviceStore.kt +360 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/GeneratedChangelogCatalog.kt +8 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/GeneratedReleaseMetadata.kt +11 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/LocalNetworkModule.kt +414 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/ObservableStore.kt +88 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/OtaManifest.kt +191 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/ReleaseChangelog.kt +61 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/ScopedNetworkReadiness.kt +17 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/audio/AudioModels.kt +144 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/camera/CameraModels.kt +486 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/connection/ConnectionModels.kt +78 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/controllers/ControllerManager.kt +158 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/controllers/R1.kt +937 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/debug/BleTraceLogger.kt +165 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/events/BluetoothEvents.kt +178 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/internal/MapParsing.kt +140 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/net/LocalIpv4.kt +57 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/otaserver/LocalOtaServer.kt +304 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/otaserver/OtaServerModule.kt +120 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/photoreceiver/LocalPhotoReceiverRegistry.java +108 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/photoreceiver/LocalPhotoUploadServer.kt +622 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/photoreceiver/PhotoReceiverModule.kt +156 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/requests/DisplayRequests.kt +56 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/services/Foreground.kt +272 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/services/PhoneMic.kt +1195 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/Ar99.java +2653 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/BesOtaHeartbeatGuard.kt +49 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/BesOtaProgressMapper.kt +27 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G1.kt +3878 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G1TextSanitizer.kt +38 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2.kt +6428 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2CfwClassification.kt +49 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2CfwRenderer.kt +1241 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2CfwTextureCache.kt +270 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2FlashProtocol.kt +291 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/G2Flasher.kt +411 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/GlasslyBle.java +43189 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/Mach1.kt +1280 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/MentraLive.kt +10817 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/MentraLiveL2capChannel.kt +274 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/MentraLivePairingAdvertisement.kt +54 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/MentraNex.kt +2011 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/Nimo.kt +2532 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/SGCManager.kt +470 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/Simulated.kt +228 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/ar99/ota/Ar99OtaManager.java +566 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/ar99/ota/OtaByteUtils.java +18 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/ar99/ota/OtaCommandConstants.java +35 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/ar99/ota/OtaCrc32Util.java +13 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/ar99/ota/OtaGattTransport.java +11 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/sgcs/ar99/ota/OtaProtocol.java +92 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/speakerid/SpeakerIdEngine.kt +525 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/status/DeviceStatus.kt +669 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/status/RuntimeState.kt +201 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/status/WifiHotspotStatus.kt +189 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/streaming/StreamModels.kt +518 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/stt/STTTools.kt +391 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/stt/SherpaOnnxTranscriber.kt +518 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/stt/VadGateSpeechPolicy.kt +229 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/tts/TTSTools.kt +248 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/types/DeviceModels.kt +96 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/AES.java +106 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/AudioSessionMonitor.kt +189 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/AvifExifStripper.java +573 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/BitmapJavaUtils.java +169 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/BleJsonCompact.java +496 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/BlePhotoUploadService.java +677 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/BleWireProtocol.java +108 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/Constants.kt +46 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/G1Text.kt +436 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/HeifExifTagReader.java +199 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/IncidentLogBleRelayNaming.java +29 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/IncidentLogBleUploadService.java +77 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/K900LengthCodec.java +115 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/K900ProtocolUtils.java +827 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/MessageChunkReassembler.java +228 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/MessageChunker.java +325 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/NexSGCUtils.kt +698 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/PhoneAudioMonitor.kt +348 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/SmartGlassesConnectionState.java +9 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/audio/Ar99OpusPcmDecoder.java +398 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/audio/ByteUtilAudioPlayer.java +655 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/audio/Lc3Player.java +441 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/audio/PCMAudioPlayer.java +431 -0
- package/android/src/main/java/com/glassly/bluetoothsdk/utils/audio/PcmStreamPlayer.kt +328 -0
- package/android/src/main/res/values/strings.xml +4 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/BluetoothSdkExceptionTest.kt +18 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/OtaManifestDowngradeTest.kt +86 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/OtaStartResponsePolicyTest.kt +30 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/ReleaseChangelogTest.kt +13 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/ScopedNetworkReadinessTest.kt +39 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/StreamStatusEventTest.kt +29 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/camera/PhotoRequestTest.kt +141 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/otaserver/LocalOtaServerTest.kt +82 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/photoreceiver/LocalPhotoReceiverRegistryTest.java +75 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/services/ForegroundServiceTypeTest.kt +69 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/Ar99AdvertisementMatcherTest.java +22 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/BesOtaHeartbeatGuardTest.kt +73 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/BesOtaProgressMapperTest.kt +67 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/EvenRleTest.kt +63 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G1TextSanitizerTest.kt +31 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2CfwClassificationTest.kt +89 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2CfwRendererTest.kt +344 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2CfwTextureCacheTest.kt +200 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/G2FlashProtocolTest.kt +131 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/MentraLiveGattCharacteristicsTest.kt +39 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/MentraLivePairingAdvertisementParserTest.kt +133 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/sgcs/NimoProtocolTest.kt +333 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/utils/AvifExifStripperTest.java +46 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/utils/BinaryMessageChunkerTest.java +84 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/utils/BleJsonCompactTest.java +319 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/utils/BlePhotoUploadServiceTest.java +107 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/utils/K900ProtocolUtilsEndiannessTest.java +172 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/utils/K900ProtocolUtilsTest.java +24 -0
- package/android/src/test/java/com/glassly/bluetoothsdk/utils/PhoneAudioMonitorTest.kt +45 -0
- package/android/src/test/resources/avif_with_exif.avif +0 -0
- package/app.plugin.js +3 -0
- package/build/BluetoothSdk.types.d.ts +1354 -0
- package/build/BluetoothSdk.types.d.ts.map +1 -0
- package/build/BluetoothSdk.types.js +41 -0
- package/build/BluetoothSdk.types.js.map +1 -0
- package/build/_internal.d.ts +17 -0
- package/build/_internal.d.ts.map +1 -0
- package/build/_internal.js +16 -0
- package/build/_internal.js.map +1 -0
- package/build/_private/BluetoothSdkModule.d.ts +172 -0
- package/build/_private/BluetoothSdkModule.d.ts.map +1 -0
- package/build/_private/BluetoothSdkModule.js +300 -0
- package/build/_private/BluetoothSdkModule.js.map +1 -0
- package/build/_private/LocalNetworkModule.d.ts +38 -0
- package/build/_private/LocalNetworkModule.d.ts.map +1 -0
- package/build/_private/LocalNetworkModule.js +3 -0
- package/build/_private/LocalNetworkModule.js.map +1 -0
- package/build/_private/cameraRequestPayload.d.ts +4 -0
- package/build/_private/cameraRequestPayload.d.ts.map +1 -0
- package/build/_private/cameraRequestPayload.js +32 -0
- package/build/_private/cameraRequestPayload.js.map +1 -0
- package/build/_private/photoRequestPayload.d.ts +6 -0
- package/build/_private/photoRequestPayload.d.ts.map +1 -0
- package/build/_private/photoRequestPayload.js +86 -0
- package/build/_private/photoRequestPayload.js.map +1 -0
- package/build/_private/sdkOtaManifest.d.ts +11 -0
- package/build/_private/sdkOtaManifest.d.ts.map +1 -0
- package/build/_private/sdkOtaManifest.js +15 -0
- package/build/_private/sdkOtaManifest.js.map +1 -0
- package/build/changelogs.d.ts +7 -0
- package/build/changelogs.d.ts.map +1 -0
- package/build/changelogs.js +46 -0
- package/build/changelogs.js.map +1 -0
- package/build/debug.d.ts +3 -0
- package/build/debug.d.ts.map +1 -0
- package/build/debug.js +8 -0
- package/build/debug.js.map +1 -0
- package/build/generated/changelogCatalog.d.ts +9 -0
- package/build/generated/changelogCatalog.d.ts.map +1 -0
- package/build/generated/changelogCatalog.js +12 -0
- package/build/generated/changelogCatalog.js.map +1 -0
- package/build/generated/releaseMetadata.d.ts +12 -0
- package/build/generated/releaseMetadata.d.ts.map +1 -0
- package/build/generated/releaseMetadata.js +10 -0
- package/build/generated/releaseMetadata.js.map +1 -0
- package/build/index.d.ts +6 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +171 -0
- package/build/index.js.map +1 -0
- package/build/ota-server/OtaServer.types.d.ts +14 -0
- package/build/ota-server/OtaServer.types.d.ts.map +1 -0
- package/build/ota-server/OtaServer.types.js +2 -0
- package/build/ota-server/OtaServer.types.js.map +1 -0
- package/build/ota-server/OtaServerModule.d.ts +21 -0
- package/build/ota-server/OtaServerModule.d.ts.map +1 -0
- package/build/ota-server/OtaServerModule.js +3 -0
- package/build/ota-server/OtaServerModule.js.map +1 -0
- package/build/ota-server/OtaServerModule.web.d.ts +10 -0
- package/build/ota-server/OtaServerModule.web.d.ts.map +1 -0
- package/build/ota-server/OtaServerModule.web.js +12 -0
- package/build/ota-server/OtaServerModule.web.js.map +1 -0
- package/build/ota-server/index.d.ts +3 -0
- package/build/ota-server/index.d.ts.map +1 -0
- package/build/ota-server/index.js +3 -0
- package/build/ota-server/index.js.map +1 -0
- package/build/ota-transport/index.d.ts +67 -0
- package/build/ota-transport/index.d.ts.map +1 -0
- package/build/ota-transport/index.js +58 -0
- package/build/ota-transport/index.js.map +1 -0
- package/build/photo-receiver/PhotoReceiver.types.d.ts +18 -0
- package/build/photo-receiver/PhotoReceiver.types.d.ts.map +1 -0
- package/build/photo-receiver/PhotoReceiver.types.js +2 -0
- package/build/photo-receiver/PhotoReceiver.types.js.map +1 -0
- package/build/photo-receiver/PhotoReceiverModule.d.ts +10 -0
- package/build/photo-receiver/PhotoReceiverModule.d.ts.map +1 -0
- package/build/photo-receiver/PhotoReceiverModule.js +3 -0
- package/build/photo-receiver/PhotoReceiverModule.js.map +1 -0
- package/build/photo-receiver/PhotoReceiverModule.web.d.ts +10 -0
- package/build/photo-receiver/PhotoReceiverModule.web.d.ts.map +1 -0
- package/build/photo-receiver/PhotoReceiverModule.web.js +12 -0
- package/build/photo-receiver/PhotoReceiverModule.web.js.map +1 -0
- package/build/photo-receiver/index.d.ts +3 -0
- package/build/photo-receiver/index.d.ts.map +1 -0
- package/build/photo-receiver/index.js +3 -0
- package/build/photo-receiver/index.js.map +1 -0
- package/build/react/index.d.ts +5 -0
- package/build/react/index.d.ts.map +1 -0
- package/build/react/index.js +4 -0
- package/build/react/index.js.map +1 -0
- package/build/react/useBluetooth.d.ts +100 -0
- package/build/react/useBluetooth.d.ts.map +1 -0
- package/build/react/useBluetooth.js +167 -0
- package/build/react/useBluetooth.js.map +1 -0
- package/build/react/useBluetoothEvent.d.ts +6 -0
- package/build/react/useBluetoothEvent.d.ts.map +1 -0
- package/build/react/useBluetoothEvent.js +21 -0
- package/build/react/useBluetoothEvent.js.map +1 -0
- package/build/react/useBluetoothScan.d.ts +22 -0
- package/build/react/useBluetoothScan.d.ts.map +1 -0
- package/build/react/useBluetoothScan.js +135 -0
- package/build/react/useBluetoothScan.js.map +1 -0
- package/build/react/useBluetoothStatus.d.ts +16 -0
- package/build/react/useBluetoothStatus.d.ts.map +1 -0
- package/build/react/useBluetoothStatus.js +137 -0
- package/build/react/useBluetoothStatus.js.map +1 -0
- package/build/react/useGlassesConnection.d.ts +29 -0
- package/build/react/useGlassesConnection.d.ts.map +1 -0
- package/build/react/useGlassesConnection.js +153 -0
- package/build/react/useGlassesConnection.js.map +1 -0
- package/build/types/index.d.ts +3 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/index.js +2 -0
- package/build/types/index.js.map +1 -0
- package/expo-module.config.json +14 -0
- package/ios/BackgroundOtaArtifactDownloader.swift +125 -0
- package/ios/BluetoothSdkModule.swift +1034 -0
- package/ios/GlasslyBluetoothSDK.podspec +106 -0
- package/ios/LocalIPv4.swift +150 -0
- package/ios/LocalOtaServer.swift +309 -0
- package/ios/LocalPhotoUploadServer.swift +754 -0
- package/ios/OtaServerModule.swift +147 -0
- package/ios/Packages/CoreObjC/CoreObjC.xcodeproj/project.pbxproj +213 -0
- package/ios/Packages/CoreObjC/PcmConverter.h +22 -0
- package/ios/Packages/CoreObjC/PcmConverter.m +266 -0
- package/ios/Packages/CoreObjC/attdet.c +92 -0
- package/ios/Packages/CoreObjC/attdet.h +44 -0
- package/ios/Packages/CoreObjC/bits.c +375 -0
- package/ios/Packages/CoreObjC/bits.h +315 -0
- package/ios/Packages/CoreObjC/bwdet.c +129 -0
- package/ios/Packages/CoreObjC/bwdet.h +69 -0
- package/ios/Packages/CoreObjC/common.h +151 -0
- package/ios/Packages/CoreObjC/energy.c +70 -0
- package/ios/Packages/CoreObjC/energy.h +43 -0
- package/ios/Packages/CoreObjC/fastmath.h +158 -0
- package/ios/Packages/CoreObjC/include/PcmConverter.h +22 -0
- package/ios/Packages/CoreObjC/lc3.c +704 -0
- package/ios/Packages/CoreObjC/lc3.h +313 -0
- package/ios/Packages/CoreObjC/lc3_cpp.h +283 -0
- package/ios/Packages/CoreObjC/lc3_private.h +163 -0
- package/ios/Packages/CoreObjC/ltpf.c +905 -0
- package/ios/Packages/CoreObjC/ltpf.h +111 -0
- package/ios/Packages/CoreObjC/ltpf_arm.h +506 -0
- package/ios/Packages/CoreObjC/ltpf_neon.h +281 -0
- package/ios/Packages/CoreObjC/makefile.mk +35 -0
- package/ios/Packages/CoreObjC/mdct.c +469 -0
- package/ios/Packages/CoreObjC/mdct.h +57 -0
- package/ios/Packages/CoreObjC/mdct_neon.h +296 -0
- package/ios/Packages/CoreObjC/meson.build +61 -0
- package/ios/Packages/CoreObjC/plc.c +61 -0
- package/ios/Packages/CoreObjC/plc.h +57 -0
- package/ios/Packages/CoreObjC/rnnoise.h +114 -0
- package/ios/Packages/CoreObjC/sns.c +880 -0
- package/ios/Packages/CoreObjC/sns.h +103 -0
- package/ios/Packages/CoreObjC/spec.c +907 -0
- package/ios/Packages/CoreObjC/spec.h +119 -0
- package/ios/Packages/CoreObjC/tables.c +3457 -0
- package/ios/Packages/CoreObjC/tables.h +94 -0
- package/ios/Packages/CoreObjC/tns.c +457 -0
- package/ios/Packages/CoreObjC/tns.h +99 -0
- package/ios/Packages/SherpaOnnx/Model/joiner.onnx +0 -0
- package/ios/Packages/SherpaOnnx/Model/tokens.txt +502 -0
- package/ios/Packages/SherpaOnnx/SherpaOnnx.swift +2383 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Info.plist +48 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/Headers/sherpa-onnx/c-api/c-api.h +4689 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/Headers/sherpa-onnx/c-api/cxx-api.h +2036 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/libsherpa-onnx.a +0 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/Headers/sherpa-onnx/c-api/c-api.h +4689 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/Headers/sherpa-onnx/c-api/cxx-api.h +2036 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/libsherpa-onnx.a +0 -0
- package/ios/Packages/libbz2/module.modulemap +5 -0
- package/ios/Packages/libbz2/shim.h +1 -0
- package/ios/PhotoReceiverModule.swift +129 -0
- package/ios/Source/BluetoothSDK.swift +2303 -0
- package/ios/Source/BluetoothSDKDebug.swift +12 -0
- package/ios/Source/BluetoothSdkDefaults.swift +29 -0
- package/ios/Source/Bridge.swift +708 -0
- package/ios/Source/Bridging-Header.h +16 -0
- package/ios/Source/DeviceManager.swift +2109 -0
- package/ios/Source/DeviceStore.swift +336 -0
- package/ios/Source/GeneratedChangelogCatalog.swift +7 -0
- package/ios/Source/GeneratedReleaseMetadata.swift +11 -0
- package/ios/Source/ObservableStore.swift +118 -0
- package/ios/Source/OtaManifest.swift +211 -0
- package/ios/Source/PrivacyInfo.xcprivacy +23 -0
- package/ios/Source/ReleaseChangelog.swift +65 -0
- package/ios/Source/Resources/G2Firmware/README.md +10 -0
- package/ios/Source/audio/AudioModels.swift +178 -0
- package/ios/Source/audio/PcmStreamPlayer.swift +410 -0
- package/ios/Source/camera/CameraModels.swift +866 -0
- package/ios/Source/connection/ScanSession.swift +27 -0
- package/ios/Source/controllers/ControllerManager.swift +184 -0
- package/ios/Source/controllers/R1.swift +829 -0
- package/ios/Source/errors/BluetoothSdkError.swift +19 -0
- package/ios/Source/events/BluetoothEvents.swift +342 -0
- package/ios/Source/internal/BleTraceLogger.swift +192 -0
- package/ios/Source/internal/BluetoothAvailability.swift +78 -0
- package/ios/Source/internal/BluetoothSdkAnalytics.swift +199 -0
- package/ios/Source/internal/ValueParsing.swift +99 -0
- package/ios/Source/requests/DisplayRequests.swift +82 -0
- package/ios/Source/services/PhoneMic.swift +662 -0
- package/ios/Source/sgcs/Ar99.swift +2451 -0
- package/ios/Source/sgcs/Frame.swift +649 -0
- package/ios/Source/sgcs/G1.swift +2554 -0
- package/ios/Source/sgcs/G2.swift +6887 -0
- package/ios/Source/sgcs/G2CfwClassification.swift +43 -0
- package/ios/Source/sgcs/G2CfwRenderer.swift +1279 -0
- package/ios/Source/sgcs/G2CfwTextureCache.swift +233 -0
- package/ios/Source/sgcs/G2FlashProtocol.swift +312 -0
- package/ios/Source/sgcs/G2Flasher.swift +773 -0
- package/ios/Source/sgcs/Mach1.swift +541 -0
- package/ios/Source/sgcs/MentraLive.swift +7011 -0
- package/ios/Source/sgcs/MentraLiveL2capChannel.swift +183 -0
- package/ios/Source/sgcs/MentraLivePairingAdvertisement.swift +64 -0
- package/ios/Source/sgcs/MentraNex.swift +3221 -0
- package/ios/Source/sgcs/Nimo.swift +1886 -0
- package/ios/Source/sgcs/SGCManager.swift +608 -0
- package/ios/Source/sgcs/Simulated.swift +274 -0
- package/ios/Source/sgcs/ar99/ota/Ar99OtaManager.swift +637 -0
- package/ios/Source/sgcs/glassly_ble.pb.swift +4354 -0
- package/ios/Source/speakerid/SpeakerIdEngine.swift +573 -0
- package/ios/Source/status/DeviceStatus.swift +981 -0
- package/ios/Source/status/RuntimeState.swift +359 -0
- package/ios/Source/status/WifiHotspotStatus.swift +345 -0
- package/ios/Source/streaming/StreamModels.swift +693 -0
- package/ios/Source/stt/STTTools.swift +191 -0
- package/ios/Source/stt/SherpaOnnxTranscriber.swift +466 -0
- package/ios/Source/tts/TTSTools.swift +171 -0
- package/ios/Source/types/DeviceModels.swift +177 -0
- package/ios/Source/utils/AudioSessionMonitor.swift +283 -0
- package/ios/Source/utils/BinaryCodec.swift +61 -0
- package/ios/Source/utils/BleJsonCompact.swift +405 -0
- package/ios/Source/utils/BleWireProtocol.swift +92 -0
- package/ios/Source/utils/Constants.swift +78 -0
- package/ios/Source/utils/Enums.swift +95 -0
- package/ios/Source/utils/G1Text.swift +2096 -0
- package/ios/Source/utils/JSCExperiment.swift +241 -0
- package/ios/Source/utils/MemoryMonitor.swift +44 -0
- package/ios/Source/utils/MessageChunkReassembler.swift +190 -0
- package/ios/Source/utils/MessageChunker.swift +294 -0
- package/ios/Source/utils/Models.swift +135 -0
- package/ios/Source/utils/PhoneAudioMonitor.swift +230 -0
- package/ios/Source/utils/TarBz2Extractor.swift +257 -0
- package/ios/Tests/BluetoothSDKTests/G2CfwClassificationTests.swift +78 -0
- package/ios/Tests/BluetoothSDKTests/G2CfwRendererTests.swift +372 -0
- package/ios/Tests/BluetoothSDKTests/G2CfwTextureCacheTests.swift +162 -0
- package/ios/Tests/BluetoothSDKTests/G2FlashProtocolTests.swift +182 -0
- package/ios/Tests/MentraLivePairingAdvertisementTests.swift +160 -0
- package/ios/Tests/ReleaseChangelogTests.swift +13 -0
- package/package.json +129 -0
- package/plugin/build/index.d.ts +10 -0
- package/plugin/build/index.js +12 -0
- package/plugin/build/withAndroid.d.ts +3 -0
- package/plugin/build/withAndroid.js +190 -0
- package/plugin/build/withIos.d.ts +5 -0
- package/plugin/build/withIos.js +108 -0
- package/scripts/inject-ios-sdk-version.mjs +65 -0
- package/scripts/public-ota-api.test.mjs +37 -0
- package/scripts/verify-release-package.mjs +45 -0
- package/scripts/write-release-metadata.mjs +152 -0
- package/scripts/write-release-metadata.test.mjs +37 -0
- package/src/BluetoothSdk.types.ts +1623 -0
- package/src/_internal.ts +16 -0
- package/src/_private/BluetoothSdkModule.ts +684 -0
- package/src/_private/LocalNetworkModule.ts +50 -0
- package/src/_private/cameraRequestPayload.ts +34 -0
- package/src/_private/photoRequestPayload.ts +90 -0
- package/src/_private/sdkOtaManifest.ts +18 -0
- package/src/changelogs.ts +46 -0
- package/src/debug.ts +9 -0
- package/src/generated/changelogCatalog.ts +13 -0
- package/src/generated/releaseMetadata.ts +20 -0
- package/src/index.ts +321 -0
- package/src/ota-server/OtaServer.types.ts +10 -0
- package/src/ota-server/OtaServerModule.ts +23 -0
- package/src/ota-server/OtaServerModule.web.ts +17 -0
- package/src/ota-server/index.ts +2 -0
- package/src/ota-transport/index.ts +116 -0
- package/src/photo-receiver/PhotoReceiver.types.ts +20 -0
- package/src/photo-receiver/PhotoReceiverModule.ts +11 -0
- package/src/photo-receiver/PhotoReceiverModule.web.ts +17 -0
- package/src/photo-receiver/index.ts +2 -0
- package/src/react/index.ts +21 -0
- package/src/react/useBluetooth.ts +309 -0
- package/src/react/useBluetoothEvent.ts +35 -0
- package/src/react/useBluetoothScan.ts +173 -0
- package/src/react/useBluetoothStatus.ts +180 -0
- package/src/react/useGlassesConnection.ts +202 -0
- package/src/types/index.ts +12 -0
|
@@ -0,0 +1,981 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
public struct WifiScanResult: CustomStringConvertible {
|
|
4
|
+
public let ssid: String
|
|
5
|
+
public let requiresPassword: Bool
|
|
6
|
+
public let signalStrength: Int
|
|
7
|
+
public let frequency: Int?
|
|
8
|
+
|
|
9
|
+
public init(ssid: String, requiresPassword: Bool, signalStrength: Int, frequency: Int? = nil) {
|
|
10
|
+
self.ssid = ssid
|
|
11
|
+
self.requiresPassword = requiresPassword
|
|
12
|
+
self.signalStrength = signalStrength
|
|
13
|
+
self.frequency = frequency
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
init(values: [String: Any]) {
|
|
17
|
+
ssid = stringValue(values, "ssid") ?? ""
|
|
18
|
+
requiresPassword = boolValue(values, "requiresPassword") ?? false
|
|
19
|
+
signalStrength = intValue(values["signalStrength"]) ?? -1
|
|
20
|
+
frequency = intValue(values["frequency"])
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var dictionary: [String: Any] {
|
|
24
|
+
var values: [String: Any] = [
|
|
25
|
+
"ssid": ssid,
|
|
26
|
+
"requiresPassword": requiresPassword,
|
|
27
|
+
"signalStrength": signalStrength,
|
|
28
|
+
]
|
|
29
|
+
if let frequency {
|
|
30
|
+
values["frequency"] = frequency
|
|
31
|
+
}
|
|
32
|
+
return values
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public var description: String {
|
|
36
|
+
"WifiScanResult(ssid: \(ssid), signalStrength: \(signalStrength))"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public enum GlassesConnectionState: String, CustomStringConvertible, Equatable {
|
|
41
|
+
case disconnected = "DISCONNECTED"
|
|
42
|
+
case scanning = "SCANNING"
|
|
43
|
+
case connecting = "CONNECTING"
|
|
44
|
+
case bonding = "BONDING"
|
|
45
|
+
case connected = "CONNECTED"
|
|
46
|
+
|
|
47
|
+
public init(_ value: String?) {
|
|
48
|
+
self = Self.fromValue(value) ?? .disconnected
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public static func fromValue(_ value: String?) -> GlassesConnectionState? {
|
|
52
|
+
guard let normalized = value?.trimmingCharacters(in: .whitespacesAndNewlines).uppercased(),
|
|
53
|
+
!normalized.isEmpty
|
|
54
|
+
else {
|
|
55
|
+
return nil
|
|
56
|
+
}
|
|
57
|
+
return Self(rawValue: normalized)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public var isConnected: Bool {
|
|
61
|
+
self == .connected
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public var isBusy: Bool {
|
|
65
|
+
self == .scanning || self == .connecting || self == .bonding
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
func statusValues(connected: Bool, fullyBooted: Bool) -> [String: Any] {
|
|
69
|
+
if self == .connected || connected || fullyBooted {
|
|
70
|
+
return ["state": "connected", "fullyBooted": fullyBooted]
|
|
71
|
+
}
|
|
72
|
+
switch self {
|
|
73
|
+
case .scanning:
|
|
74
|
+
return ["state": "scanning"]
|
|
75
|
+
case .connecting:
|
|
76
|
+
return ["state": "connecting"]
|
|
77
|
+
case .bonding:
|
|
78
|
+
return ["state": "bonding"]
|
|
79
|
+
case .connected:
|
|
80
|
+
return ["state": "connected", "fullyBooted": fullyBooted]
|
|
81
|
+
case .disconnected:
|
|
82
|
+
return ["state": "disconnected"]
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
public var description: String {
|
|
87
|
+
rawValue
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
struct GlassesStatus: CustomStringConvertible {
|
|
92
|
+
let values: [String: Any]
|
|
93
|
+
|
|
94
|
+
func applying(_ update: GlassesStatusUpdate) -> GlassesStatus {
|
|
95
|
+
GlassesStatus(values: values.merging(update.values) { _, new in new })
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
func withBattery(level: Int, charging: Bool) -> GlassesStatus {
|
|
99
|
+
applying(GlassesStatusUpdate(values: ["batteryLevel": level, "charging": charging]))
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
func withWifi(_ wifi: WifiStatus) -> GlassesStatus {
|
|
103
|
+
applying(GlassesStatusUpdate(values: wifi.storeValues))
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
func withHotspot(_ hotspot: HotspotStatus) -> GlassesStatus {
|
|
107
|
+
applying(GlassesStatusUpdate(values: hotspot.storeValues))
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
func disconnected() -> GlassesStatus {
|
|
111
|
+
applying(GlassesStatusUpdate(values: [
|
|
112
|
+
"connected": false,
|
|
113
|
+
"connectionState": "DISCONNECTED",
|
|
114
|
+
"fullyBooted": false,
|
|
115
|
+
"batteryLevel": -1,
|
|
116
|
+
"charging": false,
|
|
117
|
+
"hotspotEnabled": false,
|
|
118
|
+
"hotspotGatewayIp": "",
|
|
119
|
+
"hotspotPassword": "",
|
|
120
|
+
"hotspotSsid": "",
|
|
121
|
+
"wifiConnected": false,
|
|
122
|
+
"wifiSsid": "",
|
|
123
|
+
"wifiLocalIp": "",
|
|
124
|
+
"signalStrength": -1,
|
|
125
|
+
"signalStrengthUpdatedAt": 0,
|
|
126
|
+
]))
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
var fullyBooted: Bool {
|
|
130
|
+
boolValue(values, "fullyBooted") ?? false
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
var connected: Bool {
|
|
134
|
+
boolValue(values, "connected") ?? false
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
var micEnabled: Bool {
|
|
138
|
+
boolValue(values, "micEnabled") ?? false
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
var voiceActivityDetectionEnabled: Bool {
|
|
142
|
+
boolValue(values, "voiceActivityDetectionEnabled") ?? BluetoothSdkDefaults.voiceActivityDetectionEnabled
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
var connectionState: GlassesConnectionState {
|
|
146
|
+
GlassesConnectionState(stringValue(values, "connectionState"))
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
var bluetoothClassicConnected: Bool {
|
|
150
|
+
boolValue(values, "bluetoothClassicConnected") ?? false
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
var signalStrength: Int {
|
|
154
|
+
intValue(values["signalStrength"]) ?? -1
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
var signalStrengthUpdatedAt: Int {
|
|
158
|
+
intValue(values["signalStrengthUpdatedAt"]) ?? 0
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
var deviceModel: String {
|
|
162
|
+
stringValue(values, "deviceModel") ?? ""
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
var androidVersion: String {
|
|
166
|
+
stringValue(values, "androidVersion") ?? ""
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
var firmwareVersion: String {
|
|
170
|
+
stringValue(values, "firmwareVersion") ?? ""
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
var besFirmwareVersion: String {
|
|
174
|
+
stringValue(values, "besFirmwareVersion") ?? ""
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
var mtkFirmwareVersion: String {
|
|
178
|
+
stringValue(values, "mtkFirmwareVersion") ?? ""
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
var bluetoothMacAddress: String {
|
|
182
|
+
stringValue(values, "bluetoothMacAddress") ?? ""
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
var wifiMacAddress: String {
|
|
186
|
+
stringValue(values, "wifiMacAddress") ?? ""
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
var leftMacAddress: String {
|
|
190
|
+
stringValue(values, "leftMacAddress") ?? ""
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
var rightMacAddress: String {
|
|
194
|
+
stringValue(values, "rightMacAddress") ?? ""
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
var macAddress: String {
|
|
198
|
+
stringValue(values, "macAddress") ?? ""
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
var buildNumber: String {
|
|
202
|
+
stringValue(values, "buildNumber") ?? ""
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
var otaVersionUrl: String {
|
|
206
|
+
stringValue(values, "otaVersionUrl") ?? ""
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
var appVersion: String {
|
|
210
|
+
stringValue(values, "appVersion") ?? ""
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
var hotspotOtaVersion: Int {
|
|
214
|
+
intValue(values["hotspotOtaVersion"]) ?? 0
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
var bluetoothName: String {
|
|
218
|
+
stringValue(values, "bluetoothName") ?? ""
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
var serialNumber: String {
|
|
222
|
+
stringValue(values, "serialNumber") ?? ""
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
var style: String {
|
|
226
|
+
stringValue(values, "style") ?? ""
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
var color: String {
|
|
230
|
+
stringValue(values, "color") ?? ""
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
var wifi: WifiStatus {
|
|
234
|
+
WifiStatus.fromStoreValues(values) ?? .disconnected
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
var hotspot: HotspotStatus {
|
|
238
|
+
HotspotStatus.fromStoreValues(values) ?? .disabled
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
var dictionary: [String: Any] {
|
|
242
|
+
Self.dictionary(from: values)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
var batteryLevel: Int {
|
|
246
|
+
intValue(values["batteryLevel"]) ?? -1
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
var charging: Bool {
|
|
250
|
+
boolValue(values, "charging") ?? false
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
var caseBatteryLevel: Int {
|
|
254
|
+
intValue(values["caseBatteryLevel"]) ?? -1
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
var caseCharging: Bool {
|
|
258
|
+
boolValue(values, "caseCharging") ?? false
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
var caseOpen: Bool {
|
|
262
|
+
boolValue(values, "caseOpen") ?? true
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
var caseRemoved: Bool {
|
|
266
|
+
boolValue(values, "caseRemoved") ?? true
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
var headUp: Bool {
|
|
270
|
+
boolValue(values, "headUp") ?? false
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
var controllerConnected: Bool {
|
|
274
|
+
boolValue(values, "controllerConnected") ?? false
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
var controllerFullyBooted: Bool {
|
|
278
|
+
boolValue(values, "controllerFullyBooted") ?? false
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
var controllerMacAddress: String {
|
|
282
|
+
stringValue(values, "controllerMacAddress") ?? ""
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
var controllerBatteryLevel: Int {
|
|
286
|
+
intValue(values["controllerBatteryLevel"]) ?? -1
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
var controllerSignalStrength: Int {
|
|
290
|
+
intValue(values["controllerSignalStrength"]) ?? -1
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
var ringSignalStrength: Int {
|
|
294
|
+
intValue(values["ringSignalStrength"]) ?? -1
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
var description: String {
|
|
298
|
+
values.description
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
static func dictionary(from values: [String: Any]) -> [String: Any] {
|
|
302
|
+
var dictionary = values
|
|
303
|
+
dictionary["connection"] = GlassesConnectionState(stringValue(values, "connectionState")).statusValues(
|
|
304
|
+
connected: boolValue(values, "connected") ?? false,
|
|
305
|
+
fullyBooted: boolValue(values, "fullyBooted") ?? false
|
|
306
|
+
)
|
|
307
|
+
dictionary.removeValue(forKey: "connected")
|
|
308
|
+
dictionary.removeValue(forKey: "fullyBooted")
|
|
309
|
+
dictionary.removeValue(forKey: "connectionState")
|
|
310
|
+
dictionary["wifi"] = (WifiStatus.fromStoreValues(values) ?? .disconnected).values
|
|
311
|
+
dictionary["hotspot"] = (HotspotStatus.fromStoreValues(values) ?? .disabled).values
|
|
312
|
+
dictionary.removeValue(forKey: "wifiConnected")
|
|
313
|
+
dictionary.removeValue(forKey: "wifiSsid")
|
|
314
|
+
dictionary.removeValue(forKey: "wifiLocalIp")
|
|
315
|
+
dictionary.removeValue(forKey: "hotspotEnabled")
|
|
316
|
+
dictionary.removeValue(forKey: "hotspotSsid")
|
|
317
|
+
dictionary.removeValue(forKey: "hotspotPassword")
|
|
318
|
+
dictionary.removeValue(forKey: "hotspotGatewayIp")
|
|
319
|
+
return dictionary
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
static func updateDictionary(from values: [String: Any]) -> [String: Any] {
|
|
323
|
+
var dictionary = values
|
|
324
|
+
if hasAnyKey(values, "connection", "connected", "fullyBooted", "connectionState") {
|
|
325
|
+
dictionary["connection"] = (values["connection"] as? [String: Any])
|
|
326
|
+
?? GlassesConnectionState(stringValue(values, "connectionState")).statusValues(
|
|
327
|
+
connected: boolValue(values, "connected") ?? false,
|
|
328
|
+
fullyBooted: boolValue(values, "fullyBooted") ?? false
|
|
329
|
+
)
|
|
330
|
+
dictionary.removeValue(forKey: "connected")
|
|
331
|
+
dictionary.removeValue(forKey: "fullyBooted")
|
|
332
|
+
dictionary.removeValue(forKey: "connectionState")
|
|
333
|
+
}
|
|
334
|
+
if hasAnyKey(values, "wifi", "wifiConnected", "wifiSsid", "wifiLocalIp") {
|
|
335
|
+
let wifi = (values["wifi"] as? [String: Any]).flatMap(WifiStatus.init(values:))
|
|
336
|
+
?? WifiStatus.fromStoreValues(values)
|
|
337
|
+
if let wifi {
|
|
338
|
+
dictionary["wifi"] = wifi.values
|
|
339
|
+
}
|
|
340
|
+
dictionary.removeValue(forKey: "wifiConnected")
|
|
341
|
+
dictionary.removeValue(forKey: "wifiSsid")
|
|
342
|
+
dictionary.removeValue(forKey: "wifiLocalIp")
|
|
343
|
+
}
|
|
344
|
+
if hasAnyKey(values, "hotspot") {
|
|
345
|
+
if let hotspot = (values["hotspot"] as? [String: Any]).flatMap(HotspotStatus.init(values:)) {
|
|
346
|
+
dictionary["hotspot"] = hotspot.values
|
|
347
|
+
}
|
|
348
|
+
} else if hasAnyKey(values, "hotspotEnabled", "hotspotSsid", "hotspotPassword", "hotspotGatewayIp") {
|
|
349
|
+
if let hotspot = HotspotStatus.fromStoreValues(values) {
|
|
350
|
+
dictionary["hotspot"] = hotspot.values
|
|
351
|
+
}
|
|
352
|
+
dictionary.removeValue(forKey: "hotspotEnabled")
|
|
353
|
+
dictionary.removeValue(forKey: "hotspotSsid")
|
|
354
|
+
dictionary.removeValue(forKey: "hotspotPassword")
|
|
355
|
+
dictionary.removeValue(forKey: "hotspotGatewayIp")
|
|
356
|
+
}
|
|
357
|
+
return dictionary
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
public struct VersionInfoResult: CustomStringConvertible {
|
|
362
|
+
public let androidVersion: String
|
|
363
|
+
public let firmwareVersion: String
|
|
364
|
+
public let besFirmwareVersion: String
|
|
365
|
+
public let mtkFirmwareVersion: String
|
|
366
|
+
public let buildNumber: String
|
|
367
|
+
public let systemTimeMs: Int?
|
|
368
|
+
public let otaVersionUrl: String
|
|
369
|
+
public let appVersion: String
|
|
370
|
+
public let hotspotOtaVersion: Int
|
|
371
|
+
|
|
372
|
+
init(status: GlassesStatus) {
|
|
373
|
+
androidVersion = status.androidVersion
|
|
374
|
+
firmwareVersion = status.firmwareVersion
|
|
375
|
+
besFirmwareVersion = status.besFirmwareVersion
|
|
376
|
+
mtkFirmwareVersion = status.mtkFirmwareVersion
|
|
377
|
+
buildNumber = status.buildNumber
|
|
378
|
+
systemTimeMs = intValue(status.values["systemTimeMs"])
|
|
379
|
+
otaVersionUrl = status.otaVersionUrl
|
|
380
|
+
appVersion = status.appVersion
|
|
381
|
+
hotspotOtaVersion = status.hotspotOtaVersion
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
init(values: [String: Any]) {
|
|
385
|
+
androidVersion = stringValue(values, "androidVersion", "android_version") ?? ""
|
|
386
|
+
firmwareVersion = stringValue(values, "firmwareVersion", "firmware_version") ?? ""
|
|
387
|
+
besFirmwareVersion = stringValue(values, "besFirmwareVersion", "bes_fw_version") ?? ""
|
|
388
|
+
mtkFirmwareVersion = stringValue(values, "mtkFirmwareVersion", "mtk_fw_version") ?? ""
|
|
389
|
+
buildNumber = stringValue(values, "buildNumber", "build_number") ?? ""
|
|
390
|
+
systemTimeMs = intValue(values["systemTimeMs"]) ?? intValue(values["system_time_ms"])
|
|
391
|
+
otaVersionUrl = stringValue(values, "otaVersionUrl", "ota_version_url") ?? ""
|
|
392
|
+
appVersion = stringValue(values, "appVersion", "app_version") ?? ""
|
|
393
|
+
hotspotOtaVersion =
|
|
394
|
+
intValue(values["hotspotOtaVersion"])
|
|
395
|
+
?? intValue(values["hotspot_ota_version"])
|
|
396
|
+
?? 0
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
public var dictionary: [String: Any] {
|
|
400
|
+
var values: [String: Any] = [
|
|
401
|
+
"androidVersion": androidVersion,
|
|
402
|
+
"firmwareVersion": firmwareVersion,
|
|
403
|
+
"besFirmwareVersion": besFirmwareVersion,
|
|
404
|
+
"mtkFirmwareVersion": mtkFirmwareVersion,
|
|
405
|
+
"buildNumber": buildNumber,
|
|
406
|
+
"otaVersionUrl": otaVersionUrl,
|
|
407
|
+
"appVersion": appVersion,
|
|
408
|
+
"hotspotOtaVersion": hotspotOtaVersion,
|
|
409
|
+
]
|
|
410
|
+
if let systemTimeMs {
|
|
411
|
+
values["systemTimeMs"] = systemTimeMs
|
|
412
|
+
}
|
|
413
|
+
return values
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
public var description: String {
|
|
417
|
+
"VersionInfoResult(buildNumber: \(buildNumber), appVersion: \(appVersion))"
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
struct BluetoothStatus: CustomStringConvertible {
|
|
422
|
+
let values: [String: Any]
|
|
423
|
+
|
|
424
|
+
init(values: [String: Any]) {
|
|
425
|
+
self.values = Self.normalized(values)
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
private static func normalized(_ values: [String: Any]) -> [String: Any] {
|
|
429
|
+
var normalizedValues = values
|
|
430
|
+
if let searchResults = values["searchResults"] as? [[String: Any]] {
|
|
431
|
+
normalizedValues["searchResults"] = searchResults.compactMap { Device(values: $0)?.dictionary }
|
|
432
|
+
}
|
|
433
|
+
if let galleryMode = boolValue(values, "gallery_mode") {
|
|
434
|
+
normalizedValues["galleryModeEnabled"] = galleryMode
|
|
435
|
+
normalizedValues.removeValue(forKey: "gallery_mode")
|
|
436
|
+
}
|
|
437
|
+
return normalizedValues
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
func applying(_ update: BluetoothStatusUpdate) -> BluetoothStatus {
|
|
441
|
+
BluetoothStatus(values: values.merging(update.values) { _, new in new })
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
func withDefaultDevice(_ device: Device?) -> BluetoothStatus {
|
|
445
|
+
applying(BluetoothStatusUpdate(values: [
|
|
446
|
+
"default_wearable": device?.model.deviceType ?? "",
|
|
447
|
+
"device_name": device?.name ?? "",
|
|
448
|
+
"device_address": device?.identifier ?? "",
|
|
449
|
+
]))
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
var searching: Bool {
|
|
453
|
+
boolValue(values, "searching") ?? false
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
var searchingController: Bool {
|
|
457
|
+
boolValue(values, "searchingController") ?? false
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
var systemMicUnavailable: Bool {
|
|
461
|
+
boolValue(values, "systemMicUnavailable") ?? false
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
var micEnabled: Bool {
|
|
465
|
+
boolValue(values, "micEnabled") ?? false
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
var currentMic: String {
|
|
469
|
+
stringValue(values, "currentMic") ?? ""
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
var micRanking: [String] {
|
|
473
|
+
stringListValue(values, "micRanking")
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/// Nearby glasses in stable discovery order. Existing entries keep their array position as
|
|
477
|
+
/// details refresh; new glasses append at the end, and removals should not reorder remaining entries.
|
|
478
|
+
var searchResults: [Device] {
|
|
479
|
+
dictionaryListValue(values, "searchResults").compactMap(Device.init(values:))
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
var wifiScanResults: [WifiScanResult] {
|
|
483
|
+
dictionaryListValue(values, "wifiScanResults").map(WifiScanResult.init(values:))
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
var lastLog: [String] {
|
|
487
|
+
stringListValue(values, "lastLog")
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
var otherBtConnected: Bool {
|
|
491
|
+
boolValue(values, "otherBtConnected") ?? false
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
var defaultWearable: String {
|
|
495
|
+
stringValue(values, "default_wearable") ?? ""
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
var pendingWearable: String {
|
|
499
|
+
stringValue(values, "pending_wearable") ?? ""
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
var deviceName: String {
|
|
503
|
+
stringValue(values, "device_name") ?? ""
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
var deviceAddress: String {
|
|
507
|
+
stringValue(values, "device_address") ?? ""
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
var defaultController: String {
|
|
511
|
+
stringValue(values, "default_controller") ?? ""
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
var pendingController: String {
|
|
515
|
+
stringValue(values, "pending_controller") ?? ""
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
var controllerDeviceName: String {
|
|
519
|
+
stringValue(values, "controller_device_name") ?? ""
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
var screenDisabled: Bool {
|
|
523
|
+
boolValue(values, "screen_disabled") ?? false
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
var preferredMic: String {
|
|
527
|
+
stringValue(values, "preferred_mic") ?? "auto"
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
var sensingEnabled: Bool {
|
|
531
|
+
boolValue(values, "sensing_enabled") ?? true
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
var powerSavingMode: Bool {
|
|
535
|
+
boolValue(values, "power_saving_mode") ?? false
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
var brightness: Int {
|
|
539
|
+
intValue(values["brightness"]) ?? 50
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
var autoBrightness: Bool {
|
|
543
|
+
boolValue(values, "auto_brightness") ?? true
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
var dashboardHeight: Int {
|
|
547
|
+
intValue(values["dashboard_height"]) ?? 4
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
var dashboardDepth: Int {
|
|
551
|
+
intValue(values["dashboard_depth"]) ?? 2
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
var headUpAngle: Int {
|
|
555
|
+
intValue(values["head_up_angle"]) ?? 30
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
var contextualDashboard: Bool {
|
|
559
|
+
boolValue(values, "contextual_dashboard") ?? true
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
var galleryModeEnabled: Bool {
|
|
563
|
+
boolValue(values, "gallery_mode") ?? boolValue(values, "galleryModeEnabled") ?? true
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
var buttonPhotoSize: ButtonPhotoSize {
|
|
567
|
+
ButtonPhotoSize(rawValue: stringValue(values, "button_photo_size") ?? "") ?? .medium
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
var buttonMaxRecordingTime: Int {
|
|
571
|
+
intValue(values["button_max_recording_time"]) ?? 10
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
var buttonVideoWidth: Int {
|
|
575
|
+
intValue(values["button_video_width"]) ?? 1280
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
var buttonVideoHeight: Int {
|
|
579
|
+
intValue(values["button_video_height"]) ?? 720
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
var buttonVideoFrameRate: Int {
|
|
583
|
+
intValue(values["button_video_fps"]) ?? 30
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
var shouldSendPcm: Bool {
|
|
587
|
+
boolValue(values, "should_send_pcm") ?? false
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
var shouldSendLc3: Bool {
|
|
591
|
+
boolValue(values, "should_send_lc3") ?? false
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
var shouldSendTranscript: Bool {
|
|
595
|
+
boolValue(values, "should_send_transcript") ?? false
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
var localSttFallbackActive: Bool {
|
|
599
|
+
boolValue(values, "local_stt_fallback_active") ?? false
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
var shouldSendBootingMessage: Bool {
|
|
603
|
+
boolValue(values, "shouldSendBootingMessage") ?? true
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
var defaultDevice: Device? {
|
|
607
|
+
guard !defaultWearable.isEmpty else { return nil }
|
|
608
|
+
return Device(
|
|
609
|
+
model: DeviceModel.fromDeviceType(defaultWearable),
|
|
610
|
+
name: deviceName,
|
|
611
|
+
identifier: deviceAddress.isEmpty ? nil : deviceAddress
|
|
612
|
+
)
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
var description: String {
|
|
616
|
+
values.description
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
struct GlassesStatusUpdate: CustomStringConvertible {
|
|
621
|
+
let values: [String: Any]
|
|
622
|
+
|
|
623
|
+
var fullyBooted: Bool? {
|
|
624
|
+
optionalBoolValue(values, "fullyBooted")
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
var connected: Bool? {
|
|
628
|
+
optionalBoolValue(values, "connected")
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
var micEnabled: Bool? {
|
|
632
|
+
optionalBoolValue(values, "micEnabled")
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
var voiceActivityDetectionEnabled: Bool? {
|
|
636
|
+
optionalBoolValue(values, "voiceActivityDetectionEnabled")
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
var connectionState: GlassesConnectionState? {
|
|
640
|
+
GlassesConnectionState.fromValue(optionalStringValue(values, "connectionState"))
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
var bluetoothClassicConnected: Bool? {
|
|
644
|
+
optionalBoolValue(values, "bluetoothClassicConnected")
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
var signalStrength: Int? {
|
|
648
|
+
optionalIntValue(values, "signalStrength")
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
var signalStrengthUpdatedAt: Int? {
|
|
652
|
+
optionalIntValue(values, "signalStrengthUpdatedAt")
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
var deviceModel: String? {
|
|
656
|
+
optionalStringValue(values, "deviceModel")
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
var androidVersion: String? {
|
|
660
|
+
optionalStringValue(values, "androidVersion")
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
var firmwareVersion: String? {
|
|
664
|
+
optionalStringValue(values, "firmwareVersion")
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
var besFirmwareVersion: String? {
|
|
668
|
+
optionalStringValue(values, "besFirmwareVersion")
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
var mtkFirmwareVersion: String? {
|
|
672
|
+
optionalStringValue(values, "mtkFirmwareVersion")
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
var bluetoothMacAddress: String? {
|
|
676
|
+
optionalStringValue(values, "bluetoothMacAddress")
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
var wifiMacAddress: String? {
|
|
680
|
+
optionalStringValue(values, "wifiMacAddress")
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
var leftMacAddress: String? {
|
|
684
|
+
optionalStringValue(values, "leftMacAddress")
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
var rightMacAddress: String? {
|
|
688
|
+
optionalStringValue(values, "rightMacAddress")
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
var macAddress: String? {
|
|
692
|
+
optionalStringValue(values, "macAddress")
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
var buildNumber: String? {
|
|
696
|
+
optionalStringValue(values, "buildNumber")
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
var otaVersionUrl: String? {
|
|
700
|
+
optionalStringValue(values, "otaVersionUrl")
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
var appVersion: String? {
|
|
704
|
+
optionalStringValue(values, "appVersion")
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
var hotspotOtaVersion: Int? {
|
|
708
|
+
optionalIntValue(values, "hotspotOtaVersion")
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
var bluetoothName: String? {
|
|
712
|
+
optionalStringValue(values, "bluetoothName")
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
var serialNumber: String? {
|
|
716
|
+
optionalStringValue(values, "serialNumber")
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
var style: String? {
|
|
720
|
+
optionalStringValue(values, "style")
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
var color: String? {
|
|
724
|
+
optionalStringValue(values, "color")
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
var wifi: WifiStatus? {
|
|
728
|
+
if let wifi = values["wifi"] as? [String: Any] {
|
|
729
|
+
return WifiStatus(values: wifi)
|
|
730
|
+
}
|
|
731
|
+
if hasAnyKey(values, "wifiConnected", "wifiSsid", "wifiLocalIp") {
|
|
732
|
+
return WifiStatus.fromStoreValues(values)
|
|
733
|
+
}
|
|
734
|
+
return nil
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
var hotspot: HotspotStatus? {
|
|
738
|
+
if let hotspot = values["hotspot"] as? [String: Any] {
|
|
739
|
+
return HotspotStatus(values: hotspot)
|
|
740
|
+
}
|
|
741
|
+
if hasAnyKey(values, "hotspotEnabled", "hotspotSsid", "hotspotPassword", "hotspotGatewayIp") {
|
|
742
|
+
return HotspotStatus.fromStoreValues(values)
|
|
743
|
+
}
|
|
744
|
+
return nil
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
var dictionary: [String: Any] {
|
|
748
|
+
GlassesStatus.updateDictionary(from: values)
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
var batteryLevel: Int? {
|
|
752
|
+
optionalIntValue(values, "batteryLevel")
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
var charging: Bool? {
|
|
756
|
+
optionalBoolValue(values, "charging")
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
var caseBatteryLevel: Int? {
|
|
760
|
+
optionalIntValue(values, "caseBatteryLevel")
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
var caseCharging: Bool? {
|
|
764
|
+
optionalBoolValue(values, "caseCharging")
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
var caseOpen: Bool? {
|
|
768
|
+
optionalBoolValue(values, "caseOpen")
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
var caseRemoved: Bool? {
|
|
772
|
+
optionalBoolValue(values, "caseRemoved")
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
var headUp: Bool? {
|
|
776
|
+
optionalBoolValue(values, "headUp")
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
var controllerConnected: Bool? {
|
|
780
|
+
optionalBoolValue(values, "controllerConnected")
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
var controllerFullyBooted: Bool? {
|
|
784
|
+
optionalBoolValue(values, "controllerFullyBooted")
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
var controllerMacAddress: String? {
|
|
788
|
+
optionalStringValue(values, "controllerMacAddress")
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
var controllerBatteryLevel: Int? {
|
|
792
|
+
optionalIntValue(values, "controllerBatteryLevel")
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
var controllerSignalStrength: Int? {
|
|
796
|
+
optionalIntValue(values, "controllerSignalStrength")
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
var ringSignalStrength: Int? {
|
|
800
|
+
optionalIntValue(values, "ringSignalStrength")
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
var description: String {
|
|
804
|
+
values.description
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
struct BluetoothStatusUpdate: CustomStringConvertible {
|
|
809
|
+
let values: [String: Any]
|
|
810
|
+
|
|
811
|
+
init(values: [String: Any]) {
|
|
812
|
+
var normalizedValues = values
|
|
813
|
+
if let searchResults = values["searchResults"] as? [[String: Any]] {
|
|
814
|
+
normalizedValues["searchResults"] = searchResults.compactMap { Device(values: $0)?.dictionary }
|
|
815
|
+
}
|
|
816
|
+
if let galleryMode = optionalBoolValue(values, "gallery_mode") {
|
|
817
|
+
normalizedValues["galleryModeEnabled"] = galleryMode
|
|
818
|
+
normalizedValues.removeValue(forKey: "gallery_mode")
|
|
819
|
+
}
|
|
820
|
+
self.values = normalizedValues
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
var searching: Bool? {
|
|
824
|
+
optionalBoolValue(values, "searching")
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
var searchingController: Bool? {
|
|
828
|
+
optionalBoolValue(values, "searchingController")
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
var systemMicUnavailable: Bool? {
|
|
832
|
+
optionalBoolValue(values, "systemMicUnavailable")
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
var micEnabled: Bool? {
|
|
836
|
+
optionalBoolValue(values, "micEnabled")
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
var currentMic: String? {
|
|
840
|
+
optionalStringValue(values, "currentMic")
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
var micRanking: [String]? {
|
|
844
|
+
optionalStringListValue(values, "micRanking")
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
/// Nearby glasses in stable discovery order when included in an update. Existing entries keep their
|
|
848
|
+
/// array position as details refresh; new glasses append at the end, and removals should not reorder
|
|
849
|
+
/// remaining entries.
|
|
850
|
+
var searchResults: [Device]? {
|
|
851
|
+
optionalDictionaryListValue(values, "searchResults")?.compactMap(Device.init(values:))
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
var wifiScanResults: [WifiScanResult]? {
|
|
855
|
+
optionalDictionaryListValue(values, "wifiScanResults")?.map(WifiScanResult.init(values:))
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
var lastLog: [String]? {
|
|
859
|
+
optionalStringListValue(values, "lastLog")
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
var otherBtConnected: Bool? {
|
|
863
|
+
optionalBoolValue(values, "otherBtConnected")
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
var defaultWearable: String? {
|
|
867
|
+
optionalStringValue(values, "default_wearable")
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
var pendingWearable: String? {
|
|
871
|
+
optionalStringValue(values, "pending_wearable")
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
var deviceName: String? {
|
|
875
|
+
optionalStringValue(values, "device_name")
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
var deviceAddress: String? {
|
|
879
|
+
optionalStringValue(values, "device_address")
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
var defaultController: String? {
|
|
883
|
+
optionalStringValue(values, "default_controller")
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
var pendingController: String? {
|
|
887
|
+
optionalStringValue(values, "pending_controller")
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
var controllerDeviceName: String? {
|
|
891
|
+
optionalStringValue(values, "controller_device_name")
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
var screenDisabled: Bool? {
|
|
895
|
+
optionalBoolValue(values, "screen_disabled")
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
var preferredMic: String? {
|
|
899
|
+
optionalStringValue(values, "preferred_mic")
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
var sensingEnabled: Bool? {
|
|
903
|
+
optionalBoolValue(values, "sensing_enabled")
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
var powerSavingMode: Bool? {
|
|
907
|
+
optionalBoolValue(values, "power_saving_mode")
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
var brightness: Int? {
|
|
911
|
+
optionalIntValue(values, "brightness")
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
var autoBrightness: Bool? {
|
|
915
|
+
optionalBoolValue(values, "auto_brightness")
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
var dashboardHeight: Int? {
|
|
919
|
+
optionalIntValue(values, "dashboard_height")
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
var dashboardDepth: Int? {
|
|
923
|
+
optionalIntValue(values, "dashboard_depth")
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
var headUpAngle: Int? {
|
|
927
|
+
optionalIntValue(values, "head_up_angle")
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
var contextualDashboard: Bool? {
|
|
931
|
+
optionalBoolValue(values, "contextual_dashboard")
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
var galleryModeEnabled: Bool? {
|
|
935
|
+
optionalBoolValue(values, "gallery_mode") ?? optionalBoolValue(values, "galleryModeEnabled")
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
var buttonPhotoSize: ButtonPhotoSize? {
|
|
939
|
+
optionalStringValue(values, "button_photo_size").map { ButtonPhotoSize(normalizedRawValue: $0) }
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
var buttonMaxRecordingTime: Int? {
|
|
943
|
+
optionalIntValue(values, "button_max_recording_time")
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
var buttonVideoWidth: Int? {
|
|
947
|
+
optionalIntValue(values, "button_video_width")
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
var buttonVideoHeight: Int? {
|
|
951
|
+
optionalIntValue(values, "button_video_height")
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
var buttonVideoFrameRate: Int? {
|
|
955
|
+
optionalIntValue(values, "button_video_fps")
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
var shouldSendPcm: Bool? {
|
|
959
|
+
optionalBoolValue(values, "should_send_pcm")
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
var shouldSendLc3: Bool? {
|
|
963
|
+
optionalBoolValue(values, "should_send_lc3")
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
var shouldSendTranscript: Bool? {
|
|
967
|
+
optionalBoolValue(values, "should_send_transcript")
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
var localSttFallbackActive: Bool? {
|
|
971
|
+
optionalBoolValue(values, "local_stt_fallback_active")
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
var shouldSendBootingMessage: Bool? {
|
|
975
|
+
optionalBoolValue(values, "shouldSendBootingMessage")
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
var description: String {
|
|
979
|
+
values.description
|
|
980
|
+
}
|
|
981
|
+
}
|