@mentra/bluetooth-sdk 0.1.0
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 +278 -0
- package/android/build.gradle +167 -0
- package/android/lc3Lib/CMakeLists.txt +6 -0
- package/android/lc3Lib/build.gradle +109 -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/mentra/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 +1 -0
- package/android/src/main/AndroidManifest.xml +40 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkModule.kt +528 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/Bridge.kt +610 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +1616 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceStore.kt +314 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothModels.kt +1710 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothSdk.kt +554 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/ObservableStore.kt +68 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/controllers/ControllerManager.kt +158 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/controllers/R1.kt +934 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/services/Foreground.kt +175 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/services/PhoneMic.kt +1109 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G1.java +3974 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G2.kt +3551 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Mach1.java +1327 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.java +6959 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraNex.kt +1655 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraosBle.java +53675 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/SGCManager.kt +202 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Simulated.kt +224 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/stt/STTTools.kt +340 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/stt/SherpaOnnxTranscriber.kt +465 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/stt/VadGateSpeechPolicy.kt +221 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/AES.java +106 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/AudioSessionMonitor.kt +189 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/BitmapJavaUtils.java +169 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/BlePhotoUploadService.java +179 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/Constants.kt +44 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/G1Text.kt +436 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/IncidentLogBleRelayNaming.java +29 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/IncidentLogBleUploadService.java +76 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/K900ProtocolUtils.java +791 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/MessageChunker.java +186 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/NexSGCUtils.kt +589 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/PhoneAudioMonitor.kt +303 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/SmartGlassesConnectionState.java +9 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/audio/ByteUtilAudioPlayer.java +655 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/audio/Lc3Player.java +441 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/audio/PCMAudioPlayer.java +431 -0
- package/android/src/main/res/values/strings.xml +4 -0
- package/app.plugin.js +1 -0
- package/build/BluetoothSdk.types.d.ts +498 -0
- package/build/BluetoothSdk.types.d.ts.map +1 -0
- package/build/BluetoothSdk.types.js +23 -0
- package/build/BluetoothSdk.types.js.map +1 -0
- package/build/BluetoothSdkModule.d.ts +71 -0
- package/build/BluetoothSdkModule.d.ts.map +1 -0
- package/build/BluetoothSdkModule.js +106 -0
- package/build/BluetoothSdkModule.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +5 -0
- package/build/index.js.map +1 -0
- package/expo-module.config.json +9 -0
- package/ios/BluetoothSdkModule.swift +665 -0
- package/ios/MentraBluetoothSDK.podspec +77 -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/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 +1659 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Headers/cargs.h +162 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Headers/sherpa-onnx/c-api/c-api.h +1852 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Headers/sherpa-onnx/c-api/cxx-api.h +674 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Info.plist +44 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/libsherpa-onnx.a +0 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/sherpa-onnx.a +0 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/libsherpa-onnx.a +0 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/sherpa-onnx.a +0 -0
- package/ios/Packages/VAD/Common/VAD/VADQuality.swift +41 -0
- package/ios/Packages/VAD/Common/VAD/VADState.swift +26 -0
- package/ios/Packages/VAD/Common/VAD/VADStrategy.swift +29 -0
- package/ios/Packages/VAD/Common/VAD/VADType.swift +14 -0
- package/ios/Packages/VAD/Data/Configuration.swift +68 -0
- package/ios/Packages/VAD/Data/FrameSize.swift +39 -0
- package/ios/Packages/VAD/Data/Record.swift +13 -0
- package/ios/Packages/VAD/Data/Result.swift +22 -0
- package/ios/Packages/VAD/Data/SampleRate.swift +48 -0
- package/ios/Packages/VAD/Silero/Model/silero_vad.onnx +0 -0
- package/ios/Packages/VAD/Silero/SileroVAD.swift +284 -0
- package/ios/Packages/VAD/Silero/SileroVADStrategy.swift +64 -0
- package/ios/Packages/libbz2/module.modulemap +5 -0
- package/ios/Packages/libbz2/shim.h +1 -0
- package/ios/Source/Bridge.swift +353 -0
- package/ios/Source/Bridging-Header.h +16 -0
- package/ios/Source/DeviceManager.swift +1478 -0
- package/ios/Source/DeviceStore.swift +295 -0
- package/ios/Source/MentraBluetoothSDK.swift +2439 -0
- package/ios/Source/ObservableStore.swift +88 -0
- package/ios/Source/PrivacyInfo.xcprivacy +23 -0
- package/ios/Source/controllers/ControllerManager.swift +187 -0
- package/ios/Source/controllers/R1.swift +827 -0
- package/ios/Source/services/PhoneMic.swift +662 -0
- package/ios/Source/sgcs/Frame.swift +651 -0
- package/ios/Source/sgcs/G1.swift +2505 -0
- package/ios/Source/sgcs/G2.swift +3730 -0
- package/ios/Source/sgcs/Mach1.swift +543 -0
- package/ios/Source/sgcs/MentraLive.swift +4708 -0
- package/ios/Source/sgcs/MentraNex.swift +2479 -0
- package/ios/Source/sgcs/SGCManager.swift +243 -0
- package/ios/Source/sgcs/Simulated.swift +270 -0
- package/ios/Source/sgcs/mentraos_ble.pb.swift +3811 -0
- package/ios/Source/stt/STTTools.swift +154 -0
- package/ios/Source/stt/SherpaOnnxTranscriber.swift +401 -0
- package/ios/Source/utils/AudioSessionMonitor.swift +283 -0
- package/ios/Source/utils/Constants.swift +74 -0
- package/ios/Source/utils/Enums.swift +95 -0
- package/ios/Source/utils/G1Text.swift +2067 -0
- package/ios/Source/utils/JSCExperiment.swift +241 -0
- package/ios/Source/utils/MemoryMonitor.swift +44 -0
- package/ios/Source/utils/MessageChunker.swift +164 -0
- package/ios/Source/utils/Models.swift +135 -0
- package/ios/Source/utils/PhoneAudioMonitor.swift +226 -0
- package/ios/Source/utils/TarBz2Extractor.swift +206 -0
- package/package.json +78 -0
- package/plugin/build/index.d.ts +6 -0
- package/plugin/build/index.js +12 -0
- package/plugin/build/withAndroid.d.ts +4 -0
- package/plugin/build/withAndroid.js +80 -0
- package/plugin/build/withIos.d.ts +4 -0
- package/plugin/build/withIos.js +64 -0
- package/src/BluetoothSdk.types.ts +581 -0
- package/src/BluetoothSdkModule.ts +259 -0
- package/src/index.ts +4 -0
package/README.md
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# @mentra/bluetooth-sdk
|
|
2
|
+
|
|
3
|
+
React Native and Expo SDK for connecting mobile apps directly to supported Mentra smart glasses over Bluetooth.
|
|
4
|
+
|
|
5
|
+
The package includes:
|
|
6
|
+
|
|
7
|
+
- A React Native / Expo module API exposed as `BluetoothSdk`.
|
|
8
|
+
- Native Android code published as `com.mentra:bluetooth-sdk`.
|
|
9
|
+
- Native iOS code published as the `MentraBluetoothSDK` CocoaPod.
|
|
10
|
+
- An Expo config plugin that wires the native dependencies into generated Android and iOS projects.
|
|
11
|
+
|
|
12
|
+
Use a development build or production native build. Expo Go cannot load this package because the SDK contains native code.
|
|
13
|
+
|
|
14
|
+
## Requirements
|
|
15
|
+
|
|
16
|
+
- React Native `0.72+`.
|
|
17
|
+
- Expo `49+` when using Expo.
|
|
18
|
+
- Android min SDK `28+`.
|
|
19
|
+
- iOS deployment target `15.1+`.
|
|
20
|
+
- A physical phone for real Bluetooth testing.
|
|
21
|
+
- Bluetooth permissions, plus Android location permission where BLE scanning requires it.
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npm install @mentra/bluetooth-sdk
|
|
27
|
+
npx expo install expo-build-properties
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
For Expo apps, add the plugin to `app.json` or `app.config.ts`:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"expo": {
|
|
35
|
+
"plugins": [
|
|
36
|
+
[
|
|
37
|
+
"@mentra/bluetooth-sdk",
|
|
38
|
+
{
|
|
39
|
+
"node": true
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
[
|
|
43
|
+
"expo-build-properties",
|
|
44
|
+
{
|
|
45
|
+
"android": {
|
|
46
|
+
"minSdkVersion": 28,
|
|
47
|
+
"packagingOptions": {
|
|
48
|
+
"pickFirst": [
|
|
49
|
+
"**/libc++_shared.so",
|
|
50
|
+
"**/libonnxruntime.so",
|
|
51
|
+
"**/libonnxruntime4j_jni.so"
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Then regenerate native projects and run a development build:
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
npx expo prebuild
|
|
66
|
+
npx expo run:ios
|
|
67
|
+
# or
|
|
68
|
+
npx expo run:android
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Permissions
|
|
72
|
+
|
|
73
|
+
Android apps should request the permissions required by the features they use:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"android": {
|
|
78
|
+
"permissions": [
|
|
79
|
+
"android.permission.BLUETOOTH",
|
|
80
|
+
"android.permission.BLUETOOTH_ADMIN",
|
|
81
|
+
"android.permission.BLUETOOTH_SCAN",
|
|
82
|
+
"android.permission.BLUETOOTH_CONNECT",
|
|
83
|
+
"android.permission.ACCESS_FINE_LOCATION",
|
|
84
|
+
"android.permission.RECORD_AUDIO",
|
|
85
|
+
"android.permission.INTERNET",
|
|
86
|
+
"android.permission.POST_NOTIFICATIONS"
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Some Android 12+ devices still require Location permission and Location services before BLE scan callbacks are delivered.
|
|
93
|
+
|
|
94
|
+
iOS apps should include usage descriptions:
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"ios": {
|
|
99
|
+
"infoPlist": {
|
|
100
|
+
"NSBluetoothAlwaysUsageDescription": "This app connects to your smart glasses over Bluetooth.",
|
|
101
|
+
"NSMicrophoneUsageDescription": "This app uses the microphone when you enable audio features.",
|
|
102
|
+
"NSLocalNetworkUsageDescription": "This app connects to local photo and streaming helpers during development."
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Minimal Usage
|
|
109
|
+
|
|
110
|
+
`startScan()` starts the scan. Discovered devices arrive asynchronously through `onBluetoothStatus()` updates and `device_discovered` events.
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
import BluetoothSdk, {
|
|
114
|
+
isReadyGlassesConnectionStatus,
|
|
115
|
+
type Device,
|
|
116
|
+
} from '@mentra/bluetooth-sdk'
|
|
117
|
+
|
|
118
|
+
const firstDevice = new Promise<Device>((resolve) => {
|
|
119
|
+
let removeBluetoothListener = () => {}
|
|
120
|
+
removeBluetoothListener = BluetoothSdk.onBluetoothStatus((status) => {
|
|
121
|
+
const device = status.searchResults?.[0]
|
|
122
|
+
if (device) {
|
|
123
|
+
removeBluetoothListener()
|
|
124
|
+
resolve(device)
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
const removeGlassesListener = BluetoothSdk.onGlassesStatus((status) => {
|
|
130
|
+
console.log('Glasses status changed', status)
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
await BluetoothSdk.startScan({model: 'Mentra Live'})
|
|
134
|
+
|
|
135
|
+
await BluetoothSdk.connect(await firstDevice)
|
|
136
|
+
|
|
137
|
+
const glasses = await BluetoothSdk.getGlassesStatus()
|
|
138
|
+
if (isReadyGlassesConnectionStatus(glasses.connection)) {
|
|
139
|
+
await BluetoothSdk.displayText({
|
|
140
|
+
text: 'Hello from Mentra',
|
|
141
|
+
x: 0,
|
|
142
|
+
y: 0,
|
|
143
|
+
size: 24,
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
removeGlassesListener()
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
React Native status exposes `GlassesStatus.connection` as a discriminated union:
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
type GlassesConnectionStatus =
|
|
154
|
+
| {state: 'disconnected'}
|
|
155
|
+
| {state: 'scanning'}
|
|
156
|
+
| {state: 'connecting'}
|
|
157
|
+
| {state: 'bonding'}
|
|
158
|
+
| {state: 'connected'; fullyBooted: boolean}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Use `connection.state` for link progress. `fullyBooted` only exists when `state === 'connected'`. Android and iOS native APIs also keep `connectionState`, `connected`, and `fullyBooted` as native status properties for Kotlin and Swift callers.
|
|
162
|
+
|
|
163
|
+
## Default Device
|
|
164
|
+
|
|
165
|
+
`connectDefault()` connects to the default glasses target currently stored in the SDK. Apps that want this target to survive app restarts should persist the scanned `Device` in app storage and restore it with `setDefaultDevice()` before calling `connectDefault()`.
|
|
166
|
+
|
|
167
|
+
```ts
|
|
168
|
+
const savedDevice = await loadSavedDeviceFromYourAppStorage()
|
|
169
|
+
if (savedDevice) {
|
|
170
|
+
await BluetoothSdk.setDefaultDevice(savedDevice)
|
|
171
|
+
await BluetoothSdk.connectDefault()
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const discoveredDevice = await scanAndChooseDevice()
|
|
175
|
+
await BluetoothSdk.connect(discoveredDevice)
|
|
176
|
+
await saveDeviceToYourAppStorage(discoveredDevice)
|
|
177
|
+
|
|
178
|
+
await BluetoothSdk.clearDefaultDevice()
|
|
179
|
+
await saveDeviceToYourAppStorage(null)
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Common Commands
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
await BluetoothSdk.clearDisplay()
|
|
186
|
+
await BluetoothSdk.showDashboard()
|
|
187
|
+
|
|
188
|
+
await BluetoothSdk.requestWifiScan()
|
|
189
|
+
await BluetoothSdk.sendWifiCredentials('Office WiFi', 'secret')
|
|
190
|
+
await BluetoothSdk.forgetWifiNetwork('Office WiFi')
|
|
191
|
+
await BluetoothSdk.setHotspotState(true)
|
|
192
|
+
|
|
193
|
+
await BluetoothSdk.setGalleryMode('auto')
|
|
194
|
+
await BluetoothSdk.setGalleryMode('manual')
|
|
195
|
+
|
|
196
|
+
await BluetoothSdk.setMicState(true, true, false)
|
|
197
|
+
await BluetoothSdk.setOwnAppAudioPlaying(false)
|
|
198
|
+
|
|
199
|
+
await BluetoothSdk.rgbLedControl(
|
|
200
|
+
`led-${Date.now()}`,
|
|
201
|
+
'com.example.app',
|
|
202
|
+
'on',
|
|
203
|
+
'green',
|
|
204
|
+
500,
|
|
205
|
+
500,
|
|
206
|
+
3,
|
|
207
|
+
)
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Photo Upload
|
|
211
|
+
|
|
212
|
+
```ts
|
|
213
|
+
await BluetoothSdk.photoRequest(
|
|
214
|
+
`photo-${Date.now()}`,
|
|
215
|
+
'com.example.app',
|
|
216
|
+
'medium',
|
|
217
|
+
'https://api.example.com/mentra/photo',
|
|
218
|
+
'optional-token',
|
|
219
|
+
'medium',
|
|
220
|
+
false,
|
|
221
|
+
true,
|
|
222
|
+
)
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
The webhook should accept multipart form data with a `photo` file and `requestId`. If `authToken` is provided, the uploader adds `Authorization: Bearer <token>`.
|
|
226
|
+
|
|
227
|
+
## Streaming
|
|
228
|
+
|
|
229
|
+
```ts
|
|
230
|
+
const streamId = `stream-${Date.now()}`
|
|
231
|
+
|
|
232
|
+
await BluetoothSdk.startStream({
|
|
233
|
+
type: 'start_stream',
|
|
234
|
+
streamUrl: 'http://192.168.1.42:8889/mentra-live/whip',
|
|
235
|
+
streamId,
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
await BluetoothSdk.keepStreamAlive({
|
|
239
|
+
type: 'keep_stream_alive',
|
|
240
|
+
streamId,
|
|
241
|
+
ackId: `ack-${Date.now()}`,
|
|
242
|
+
})
|
|
243
|
+
|
|
244
|
+
await BluetoothSdk.stopStream()
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Use `rtmp://` or `rtmps://` for RTMP, `srt://` for SRT, and `http://` or `https://` for WHIP/WebRTC ingest. Send keep-alives about every 15 seconds while streaming.
|
|
248
|
+
|
|
249
|
+
## Events
|
|
250
|
+
|
|
251
|
+
```ts
|
|
252
|
+
const subscriptions = [
|
|
253
|
+
BluetoothSdk.addListener('button_press', (event) => console.log(event)),
|
|
254
|
+
BluetoothSdk.addListener('touch_event', (event) => console.log(event)),
|
|
255
|
+
BluetoothSdk.addListener('photo_response', (event) => console.log(event)),
|
|
256
|
+
BluetoothSdk.addListener('stream_status', (event) => console.log(event)),
|
|
257
|
+
BluetoothSdk.addListener('mic_pcm', (event) => console.log(event.pcm)),
|
|
258
|
+
]
|
|
259
|
+
|
|
260
|
+
subscriptions.forEach((subscription) => subscription.remove())
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Common event names include `button_press`, `touch_event`, `head_up`, `battery_status`, `wifi_status_change`, `hotspot_status_change`, `photo_response`, `gallery_status`, `stream_status`, `keep_alive_ack`, `mic_pcm`, `mic_lc3`, `local_transcription`, `rgb_led_control_response`, `audio_connected`, `audio_disconnected`, `log`, `send_command_to_ble`, and `receive_command_from_ble`.
|
|
264
|
+
|
|
265
|
+
## Local SDK Development
|
|
266
|
+
|
|
267
|
+
For normal app development, install the published npm package. For SDK development before a package release, install a local checkout and point Metro/native resolution at the same path:
|
|
268
|
+
|
|
269
|
+
```sh
|
|
270
|
+
npm install --no-save /path/to/MentraOS/mobile/modules/bluetooth-sdk
|
|
271
|
+
MENTRA_BLUETOOTH_SDK_PACKAGE_PATH=/path/to/MentraOS/mobile/modules/bluetooth-sdk npx expo run:ios
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Use `npx expo run:android` for Android. Keep local paths in your shell or CI environment, not in committed app config.
|
|
275
|
+
|
|
276
|
+
## Example App
|
|
277
|
+
|
|
278
|
+
The partner example app lives in `Mentra-Bluetooth-SDK-Partner-Kit/examples/react-native`. It demonstrates scan/connect, display, camera photo upload, RTMP/SRT/WebRTC streaming, Wi-Fi/hotspot, microphone PCM, RGB LED, gallery-button mode, and console event inspection.
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import groovy.json.JsonSlurper
|
|
2
|
+
|
|
3
|
+
apply plugin: 'com.android.library'
|
|
4
|
+
apply plugin: 'maven-publish'
|
|
5
|
+
apply plugin: 'signing'
|
|
6
|
+
|
|
7
|
+
def packageJson = new JsonSlurper().parse(file("../package.json"))
|
|
8
|
+
|
|
9
|
+
group = 'com.mentra'
|
|
10
|
+
version = packageJson.version
|
|
11
|
+
|
|
12
|
+
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
13
|
+
apply from: expoModulesCorePlugin
|
|
14
|
+
applyKotlinExpoModulesCorePlugin()
|
|
15
|
+
useExpoPublishing()
|
|
16
|
+
|
|
17
|
+
// If you want to use the managed Android SDK versions from expo-modules-core, set this to true.
|
|
18
|
+
// The Android SDK versions will be bumped from time to time in SDK releases and may introduce breaking changes in your module code.
|
|
19
|
+
// Most of the time, you may like to manage the Android SDK versions yourself.
|
|
20
|
+
def useManagedAndroidSdkVersions = false
|
|
21
|
+
if (useManagedAndroidSdkVersions) {
|
|
22
|
+
useDefaultAndroidSdkVersions()
|
|
23
|
+
} else {
|
|
24
|
+
buildscript {
|
|
25
|
+
// Simple helper that allows the root project to override versions declared by this library.
|
|
26
|
+
ext.safeExtGet = { prop, fallback ->
|
|
27
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
project.android {
|
|
31
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 36)
|
|
32
|
+
defaultConfig {
|
|
33
|
+
minSdkVersion safeExtGet("minSdkVersion", 28)
|
|
34
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 36)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
android {
|
|
40
|
+
namespace "com.mentra.bluetoothsdk"
|
|
41
|
+
defaultConfig {
|
|
42
|
+
versionCode 1
|
|
43
|
+
versionName packageJson.version
|
|
44
|
+
}
|
|
45
|
+
publishing {
|
|
46
|
+
singleVariant("release") {
|
|
47
|
+
withSourcesJar()
|
|
48
|
+
withJavadocJar()
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
lintOptions {
|
|
52
|
+
abortOnError false
|
|
53
|
+
}
|
|
54
|
+
packagingOptions {
|
|
55
|
+
pickFirst '**/libjsc.so'
|
|
56
|
+
pickFirst '**/libc++_shared.so'
|
|
57
|
+
pickFirst '**/libonnxruntime.so'
|
|
58
|
+
pickFirst '**/libonnxruntime4j_jni.so'
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
dependencies {
|
|
63
|
+
// Expo adapter class is compiled into the MentraOS module, but the bare SDK
|
|
64
|
+
// artifact should not expose Expo as a runtime dependency.
|
|
65
|
+
compileOnly project(':expo-modules-core')
|
|
66
|
+
|
|
67
|
+
// Kotlin standard library (explicitly added for IDE support)
|
|
68
|
+
// Version is managed by Expo modules, but explicit dependency helps IDE indexing
|
|
69
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
|
|
70
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
|
71
|
+
|
|
72
|
+
implementation "androidx.lifecycle:lifecycle-service:2.6.1"
|
|
73
|
+
implementation "org.greenrobot:eventbus:3.3.1"
|
|
74
|
+
implementation 'com.google.code.gson:gson:2.10.1'
|
|
75
|
+
|
|
76
|
+
// Google Play Services for location settings dialog
|
|
77
|
+
implementation 'com.google.android.gms:play-services-location:21.0.1'
|
|
78
|
+
implementation 'com.google.android.gms:play-services-base:18.2.0'
|
|
79
|
+
|
|
80
|
+
// Apache Commons Compress for tar.bz2 extraction
|
|
81
|
+
implementation 'org.apache.commons:commons-compress:1.24.0'
|
|
82
|
+
|
|
83
|
+
// OkHttp for HTTP requests
|
|
84
|
+
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
|
|
85
|
+
|
|
86
|
+
// LC3 audio codec library
|
|
87
|
+
implementation project(':lc3Lib')
|
|
88
|
+
|
|
89
|
+
// Sherpa-ONNX for local transcription
|
|
90
|
+
implementation 'com.github.k2-fsa:sherpa-onnx:v1.12.8'
|
|
91
|
+
|
|
92
|
+
// Silero VAD (with onnxruntime exclusions to avoid conflicts with sherpa-onnx)
|
|
93
|
+
implementation ('com.github.gkonovalov:android-vad:2.0.9') {
|
|
94
|
+
exclude group: 'com.microsoft.onnxruntime', module: 'onnxruntime'
|
|
95
|
+
exclude group: 'com.microsoft.onnxruntime', module: 'onnxruntime4j'
|
|
96
|
+
exclude group: 'com.microsoft.onnxruntime', module: 'onnxruntime4j-jni'
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Vuzix Z100
|
|
100
|
+
implementation 'com.vuzix:ultralite-sdk-android:1.8'
|
|
101
|
+
implementation 'com.squareup.picasso:picasso:2.8'
|
|
102
|
+
|
|
103
|
+
implementation 'com.google.protobuf:protobuf-java:4.32.0'
|
|
104
|
+
implementation 'com.google.protobuf:protobuf-java-util:4.32.0'
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Force override onnxruntime version to 1.17.1
|
|
108
|
+
configurations.all {
|
|
109
|
+
resolutionStrategy {
|
|
110
|
+
eachDependency { DependencyResolveDetails details ->
|
|
111
|
+
if (details.requested.group == 'com.microsoft.onnxruntime') {
|
|
112
|
+
details.useVersion '1.17.1'
|
|
113
|
+
details.because('Force override vad\'s transitive version')
|
|
114
|
+
}
|
|
115
|
+
if (details.requested.name == 'onnxruntime-android') {
|
|
116
|
+
details.useVersion '1.17.1'
|
|
117
|
+
details.because('Force override vad\'s transitive version')
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
afterEvaluate {
|
|
124
|
+
publishing {
|
|
125
|
+
publications {
|
|
126
|
+
release(MavenPublication) {
|
|
127
|
+
groupId = 'com.mentra'
|
|
128
|
+
artifactId = 'bluetooth-sdk'
|
|
129
|
+
version = project.version
|
|
130
|
+
|
|
131
|
+
from components.release
|
|
132
|
+
|
|
133
|
+
pom {
|
|
134
|
+
name = 'Mentra Bluetooth SDK'
|
|
135
|
+
description = 'SDK for communicating with smart glasses'
|
|
136
|
+
url = 'https://github.com/Mentra-Community/MentraOS'
|
|
137
|
+
licenses {
|
|
138
|
+
license {
|
|
139
|
+
name = 'MIT License'
|
|
140
|
+
url = 'https://opensource.org/licenses/MIT'
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
developers {
|
|
144
|
+
developer {
|
|
145
|
+
id = 'mentra'
|
|
146
|
+
name = 'Mentra'
|
|
147
|
+
email = 'dev@mentra.glass'
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
scm {
|
|
151
|
+
connection = 'scm:git:https://github.com/Mentra-Community/MentraOS.git'
|
|
152
|
+
developerConnection = 'scm:git:ssh://git@github.com:Mentra-Community/MentraOS.git'
|
|
153
|
+
url = 'https://github.com/Mentra-Community/MentraOS'
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
signing {
|
|
161
|
+
required {
|
|
162
|
+
gradle.taskGraph.allTasks.any { it.name.toLowerCase().contains("publish") } &&
|
|
163
|
+
(findProperty("signing.keyId") || findProperty("signingKey"))
|
|
164
|
+
}
|
|
165
|
+
sign publishing.publications.release
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
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
|
+
|
|
11
|
+
group = 'com.mentra'
|
|
12
|
+
version = packageJson.version
|
|
13
|
+
|
|
14
|
+
def isPublishTask = {
|
|
15
|
+
gradle.taskGraph.allTasks.any { it.name.toLowerCase().contains("publish") }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
android {
|
|
19
|
+
namespace "com.mentra.lc3Lib"
|
|
20
|
+
compileSdk 33
|
|
21
|
+
|
|
22
|
+
publishing {
|
|
23
|
+
singleVariant("release") {
|
|
24
|
+
withSourcesJar()
|
|
25
|
+
withJavadocJar()
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
packagingOptions {
|
|
30
|
+
exclude 'META-INF/proguard/androidx-annotations.pro'
|
|
31
|
+
resources {
|
|
32
|
+
excludes += '/META-INF/{AL2.0,LGPL2.1,DEPENDENCIES}'
|
|
33
|
+
excludes += '/META-INF/INDEX.LIST'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
defaultConfig {
|
|
38
|
+
minSdk 28
|
|
39
|
+
targetSdk 32
|
|
40
|
+
versionCode 3
|
|
41
|
+
versionName "0.1"
|
|
42
|
+
|
|
43
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
44
|
+
|
|
45
|
+
externalNativeBuild {
|
|
46
|
+
cmake {
|
|
47
|
+
arguments '-DCMAKE_OBJECT_PATH_MAX=600', '-DANDROID_STL=c++_static'
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
externalNativeBuild {
|
|
53
|
+
cmake {
|
|
54
|
+
path file('src/main/cpp/liblc3/CMakeLists.txt')
|
|
55
|
+
version '3.22.1'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
dependencies {
|
|
62
|
+
testImplementation 'junit:junit:4.13.2'
|
|
63
|
+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
afterEvaluate {
|
|
67
|
+
publishing {
|
|
68
|
+
publications {
|
|
69
|
+
release(MavenPublication) {
|
|
70
|
+
groupId = 'com.mentra'
|
|
71
|
+
artifactId = 'lc3Lib'
|
|
72
|
+
version = project.version
|
|
73
|
+
|
|
74
|
+
from components.release
|
|
75
|
+
|
|
76
|
+
pom {
|
|
77
|
+
name = 'Mentra LC3 Android Library'
|
|
78
|
+
description = 'LC3 audio codec support for Mentra Bluetooth SDK'
|
|
79
|
+
url = 'https://github.com/Mentra-Community/MentraOS'
|
|
80
|
+
licenses {
|
|
81
|
+
license {
|
|
82
|
+
name = 'MIT License'
|
|
83
|
+
url = 'https://opensource.org/licenses/MIT'
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
developers {
|
|
87
|
+
developer {
|
|
88
|
+
id = 'mentra'
|
|
89
|
+
name = 'Mentra'
|
|
90
|
+
email = 'dev@mentra.glass'
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
scm {
|
|
94
|
+
connection = 'scm:git:https://github.com/Mentra-Community/MentraOS.git'
|
|
95
|
+
developerConnection = 'scm:git:ssh://git@github.com:Mentra-Community/MentraOS.git'
|
|
96
|
+
url = 'https://github.com/Mentra-Community/MentraOS'
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
signing {
|
|
104
|
+
required {
|
|
105
|
+
isPublishTask() && (findProperty("signing.keyId") || findProperty("signingKey"))
|
|
106
|
+
}
|
|
107
|
+
sign publishing.publications.release
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Add project specific ProGuard rules here.
|
|
2
|
+
# You can control the set of applied configuration files using the
|
|
3
|
+
# proguardFiles setting in build.gradle.
|
|
4
|
+
#
|
|
5
|
+
# For more details, see
|
|
6
|
+
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
7
|
+
|
|
8
|
+
# If your project uses WebView with JS, uncomment the following
|
|
9
|
+
# and specify the fully qualified class name to the JavaScript interface
|
|
10
|
+
# class:
|
|
11
|
+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
12
|
+
# public *;
|
|
13
|
+
#}
|
|
14
|
+
|
|
15
|
+
# Uncomment this to preserve the line number information for
|
|
16
|
+
# debugging stack traces.
|
|
17
|
+
#-keepattributes SourceFile,LineNumberTable
|
|
18
|
+
|
|
19
|
+
# If you keep the line number information, uncomment this to
|
|
20
|
+
# hide the original source file name.
|
|
21
|
+
#-renamesourcefileattribute SourceFile
|
|
22
|
+
|
|
23
|
+
#don't leave logs in release build:
|
|
24
|
+
-dontskipnonpubliclibraryclasses
|
|
25
|
+
-dontobfuscate
|
|
26
|
+
-forceprocessing
|
|
27
|
+
-optimizationpasses 5
|
|
28
|
+
|
|
29
|
+
-keep class * extends android.app.Activity
|
|
30
|
+
-assumenosideeffects class android.util.Log {
|
|
31
|
+
public static *** d(...);
|
|
32
|
+
public static *** v(...);
|
|
33
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Builds the ogg and opus encoder library which used third party module.
|
|
2
|
+
cmake_minimum_required(VERSION 3.22.1)
|
|
3
|
+
|
|
4
|
+
# set related path of third party libraries.
|
|
5
|
+
set(third_party_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../third_party)
|
|
6
|
+
|
|
7
|
+
# libogg library refer from https://github.com/xiph/ogg.
|
|
8
|
+
set(libogg_INCLUDE ${third_party_DIR}/libogg/include)
|
|
9
|
+
set(libogg_LIB ${third_party_DIR}/libogg/lib/${ANDROID_ABI})
|
|
10
|
+
add_library(lib_ogg STATIC IMPORTED)
|
|
11
|
+
set_target_properties(lib_ogg PROPERTIES IMPORTED_LOCATION ${libogg_LIB}/libogg.a)
|
|
12
|
+
|
|
13
|
+
# libopus library refer from https://github.com/xiph/opus.
|
|
14
|
+
set(libopus_INCLUDE ${third_party_DIR}/libopus/include)
|
|
15
|
+
set(libopus_LIB ${third_party_DIR}/libopus/lib/${ANDROID_ABI})
|
|
16
|
+
add_library(lib_opus STATIC IMPORTED)
|
|
17
|
+
set_target_properties(lib_opus PROPERTIES IMPORTED_LOCATION ${libopus_LIB}/libopus.a)
|
|
18
|
+
|
|
19
|
+
# opus-tools https://github.com/xiph/opus-tools.
|
|
20
|
+
set(opus_tools_INCLUDE ${third_party_DIR}/opus_tools/include)
|
|
21
|
+
set(opus_tools_LIB ${third_party_DIR}/opus_tools/lib/${ANDROID_ABI})
|
|
22
|
+
add_library(lib_opus_header STATIC IMPORTED)
|
|
23
|
+
set_target_properties(lib_opus_header PROPERTIES IMPORTED_LOCATION
|
|
24
|
+
${opus_tools_LIB}/libopus_header.a)
|
|
25
|
+
|
|
26
|
+
# Build ogg_opus_encoder_tool shared lib.
|
|
27
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
|
|
28
|
+
add_library(ogg_opus_encoder_tool SHARED ogg_opus_encoder.cc)
|
|
29
|
+
target_include_directories(ogg_opus_encoder_tool PRIVATE ${libogg_INCLUDE})
|
|
30
|
+
target_link_libraries(ogg_opus_encoder_tool lib_opus lib_ogg lib_opus_header)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#build for ogg_opus_encoder shared library
|
|
2
|
+
cmake_minimum_required(VERSION 3.22.1)
|
|
3
|
+
|
|
4
|
+
add_library(ogg_opus_encoder SHARED ogg_opus_encoder.cc ../ogg_opus_encoder.cc)
|
|
5
|
+
|
|
6
|
+
# Include libraries needed for ogg_opus_encoder
|
|
7
|
+
target_link_libraries(ogg_opus_encoder ogg_opus_encoder_tool)
|