@bits-innovate/react-native-vstarcam 1.0.13 → 1.0.15
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.
|
@@ -165,13 +165,26 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
165
165
|
new InvocationHandler() {
|
|
166
166
|
@Override
|
|
167
167
|
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
168
|
+
try {
|
|
169
|
+
Log.d(TAG, "ClientStateListener." + method.getName() + " called with " + (args != null ? args.length : 0) + " args");
|
|
170
|
+
if (method.getName().equals("stateListener")) {
|
|
171
|
+
// args: long clientPtr, int state
|
|
172
|
+
final long clientPtr = (Long) args[0];
|
|
173
|
+
final int state = (Integer) args[1];
|
|
174
|
+
Log.d(TAG, "State callback: clientPtr=" + clientPtr + ", state=" + state);
|
|
175
|
+
|
|
176
|
+
// Post to main thread for React Native compatibility
|
|
177
|
+
if (reactContext != null) {
|
|
178
|
+
reactContext.runOnUiQueueThread(new Runnable() {
|
|
179
|
+
@Override
|
|
180
|
+
public void run() {
|
|
181
|
+
handleStateChange(clientPtr, state);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
} catch (Exception e) {
|
|
187
|
+
Log.e(TAG, "Error in stateListener callback", e);
|
|
175
188
|
}
|
|
176
189
|
return null;
|
|
177
190
|
}
|
|
@@ -185,14 +198,26 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
185
198
|
new InvocationHandler() {
|
|
186
199
|
@Override
|
|
187
200
|
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
201
|
+
try {
|
|
202
|
+
Log.d(TAG, "ClientCommandListener." + method.getName() + " called with " + (args != null ? args.length : 0) + " args");
|
|
203
|
+
if (method.getName().equals("commandListener")) {
|
|
204
|
+
// args: long clientPtr, byte[] data, int length (from interface)
|
|
205
|
+
final long clientPtr = (Long) args[0];
|
|
206
|
+
final byte[] data = (byte[]) args[1];
|
|
207
|
+
final int length = (Integer) args[2];
|
|
208
|
+
Log.d(TAG, "Command callback: clientPtr=" + clientPtr + ", dataLen=" + (data != null ? data.length : 0));
|
|
209
|
+
|
|
210
|
+
if (reactContext != null) {
|
|
211
|
+
reactContext.runOnUiQueueThread(new Runnable() {
|
|
212
|
+
@Override
|
|
213
|
+
public void run() {
|
|
214
|
+
handleCommandReceive(clientPtr, 0, data);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
} catch (Exception e) {
|
|
220
|
+
Log.e(TAG, "Error in commandListener callback", e);
|
|
196
221
|
}
|
|
197
222
|
return null;
|
|
198
223
|
}
|
|
@@ -206,7 +231,11 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
206
231
|
new InvocationHandler() {
|
|
207
232
|
@Override
|
|
208
233
|
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
|
209
|
-
|
|
234
|
+
try {
|
|
235
|
+
Log.d(TAG, "ClientReleaseListener." + method.getName() + " called");
|
|
236
|
+
} catch (Exception e) {
|
|
237
|
+
Log.e(TAG, "Error in releaseListener callback", e);
|
|
238
|
+
}
|
|
210
239
|
return null;
|
|
211
240
|
}
|
|
212
241
|
}
|
|
@@ -268,6 +297,20 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
268
297
|
return MODULE_NAME;
|
|
269
298
|
}
|
|
270
299
|
|
|
300
|
+
// Required by NativeEventEmitter
|
|
301
|
+
@ReactMethod
|
|
302
|
+
public void addListener(String eventName) {
|
|
303
|
+
// Keep: Required for RN built in Event Emitter Calls
|
|
304
|
+
Log.d(TAG, "addListener called for: " + eventName);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Required by NativeEventEmitter
|
|
308
|
+
@ReactMethod
|
|
309
|
+
public void removeListeners(Integer count) {
|
|
310
|
+
// Keep: Required for RN built in Event Emitter Calls
|
|
311
|
+
Log.d(TAG, "removeListeners called with count: " + count);
|
|
312
|
+
}
|
|
313
|
+
|
|
271
314
|
private void sendEvent(String eventName, @Nullable WritableMap params) {
|
|
272
315
|
if (reactContext.hasActiveReactInstance()) {
|
|
273
316
|
reactContext
|
|
@@ -359,7 +402,17 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
359
402
|
long.class, int.class, String.class, int.class);
|
|
360
403
|
|
|
361
404
|
Log.d(TAG, "Calling JNIApi.connect(" + clientInfo.sdkClientPtr + ", 15, " + param + ", " + connectType + ")");
|
|
362
|
-
|
|
405
|
+
|
|
406
|
+
try {
|
|
407
|
+
connectMethod.invoke(null, clientInfo.sdkClientPtr, 15, param, connectType);
|
|
408
|
+
Log.d(TAG, "JNIApi.connect returned normally");
|
|
409
|
+
} catch (java.lang.reflect.InvocationTargetException ite) {
|
|
410
|
+
Log.e(TAG, "JNIApi.connect threw exception: " + ite.getCause(), ite.getCause());
|
|
411
|
+
throw ite;
|
|
412
|
+
} catch (Throwable t) {
|
|
413
|
+
Log.e(TAG, "JNIApi.connect crashed: " + t.getMessage(), t);
|
|
414
|
+
throw t;
|
|
415
|
+
}
|
|
363
416
|
|
|
364
417
|
Log.d(TAG, "JNIApi.connect called - waiting for state callback");
|
|
365
418
|
|
|
@@ -601,7 +654,7 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
601
654
|
@ReactMethod
|
|
602
655
|
public void getSdkVersion(Promise promise) {
|
|
603
656
|
WritableMap result = Arguments.createMap();
|
|
604
|
-
result.putString("version", "1.0.
|
|
657
|
+
result.putString("version", "1.0.15");
|
|
605
658
|
result.putBoolean("nativeLoaded", isNativeLibraryLoaded);
|
|
606
659
|
result.putString("nativeLib", "OKSMARTPPCS");
|
|
607
660
|
result.putBoolean("p2pInitialized", isP2PInitialized);
|