@mentra/bluetooth-sdk 0.1.9 → 0.1.10
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 +116 -18
- package/android/build.gradle +289 -16
- package/android/gradle.properties.example +9 -0
- package/android/lc3Lib/build.gradle +95 -6
- package/android/settings.gradle +3 -0
- package/android/silero/LICENSE.md +17 -0
- package/android/silero/build.gradle +42 -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/java/com/mentra/bluetoothsdk/BluetoothSdkDefaults.kt +6 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkModule.kt +165 -27
- package/android/src/main/java/com/mentra/bluetoothsdk/Bridge.kt +89 -21
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +189 -16
- package/android/src/main/java/com/mentra/bluetoothsdk/DeviceStore.kt +22 -2
- package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothSdk.kt +787 -85
- package/android/src/main/java/com/mentra/bluetoothsdk/audio/AudioModels.kt +6 -2
- package/android/src/main/java/com/mentra/bluetoothsdk/camera/CameraModels.kt +123 -10
- package/android/src/main/java/com/mentra/bluetoothsdk/controllers/ControllerManager.kt +12 -2
- package/android/src/main/java/com/mentra/bluetoothsdk/controllers/R1.kt +8 -2
- package/android/src/main/java/com/mentra/bluetoothsdk/debug/BleTraceLogger.kt +33 -17
- package/android/src/main/java/com/mentra/bluetoothsdk/events/BluetoothEvents.kt +101 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/internal/MapParsing.kt +8 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/photoreceiver/LocalPhotoReceiverRegistry.java +108 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/photoreceiver/LocalPhotoUploadServer.kt +399 -74
- package/android/src/main/java/com/mentra/bluetoothsdk/photoreceiver/MentraPhotoReceiverModule.kt +100 -17
- package/android/src/main/java/com/mentra/bluetoothsdk/requests/DisplayRequests.kt +17 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G1.java +2 -2
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G2.kt +569 -220
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Mach1.java +2 -2
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.java +271 -66
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraNex.kt +176 -104
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraosBle.java +12753 -27036
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/SGCManager.kt +54 -2
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Simulated.kt +16 -4
- package/android/src/main/java/com/mentra/bluetoothsdk/status/DeviceStatus.kt +60 -3
- package/android/src/main/java/com/mentra/bluetoothsdk/streaming/StreamModels.kt +12 -3
- package/android/src/main/java/com/mentra/bluetoothsdk/stt/STTTools.kt +87 -36
- package/android/src/main/java/com/mentra/bluetoothsdk/stt/SherpaOnnxTranscriber.kt +13 -4
- package/android/src/main/java/com/mentra/bluetoothsdk/stt/VadGateSpeechPolicy.kt +229 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/tts/TTSTools.kt +180 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/AvifExifStripper.java +573 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/BlePhotoUploadService.java +488 -50
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/HeifExifTagReader.java +199 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/MessageChunkReassembler.java +18 -1
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/MessageChunker.java +64 -18
- package/android/src/main/java/com/mentra/bluetoothsdk/utils/NexSGCUtils.kt +48 -39
- package/android/src/test/java/com/mentra/bluetoothsdk/camera/PhotoRequestTest.kt +23 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/photoreceiver/LocalPhotoReceiverRegistryTest.java +75 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/utils/AvifExifStripperTest.java +30 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/utils/BlePhotoUploadServiceTest.java +98 -0
- package/android/src/test/resources/avif_with_exif.avif +0 -0
- package/build/BluetoothSdk.types.d.ts +241 -43
- package/build/BluetoothSdk.types.d.ts.map +1 -1
- package/build/BluetoothSdk.types.js +11 -10
- package/build/BluetoothSdk.types.js.map +1 -1
- package/build/_private/BluetoothSdkModule.d.ts +36 -23
- package/build/_private/BluetoothSdkModule.d.ts.map +1 -1
- package/build/_private/BluetoothSdkModule.js +30 -52
- package/build/_private/BluetoothSdkModule.js.map +1 -1
- package/build/_private/photoRequestPayload.d.ts +4 -0
- package/build/_private/photoRequestPayload.d.ts.map +1 -0
- package/build/_private/photoRequestPayload.js +25 -0
- package/build/_private/photoRequestPayload.js.map +1 -0
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +23 -0
- package/build/index.js.map +1 -1
- package/build/react/useMentraBluetooth.d.ts +2 -2
- package/build/react/useMentraBluetooth.d.ts.map +1 -1
- package/build/react/useMentraBluetooth.js +3 -3
- package/build/react/useMentraBluetooth.js.map +1 -1
- package/ios/BluetoothSdkModule.swift +174 -70
- package/ios/LocalPhotoUploadServer.swift +370 -105
- package/ios/MentraBluetoothSDK.podspec +3 -1
- package/ios/MentraPhotoReceiverModule.swift +62 -10
- package/ios/Packages/CoreObjC/include/PcmConverter.h +22 -0
- package/ios/Packages/SherpaOnnx/SherpaOnnx.swift +668 -26
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Info.plist +13 -9
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/Headers/sherpa-onnx/c-api/c-api.h +4551 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64/Headers/sherpa-onnx/c-api/cxx-api.h +1745 -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 +4551 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/Headers/sherpa-onnx/c-api/cxx-api.h +1745 -0
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/ios-arm64_x86_64-simulator/libsherpa-onnx.a +0 -0
- package/ios/Source/BluetoothSdkDefaults.swift +6 -0
- package/ios/Source/Bridge.swift +58 -19
- package/ios/Source/DeviceManager.swift +149 -17
- package/ios/Source/DeviceStore.swift +16 -6
- package/ios/Source/MentraBluetoothSDK.swift +803 -47
- package/ios/Source/ObservableStore.swift +6 -0
- package/ios/Source/{Audio → audio}/AudioModels.swift +9 -7
- package/ios/Source/{Camera → camera}/CameraModels.swift +225 -16
- package/ios/Source/controllers/ControllerManager.swift +4 -3
- package/ios/Source/controllers/R1.swift +3 -3
- package/ios/Source/{Events → events}/BluetoothEvents.swift +183 -1
- package/ios/Source/{Internal → internal}/ValueParsing.swift +10 -1
- package/ios/Source/{Requests → requests}/DisplayRequests.swift +28 -4
- package/ios/Source/services/PhoneMic.swift +1 -0
- package/ios/Source/sgcs/G1.swift +2 -2
- package/ios/Source/sgcs/G2.swift +645 -403
- package/ios/Source/sgcs/Mach1.swift +2 -2
- package/ios/Source/sgcs/MentraLive.swift +812 -319
- package/ios/Source/sgcs/MentraNex.swift +412 -182
- package/ios/Source/sgcs/SGCManager.swift +57 -3
- package/ios/Source/sgcs/Simulated.swift +7 -3
- package/ios/Source/sgcs/mentraos_ble.pb.swift +3073 -3134
- package/ios/Source/status/DeviceStatus.swift +974 -0
- package/ios/Source/{Status → status}/WifiHotspotStatus.swift +4 -4
- package/ios/Source/{Streaming → streaming}/StreamModels.swift +24 -9
- package/ios/Source/stt/STTTools.swift +27 -12
- package/ios/Source/stt/SherpaOnnxTranscriber.swift +31 -8
- package/ios/Source/tts/TTSTools.swift +164 -0
- package/ios/Source/utils/JSCExperiment.swift +7 -7
- package/ios/Source/utils/MessageChunkReassembler.swift +20 -1
- package/ios/Source/utils/MessageChunker.swift +78 -21
- package/ios/Source/utils/TarBz2Extractor.swift +53 -2
- package/package.json +1 -1
- package/plugin/build/withAndroid.js +68 -4
- package/src/BluetoothSdk.types.ts +331 -59
- package/src/_private/BluetoothSdkModule.ts +113 -102
- package/src/_private/photoRequestPayload.ts +28 -0
- package/src/index.ts +58 -15
- package/src/react/useMentraBluetooth.ts +6 -4
- package/android/.project +0 -28
- package/android/lc3Lib/.project +0 -28
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Headers/cargs.h +0 -162
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Headers/sherpa-onnx/c-api/c-api.h +0 -1852
- package/ios/Packages/SherpaOnnx/sherpa-onnx.xcframework/Headers/sherpa-onnx/c-api/cxx-api.h +0 -674
- 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/sherpa-onnx.a +0 -0
- package/ios/Source/Status/DeviceStatus.swift +0 -471
- /package/ios/Source/{Connection → connection}/ScanSession.swift +0 -0
- /package/ios/Source/{Errors → errors}/BluetoothError.swift +0 -0
- /package/ios/Source/{Internal → internal}/BluetoothAvailability.swift +0 -0
- /package/ios/Source/{Status → status}/RuntimeState.swift +0 -0
- /package/ios/Source/{Types → types}/DeviceModels.swift +0 -0
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This is a simple alternative cross-platform implementation of getopt, which
|
|
5
|
-
* is used to parse argument strings submitted to the executable (argc and argv
|
|
6
|
-
* which are received in the main function).
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
#ifndef CAG_LIBRARY_H
|
|
10
|
-
#define CAG_LIBRARY_H
|
|
11
|
-
|
|
12
|
-
#include <stdbool.h>
|
|
13
|
-
#include <stddef.h>
|
|
14
|
-
#include <stdio.h>
|
|
15
|
-
|
|
16
|
-
#if defined(_WIN32) || defined(__CYGWIN__)
|
|
17
|
-
#define CAG_EXPORT __declspec(dllexport)
|
|
18
|
-
#define CAG_IMPORT __declspec(dllimport)
|
|
19
|
-
#elif __GNUC__ >= 4
|
|
20
|
-
#define CAG_EXPORT __attribute__((visibility("default")))
|
|
21
|
-
#define CAG_IMPORT __attribute__((visibility("default")))
|
|
22
|
-
#else
|
|
23
|
-
#define CAG_EXPORT
|
|
24
|
-
#define CAG_IMPORT
|
|
25
|
-
#endif
|
|
26
|
-
|
|
27
|
-
#if defined(CAG_SHARED)
|
|
28
|
-
#if defined(CAG_EXPORTS)
|
|
29
|
-
#define CAG_PUBLIC CAG_EXPORT
|
|
30
|
-
#else
|
|
31
|
-
#define CAG_PUBLIC CAG_IMPORT
|
|
32
|
-
#endif
|
|
33
|
-
#else
|
|
34
|
-
#define CAG_PUBLIC
|
|
35
|
-
#endif
|
|
36
|
-
|
|
37
|
-
#ifdef __cplusplus
|
|
38
|
-
extern "C" {
|
|
39
|
-
#endif
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* An option is used to describe a flag/argument option submitted when the
|
|
43
|
-
* program is run.
|
|
44
|
-
*/
|
|
45
|
-
typedef struct cag_option
|
|
46
|
-
{
|
|
47
|
-
const char identifier;
|
|
48
|
-
const char *access_letters;
|
|
49
|
-
const char *access_name;
|
|
50
|
-
const char *value_name;
|
|
51
|
-
const char *description;
|
|
52
|
-
} cag_option;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* A context is used to iterate over all options provided. It stores the parsing
|
|
56
|
-
* state.
|
|
57
|
-
*/
|
|
58
|
-
typedef struct cag_option_context
|
|
59
|
-
{
|
|
60
|
-
const struct cag_option *options;
|
|
61
|
-
size_t option_count;
|
|
62
|
-
int argc;
|
|
63
|
-
char **argv;
|
|
64
|
-
int index;
|
|
65
|
-
int inner_index;
|
|
66
|
-
bool forced_end;
|
|
67
|
-
char identifier;
|
|
68
|
-
char *value;
|
|
69
|
-
} cag_option_context;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* This is just a small macro which calculates the size of an array.
|
|
73
|
-
*/
|
|
74
|
-
#define CAG_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* @brief Prints all options to the terminal.
|
|
78
|
-
*
|
|
79
|
-
* This function prints all options to the terminal. This can be used to
|
|
80
|
-
* generate the output for a "--help" option.
|
|
81
|
-
*
|
|
82
|
-
* @param options The options which will be printed.
|
|
83
|
-
* @param option_count The option count which will be printed.
|
|
84
|
-
* @param destination The destination where the output will be printed.
|
|
85
|
-
*/
|
|
86
|
-
CAG_PUBLIC void cag_option_print(const cag_option *options, size_t option_count,
|
|
87
|
-
FILE *destination);
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* @brief Prepare argument options context for parsing.
|
|
91
|
-
*
|
|
92
|
-
* This function prepares the context for iteration and initializes the context
|
|
93
|
-
* with the supplied options and arguments. After the context has been prepared,
|
|
94
|
-
* it can be used to fetch arguments from it.
|
|
95
|
-
*
|
|
96
|
-
* @param context The context which will be initialized.
|
|
97
|
-
* @param options The registered options which are available for the program.
|
|
98
|
-
* @param option_count The amount of options which are available for the
|
|
99
|
-
* program.
|
|
100
|
-
* @param argc The amount of arguments the user supplied in the main function.
|
|
101
|
-
* @param argv A pointer to the arguments of the main function.
|
|
102
|
-
*/
|
|
103
|
-
CAG_PUBLIC void cag_option_prepare(cag_option_context *context,
|
|
104
|
-
const cag_option *options, size_t option_count, int argc, char **argv);
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* @brief Fetches an option from the argument list.
|
|
108
|
-
*
|
|
109
|
-
* This function fetches a single option from the argument list. The context
|
|
110
|
-
* will be moved to that item. Information can be extracted from the context
|
|
111
|
-
* after the item has been fetched.
|
|
112
|
-
* The arguments will be re-ordered, which means that non-option arguments will
|
|
113
|
-
* be moved to the end of the argument list. After all options have been
|
|
114
|
-
* fetched, all non-option arguments will be positioned after the index of
|
|
115
|
-
* the context.
|
|
116
|
-
*
|
|
117
|
-
* @param context The context from which we will fetch the option.
|
|
118
|
-
* @return Returns true if there was another option or false if the end is
|
|
119
|
-
* reached.
|
|
120
|
-
*/
|
|
121
|
-
CAG_PUBLIC bool cag_option_fetch(cag_option_context *context);
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* @brief Gets the identifier of the option.
|
|
125
|
-
*
|
|
126
|
-
* This function gets the identifier of the option, which should be unique to
|
|
127
|
-
* this option and can be used to determine what kind of option this is.
|
|
128
|
-
*
|
|
129
|
-
* @param context The context from which the option was fetched.
|
|
130
|
-
* @return Returns the identifier of the option.
|
|
131
|
-
*/
|
|
132
|
-
CAG_PUBLIC char cag_option_get(const cag_option_context *context);
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* @brief Gets the value from the option.
|
|
136
|
-
*
|
|
137
|
-
* This function gets the value from the option, if any. If the option does not
|
|
138
|
-
* contain a value, this function will return NULL.
|
|
139
|
-
*
|
|
140
|
-
* @param context The context from which the option was fetched.
|
|
141
|
-
* @return Returns a pointer to the value or NULL if there is no value.
|
|
142
|
-
*/
|
|
143
|
-
CAG_PUBLIC const char *cag_option_get_value(const cag_option_context *context);
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* @brief Gets the current index of the context.
|
|
147
|
-
*
|
|
148
|
-
* This function gets the index within the argv arguments of the context. The
|
|
149
|
-
* context always points to the next item which it will inspect. This is
|
|
150
|
-
* particularly useful to inspect the original argument array, or to get
|
|
151
|
-
* non-option arguments after option fetching has finished.
|
|
152
|
-
*
|
|
153
|
-
* @param context The context from which the option was fetched.
|
|
154
|
-
* @return Returns the current index of the context.
|
|
155
|
-
*/
|
|
156
|
-
CAG_PUBLIC int cag_option_get_index(const cag_option_context *context);
|
|
157
|
-
|
|
158
|
-
#ifdef __cplusplus
|
|
159
|
-
} // extern "C"
|
|
160
|
-
#endif
|
|
161
|
-
|
|
162
|
-
#endif
|