@bota.dev/react-native-app-sdk 2.0.0-beta.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/BotaDeviceSDK.podspec +55 -0
- package/LICENSE +21 -0
- package/README.md +101 -0
- package/android/build.gradle +76 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/dev/bota/sdk/reactnative/BotaDeviceSDKAndroidDevices.kt +172 -0
- package/android/src/main/java/dev/bota/sdk/reactnative/BotaDeviceSDKAndroidLifecycle.kt +100 -0
- package/android/src/main/java/dev/bota/sdk/reactnative/BotaDeviceSDKAndroidLogs.kt +82 -0
- package/android/src/main/java/dev/bota/sdk/reactnative/BotaDeviceSDKAndroidModels.kt +476 -0
- package/android/src/main/java/dev/bota/sdk/reactnative/BotaDeviceSDKAndroidOTA.kt +58 -0
- package/android/src/main/java/dev/bota/sdk/reactnative/BotaDeviceSDKAndroidRecordingUploads.kt +180 -0
- package/android/src/main/java/dev/bota/sdk/reactnative/BotaDeviceSDKAndroidRecordings.kt +751 -0
- package/android/src/main/java/dev/bota/sdk/reactnative/BotaDeviceSDKAndroidSecurity.kt +509 -0
- package/android/src/main/java/dev/bota/sdk/reactnative/BotaDeviceSDKAndroidWiFi.kt +125 -0
- package/android/src/main/java/dev/bota/sdk/reactnative/BotaDeviceSDKEncryptedUploadV2Materials.kt +46 -0
- package/android/src/main/java/dev/bota/sdk/reactnative/BotaDeviceSDKModule.kt +723 -0
- package/android/src/main/java/dev/bota/sdk/reactnative/BotaDeviceSDKPackage.kt +33 -0
- package/android/src/test/java/dev/bota/sdk/reactnative/BotaDeviceSDKAndroidDevicesTest.kt +211 -0
- package/android/src/test/java/dev/bota/sdk/reactnative/BotaDeviceSDKAndroidLifecycleTest.kt +132 -0
- package/android/src/test/java/dev/bota/sdk/reactnative/BotaDeviceSDKAndroidLogsTest.kt +57 -0
- package/android/src/test/java/dev/bota/sdk/reactnative/BotaDeviceSDKAndroidOTATest.kt +75 -0
- package/android/src/test/java/dev/bota/sdk/reactnative/BotaDeviceSDKAndroidRecordingUploadsTest.kt +147 -0
- package/android/src/test/java/dev/bota/sdk/reactnative/BotaDeviceSDKAndroidRecordingsTest.kt +355 -0
- package/android/src/test/java/dev/bota/sdk/reactnative/BotaDeviceSDKAndroidSecurityTest.kt +523 -0
- package/android/src/test/java/dev/bota/sdk/reactnative/BotaDeviceSDKAndroidWiFiTest.kt +100 -0
- package/generated/codegen-contract.json +3593 -0
- package/ios/BotaDeviceSDK.mm +1300 -0
- package/ios/BotaDeviceSDKAppleBridge.swift +2260 -0
- package/ios/BotaDeviceSDKAppleDevices.swift +191 -0
- package/ios/BotaDeviceSDKAppleLifecycle.swift +167 -0
- package/ios/BotaDeviceSDKAppleLogs.swift +79 -0
- package/ios/BotaDeviceSDKAppleOTA.swift +73 -0
- package/ios/BotaDeviceSDKAppleRecordingUploads.swift +178 -0
- package/ios/BotaDeviceSDKAppleRecordings.swift +670 -0
- package/ios/BotaDeviceSDKAppleSecurity.swift +586 -0
- package/ios/BotaDeviceSDKAppleWiFi.swift +128 -0
- package/ios/BotaDeviceSDKEncryptedUploadV2Materials.swift +99 -0
- package/lib/commonjs/BotaClient.js +194 -0
- package/lib/commonjs/BotaClient.js.map +1 -0
- package/lib/commonjs/ble/constants.js +10 -0
- package/lib/commonjs/ble/constants.js.map +1 -0
- package/lib/commonjs/ble/deviceLogs.js +50 -0
- package/lib/commonjs/ble/deviceLogs.js.map +1 -0
- package/lib/commonjs/cache/DeviceStateCache.js +6 -0
- package/lib/commonjs/cache/DeviceStateCache.js.map +1 -0
- package/lib/commonjs/client.js +746 -0
- package/lib/commonjs/client.js.map +1 -0
- package/lib/commonjs/compatibility/runtime.js +44 -0
- package/lib/commonjs/compatibility/runtime.js.map +1 -0
- package/lib/commonjs/index.js +123 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/managers/DeviceManager.js +647 -0
- package/lib/commonjs/managers/DeviceManager.js.map +1 -0
- package/lib/commonjs/managers/OTAManager.js +140 -0
- package/lib/commonjs/managers/OTAManager.js.map +1 -0
- package/lib/commonjs/managers/RecordingManager.js +444 -0
- package/lib/commonjs/managers/RecordingManager.js.map +1 -0
- package/lib/commonjs/managers/StreamingSession.js +175 -0
- package/lib/commonjs/managers/StreamingSession.js.map +1 -0
- package/lib/commonjs/managers/types.js +6 -0
- package/lib/commonjs/managers/types.js.map +1 -0
- package/lib/commonjs/models/Device.js +2 -0
- package/lib/commonjs/models/Device.js.map +1 -0
- package/lib/commonjs/models/Recording.js +2 -0
- package/lib/commonjs/models/Recording.js.map +1 -0
- package/lib/commonjs/models/Status.js +6 -0
- package/lib/commonjs/models/Status.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/specs/NativeBotaDeviceSDK.js +9 -0
- package/lib/commonjs/specs/NativeBotaDeviceSDK.js.map +1 -0
- package/lib/commonjs/sync/syncStatus.js +178 -0
- package/lib/commonjs/sync/syncStatus.js.map +1 -0
- package/lib/commonjs/utils/errors.js +194 -0
- package/lib/commonjs/utils/errors.js.map +1 -0
- package/lib/commonjs/utils/logger.js +84 -0
- package/lib/commonjs/utils/logger.js.map +1 -0
- package/lib/module/BotaClient.js +189 -0
- package/lib/module/BotaClient.js.map +1 -0
- package/lib/module/ble/constants.js +6 -0
- package/lib/module/ble/constants.js.map +1 -0
- package/lib/module/ble/deviceLogs.js +45 -0
- package/lib/module/ble/deviceLogs.js.map +1 -0
- package/lib/module/cache/DeviceStateCache.js +4 -0
- package/lib/module/cache/DeviceStateCache.js.map +1 -0
- package/lib/module/client.js +740 -0
- package/lib/module/client.js.map +1 -0
- package/lib/module/compatibility/runtime.js +35 -0
- package/lib/module/compatibility/runtime.js.map +1 -0
- package/lib/module/index.js +17 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/managers/DeviceManager.js +641 -0
- package/lib/module/managers/DeviceManager.js.map +1 -0
- package/lib/module/managers/OTAManager.js +134 -0
- package/lib/module/managers/OTAManager.js.map +1 -0
- package/lib/module/managers/RecordingManager.js +438 -0
- package/lib/module/managers/RecordingManager.js.map +1 -0
- package/lib/module/managers/StreamingSession.js +168 -0
- package/lib/module/managers/StreamingSession.js.map +1 -0
- package/lib/module/managers/types.js +4 -0
- package/lib/module/managers/types.js.map +1 -0
- package/lib/module/models/Device.js +2 -0
- package/lib/module/models/Device.js.map +1 -0
- package/lib/module/models/Recording.js +2 -0
- package/lib/module/models/Recording.js.map +1 -0
- package/lib/module/models/Status.js +4 -0
- package/lib/module/models/Status.js.map +1 -0
- package/lib/module/specs/NativeBotaDeviceSDK.js +5 -0
- package/lib/module/specs/NativeBotaDeviceSDK.js.map +1 -0
- package/lib/module/sync/syncStatus.js +174 -0
- package/lib/module/sync/syncStatus.js.map +1 -0
- package/lib/module/utils/errors.js +183 -0
- package/lib/module/utils/errors.js.map +1 -0
- package/lib/module/utils/logger.js +80 -0
- package/lib/module/utils/logger.js.map +1 -0
- package/lib/typescript/BotaClient.d.ts +40 -0
- package/lib/typescript/BotaClient.d.ts.map +1 -0
- package/lib/typescript/ble/constants.d.ts +4 -0
- package/lib/typescript/ble/constants.d.ts.map +1 -0
- package/lib/typescript/ble/deviceLogs.d.ts +10 -0
- package/lib/typescript/ble/deviceLogs.d.ts.map +1 -0
- package/lib/typescript/cache/DeviceStateCache.d.ts +14 -0
- package/lib/typescript/cache/DeviceStateCache.d.ts.map +1 -0
- package/lib/typescript/client.d.ts +208 -0
- package/lib/typescript/client.d.ts.map +1 -0
- package/lib/typescript/compatibility/runtime.d.ts +11 -0
- package/lib/typescript/compatibility/runtime.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +19 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/managers/DeviceManager.d.ts +117 -0
- package/lib/typescript/managers/DeviceManager.d.ts.map +1 -0
- package/lib/typescript/managers/OTAManager.d.ts +25 -0
- package/lib/typescript/managers/OTAManager.d.ts.map +1 -0
- package/lib/typescript/managers/RecordingManager.d.ts +54 -0
- package/lib/typescript/managers/RecordingManager.d.ts.map +1 -0
- package/lib/typescript/managers/StreamingSession.d.ts +35 -0
- package/lib/typescript/managers/StreamingSession.d.ts.map +1 -0
- package/lib/typescript/managers/types.d.ts +19 -0
- package/lib/typescript/managers/types.d.ts.map +1 -0
- package/lib/typescript/models/Device.d.ts +392 -0
- package/lib/typescript/models/Device.d.ts.map +1 -0
- package/lib/typescript/models/Recording.d.ts +259 -0
- package/lib/typescript/models/Recording.d.ts.map +1 -0
- package/lib/typescript/models/Status.d.ts +106 -0
- package/lib/typescript/models/Status.d.ts.map +1 -0
- package/lib/typescript/specs/NativeBotaDeviceSDK.d.ts +393 -0
- package/lib/typescript/specs/NativeBotaDeviceSDK.d.ts.map +1 -0
- package/lib/typescript/sync/syncStatus.d.ts +123 -0
- package/lib/typescript/sync/syncStatus.d.ts.map +1 -0
- package/lib/typescript/utils/errors.d.ts +83 -0
- package/lib/typescript/utils/errors.d.ts.map +1 -0
- package/lib/typescript/utils/logger.d.ts +36 -0
- package/lib/typescript/utils/logger.d.ts.map +1 -0
- package/package.json +100 -0
- package/scripts/bota_device_sdk_spm_workaround.rb +53 -0
- package/src/BotaClient.ts +231 -0
- package/src/ble/constants.ts +3 -0
- package/src/ble/deviceLogs.ts +61 -0
- package/src/cache/DeviceStateCache.ts +20 -0
- package/src/client.ts +1410 -0
- package/src/compatibility/runtime.ts +55 -0
- package/src/index.ts +146 -0
- package/src/managers/DeviceManager.ts +927 -0
- package/src/managers/OTAManager.ts +195 -0
- package/src/managers/RecordingManager.ts +578 -0
- package/src/managers/StreamingSession.ts +212 -0
- package/src/managers/types.ts +36 -0
- package/src/models/Device.ts +484 -0
- package/src/models/Recording.ts +281 -0
- package/src/models/Status.ts +128 -0
- package/src/specs/NativeBotaDeviceSDK.ts +542 -0
- package/src/sync/syncStatus.ts +243 -0
- package/src/utils/errors.ts +327 -0
- package/src/utils/logger.ts +122 -0
|
@@ -0,0 +1,1300 @@
|
|
|
1
|
+
#import <BotaDeviceSDKSpec/BotaDeviceSDKSpec.h>
|
|
2
|
+
|
|
3
|
+
#if __has_include(<BotaDeviceSDK/BotaDeviceSDK-Swift.h>)
|
|
4
|
+
#import <BotaDeviceSDK/BotaDeviceSDK-Swift.h>
|
|
5
|
+
#else
|
|
6
|
+
#import "BotaDeviceSDK-Swift.h"
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
static void BotaRejectAppleError(NSError *error, RCTPromiseRejectBlock reject)
|
|
10
|
+
{
|
|
11
|
+
reject(@"apple_sdk_error", error.localizedDescription, error);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static void BotaRejectEncryptedUploadV2Error(RCTPromiseRejectBlock reject)
|
|
15
|
+
{
|
|
16
|
+
reject(@"encrypted_upload_v2_failed", @"encrypted upload v2 failed", nil);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@interface BotaDeviceSDK : NativeBotaDeviceSDKSpecBase <NativeBotaDeviceSDKSpec>
|
|
20
|
+
@end
|
|
21
|
+
|
|
22
|
+
@implementation BotaDeviceSDK
|
|
23
|
+
|
|
24
|
+
RCT_EXPORT_MODULE(BotaDeviceSDK)
|
|
25
|
+
|
|
26
|
+
+ (BOOL)requiresMainQueueSetup
|
|
27
|
+
{
|
|
28
|
+
return NO;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
- (void)configure:(JS::NativeBotaDeviceSDK::NativeConfiguration &)configuration
|
|
32
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
33
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
34
|
+
{
|
|
35
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
36
|
+
configureWithApplicationSupportDirectory:configuration.applicationSupportDirectory()
|
|
37
|
+
logLevel:configuration.logLevel()
|
|
38
|
+
completion:^(NSError *_Nullable error) {
|
|
39
|
+
if (error != nil) {
|
|
40
|
+
BotaRejectAppleError(error, reject);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
resolve(nil);
|
|
44
|
+
}];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
- (void)startScan:(double)timeoutMs
|
|
48
|
+
allowDuplicates:(BOOL)allowDuplicates
|
|
49
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
50
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
51
|
+
{
|
|
52
|
+
__weak BotaDeviceSDK *weakSelf = self;
|
|
53
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
54
|
+
startScanWithTimeoutMilliseconds:timeoutMs
|
|
55
|
+
allowDuplicates:allowDuplicates
|
|
56
|
+
onDevice:^(NSDictionary *device) {
|
|
57
|
+
[weakSelf emitOnDeviceDiscovered:device];
|
|
58
|
+
}
|
|
59
|
+
onError:^(__unused NSError *error) {}
|
|
60
|
+
completion:^(NSError *_Nullable error) {
|
|
61
|
+
if (error != nil) {
|
|
62
|
+
BotaRejectAppleError(error, reject);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
resolve(nil);
|
|
66
|
+
}];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
- (void)stopScan:(RCTPromiseResolveBlock)resolve
|
|
70
|
+
reject:(__unused RCTPromiseRejectBlock)reject
|
|
71
|
+
{
|
|
72
|
+
[[BotaDeviceSDKAppleBridge shared] stopScanWithCompletion:^{
|
|
73
|
+
resolve(nil);
|
|
74
|
+
}];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
- (void)connectSelected:(JS::NativeBotaDeviceSDK::NativeDiscoveredDevice &)device
|
|
78
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
79
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
80
|
+
{
|
|
81
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
82
|
+
connectSelectedWithID:device.id_()
|
|
83
|
+
name:device.name()
|
|
84
|
+
deviceType:device.deviceType()
|
|
85
|
+
firmwareVersion:device.firmwareVersion()
|
|
86
|
+
macAddress:device.macAddress()
|
|
87
|
+
pairingState:device.pairingState()
|
|
88
|
+
rssi:device.rssi()
|
|
89
|
+
discoveredAtMilliseconds:device.discoveredAtMs()
|
|
90
|
+
completion:^(NSDictionary *_Nullable connected, NSError *_Nullable error) {
|
|
91
|
+
if (error != nil) {
|
|
92
|
+
BotaRejectAppleError(error, reject);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
resolve(connected);
|
|
96
|
+
}];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
- (void)reconnect:(NSString *)serialNumber
|
|
100
|
+
options:(JS::NativeBotaDeviceSDK::NativeReconnectOptions &)options
|
|
101
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
102
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
103
|
+
{
|
|
104
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
105
|
+
reconnectWithSerialNumber:serialNumber
|
|
106
|
+
scanTimeoutMilliseconds:options.scanTimeoutMs()
|
|
107
|
+
connectionTimeoutMilliseconds:options.connectionTimeoutMs()
|
|
108
|
+
completion:^(NSDictionary *_Nullable connected, NSError *_Nullable error) {
|
|
109
|
+
if (error != nil) {
|
|
110
|
+
BotaRejectAppleError(error, reject);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
resolve(connected);
|
|
114
|
+
}];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
- (void)disconnect:(RCTPromiseResolveBlock)resolve
|
|
118
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
119
|
+
{
|
|
120
|
+
[[BotaDeviceSDKAppleBridge shared] disconnectWithCompletion:^(NSError *_Nullable error) {
|
|
121
|
+
if (error != nil) {
|
|
122
|
+
BotaRejectAppleError(error, reject);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
resolve(nil);
|
|
126
|
+
}];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
- (void)isProvisioned:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
130
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
131
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
132
|
+
{
|
|
133
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
134
|
+
isProvisionedWithID:device.id_()
|
|
135
|
+
serialNumber:device.serialNumber()
|
|
136
|
+
deviceType:device.deviceType()
|
|
137
|
+
firmwareVersion:device.firmwareVersion()
|
|
138
|
+
hardwareRevision:device.hardwareRevision()
|
|
139
|
+
isProvisioned:device.isProvisioned()
|
|
140
|
+
connectionState:device.connectionState()
|
|
141
|
+
mtu:device.mtu()
|
|
142
|
+
completion:^(BOOL value, NSError *_Nullable error) {
|
|
143
|
+
if (error != nil) {
|
|
144
|
+
BotaRejectAppleError(error, reject);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
resolve(@(value));
|
|
148
|
+
}];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
- (void)readPublicKey:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
152
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
153
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
154
|
+
{
|
|
155
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
156
|
+
readPublicKeyWithID:device.id_()
|
|
157
|
+
serialNumber:device.serialNumber()
|
|
158
|
+
deviceType:device.deviceType()
|
|
159
|
+
firmwareVersion:device.firmwareVersion()
|
|
160
|
+
hardwareRevision:device.hardwareRevision()
|
|
161
|
+
isProvisioned:device.isProvisioned()
|
|
162
|
+
connectionState:device.connectionState()
|
|
163
|
+
mtu:device.mtu()
|
|
164
|
+
completion:^(NSString *_Nullable value, NSError *_Nullable error) {
|
|
165
|
+
if (error != nil) {
|
|
166
|
+
BotaRejectAppleError(error, reject);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
resolve(value ?: [NSNull null]);
|
|
170
|
+
}];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
- (void)readAuthNonce:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
174
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
175
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
176
|
+
{
|
|
177
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
178
|
+
readAuthNonceWithID:device.id_()
|
|
179
|
+
serialNumber:device.serialNumber()
|
|
180
|
+
deviceType:device.deviceType()
|
|
181
|
+
firmwareVersion:device.firmwareVersion()
|
|
182
|
+
hardwareRevision:device.hardwareRevision()
|
|
183
|
+
isProvisioned:device.isProvisioned()
|
|
184
|
+
connectionState:device.connectionState()
|
|
185
|
+
mtu:device.mtu()
|
|
186
|
+
completion:^(NSString *_Nullable value, NSError *_Nullable error) {
|
|
187
|
+
if (error != nil) {
|
|
188
|
+
BotaRejectAppleError(error, reject);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
resolve(value ?: [NSNull null]);
|
|
192
|
+
}];
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
- (void)setApiEndpoint:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
196
|
+
environment:(NSString *)environment
|
|
197
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
198
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
199
|
+
{
|
|
200
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
201
|
+
setApiEndpointWithID:device.id_()
|
|
202
|
+
serialNumber:device.serialNumber()
|
|
203
|
+
deviceType:device.deviceType()
|
|
204
|
+
firmwareVersion:device.firmwareVersion()
|
|
205
|
+
hardwareRevision:device.hardwareRevision()
|
|
206
|
+
isProvisioned:device.isProvisioned()
|
|
207
|
+
connectionState:device.connectionState()
|
|
208
|
+
mtu:device.mtu()
|
|
209
|
+
environment:environment
|
|
210
|
+
completion:^(NSError *_Nullable error) {
|
|
211
|
+
if (error != nil) {
|
|
212
|
+
BotaRejectAppleError(error, reject);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
resolve(nil);
|
|
216
|
+
}];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
- (void)deliverCertificate:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
220
|
+
certificatePem:(NSString *)certificatePem
|
|
221
|
+
privateKeyPem:(NSString *)privateKeyPem
|
|
222
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
223
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
224
|
+
{
|
|
225
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
226
|
+
deliverCertificateWithID:device.id_()
|
|
227
|
+
serialNumber:device.serialNumber()
|
|
228
|
+
deviceType:device.deviceType()
|
|
229
|
+
firmwareVersion:device.firmwareVersion()
|
|
230
|
+
hardwareRevision:device.hardwareRevision()
|
|
231
|
+
isProvisioned:device.isProvisioned()
|
|
232
|
+
connectionState:device.connectionState()
|
|
233
|
+
mtu:device.mtu()
|
|
234
|
+
certificatePem:certificatePem
|
|
235
|
+
privateKeyPem:privateKeyPem
|
|
236
|
+
completion:^(NSError *_Nullable error) {
|
|
237
|
+
if (error != nil) {
|
|
238
|
+
BotaRejectAppleError(error, reject);
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
resolve(nil);
|
|
242
|
+
}];
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
- (void)deliverBackendPublicKey:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
246
|
+
publicKeyHex:(NSString *)publicKeyHex
|
|
247
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
248
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
249
|
+
{
|
|
250
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
251
|
+
deliverBackendPublicKeyWithID:device.id_()
|
|
252
|
+
serialNumber:device.serialNumber()
|
|
253
|
+
deviceType:device.deviceType()
|
|
254
|
+
firmwareVersion:device.firmwareVersion()
|
|
255
|
+
hardwareRevision:device.hardwareRevision()
|
|
256
|
+
isProvisioned:device.isProvisioned()
|
|
257
|
+
connectionState:device.connectionState()
|
|
258
|
+
mtu:device.mtu()
|
|
259
|
+
publicKeyHex:publicKeyHex
|
|
260
|
+
completion:^(NSError *_Nullable error) {
|
|
261
|
+
if (error != nil) {
|
|
262
|
+
BotaRejectAppleError(error, reject);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
resolve(nil);
|
|
266
|
+
}];
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
- (void)writeGrant:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
270
|
+
grantBlob:(NSString *)grantBlob
|
|
271
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
272
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
273
|
+
{
|
|
274
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
275
|
+
writeGrantWithID:device.id_()
|
|
276
|
+
serialNumber:device.serialNumber()
|
|
277
|
+
deviceType:device.deviceType()
|
|
278
|
+
firmwareVersion:device.firmwareVersion()
|
|
279
|
+
hardwareRevision:device.hardwareRevision()
|
|
280
|
+
isProvisioned:device.isProvisioned()
|
|
281
|
+
connectionState:device.connectionState()
|
|
282
|
+
mtu:device.mtu()
|
|
283
|
+
grantBlob:grantBlob
|
|
284
|
+
completion:^(NSError *_Nullable error) {
|
|
285
|
+
if (error != nil) {
|
|
286
|
+
BotaRejectAppleError(error, reject);
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
resolve(nil);
|
|
290
|
+
}];
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
- (void)syncTime:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
294
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
295
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
296
|
+
{
|
|
297
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
298
|
+
syncTimeWithID:device.id_()
|
|
299
|
+
serialNumber:device.serialNumber()
|
|
300
|
+
deviceType:device.deviceType()
|
|
301
|
+
firmwareVersion:device.firmwareVersion()
|
|
302
|
+
hardwareRevision:device.hardwareRevision()
|
|
303
|
+
isProvisioned:device.isProvisioned()
|
|
304
|
+
connectionState:device.connectionState()
|
|
305
|
+
mtu:device.mtu()
|
|
306
|
+
completion:^(NSError *_Nullable error) {
|
|
307
|
+
if (error != nil) {
|
|
308
|
+
BotaRejectAppleError(error, reject);
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
resolve(nil);
|
|
312
|
+
}];
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
- (void)requestStartRecording:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
316
|
+
grantBlob:(NSString *)grantBlob
|
|
317
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
318
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
319
|
+
{
|
|
320
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
321
|
+
requestStartRecordingWithID:device.id_()
|
|
322
|
+
serialNumber:device.serialNumber()
|
|
323
|
+
deviceType:device.deviceType()
|
|
324
|
+
firmwareVersion:device.firmwareVersion()
|
|
325
|
+
hardwareRevision:device.hardwareRevision()
|
|
326
|
+
isProvisioned:device.isProvisioned()
|
|
327
|
+
connectionState:device.connectionState()
|
|
328
|
+
mtu:device.mtu()
|
|
329
|
+
grantBlob:grantBlob
|
|
330
|
+
completion:^(NSDictionary *_Nullable result, NSError *_Nullable error) {
|
|
331
|
+
if (error != nil) {
|
|
332
|
+
BotaRejectAppleError(error, reject);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
resolve(result);
|
|
336
|
+
}];
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
- (void)requestStopRecording:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
340
|
+
grantBlob:(NSString *)grantBlob
|
|
341
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
342
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
343
|
+
{
|
|
344
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
345
|
+
requestStopRecordingWithID:device.id_()
|
|
346
|
+
serialNumber:device.serialNumber()
|
|
347
|
+
deviceType:device.deviceType()
|
|
348
|
+
firmwareVersion:device.firmwareVersion()
|
|
349
|
+
hardwareRevision:device.hardwareRevision()
|
|
350
|
+
isProvisioned:device.isProvisioned()
|
|
351
|
+
connectionState:device.connectionState()
|
|
352
|
+
mtu:device.mtu()
|
|
353
|
+
grantBlob:grantBlob
|
|
354
|
+
completion:^(NSDictionary *_Nullable result, NSError *_Nullable error) {
|
|
355
|
+
if (error != nil) {
|
|
356
|
+
BotaRejectAppleError(error, reject);
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
resolve(result);
|
|
360
|
+
}];
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
- (void)readRecordingState:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
364
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
365
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
366
|
+
{
|
|
367
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
368
|
+
readRecordingStateWithID:device.id_()
|
|
369
|
+
serialNumber:device.serialNumber()
|
|
370
|
+
deviceType:device.deviceType()
|
|
371
|
+
firmwareVersion:device.firmwareVersion()
|
|
372
|
+
hardwareRevision:device.hardwareRevision()
|
|
373
|
+
isProvisioned:device.isProvisioned()
|
|
374
|
+
connectionState:device.connectionState()
|
|
375
|
+
mtu:device.mtu()
|
|
376
|
+
completion:^(NSDictionary *_Nullable state, NSError *_Nullable error) {
|
|
377
|
+
if (error != nil) {
|
|
378
|
+
BotaRejectAppleError(error, reject);
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
resolve(state);
|
|
382
|
+
}];
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
- (void)startRecordingStateUpdates:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
386
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
387
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
388
|
+
{
|
|
389
|
+
__weak BotaDeviceSDK *weakSelf = self;
|
|
390
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
391
|
+
startRecordingStateUpdatesWithID:device.id_()
|
|
392
|
+
serialNumber:device.serialNumber()
|
|
393
|
+
deviceType:device.deviceType()
|
|
394
|
+
firmwareVersion:device.firmwareVersion()
|
|
395
|
+
hardwareRevision:device.hardwareRevision()
|
|
396
|
+
isProvisioned:device.isProvisioned()
|
|
397
|
+
connectionState:device.connectionState()
|
|
398
|
+
mtu:device.mtu()
|
|
399
|
+
onState:^(NSDictionary *state) {
|
|
400
|
+
[weakSelf emitOnRecordingStateUpdated:state];
|
|
401
|
+
}
|
|
402
|
+
onError:^(__unused NSError *error) {}
|
|
403
|
+
completion:^(NSError *_Nullable error) {
|
|
404
|
+
if (error != nil) {
|
|
405
|
+
BotaRejectAppleError(error, reject);
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
resolve(nil);
|
|
409
|
+
}];
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
- (void)stopRecordingStateUpdates:(RCTPromiseResolveBlock)resolve
|
|
413
|
+
reject:(__unused RCTPromiseRejectBlock)reject
|
|
414
|
+
{
|
|
415
|
+
[[BotaDeviceSDKAppleBridge shared] stopRecordingStateUpdatesWithCompletion:^{
|
|
416
|
+
resolve(nil);
|
|
417
|
+
}];
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
- (void)configureWiFi:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
421
|
+
ssid:(NSString *)ssid
|
|
422
|
+
password:(NSString *)password
|
|
423
|
+
grantBlob:(NSString *)grantBlob
|
|
424
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
425
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
426
|
+
{
|
|
427
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
428
|
+
configureWiFiWithID:device.id_()
|
|
429
|
+
serialNumber:device.serialNumber()
|
|
430
|
+
deviceType:device.deviceType()
|
|
431
|
+
firmwareVersion:device.firmwareVersion()
|
|
432
|
+
hardwareRevision:device.hardwareRevision()
|
|
433
|
+
isProvisioned:device.isProvisioned()
|
|
434
|
+
connectionState:device.connectionState()
|
|
435
|
+
mtu:device.mtu()
|
|
436
|
+
ssid:ssid
|
|
437
|
+
password:password
|
|
438
|
+
grantBlob:grantBlob
|
|
439
|
+
completion:^(NSDictionary *_Nullable result, NSError *_Nullable error) {
|
|
440
|
+
if (error != nil) {
|
|
441
|
+
BotaRejectAppleError(error, reject);
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
resolve(result);
|
|
445
|
+
}];
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
- (void)disconnectWiFi:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
449
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
450
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
451
|
+
{
|
|
452
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
453
|
+
disconnectWiFiWithID:device.id_()
|
|
454
|
+
serialNumber:device.serialNumber()
|
|
455
|
+
deviceType:device.deviceType()
|
|
456
|
+
firmwareVersion:device.firmwareVersion()
|
|
457
|
+
hardwareRevision:device.hardwareRevision()
|
|
458
|
+
isProvisioned:device.isProvisioned()
|
|
459
|
+
connectionState:device.connectionState()
|
|
460
|
+
mtu:device.mtu()
|
|
461
|
+
completion:^(NSDictionary *_Nullable result, NSError *_Nullable error) {
|
|
462
|
+
if (error != nil) {
|
|
463
|
+
BotaRejectAppleError(error, reject);
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
resolve(result);
|
|
467
|
+
}];
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
- (void)readWiFiStatus:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
471
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
472
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
473
|
+
{
|
|
474
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
475
|
+
readWiFiStatusWithID:device.id_()
|
|
476
|
+
serialNumber:device.serialNumber()
|
|
477
|
+
deviceType:device.deviceType()
|
|
478
|
+
firmwareVersion:device.firmwareVersion()
|
|
479
|
+
hardwareRevision:device.hardwareRevision()
|
|
480
|
+
isProvisioned:device.isProvisioned()
|
|
481
|
+
connectionState:device.connectionState()
|
|
482
|
+
mtu:device.mtu()
|
|
483
|
+
completion:^(NSDictionary *_Nullable status, NSError *_Nullable error) {
|
|
484
|
+
if (error != nil) {
|
|
485
|
+
BotaRejectAppleError(error, reject);
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
resolve(status);
|
|
489
|
+
}];
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
- (void)startWiFiStatusUpdates:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
493
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
494
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
495
|
+
{
|
|
496
|
+
__weak BotaDeviceSDK *weakSelf = self;
|
|
497
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
498
|
+
startWiFiStatusUpdatesWithID:device.id_()
|
|
499
|
+
serialNumber:device.serialNumber()
|
|
500
|
+
deviceType:device.deviceType()
|
|
501
|
+
firmwareVersion:device.firmwareVersion()
|
|
502
|
+
hardwareRevision:device.hardwareRevision()
|
|
503
|
+
isProvisioned:device.isProvisioned()
|
|
504
|
+
connectionState:device.connectionState()
|
|
505
|
+
mtu:device.mtu()
|
|
506
|
+
onStatus:^(NSDictionary *status) {
|
|
507
|
+
[weakSelf emitOnWiFiStatusUpdated:status];
|
|
508
|
+
}
|
|
509
|
+
onError:^(__unused NSError *error) {}
|
|
510
|
+
completion:^(NSError *_Nullable error) {
|
|
511
|
+
if (error != nil) {
|
|
512
|
+
BotaRejectAppleError(error, reject);
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
resolve(nil);
|
|
516
|
+
}];
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
- (void)stopWiFiStatusUpdates:(RCTPromiseResolveBlock)resolve
|
|
520
|
+
reject:(__unused RCTPromiseRejectBlock)reject
|
|
521
|
+
{
|
|
522
|
+
[[BotaDeviceSDKAppleBridge shared] stopWiFiStatusUpdatesWithCompletion:^{
|
|
523
|
+
resolve(nil);
|
|
524
|
+
}];
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
- (void)scanWiFiNetworks:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
528
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
529
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
530
|
+
{
|
|
531
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
532
|
+
scanWiFiNetworksWithID:device.id_()
|
|
533
|
+
serialNumber:device.serialNumber()
|
|
534
|
+
deviceType:device.deviceType()
|
|
535
|
+
firmwareVersion:device.firmwareVersion()
|
|
536
|
+
hardwareRevision:device.hardwareRevision()
|
|
537
|
+
isProvisioned:device.isProvisioned()
|
|
538
|
+
connectionState:device.connectionState()
|
|
539
|
+
mtu:device.mtu()
|
|
540
|
+
completion:^(NSDictionary *_Nullable result, NSError *_Nullable error) {
|
|
541
|
+
if (error != nil) {
|
|
542
|
+
BotaRejectAppleError(error, reject);
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
resolve(result);
|
|
546
|
+
}];
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
- (void)listRecordings:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
550
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
551
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
552
|
+
{
|
|
553
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
554
|
+
listRecordingsWithID:device.id_()
|
|
555
|
+
serialNumber:device.serialNumber()
|
|
556
|
+
deviceType:device.deviceType()
|
|
557
|
+
firmwareVersion:device.firmwareVersion()
|
|
558
|
+
hardwareRevision:device.hardwareRevision()
|
|
559
|
+
isProvisioned:device.isProvisioned()
|
|
560
|
+
connectionState:device.connectionState()
|
|
561
|
+
mtu:device.mtu()
|
|
562
|
+
completion:^(NSArray<NSDictionary *> *_Nullable recordings,
|
|
563
|
+
NSError *_Nullable error) {
|
|
564
|
+
if (error != nil) {
|
|
565
|
+
BotaRejectAppleError(error, reject);
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
resolve(recordings);
|
|
569
|
+
}];
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
- (void)syncRecording:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
573
|
+
recording:(JS::NativeBotaDeviceSDK::NativeDeviceRecording &)recording
|
|
574
|
+
sinkId:(NSString *)sinkId
|
|
575
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
576
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
577
|
+
{
|
|
578
|
+
__weak BotaDeviceSDK *weakSelf = self;
|
|
579
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
580
|
+
syncRecordingWithID:device.id_()
|
|
581
|
+
serialNumber:device.serialNumber()
|
|
582
|
+
deviceType:device.deviceType()
|
|
583
|
+
firmwareVersion:device.firmwareVersion()
|
|
584
|
+
hardwareRevision:device.hardwareRevision()
|
|
585
|
+
isProvisioned:device.isProvisioned()
|
|
586
|
+
connectionState:device.connectionState()
|
|
587
|
+
mtu:device.mtu()
|
|
588
|
+
recordingUUID:recording.uuid()
|
|
589
|
+
startedAtMilliseconds:recording.startedAtMs()
|
|
590
|
+
durationMilliseconds:recording.durationMs()
|
|
591
|
+
fileSize:recording.fileSize()
|
|
592
|
+
codec:recording.codec()
|
|
593
|
+
isEncrypted:recording.isEncrypted()
|
|
594
|
+
sinkID:sinkId
|
|
595
|
+
onProgress:^(NSDictionary *progress) {
|
|
596
|
+
[weakSelf emitOnRecordingTransferProgress:progress];
|
|
597
|
+
}
|
|
598
|
+
completion:^(NSDictionary *_Nullable result, NSError *_Nullable error) {
|
|
599
|
+
if (error != nil) {
|
|
600
|
+
BotaRejectAppleError(error, reject);
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
resolve(result);
|
|
604
|
+
}];
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
- (void)syncEncryptedRecordingV2:
|
|
608
|
+
(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
609
|
+
recording:
|
|
610
|
+
(JS::NativeBotaDeviceSDK::NativeEncryptedUploadV2Recording &)recording
|
|
611
|
+
operationId:(NSString *)operationId
|
|
612
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
613
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
614
|
+
{
|
|
615
|
+
__weak BotaDeviceSDK *weakSelf = self;
|
|
616
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
617
|
+
syncEncryptedRecordingV2WithID:device.id_()
|
|
618
|
+
serialNumber:device.serialNumber()
|
|
619
|
+
deviceType:device.deviceType()
|
|
620
|
+
firmwareVersion:device.firmwareVersion()
|
|
621
|
+
hardwareRevision:device.hardwareRevision()
|
|
622
|
+
isProvisioned:device.isProvisioned()
|
|
623
|
+
connectionState:device.connectionState()
|
|
624
|
+
mtu:device.mtu()
|
|
625
|
+
recordingUUID:recording.uuid()
|
|
626
|
+
generation:recording.generation()
|
|
627
|
+
ciphertextLength:recording.ciphertextLength()
|
|
628
|
+
ciphertextSHA256:recording.ciphertextSha256()
|
|
629
|
+
operationID:operationId
|
|
630
|
+
onProfileRequest:^(NSDictionary *request) {
|
|
631
|
+
[weakSelf emitOnEncryptedUploadV2ProfileRequested:request];
|
|
632
|
+
}
|
|
633
|
+
onProgress:^(NSDictionary *progress) {
|
|
634
|
+
[weakSelf emitOnEncryptedUploadV2Progress:progress];
|
|
635
|
+
}
|
|
636
|
+
completion:^(NSError *_Nullable error) {
|
|
637
|
+
if (error != nil) {
|
|
638
|
+
BotaRejectEncryptedUploadV2Error(reject);
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
resolve(nil);
|
|
642
|
+
}];
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
- (void)resolveEncryptedUploadV2Profile:
|
|
646
|
+
(NSString *)requestId
|
|
647
|
+
decision:
|
|
648
|
+
(JS::NativeBotaDeviceSDK::NativeEncryptedUploadV2ProfileDecision &)decision
|
|
649
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
650
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
651
|
+
{
|
|
652
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
653
|
+
resolveEncryptedUploadV2ProfileWithRequestID:requestId
|
|
654
|
+
profile:decision.profile()
|
|
655
|
+
uploadSessionID:decision.uploadSessionId()
|
|
656
|
+
ownerRevision:decision.ownerRevision()
|
|
657
|
+
securityPolicy:decision.securityPolicy()
|
|
658
|
+
materialRegistrationID:decision.materialRegistrationId()
|
|
659
|
+
completion:^(NSError *_Nullable error) {
|
|
660
|
+
if (error != nil) {
|
|
661
|
+
BotaRejectAppleError(error, reject);
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
resolve(nil);
|
|
665
|
+
}];
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
- (void)rejectEncryptedUploadV2Profile:(NSString *)requestId
|
|
669
|
+
errorCode:(NSString *)errorCode
|
|
670
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
671
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
672
|
+
{
|
|
673
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
674
|
+
rejectEncryptedUploadV2ProfileWithRequestID:requestId
|
|
675
|
+
errorCode:errorCode
|
|
676
|
+
completion:^(NSError *_Nullable error) {
|
|
677
|
+
if (error != nil) {
|
|
678
|
+
BotaRejectAppleError(error, reject);
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
resolve(nil);
|
|
682
|
+
}];
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
- (void)startStreaming:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
686
|
+
request:(JS::NativeBotaDeviceSDK::NativeStreamingStartRequest &)request
|
|
687
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
688
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
689
|
+
{
|
|
690
|
+
__weak BotaDeviceSDK *weakSelf = self;
|
|
691
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
692
|
+
startStreamingWithID:device.id_()
|
|
693
|
+
serialNumber:device.serialNumber()
|
|
694
|
+
deviceType:device.deviceType()
|
|
695
|
+
firmwareVersion:device.firmwareVersion()
|
|
696
|
+
hardwareRevision:device.hardwareRevision()
|
|
697
|
+
isProvisioned:device.isProvisioned()
|
|
698
|
+
connectionState:device.connectionState()
|
|
699
|
+
mtu:device.mtu()
|
|
700
|
+
sessionID:request.sessionId()
|
|
701
|
+
recordingUUID:request.recordingUuid()
|
|
702
|
+
recordingID:request.recordingId()
|
|
703
|
+
chunkSizeBytes:request.chunkSizeBytes()
|
|
704
|
+
flushIntervalMilliseconds:request.flushIntervalMs()
|
|
705
|
+
onProgress:^(NSDictionary *progress) {
|
|
706
|
+
[weakSelf emitOnStreamingProgress:progress];
|
|
707
|
+
}
|
|
708
|
+
onDestinationRequest:^(NSDictionary *destinationRequest) {
|
|
709
|
+
[weakSelf emitOnStreamingChunkDestinationRequested:destinationRequest];
|
|
710
|
+
}
|
|
711
|
+
onFinalizeRequest:^(NSDictionary *finalizeRequest) {
|
|
712
|
+
[weakSelf emitOnStreamingFinalizeRequested:finalizeRequest];
|
|
713
|
+
}
|
|
714
|
+
completion:^(double totalBytes, NSError *_Nullable error) {
|
|
715
|
+
if (error != nil) {
|
|
716
|
+
BotaRejectAppleError(error, reject);
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
resolve(@{ @"totalBytes": @(totalBytes) });
|
|
720
|
+
}];
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
- (void)abortStreaming:(NSString *)sessionId
|
|
724
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
725
|
+
reject:(__unused RCTPromiseRejectBlock)reject
|
|
726
|
+
{
|
|
727
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
728
|
+
abortStreamingWithSessionID:sessionId
|
|
729
|
+
completion:^{ resolve(nil); }];
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
- (void)resolveStreamingChunkDestination:(NSString *)requestId
|
|
733
|
+
destination:(JS::NativeBotaDeviceSDK::NativeStreamingUploadDestination &)destination
|
|
734
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
735
|
+
reject:(__unused RCTPromiseRejectBlock)reject
|
|
736
|
+
{
|
|
737
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
738
|
+
resolveStreamingDestinationWithRequestID:requestId
|
|
739
|
+
url:destination.url()
|
|
740
|
+
method:destination.method()
|
|
741
|
+
contentType:destination.contentType()
|
|
742
|
+
bearerToken:destination.bearerToken()
|
|
743
|
+
completion:^{ resolve(nil); }];
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
- (void)rejectStreamingChunkDestination:(NSString *)requestId
|
|
747
|
+
message:(NSString *)message
|
|
748
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
749
|
+
reject:(__unused RCTPromiseRejectBlock)reject
|
|
750
|
+
{
|
|
751
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
752
|
+
rejectStreamingDestinationWithRequestID:requestId
|
|
753
|
+
message:message
|
|
754
|
+
completion:^{ resolve(nil); }];
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
- (void)resolveStreamingFinalize:(NSString *)requestId
|
|
758
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
759
|
+
reject:(__unused RCTPromiseRejectBlock)reject
|
|
760
|
+
{
|
|
761
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
762
|
+
resolveStreamingFinalizeWithRequestID:requestId
|
|
763
|
+
completion:^{ resolve(nil); }];
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
- (void)rejectStreamingFinalize:(NSString *)requestId
|
|
767
|
+
message:(NSString *)message
|
|
768
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
769
|
+
reject:(__unused RCTPromiseRejectBlock)reject
|
|
770
|
+
{
|
|
771
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
772
|
+
rejectStreamingFinalizeWithRequestID:requestId
|
|
773
|
+
message:message
|
|
774
|
+
completion:^{ resolve(nil); }];
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
- (void)confirmRecording:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
778
|
+
recordingUuid:(NSString *)recordingUuid
|
|
779
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
780
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
781
|
+
{
|
|
782
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
783
|
+
confirmRecordingWithID:device.id_()
|
|
784
|
+
serialNumber:device.serialNumber()
|
|
785
|
+
deviceType:device.deviceType()
|
|
786
|
+
firmwareVersion:device.firmwareVersion()
|
|
787
|
+
hardwareRevision:device.hardwareRevision()
|
|
788
|
+
isProvisioned:device.isProvisioned()
|
|
789
|
+
connectionState:device.connectionState()
|
|
790
|
+
mtu:device.mtu()
|
|
791
|
+
recordingUUID:recordingUuid
|
|
792
|
+
completion:^(NSError *_Nullable error) {
|
|
793
|
+
if (error != nil) {
|
|
794
|
+
BotaRejectAppleError(error, reject);
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
resolve(nil);
|
|
798
|
+
}];
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
- (void)uploadRecordingFile:(JS::NativeBotaDeviceSDK::NativeRecordingUploadRequest &)request
|
|
802
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
803
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
804
|
+
{
|
|
805
|
+
__weak BotaDeviceSDK *weakSelf = self;
|
|
806
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
807
|
+
uploadRecordingFileWithTaskID:request.taskId()
|
|
808
|
+
recordingID:request.recordingId()
|
|
809
|
+
localPath:request.localPath()
|
|
810
|
+
uploadURL:request.uploadUrl()
|
|
811
|
+
uploadToken:request.uploadToken()
|
|
812
|
+
completeURL:request.completeUrl()
|
|
813
|
+
contentType:request.contentType()
|
|
814
|
+
contentSHA256:request.contentSha256()
|
|
815
|
+
relayURL:request.relayUrl()
|
|
816
|
+
relayBearerToken:request.relayBearerToken()
|
|
817
|
+
onProgress:^(NSDictionary *progress) {
|
|
818
|
+
[weakSelf emitOnRecordingUploadProgress:progress];
|
|
819
|
+
}
|
|
820
|
+
completion:^(NSError *_Nullable error) {
|
|
821
|
+
if (error != nil) {
|
|
822
|
+
BotaRejectAppleError(error, reject);
|
|
823
|
+
return;
|
|
824
|
+
}
|
|
825
|
+
resolve(nil);
|
|
826
|
+
}];
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
- (void)cancelRecordingUpload:(NSString *)taskId
|
|
830
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
831
|
+
reject:(__unused RCTPromiseRejectBlock)reject
|
|
832
|
+
{
|
|
833
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
834
|
+
cancelRecordingUploadWithTaskID:taskId
|
|
835
|
+
completion:^{ resolve(nil); }];
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
- (void)loadCompatibilityUploadQueue:(RCTPromiseResolveBlock)resolve
|
|
839
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
840
|
+
{
|
|
841
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
842
|
+
loadCompatibilityUploadQueueWithCompletion:^(NSString *_Nullable value,
|
|
843
|
+
NSError *_Nullable error) {
|
|
844
|
+
if (error != nil) {
|
|
845
|
+
BotaRejectAppleError(error, reject);
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
resolve(value);
|
|
849
|
+
}];
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
- (void)saveCompatibilityUploadQueue:(NSString *)serializedTasks
|
|
853
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
854
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
855
|
+
{
|
|
856
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
857
|
+
saveCompatibilityUploadQueueWithSerializedTasks:serializedTasks
|
|
858
|
+
completion:^(NSError *_Nullable error) {
|
|
859
|
+
if (error != nil) {
|
|
860
|
+
BotaRejectAppleError(error, reject);
|
|
861
|
+
return;
|
|
862
|
+
}
|
|
863
|
+
resolve(nil);
|
|
864
|
+
}];
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
- (void)stopAllRecordingOperations:(RCTPromiseResolveBlock)resolve
|
|
868
|
+
reject:(__unused RCTPromiseRejectBlock)reject
|
|
869
|
+
{
|
|
870
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
871
|
+
stopAllRecordingOperationsWithCompletion:^{ resolve(nil); }];
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
- (void)observeUploadOwnership:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
875
|
+
request:(JS::NativeBotaDeviceSDK::NativeUploadOwnershipRequest &)request
|
|
876
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
877
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
878
|
+
{
|
|
879
|
+
__weak BotaDeviceSDK *weakSelf = self;
|
|
880
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
881
|
+
observeUploadOwnershipWithID:device.id_()
|
|
882
|
+
serialNumber:device.serialNumber()
|
|
883
|
+
deviceType:device.deviceType()
|
|
884
|
+
firmwareVersion:device.firmwareVersion()
|
|
885
|
+
hardwareRevision:device.hardwareRevision()
|
|
886
|
+
isProvisioned:device.isProvisioned()
|
|
887
|
+
connectionState:device.connectionState()
|
|
888
|
+
mtu:device.mtu()
|
|
889
|
+
recordingUUID:request.recordingUuid()
|
|
890
|
+
uploadID:request.uploadId()
|
|
891
|
+
destinationID:request.destinationId()
|
|
892
|
+
onProgress:^(NSDictionary *progress) {
|
|
893
|
+
[weakSelf emitOnUploadOwnershipProgress:progress];
|
|
894
|
+
}
|
|
895
|
+
completion:^(NSDictionary *_Nullable result, NSError *_Nullable error) {
|
|
896
|
+
if (error != nil) {
|
|
897
|
+
BotaRejectAppleError(error, reject);
|
|
898
|
+
return;
|
|
899
|
+
}
|
|
900
|
+
resolve(result);
|
|
901
|
+
}];
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
- (void)updateFirmware:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
905
|
+
image:(JS::NativeBotaDeviceSDK::NativeFirmwareImage &)image
|
|
906
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
907
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
908
|
+
{
|
|
909
|
+
__weak BotaDeviceSDK *weakSelf = self;
|
|
910
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
911
|
+
updateFirmwareWithID:device.id_()
|
|
912
|
+
serialNumber:device.serialNumber()
|
|
913
|
+
deviceType:device.deviceType()
|
|
914
|
+
firmwareVersion:device.firmwareVersion()
|
|
915
|
+
hardwareRevision:device.hardwareRevision()
|
|
916
|
+
isProvisioned:device.isProvisioned()
|
|
917
|
+
connectionState:device.connectionState()
|
|
918
|
+
mtu:device.mtu()
|
|
919
|
+
version:image.version()
|
|
920
|
+
sizeUnits:image.sizeUnits()
|
|
921
|
+
crc32:image.crc32()
|
|
922
|
+
url:image.url()
|
|
923
|
+
onProgress:^(NSDictionary *progress) {
|
|
924
|
+
[weakSelf emitOnFirmwareUpdateProgress:progress];
|
|
925
|
+
}
|
|
926
|
+
completion:^(NSError *_Nullable error) {
|
|
927
|
+
if (error != nil) {
|
|
928
|
+
BotaRejectAppleError(error, reject);
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
resolve(nil);
|
|
932
|
+
}];
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
- (void)cancelFirmwareUpdate:(RCTPromiseResolveBlock)resolve
|
|
936
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
937
|
+
{
|
|
938
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
939
|
+
cancelFirmwareUpdateWithCompletion:^{ resolve(nil); }];
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
- (void)startDeviceLogs:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
943
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
944
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
945
|
+
{
|
|
946
|
+
__weak BotaDeviceSDK *weakSelf = self;
|
|
947
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
948
|
+
startDeviceLogsWithID:device.id_()
|
|
949
|
+
serialNumber:device.serialNumber()
|
|
950
|
+
deviceType:device.deviceType()
|
|
951
|
+
firmwareVersion:device.firmwareVersion()
|
|
952
|
+
hardwareRevision:device.hardwareRevision()
|
|
953
|
+
isProvisioned:device.isProvisioned()
|
|
954
|
+
connectionState:device.connectionState()
|
|
955
|
+
mtu:device.mtu()
|
|
956
|
+
onLine:^(NSDictionary *line) {
|
|
957
|
+
[weakSelf emitOnDeviceLog:line];
|
|
958
|
+
}
|
|
959
|
+
onError:^(__unused NSError *error) {}
|
|
960
|
+
completion:^(NSError *_Nullable error) {
|
|
961
|
+
if (error != nil) {
|
|
962
|
+
BotaRejectAppleError(error, reject);
|
|
963
|
+
return;
|
|
964
|
+
}
|
|
965
|
+
resolve(nil);
|
|
966
|
+
}];
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
- (void)stopDeviceLogs:(RCTPromiseResolveBlock)resolve
|
|
970
|
+
reject:(__unused RCTPromiseRejectBlock)reject
|
|
971
|
+
{
|
|
972
|
+
[[BotaDeviceSDKAppleBridge shared] stopDeviceLogsWithCompletion:^{
|
|
973
|
+
resolve(nil);
|
|
974
|
+
}];
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
- (void)readStatus:(RCTPromiseResolveBlock)resolve
|
|
978
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
979
|
+
{
|
|
980
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
981
|
+
readStatusWithCompletion:^(NSDictionary *_Nullable status, NSError *_Nullable error) {
|
|
982
|
+
if (error != nil) {
|
|
983
|
+
BotaRejectAppleError(error, reject);
|
|
984
|
+
return;
|
|
985
|
+
}
|
|
986
|
+
resolve(status);
|
|
987
|
+
}];
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
- (void)startStatusUpdates:(RCTPromiseResolveBlock)resolve
|
|
991
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
992
|
+
{
|
|
993
|
+
__weak BotaDeviceSDK *weakSelf = self;
|
|
994
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
995
|
+
startStatusUpdatesWithOnStatus:^(NSDictionary *status) {
|
|
996
|
+
[weakSelf emitOnDeviceStatusUpdated:status];
|
|
997
|
+
}
|
|
998
|
+
onError:^(NSError *error) {
|
|
999
|
+
[weakSelf emitOnDeviceDisconnected:@{
|
|
1000
|
+
@"error": error.localizedDescription ?: @"Bluetooth link lost"
|
|
1001
|
+
}];
|
|
1002
|
+
}
|
|
1003
|
+
completion:^(NSError *_Nullable error) {
|
|
1004
|
+
if (error != nil) {
|
|
1005
|
+
BotaRejectAppleError(error, reject);
|
|
1006
|
+
return;
|
|
1007
|
+
}
|
|
1008
|
+
resolve(nil);
|
|
1009
|
+
}];
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
- (void)stopStatusUpdates:(RCTPromiseResolveBlock)resolve
|
|
1013
|
+
reject:(__unused RCTPromiseRejectBlock)reject
|
|
1014
|
+
{
|
|
1015
|
+
[[BotaDeviceSDKAppleBridge shared] stopStatusUpdatesWithCompletion:^{
|
|
1016
|
+
resolve(nil);
|
|
1017
|
+
}];
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
- (void)provision:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
1021
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
1022
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
1023
|
+
{
|
|
1024
|
+
__weak BotaDeviceSDK *weakSelf = self;
|
|
1025
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
1026
|
+
provisionWithID:device.id_()
|
|
1027
|
+
serialNumber:device.serialNumber()
|
|
1028
|
+
deviceType:device.deviceType()
|
|
1029
|
+
firmwareVersion:device.firmwareVersion()
|
|
1030
|
+
hardwareRevision:device.hardwareRevision()
|
|
1031
|
+
isProvisioned:device.isProvisioned()
|
|
1032
|
+
connectionState:device.connectionState()
|
|
1033
|
+
mtu:device.mtu()
|
|
1034
|
+
onMaterialRequest:^(NSDictionary *request) {
|
|
1035
|
+
[weakSelf emitOnProvisioningMaterialRequested:request];
|
|
1036
|
+
}
|
|
1037
|
+
completion:^(NSError *_Nullable error) {
|
|
1038
|
+
if (error != nil) {
|
|
1039
|
+
BotaRejectAppleError(error, reject);
|
|
1040
|
+
return;
|
|
1041
|
+
}
|
|
1042
|
+
resolve(nil);
|
|
1043
|
+
}];
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
- (void)deprovision:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
1047
|
+
grantBlob:(NSString *)grantBlob
|
|
1048
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
1049
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
1050
|
+
{
|
|
1051
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
1052
|
+
deprovisionWithID:device.id_()
|
|
1053
|
+
serialNumber:device.serialNumber()
|
|
1054
|
+
deviceType:device.deviceType()
|
|
1055
|
+
firmwareVersion:device.firmwareVersion()
|
|
1056
|
+
hardwareRevision:device.hardwareRevision()
|
|
1057
|
+
isProvisioned:device.isProvisioned()
|
|
1058
|
+
connectionState:device.connectionState()
|
|
1059
|
+
mtu:device.mtu()
|
|
1060
|
+
grantBlob:grantBlob
|
|
1061
|
+
completion:^(NSDictionary *_Nullable result,
|
|
1062
|
+
NSError *_Nullable error) {
|
|
1063
|
+
if (error != nil) {
|
|
1064
|
+
BotaRejectAppleError(error, reject);
|
|
1065
|
+
return;
|
|
1066
|
+
}
|
|
1067
|
+
resolve(result);
|
|
1068
|
+
}];
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
- (void)readConnectionSettings:
|
|
1072
|
+
(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
1073
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
1074
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
1075
|
+
{
|
|
1076
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
1077
|
+
readConnectionSettingsWithID:device.id_()
|
|
1078
|
+
serialNumber:device.serialNumber()
|
|
1079
|
+
deviceType:device.deviceType()
|
|
1080
|
+
firmwareVersion:device.firmwareVersion()
|
|
1081
|
+
hardwareRevision:device.hardwareRevision()
|
|
1082
|
+
isProvisioned:device.isProvisioned()
|
|
1083
|
+
connectionState:device.connectionState()
|
|
1084
|
+
mtu:device.mtu()
|
|
1085
|
+
completion:^(NSDictionary *_Nullable settings,
|
|
1086
|
+
NSError *_Nullable error) {
|
|
1087
|
+
if (error != nil) {
|
|
1088
|
+
BotaRejectAppleError(error, reject);
|
|
1089
|
+
return;
|
|
1090
|
+
}
|
|
1091
|
+
resolve(settings);
|
|
1092
|
+
}];
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
- (void)writeConnectionSettings:
|
|
1096
|
+
(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
1097
|
+
settings:
|
|
1098
|
+
(JS::NativeBotaDeviceSDK::NativeDeviceConnectionSettings &)settings
|
|
1099
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
1100
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
1101
|
+
{
|
|
1102
|
+
auto enabled = settings.enabledConnections();
|
|
1103
|
+
auto heartbeat = settings.heartbeatEnabledConnections();
|
|
1104
|
+
auto power = settings.powerManagement();
|
|
1105
|
+
NSMutableArray<NSString *> *preference = [NSMutableArray array];
|
|
1106
|
+
for (NSString *value : settings.uploadNetworkPreference()) {
|
|
1107
|
+
[preference addObject:value];
|
|
1108
|
+
}
|
|
1109
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
1110
|
+
writeConnectionSettingsWithID:device.id_()
|
|
1111
|
+
serialNumber:device.serialNumber()
|
|
1112
|
+
deviceType:device.deviceType()
|
|
1113
|
+
firmwareVersion:device.firmwareVersion()
|
|
1114
|
+
hardwareRevision:device.hardwareRevision()
|
|
1115
|
+
isProvisioned:device.isProvisioned()
|
|
1116
|
+
connectionState:device.connectionState()
|
|
1117
|
+
mtu:device.mtu()
|
|
1118
|
+
enabledWifi:enabled.wifi()
|
|
1119
|
+
enabledCellular:enabled.cellular()
|
|
1120
|
+
heartbeatWifi:heartbeat.wifi()
|
|
1121
|
+
heartbeatCellular:heartbeat.cellular()
|
|
1122
|
+
uploadNetworkPreference:preference
|
|
1123
|
+
wifiIdleTimeoutSeconds:power.wifiIdleTimeoutSeconds()
|
|
1124
|
+
cellularIdleTimeoutSeconds:power.cellularIdleTimeoutSeconds()
|
|
1125
|
+
streamingEnabled:settings.streamingEnabled()
|
|
1126
|
+
streamingFlushIntervalSeconds:settings.streamingFlushIntervalSeconds()
|
|
1127
|
+
completion:^(NSError *_Nullable error) {
|
|
1128
|
+
if (error != nil) {
|
|
1129
|
+
BotaRejectAppleError(error, reject);
|
|
1130
|
+
return;
|
|
1131
|
+
}
|
|
1132
|
+
resolve(nil);
|
|
1133
|
+
}];
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
- (void)factoryReset:(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
1137
|
+
commandId:(NSString *)commandId
|
|
1138
|
+
bindingGeneration:(double)bindingGeneration
|
|
1139
|
+
requiresApplicationPersistence:(BOOL)requiresApplicationPersistence
|
|
1140
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
1141
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
1142
|
+
{
|
|
1143
|
+
__weak BotaDeviceSDK *weakSelf = self;
|
|
1144
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
1145
|
+
factoryResetWithID:device.id_()
|
|
1146
|
+
serialNumber:device.serialNumber()
|
|
1147
|
+
deviceType:device.deviceType()
|
|
1148
|
+
firmwareVersion:device.firmwareVersion()
|
|
1149
|
+
hardwareRevision:device.hardwareRevision()
|
|
1150
|
+
isProvisioned:device.isProvisioned()
|
|
1151
|
+
connectionState:device.connectionState()
|
|
1152
|
+
mtu:device.mtu()
|
|
1153
|
+
commandID:commandId
|
|
1154
|
+
bindingGeneration:bindingGeneration
|
|
1155
|
+
requiresApplicationPersistence:requiresApplicationPersistence
|
|
1156
|
+
onGrantRequest:^(NSDictionary *request) {
|
|
1157
|
+
[weakSelf emitOnFactoryResetGrantRequested:request];
|
|
1158
|
+
}
|
|
1159
|
+
onPersistenceRequest:^(NSDictionary *request) {
|
|
1160
|
+
[weakSelf emitOnFactoryResetResultPersistenceRequested:request];
|
|
1161
|
+
}
|
|
1162
|
+
completion:^(NSDictionary *_Nullable result, NSError *_Nullable error) {
|
|
1163
|
+
if (error != nil) {
|
|
1164
|
+
BotaRejectAppleError(error, reject);
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
resolve(result);
|
|
1168
|
+
}];
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
- (void)resumePendingFactoryReset:
|
|
1172
|
+
(JS::NativeBotaDeviceSDK::NativeConnectedDevice &)device
|
|
1173
|
+
currentBindingGeneration:(double)currentBindingGeneration
|
|
1174
|
+
requiresApplicationPersistence:(BOOL)requiresApplicationPersistence
|
|
1175
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
1176
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
1177
|
+
{
|
|
1178
|
+
__weak BotaDeviceSDK *weakSelf = self;
|
|
1179
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
1180
|
+
resumePendingFactoryResetWithID:device.id_()
|
|
1181
|
+
serialNumber:device.serialNumber()
|
|
1182
|
+
deviceType:device.deviceType()
|
|
1183
|
+
firmwareVersion:device.firmwareVersion()
|
|
1184
|
+
hardwareRevision:device.hardwareRevision()
|
|
1185
|
+
isProvisioned:device.isProvisioned()
|
|
1186
|
+
connectionState:device.connectionState()
|
|
1187
|
+
mtu:device.mtu()
|
|
1188
|
+
currentBindingGeneration:currentBindingGeneration
|
|
1189
|
+
requiresApplicationPersistence:requiresApplicationPersistence
|
|
1190
|
+
onPersistenceRequest:^(NSDictionary *request) {
|
|
1191
|
+
[weakSelf emitOnFactoryResetResultPersistenceRequested:request];
|
|
1192
|
+
}
|
|
1193
|
+
completion:^(NSDictionary *_Nullable result, NSError *_Nullable error) {
|
|
1194
|
+
if (error != nil) {
|
|
1195
|
+
BotaRejectAppleError(error, reject);
|
|
1196
|
+
return;
|
|
1197
|
+
}
|
|
1198
|
+
resolve(result);
|
|
1199
|
+
}];
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
- (void)resolveFactoryResetResultPersistence:(NSString *)requestId
|
|
1203
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
1204
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
1205
|
+
{
|
|
1206
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
1207
|
+
resolveFactoryResetResultPersistenceWithRequestID:requestId
|
|
1208
|
+
completion:^(NSError *_Nullable error) {
|
|
1209
|
+
if (error != nil) {
|
|
1210
|
+
BotaRejectAppleError(error, reject);
|
|
1211
|
+
return;
|
|
1212
|
+
}
|
|
1213
|
+
resolve(nil);
|
|
1214
|
+
}];
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
- (void)resolveProvisioningMaterial:(NSString *)requestId
|
|
1218
|
+
material:(JS::NativeBotaDeviceSDK::NativeProvisioningMaterial &)material
|
|
1219
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
1220
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
1221
|
+
{
|
|
1222
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
1223
|
+
resolveProvisioningMaterialWithRequestID:requestId
|
|
1224
|
+
apiEndpoint:material.apiEndpoint()
|
|
1225
|
+
deviceToken:material.deviceToken()
|
|
1226
|
+
mtu:material.mtu()
|
|
1227
|
+
completion:^(NSError *_Nullable error) {
|
|
1228
|
+
if (error != nil) {
|
|
1229
|
+
BotaRejectAppleError(error, reject);
|
|
1230
|
+
return;
|
|
1231
|
+
}
|
|
1232
|
+
resolve(nil);
|
|
1233
|
+
}];
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
- (void)resolveFactoryResetGrant:(NSString *)requestId
|
|
1237
|
+
grantBlob:(NSString *)grantBlob
|
|
1238
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
1239
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
1240
|
+
{
|
|
1241
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
1242
|
+
resolveFactoryResetGrantWithRequestID:requestId
|
|
1243
|
+
grantBlob:grantBlob
|
|
1244
|
+
completion:^(NSError *_Nullable error) {
|
|
1245
|
+
if (error != nil) {
|
|
1246
|
+
BotaRejectAppleError(error, reject);
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
resolve(nil);
|
|
1250
|
+
}];
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
- (void)rejectApplicationMaterial:(NSString *)requestId
|
|
1254
|
+
message:(NSString *)message
|
|
1255
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
1256
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
1257
|
+
{
|
|
1258
|
+
[[BotaDeviceSDKAppleBridge shared]
|
|
1259
|
+
rejectApplicationMaterialWithRequestID:requestId
|
|
1260
|
+
message:message
|
|
1261
|
+
completion:^(NSError *_Nullable error) {
|
|
1262
|
+
if (error != nil) {
|
|
1263
|
+
BotaRejectAppleError(error, reject);
|
|
1264
|
+
return;
|
|
1265
|
+
}
|
|
1266
|
+
resolve(nil);
|
|
1267
|
+
}];
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
- (void)destroy:(RCTPromiseResolveBlock)resolve
|
|
1271
|
+
reject:(__unused RCTPromiseRejectBlock)reject
|
|
1272
|
+
{
|
|
1273
|
+
[[BotaDeviceSDKAppleBridge shared] destroyWithCompletion:^{
|
|
1274
|
+
resolve(nil);
|
|
1275
|
+
}];
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
- (void)getCapabilities:(RCTPromiseResolveBlock)resolve
|
|
1279
|
+
reject:(__unused RCTPromiseRejectBlock)reject
|
|
1280
|
+
{
|
|
1281
|
+
resolve([[BotaDeviceSDKAppleBridge shared] capabilities]);
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
- (void)getState:(RCTPromiseResolveBlock)resolve
|
|
1285
|
+
reject:(__unused RCTPromiseRejectBlock)reject
|
|
1286
|
+
{
|
|
1287
|
+
[[BotaDeviceSDKAppleBridge shared] stateWithCompletion:^(NSString *state) {
|
|
1288
|
+
resolve(state);
|
|
1289
|
+
}];
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
#if RCT_NEW_ARCH_ENABLED
|
|
1293
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
1294
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
1295
|
+
{
|
|
1296
|
+
return std::make_shared<facebook::react::NativeBotaDeviceSDKSpecJSI>(params);
|
|
1297
|
+
}
|
|
1298
|
+
#endif
|
|
1299
|
+
|
|
1300
|
+
@end
|