@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,450 @@
|
|
|
1
|
+
import groovy.json.JsonSlurper
|
|
2
|
+
import java.security.MessageDigest
|
|
3
|
+
|
|
4
|
+
apply plugin: 'com.android.library'
|
|
5
|
+
apply plugin: 'maven-publish'
|
|
6
|
+
apply plugin: 'signing'
|
|
7
|
+
|
|
8
|
+
def packageJson = new JsonSlurper().parse(file("../package.json"))
|
|
9
|
+
def mavenGroupId = 'com.glassly'
|
|
10
|
+
def mavenPublishVersion = (findProperty('glasslyMavenVersion') ?: System.getenv('MAVEN_VERSION') ?: packageJson.version).toString()
|
|
11
|
+
def publicMavenSdk = (findProperty('glasslyPublicSdk') ?: System.getenv('PUBLIC_SDK') ?: 'false').toString().toBoolean()
|
|
12
|
+
|
|
13
|
+
// Download Sherpa-ONNX Android AAR from the upstream GitHub release and stage
|
|
14
|
+
// it as a Maven artifact in a tiny on-disk repository under libs/maven/.
|
|
15
|
+
// Why this shape:
|
|
16
|
+
// - Jitpack stopped publishing for v1.13.2+ (their build step fails because
|
|
17
|
+
// the AAR asset isn't present when its install-file step runs).
|
|
18
|
+
// - We can't just `implementation files("…aar")` because AGP refuses local
|
|
19
|
+
// .aar deps from library modules ("Direct local .aar file dependencies
|
|
20
|
+
// are not supported when building an AAR"). Maven-coord deps are fine.
|
|
21
|
+
// The SHA-256 is pinned (computed from the upstream release asset for v1.13.4;
|
|
22
|
+
// upstream ships no checksum.txt for this tag) so a tampered or
|
|
23
|
+
// partially-written artifact is rejected before being used.
|
|
24
|
+
def sherpaOnnxGroup = "com.k2fsa.sherpa.onnx"
|
|
25
|
+
def sherpaOnnxArtifact = "sherpa-onnx"
|
|
26
|
+
def sherpaOnnxVersion = "1.13.4"
|
|
27
|
+
def sherpaOnnxSha256 = "03f9c4df965f21c71269365a7951a7f23b5696fddd093fa318c80d65550ab780"
|
|
28
|
+
|
|
29
|
+
def sherpaOnnxMavenRoot = file("libs/maven")
|
|
30
|
+
def sherpaOnnxRepoDir = new File(
|
|
31
|
+
sherpaOnnxMavenRoot,
|
|
32
|
+
"${sherpaOnnxGroup.replace('.', '/')}/${sherpaOnnxArtifact}/${sherpaOnnxVersion}"
|
|
33
|
+
)
|
|
34
|
+
def sherpaOnnxAar = new File(sherpaOnnxRepoDir, "${sherpaOnnxArtifact}-${sherpaOnnxVersion}.aar")
|
|
35
|
+
def sherpaOnnxPom = new File(sherpaOnnxRepoDir, "${sherpaOnnxArtifact}-${sherpaOnnxVersion}.pom")
|
|
36
|
+
|
|
37
|
+
def sha256OfFile = { File f ->
|
|
38
|
+
def digest = MessageDigest.getInstance("SHA-256")
|
|
39
|
+
f.withInputStream { input ->
|
|
40
|
+
def buf = new byte[64 * 1024]
|
|
41
|
+
int n
|
|
42
|
+
while ((n = input.read(buf)) != -1) {
|
|
43
|
+
digest.update(buf, 0, n)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
digest.digest().collect { String.format("%02x", it & 0xff) }.join("")
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// If a stale AAR exists with the wrong hash (e.g. from a previous failed
|
|
50
|
+
// download or a version bump), drop it so we re-fetch.
|
|
51
|
+
if (sherpaOnnxAar.exists() && sha256OfFile(sherpaOnnxAar) != sherpaOnnxSha256) {
|
|
52
|
+
logger.lifecycle("Sherpa-ONNX AAR checksum mismatch on disk; redownloading.")
|
|
53
|
+
if (!sherpaOnnxAar.delete()) {
|
|
54
|
+
throw new GradleException(
|
|
55
|
+
"Sherpa-ONNX AAR at ${sherpaOnnxAar.absolutePath} has a mismatched SHA-256 " +
|
|
56
|
+
"but could not be deleted. Refusing to continue with a potentially tampered artifact."
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (!sherpaOnnxAar.exists()) {
|
|
62
|
+
sherpaOnnxRepoDir.mkdirs()
|
|
63
|
+
def sherpaOnnxUrl = "https://github.com/k2-fsa/sherpa-onnx/releases/download/v${sherpaOnnxVersion}/${sherpaOnnxArtifact}-${sherpaOnnxVersion}.aar"
|
|
64
|
+
logger.lifecycle("Downloading Sherpa-ONNX AAR v${sherpaOnnxVersion} from GitHub release…")
|
|
65
|
+
// Download to a .part sibling and rename only after the SHA-256 matches, so
|
|
66
|
+
// an interrupted or tampered download can't be silently accepted as valid.
|
|
67
|
+
def partial = file("${sherpaOnnxAar.absolutePath}.part")
|
|
68
|
+
try {
|
|
69
|
+
new URL(sherpaOnnxUrl).withInputStream { input ->
|
|
70
|
+
partial.withOutputStream { output -> output << input }
|
|
71
|
+
}
|
|
72
|
+
def actual = sha256OfFile(partial)
|
|
73
|
+
if (actual != sherpaOnnxSha256) {
|
|
74
|
+
throw new GradleException(
|
|
75
|
+
"Sherpa-ONNX AAR v${sherpaOnnxVersion} SHA-256 mismatch.\n" +
|
|
76
|
+
" expected: ${sherpaOnnxSha256}\n" +
|
|
77
|
+
" actual: ${actual}\n" +
|
|
78
|
+
"Refusing to use the downloaded artifact."
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
if (!partial.renameTo(sherpaOnnxAar)) {
|
|
82
|
+
throw new GradleException("Failed to move ${partial.name} to ${sherpaOnnxAar.name}")
|
|
83
|
+
}
|
|
84
|
+
} finally {
|
|
85
|
+
if (partial.exists()) {
|
|
86
|
+
partial.delete()
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Minimal POM so the Maven resolver is happy. No transitive deps — the AAR
|
|
92
|
+
// ships its own native libs and we already pin onnxruntime separately below.
|
|
93
|
+
if (!sherpaOnnxPom.exists()) {
|
|
94
|
+
sherpaOnnxPom.text = """<?xml version="1.0" encoding="UTF-8"?>
|
|
95
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0">
|
|
96
|
+
<modelVersion>4.0.0</modelVersion>
|
|
97
|
+
<groupId>${sherpaOnnxGroup}</groupId>
|
|
98
|
+
<artifactId>${sherpaOnnxArtifact}</artifactId>
|
|
99
|
+
<version>${sherpaOnnxVersion}</version>
|
|
100
|
+
<packaging>aar</packaging>
|
|
101
|
+
</project>
|
|
102
|
+
"""
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
repositories {
|
|
106
|
+
maven { url = uri(sherpaOnnxMavenRoot) }
|
|
107
|
+
maven { url 'https://jitpack.io' }
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
group = mavenGroupId
|
|
112
|
+
version = mavenPublishVersion
|
|
113
|
+
|
|
114
|
+
def credentialValue = { List<String> propertyNames, List<String> envNames ->
|
|
115
|
+
for (propertyName in propertyNames) {
|
|
116
|
+
def value = findProperty(propertyName)
|
|
117
|
+
if (value != null && value.toString().trim()) {
|
|
118
|
+
return value.toString()
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
for (envName in envNames) {
|
|
122
|
+
def value = System.getenv(envName)
|
|
123
|
+
if (value != null && value.trim()) {
|
|
124
|
+
return value
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return null
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
def centralTokenParts = { boolean failOnInvalid = false ->
|
|
131
|
+
def token = credentialValue(['sonatypeTokenBase64', 'mavenCentralTokenBase64'], ['SONATYPE_TOKEN_BASE64', 'MAVEN_CENTRAL_TOKEN_BASE64'])
|
|
132
|
+
if (!token) {
|
|
133
|
+
return null
|
|
134
|
+
}
|
|
135
|
+
def decoded
|
|
136
|
+
try {
|
|
137
|
+
decoded = new String(token.decodeBase64(), 'UTF-8')
|
|
138
|
+
} catch (Exception e) {
|
|
139
|
+
if (failOnInvalid) {
|
|
140
|
+
throw new GradleException('Sonatype token must be valid base64 for username:password', e)
|
|
141
|
+
}
|
|
142
|
+
return null
|
|
143
|
+
}
|
|
144
|
+
def separator = decoded.indexOf(':')
|
|
145
|
+
if (separator <= 0) {
|
|
146
|
+
if (failOnInvalid) {
|
|
147
|
+
throw new GradleException('Sonatype token must decode to username:password')
|
|
148
|
+
}
|
|
149
|
+
return null
|
|
150
|
+
}
|
|
151
|
+
return [decoded.substring(0, separator), decoded.substring(separator + 1)]
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
def centralUsername = { boolean failOnInvalidToken = false ->
|
|
155
|
+
credentialValue(['sonatypeUsername', 'mavenCentralUsername'], ['SONATYPE_USERNAME', 'MAVEN_CENTRAL_USERNAME']) ?: centralTokenParts(failOnInvalidToken)?.get(0)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
def centralPassword = { boolean failOnInvalidToken = false ->
|
|
159
|
+
credentialValue(['sonatypePassword', 'mavenCentralPassword'], ['SONATYPE_PASSWORD', 'MAVEN_CENTRAL_PASSWORD']) ?: centralTokenParts(failOnInvalidToken)?.get(1)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
def signingKey = {
|
|
163
|
+
credentialValue(['signingKey'], ['SIGNING_KEY'])
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
def signingPassword = {
|
|
167
|
+
credentialValue(['signingPassword'], ['SIGNING_PASSWORD'])
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
def shouldUseGpgCmd = {
|
|
171
|
+
(credentialValue(['signing.useGpgCmd'], ['SIGNING_USE_GPG_CMD']) ?: 'false').toBoolean()
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
def isCentralPublishTask = {
|
|
175
|
+
gradle.taskGraph.allTasks.any { it.name.toLowerCase().contains('sonatypecentral') }
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
gradle.taskGraph.whenReady {
|
|
179
|
+
if (isCentralPublishTask()) {
|
|
180
|
+
centralUsername(true)
|
|
181
|
+
centralPassword(true)
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
186
|
+
apply from: expoModulesCorePlugin
|
|
187
|
+
applyKotlinExpoModulesCorePlugin()
|
|
188
|
+
useExpoPublishing()
|
|
189
|
+
|
|
190
|
+
// If you want to use the managed Android SDK versions from expo-modules-core, set this to true.
|
|
191
|
+
// The Android SDK versions will be bumped from time to time in SDK releases and may introduce breaking changes in your module code.
|
|
192
|
+
// Most of the time, you may like to manage the Android SDK versions yourself.
|
|
193
|
+
def useManagedAndroidSdkVersions = false
|
|
194
|
+
if (useManagedAndroidSdkVersions) {
|
|
195
|
+
useDefaultAndroidSdkVersions()
|
|
196
|
+
} else {
|
|
197
|
+
buildscript {
|
|
198
|
+
// Simple helper that allows the root project to override versions declared by this library.
|
|
199
|
+
ext.safeExtGet = { prop, fallback ->
|
|
200
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
project.android {
|
|
204
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 36)
|
|
205
|
+
defaultConfig {
|
|
206
|
+
minSdkVersion safeExtGet("minSdkVersion", 28)
|
|
207
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 36)
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
android {
|
|
213
|
+
namespace "com.glassly.bluetoothsdk"
|
|
214
|
+
defaultConfig {
|
|
215
|
+
versionCode 1
|
|
216
|
+
versionName project.version
|
|
217
|
+
buildConfigField "String", "SDK_VERSION", "\"${project.version}\""
|
|
218
|
+
}
|
|
219
|
+
publishing {
|
|
220
|
+
singleVariant("release") {
|
|
221
|
+
withSourcesJar()
|
|
222
|
+
withJavadocJar()
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
lintOptions {
|
|
226
|
+
abortOnError false
|
|
227
|
+
}
|
|
228
|
+
testOptions {
|
|
229
|
+
unitTests {
|
|
230
|
+
includeAndroidResources = true
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
packagingOptions {
|
|
234
|
+
pickFirst '**/libjsc.so'
|
|
235
|
+
pickFirst '**/libc++_shared.so'
|
|
236
|
+
pickFirst '**/libonnxruntime.so'
|
|
237
|
+
pickFirst '**/libonnxruntime4j_jni.so'
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
dependencies {
|
|
242
|
+
// Expo adapter class is compiled into the Glassly module, but the bare SDK
|
|
243
|
+
// artifact should not expose Expo as a runtime dependency.
|
|
244
|
+
compileOnly project(':expo-modules-core')
|
|
245
|
+
|
|
246
|
+
// Kotlin standard library (explicitly added for IDE support)
|
|
247
|
+
// Version is managed by Expo modules, but explicit dependency helps IDE indexing
|
|
248
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
|
|
249
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
|
250
|
+
|
|
251
|
+
implementation "androidx.lifecycle:lifecycle-service:2.6.1"
|
|
252
|
+
implementation "org.greenrobot:eventbus:3.3.1"
|
|
253
|
+
implementation 'com.google.code.gson:gson:2.10.1'
|
|
254
|
+
|
|
255
|
+
// Google Play Services for location settings dialog
|
|
256
|
+
implementation 'com.google.android.gms:play-services-location:21.0.1'
|
|
257
|
+
implementation 'com.google.android.gms:play-services-base:18.2.0'
|
|
258
|
+
|
|
259
|
+
// Apache Commons Compress for tar.bz2 extraction
|
|
260
|
+
implementation 'org.apache.commons:commons-compress:1.24.0'
|
|
261
|
+
|
|
262
|
+
// OkHttp for HTTP requests
|
|
263
|
+
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
|
|
264
|
+
implementation 'androidx.exifinterface:exifinterface:1.3.7'
|
|
265
|
+
|
|
266
|
+
// AVIF decode for BLE photo fallback. Public Maven artifacts omit this
|
|
267
|
+
// JitPack-only decoder from runtime metadata; Android 12+ can still use the
|
|
268
|
+
// platform decoder, while Glassly app builds keep HeifCoder for broader
|
|
269
|
+
// fallback support.
|
|
270
|
+
// Pinned to the JitPack 1.7.3 build (same as asg_client): the Maven Central
|
|
271
|
+
// 2.2.x releases transitively pull kotlin-stdlib 2.3.0, which breaks this
|
|
272
|
+
// project's Kotlin 2.1 compile of :expo.
|
|
273
|
+
dependencies.add(publicMavenSdk ? 'compileOnly' : 'implementation', 'com.github.awxkee:avif-coder:1.7.3')
|
|
274
|
+
|
|
275
|
+
testImplementation 'junit:junit:4.13.2'
|
|
276
|
+
testImplementation 'org.robolectric:robolectric:4.11.1'
|
|
277
|
+
testImplementation 'org.assertj:assertj-core:3.24.2'
|
|
278
|
+
testImplementation 'androidx.test:core:1.5.0'
|
|
279
|
+
|
|
280
|
+
// Local photo upload receiver
|
|
281
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1"
|
|
282
|
+
|
|
283
|
+
// AR99 GATT Opus to PCM decoder.
|
|
284
|
+
implementation 'io.github.jaredmdobson:concentus:1.0.1'
|
|
285
|
+
|
|
286
|
+
// LC3 audio codec library
|
|
287
|
+
implementation project(':lc3Lib')
|
|
288
|
+
|
|
289
|
+
// These integrations are used by the full Glassly app, but are not exposed
|
|
290
|
+
// through the public SDK API. Public Maven artifacts compile against them
|
|
291
|
+
// without publishing them as runtime transitives, so consumers only need
|
|
292
|
+
// Maven Central/Google repositories for normal SDK use.
|
|
293
|
+
def optionalGlasslyIntegrationDependency = publicMavenSdk ? 'compileOnly' : 'implementation'
|
|
294
|
+
|
|
295
|
+
// Sherpa-ONNX for local transcription. Jitpack's v1.13.2 build failed
|
|
296
|
+
// upstream, so we stage the prebuilt AAR into libs/maven/ (see top of file)
|
|
297
|
+
// and consume it as a Maven coord — AGP rejects raw files() .aar deps in
|
|
298
|
+
// library modules.
|
|
299
|
+
dependencies.add(optionalGlasslyIntegrationDependency, "${sherpaOnnxGroup}:${sherpaOnnxArtifact}:${sherpaOnnxVersion}@aar")
|
|
300
|
+
|
|
301
|
+
if (!publicMavenSdk) {
|
|
302
|
+
// Silero VAD — vendored source under silero/, wired as :silero
|
|
303
|
+
// sub-project (see settings.gradle). This replaces the previous Jitpack AAR
|
|
304
|
+
// (com.github.gkonovalov:android-vad:2.0.9) whose prebuilt JNI was bound to
|
|
305
|
+
// an ORT version incompatible with the one bundled by sherpa-onnx, causing a
|
|
306
|
+
// dlopen UnsatisfiedLinkError for OrtGetApiBase at VAD startup. By owning the
|
|
307
|
+
// source we control both the Java API surface and the ORT version it links
|
|
308
|
+
// against; today both consumers (Silero VAD and sherpa-onnx) load their own
|
|
309
|
+
// libonnxruntime.so — see packagingOptions pickFirst above.
|
|
310
|
+
implementation project(':silero')
|
|
311
|
+
|
|
312
|
+
// Vuzix Z100
|
|
313
|
+
implementation 'com.vuzix:ultralite-sdk-android:1.8'
|
|
314
|
+
implementation 'com.squareup.picasso:picasso:2.8'
|
|
315
|
+
} else {
|
|
316
|
+
compileOnly project(':silero')
|
|
317
|
+
compileOnly 'com.vuzix:ultralite-sdk-android:1.8'
|
|
318
|
+
compileOnly 'com.squareup.picasso:picasso:2.8'
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
implementation 'com.google.protobuf:protobuf-java:4.32.0'
|
|
322
|
+
implementation 'com.google.protobuf:protobuf-java-util:4.32.0'
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// Pin onnxruntime-android to 1.27.0 — the version sherpa-onnx 1.13.4 was built
|
|
326
|
+
// against (its libonnxruntime.so exports OrtGetApiBase@@VERS_1.27.0). Matching
|
|
327
|
+
// this lets the :silero VAD module share a single libonnxruntime.so with
|
|
328
|
+
// sherpa-onnx, resolving the ELF symbol-versioning conflict that crashed VAD
|
|
329
|
+
// startup on previous mismatched versions.
|
|
330
|
+
//
|
|
331
|
+
// This pin MUST be bumped in lockstep with sherpaOnnxVersion above: the bundled
|
|
332
|
+
// ORT moved 1.24.3 -> 1.27.0 across the 1.13.2 -> 1.13.4 upgrade. To re-derive
|
|
333
|
+
// it after a future bump:
|
|
334
|
+
// unzip -p <aar> jni/arm64-v8a/libonnxruntime.so > /tmp/ort.so
|
|
335
|
+
// strings /tmp/ort.so | grep -Eo 'VERS_1\.[0-9]+\.[0-9]+' | sort -u
|
|
336
|
+
configurations.all {
|
|
337
|
+
resolutionStrategy {
|
|
338
|
+
eachDependency { DependencyResolveDetails details ->
|
|
339
|
+
if (details.requested.group == 'com.microsoft.onnxruntime') {
|
|
340
|
+
details.useVersion '1.27.0'
|
|
341
|
+
details.because('Match sherpa-onnx 1.13.4 ORT 1.27.0')
|
|
342
|
+
}
|
|
343
|
+
if (details.requested.name == 'onnxruntime-android') {
|
|
344
|
+
details.useVersion '1.27.0'
|
|
345
|
+
details.because('Match sherpa-onnx 1.13.4 ORT 1.27.0')
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
afterEvaluate {
|
|
352
|
+
publishing {
|
|
353
|
+
publications {
|
|
354
|
+
release(MavenPublication) {
|
|
355
|
+
groupId = mavenGroupId
|
|
356
|
+
artifactId = 'bluetooth-sdk'
|
|
357
|
+
version = project.version
|
|
358
|
+
|
|
359
|
+
from components.release
|
|
360
|
+
|
|
361
|
+
pom {
|
|
362
|
+
name = 'Glassly Bluetooth SDK'
|
|
363
|
+
description = 'SDK for communicating with smart glasses'
|
|
364
|
+
url = 'https://github.com/tetramo-labs/glassly'
|
|
365
|
+
licenses {
|
|
366
|
+
license {
|
|
367
|
+
name = 'MIT License'
|
|
368
|
+
url = 'https://opensource.org/licenses/MIT'
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
developers {
|
|
372
|
+
developer {
|
|
373
|
+
id = 'glassly'
|
|
374
|
+
name = 'Glassly'
|
|
375
|
+
email = 'dev@glassly.com'
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
scm {
|
|
379
|
+
connection = 'scm:git:https://github.com/tetramo-labs/glassly.git'
|
|
380
|
+
developerConnection = 'scm:git:ssh://git@github.com:tetramo-labs/glassly.git'
|
|
381
|
+
url = 'https://github.com/tetramo-labs/glassly'
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
repositories {
|
|
387
|
+
maven {
|
|
388
|
+
name = 'sonatypeCentral'
|
|
389
|
+
def repositoryUrl = System.getenv('GLASSLY_MAVEN_STAGING_REPOSITORY_URL') ?: 'https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/'
|
|
390
|
+
url = uri(repositoryUrl)
|
|
391
|
+
if (repositoryUrl.startsWith('http')) {
|
|
392
|
+
credentials {
|
|
393
|
+
username = centralUsername()
|
|
394
|
+
password = centralPassword()
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
signing {
|
|
402
|
+
def inMemorySigningKey = signingKey()
|
|
403
|
+
if (inMemorySigningKey) {
|
|
404
|
+
useInMemoryPgpKeys(inMemorySigningKey, signingPassword())
|
|
405
|
+
} else if (shouldUseGpgCmd()) {
|
|
406
|
+
useGpgCmd()
|
|
407
|
+
}
|
|
408
|
+
required {
|
|
409
|
+
isCentralPublishTask()
|
|
410
|
+
}
|
|
411
|
+
sign publishing.publications.release
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
tasks.withType(Sign).configureEach {
|
|
416
|
+
onlyIf { isCentralPublishTask() }
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
tasks.register('uploadSonatypeCentralDeployment') {
|
|
420
|
+
group = 'publishing'
|
|
421
|
+
description = "Uploads the ${mavenGroupId} OSSRH compatibility repository to the Central Portal."
|
|
422
|
+
def releasePublishTaskPath = project.path == ':'
|
|
423
|
+
? ':publishReleasePublicationToSonatypeCentralRepository'
|
|
424
|
+
: "${project.path}:publishReleasePublicationToSonatypeCentralRepository"
|
|
425
|
+
dependsOn ':lc3Lib:publishReleasePublicationToSonatypeCentralRepository',
|
|
426
|
+
releasePublishTaskPath
|
|
427
|
+
|
|
428
|
+
doLast {
|
|
429
|
+
def username = centralUsername(true)
|
|
430
|
+
def password = centralPassword(true)
|
|
431
|
+
if (!username || !password) {
|
|
432
|
+
throw new GradleException('Set sonatypeTokenBase64 or sonatypeUsername/sonatypePassword before uploading to Central.')
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
def publishingType = (findProperty('sonatypePublishingType') ?: System.getenv('SONATYPE_PUBLISHING_TYPE') ?: 'user_managed').toString()
|
|
436
|
+
def endpoint = new URL("https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/${mavenGroupId}?publishing_type=${publishingType}")
|
|
437
|
+
def connection = endpoint.openConnection()
|
|
438
|
+
connection.requestMethod = 'POST'
|
|
439
|
+
connection.setRequestProperty('Authorization', "Bearer ${"${username}:${password}".bytes.encodeBase64()}")
|
|
440
|
+
connection.setRequestProperty('Content-Length', '0')
|
|
441
|
+
|
|
442
|
+
def statusCode = connection.responseCode
|
|
443
|
+
def responseBody = statusCode >= 400 ? connection.errorStream?.text : connection.inputStream?.text
|
|
444
|
+
if (statusCode < 200 || statusCode >= 300) {
|
|
445
|
+
throw new GradleException("Central deployment upload failed with HTTP ${statusCode}: ${responseBody ?: ''}")
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
println "Sonatype Central deployment upload requested for ${mavenGroupId} (${publishingType})."
|
|
449
|
+
}
|
|
450
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Copy these values into ~/.gradle/gradle.properties or inject them as CI
|
|
2
|
+
# secrets before running Android Maven publishing tasks. Do not commit real
|
|
3
|
+
# Sonatype tokens, GPG key names, or GPG passphrases.
|
|
4
|
+
sonatypeTokenBase64=...
|
|
5
|
+
sonatypePublishingType=user_managed
|
|
6
|
+
signing.useGpgCmd=true
|
|
7
|
+
signing.gnupg.executable=/opt/homebrew/bin/gpg
|
|
8
|
+
signing.gnupg.keyName=...
|
|
9
|
+
signing.gnupg.passphrase=...
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import groovy.json.JsonSlurper
|
|
2
|
+
|
|
3
|
+
plugins {
|
|
4
|
+
id 'com.android.library'
|
|
5
|
+
id 'maven-publish'
|
|
6
|
+
id 'signing'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
def packageJson = new JsonSlurper().parse(file("../../package.json"))
|
|
10
|
+
def mavenGroupId = 'com.glassly'
|
|
11
|
+
def mavenPublishVersion = (findProperty('glasslyMavenVersion') ?: System.getenv('MAVEN_VERSION') ?: packageJson.version).toString()
|
|
12
|
+
|
|
13
|
+
group = mavenGroupId
|
|
14
|
+
version = mavenPublishVersion
|
|
15
|
+
|
|
16
|
+
def credentialValue = { List<String> propertyNames, List<String> envNames ->
|
|
17
|
+
for (propertyName in propertyNames) {
|
|
18
|
+
def value = findProperty(propertyName)
|
|
19
|
+
if (value != null && value.toString().trim()) {
|
|
20
|
+
return value.toString()
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
for (envName in envNames) {
|
|
24
|
+
def value = System.getenv(envName)
|
|
25
|
+
if (value != null && value.trim()) {
|
|
26
|
+
return value
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return null
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
def centralTokenParts = { boolean failOnInvalid = false ->
|
|
33
|
+
def token = credentialValue(['sonatypeTokenBase64', 'mavenCentralTokenBase64'], ['SONATYPE_TOKEN_BASE64', 'MAVEN_CENTRAL_TOKEN_BASE64'])
|
|
34
|
+
if (!token) {
|
|
35
|
+
return null
|
|
36
|
+
}
|
|
37
|
+
def decoded
|
|
38
|
+
try {
|
|
39
|
+
decoded = new String(token.decodeBase64(), 'UTF-8')
|
|
40
|
+
} catch (Exception e) {
|
|
41
|
+
if (failOnInvalid) {
|
|
42
|
+
throw new GradleException('Sonatype token must be valid base64 for username:password', e)
|
|
43
|
+
}
|
|
44
|
+
return null
|
|
45
|
+
}
|
|
46
|
+
def separator = decoded.indexOf(':')
|
|
47
|
+
if (separator <= 0) {
|
|
48
|
+
if (failOnInvalid) {
|
|
49
|
+
throw new GradleException('Sonatype token must decode to username:password')
|
|
50
|
+
}
|
|
51
|
+
return null
|
|
52
|
+
}
|
|
53
|
+
return [decoded.substring(0, separator), decoded.substring(separator + 1)]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
def centralUsername = { boolean failOnInvalidToken = false ->
|
|
57
|
+
credentialValue(['sonatypeUsername', 'mavenCentralUsername'], ['SONATYPE_USERNAME', 'MAVEN_CENTRAL_USERNAME']) ?: centralTokenParts(failOnInvalidToken)?.get(0)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
def centralPassword = { boolean failOnInvalidToken = false ->
|
|
61
|
+
credentialValue(['sonatypePassword', 'mavenCentralPassword'], ['SONATYPE_PASSWORD', 'MAVEN_CENTRAL_PASSWORD']) ?: centralTokenParts(failOnInvalidToken)?.get(1)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
def signingKey = {
|
|
65
|
+
credentialValue(['signingKey'], ['SIGNING_KEY'])
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
def signingPassword = {
|
|
69
|
+
credentialValue(['signingPassword'], ['SIGNING_PASSWORD'])
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
def shouldUseGpgCmd = {
|
|
73
|
+
(credentialValue(['signing.useGpgCmd'], ['SIGNING_USE_GPG_CMD']) ?: 'false').toBoolean()
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
def isCentralPublishTask = {
|
|
77
|
+
gradle.taskGraph.allTasks.any { it.name.toLowerCase().contains('sonatypecentral') }
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
gradle.taskGraph.whenReady {
|
|
81
|
+
if (isCentralPublishTask()) {
|
|
82
|
+
centralUsername(true)
|
|
83
|
+
centralPassword(true)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
android {
|
|
88
|
+
namespace "com.glassly.lc3Lib"
|
|
89
|
+
compileSdk 33
|
|
90
|
+
|
|
91
|
+
publishing {
|
|
92
|
+
singleVariant("release") {
|
|
93
|
+
withSourcesJar()
|
|
94
|
+
withJavadocJar()
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
packagingOptions {
|
|
99
|
+
exclude 'META-INF/proguard/androidx-annotations.pro'
|
|
100
|
+
resources {
|
|
101
|
+
excludes += '/META-INF/{AL2.0,LGPL2.1,DEPENDENCIES}'
|
|
102
|
+
excludes += '/META-INF/INDEX.LIST'
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
defaultConfig {
|
|
107
|
+
minSdk 28
|
|
108
|
+
targetSdk 32
|
|
109
|
+
versionCode 3
|
|
110
|
+
versionName "0.1"
|
|
111
|
+
|
|
112
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
113
|
+
|
|
114
|
+
ndk {
|
|
115
|
+
// Honor reactNativeArchitectures so CI/staging ABI filters apply.
|
|
116
|
+
// Without this, CMake still builds every ABI on an arm64-only job.
|
|
117
|
+
def abiList = (findProperty("reactNativeArchitectures") ?: "armeabi-v7a,arm64-v8a,x86,x86_64")
|
|
118
|
+
.toString()
|
|
119
|
+
.split(",")
|
|
120
|
+
.collect { it.trim() }
|
|
121
|
+
.findAll { !it.isEmpty() }
|
|
122
|
+
abiFilters(*abiList)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
externalNativeBuild {
|
|
126
|
+
cmake {
|
|
127
|
+
arguments '-DCMAKE_OBJECT_PATH_MAX=600', '-DANDROID_STL=c++_static'
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
externalNativeBuild {
|
|
133
|
+
cmake {
|
|
134
|
+
path file('src/main/cpp/liblc3/CMakeLists.txt')
|
|
135
|
+
version '3.22.1'
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
dependencies {
|
|
142
|
+
testImplementation 'junit:junit:4.13.2'
|
|
143
|
+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
afterEvaluate {
|
|
147
|
+
publishing {
|
|
148
|
+
publications {
|
|
149
|
+
release(MavenPublication) {
|
|
150
|
+
groupId = mavenGroupId
|
|
151
|
+
artifactId = 'lc3Lib'
|
|
152
|
+
version = project.version
|
|
153
|
+
|
|
154
|
+
from components.release
|
|
155
|
+
|
|
156
|
+
pom {
|
|
157
|
+
name = 'Glassly LC3 Android Library'
|
|
158
|
+
description = 'LC3 audio codec support for Glassly Bluetooth SDK'
|
|
159
|
+
url = 'https://github.com/tetramo-labs/glassly'
|
|
160
|
+
licenses {
|
|
161
|
+
license {
|
|
162
|
+
name = 'MIT License'
|
|
163
|
+
url = 'https://opensource.org/licenses/MIT'
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
developers {
|
|
167
|
+
developer {
|
|
168
|
+
id = 'glassly'
|
|
169
|
+
name = 'Glassly'
|
|
170
|
+
email = 'dev@glassly.com'
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
scm {
|
|
174
|
+
connection = 'scm:git:https://github.com/tetramo-labs/glassly.git'
|
|
175
|
+
developerConnection = 'scm:git:ssh://git@github.com:tetramo-labs/glassly.git'
|
|
176
|
+
url = 'https://github.com/tetramo-labs/glassly'
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
repositories {
|
|
182
|
+
maven {
|
|
183
|
+
name = 'sonatypeCentral'
|
|
184
|
+
def repositoryUrl = System.getenv('GLASSLY_MAVEN_STAGING_REPOSITORY_URL') ?: 'https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/'
|
|
185
|
+
url = uri(repositoryUrl)
|
|
186
|
+
if (repositoryUrl.startsWith('http')) {
|
|
187
|
+
credentials {
|
|
188
|
+
username = centralUsername()
|
|
189
|
+
password = centralPassword()
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
signing {
|
|
197
|
+
def inMemorySigningKey = signingKey()
|
|
198
|
+
if (inMemorySigningKey) {
|
|
199
|
+
useInMemoryPgpKeys(inMemorySigningKey, signingPassword())
|
|
200
|
+
} else if (shouldUseGpgCmd()) {
|
|
201
|
+
useGpgCmd()
|
|
202
|
+
}
|
|
203
|
+
required {
|
|
204
|
+
isCentralPublishTask()
|
|
205
|
+
}
|
|
206
|
+
sign publishing.publications.release
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
tasks.withType(Sign).configureEach {
|
|
211
|
+
onlyIf { isCentralPublishTask() }
|
|
212
|
+
}
|