@bits-innovate/react-native-vstarcam 1.0.28 → 1.0.30
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.
|
@@ -218,7 +218,16 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
218
218
|
// Log JNIApi methods to find hidden functionality (Sound Wave, SmartConfig, etc.)
|
|
219
219
|
Log.d(TAG, "=== JNIApi Methods ===");
|
|
220
220
|
for (Method m : jniApiClass.getDeclaredMethods()) {
|
|
221
|
-
|
|
221
|
+
StringBuilder sb = new StringBuilder();
|
|
222
|
+
sb.append(" -> ").append(m.getReturnType().getSimpleName()).append(" ");
|
|
223
|
+
sb.append(m.getName()).append("(");
|
|
224
|
+
Class<?>[] params = m.getParameterTypes();
|
|
225
|
+
for (int i = 0; i < params.length; i++) {
|
|
226
|
+
sb.append(params[i].getName());
|
|
227
|
+
if (i < params.length - 1) sb.append(", ");
|
|
228
|
+
}
|
|
229
|
+
sb.append(")");
|
|
230
|
+
Log.d(TAG, sb.toString());
|
|
222
231
|
}
|
|
223
232
|
Log.d(TAG, "======================");
|
|
224
233
|
|
|
@@ -231,15 +240,15 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
231
240
|
// Log all methods on each listener for debugging
|
|
232
241
|
Log.d(TAG, "ClientStateListener methods:");
|
|
233
242
|
for (Method m : stateListenerClass.getDeclaredMethods()) {
|
|
234
|
-
Log.d(TAG, " -> " + m.getName() + "(" + java.util.Arrays.toString(m.getParameterTypes()) + ")");
|
|
243
|
+
Log.d(TAG, " -> " + m.getReturnType().getSimpleName() + " " + m.getName() + "(" + java.util.Arrays.toString(m.getParameterTypes()) + ")");
|
|
235
244
|
}
|
|
236
245
|
Log.d(TAG, "ClientCommandListener methods:");
|
|
237
246
|
for (Method m : commandListenerClass.getDeclaredMethods()) {
|
|
238
|
-
Log.d(TAG, " -> " + m.getName() + "(" + java.util.Arrays.toString(m.getParameterTypes()) + ")");
|
|
247
|
+
Log.d(TAG, " -> " + m.getReturnType().getSimpleName() + " " + m.getName() + "(" + java.util.Arrays.toString(m.getParameterTypes()) + ")");
|
|
239
248
|
}
|
|
240
249
|
Log.d(TAG, "ClientReleaseListener methods:");
|
|
241
250
|
for (Method m : releaseListenerClass.getDeclaredMethods()) {
|
|
242
|
-
Log.d(TAG, " -> " + m.getName() + "(" + java.util.Arrays.toString(m.getParameterTypes()) + ")");
|
|
251
|
+
Log.d(TAG, " -> " + m.getReturnType().getSimpleName() + " " + m.getName() + "(" + java.util.Arrays.toString(m.getParameterTypes()) + ")");
|
|
243
252
|
}
|
|
244
253
|
|
|
245
254
|
// Initialize P2P system with listeners
|
|
@@ -288,6 +297,12 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
288
297
|
} catch (Exception e) {
|
|
289
298
|
Log.e(TAG, "Error in stateListener callback", e);
|
|
290
299
|
}
|
|
300
|
+
|
|
301
|
+
// Handle return type
|
|
302
|
+
Class<?> returnType = method.getReturnType();
|
|
303
|
+
if (returnType.equals(int.class) || returnType.equals(Integer.class)) {
|
|
304
|
+
return 0;
|
|
305
|
+
}
|
|
291
306
|
return null;
|
|
292
307
|
}
|
|
293
308
|
}
|
|
@@ -321,6 +336,12 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
321
336
|
} catch (Exception e) {
|
|
322
337
|
Log.e(TAG, "Error in commandListener callback", e);
|
|
323
338
|
}
|
|
339
|
+
|
|
340
|
+
// Handle return type
|
|
341
|
+
Class<?> returnType = method.getReturnType();
|
|
342
|
+
if (returnType.equals(int.class) || returnType.equals(Integer.class)) {
|
|
343
|
+
return 0;
|
|
344
|
+
}
|
|
324
345
|
return null;
|
|
325
346
|
}
|
|
326
347
|
}
|
|
@@ -338,6 +359,12 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
338
359
|
} catch (Exception e) {
|
|
339
360
|
Log.e(TAG, "Error in releaseListener callback", e);
|
|
340
361
|
}
|
|
362
|
+
|
|
363
|
+
// Handle return type
|
|
364
|
+
Class<?> returnType = method.getReturnType();
|
|
365
|
+
if (returnType.equals(int.class) || returnType.equals(Integer.class)) {
|
|
366
|
+
return 0;
|
|
367
|
+
}
|
|
341
368
|
return null;
|
|
342
369
|
}
|
|
343
370
|
}
|
|
@@ -883,6 +910,44 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
883
910
|
promise.resolve(result);
|
|
884
911
|
}
|
|
885
912
|
|
|
913
|
+
/**
|
|
914
|
+
* Get device info via get_status.cgi
|
|
915
|
+
*/
|
|
916
|
+
@ReactMethod
|
|
917
|
+
public void clientGetDeviceInfo(int clientPtr, Promise promise) {
|
|
918
|
+
executor.execute(() -> {
|
|
919
|
+
try {
|
|
920
|
+
ClientInfo clientInfo = clients.get(clientPtr);
|
|
921
|
+
if (clientInfo == null || clientInfo.sdkClientPtr == 0) {
|
|
922
|
+
promise.reject("E_NOT_CONNECTED", "Client not connected");
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
// Use get_status.cgi to check if camera is responsive on network
|
|
927
|
+
String cgi = "get_status.cgi?loginuse=admin&loginpas=888888";
|
|
928
|
+
if (clientInfo.username != null) {
|
|
929
|
+
cgi = String.format("get_status.cgi?loginuse=%s&loginpas=%s",
|
|
930
|
+
clientInfo.username, clientInfo.password);
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
Method writeCgiMethod = jniApiClass.getMethod("writeCgi", long.class, String.class, int.class);
|
|
934
|
+
Log.d(TAG, "Verifying network: " + cgi);
|
|
935
|
+
Object result = writeCgiMethod.invoke(null, clientInfo.sdkClientPtr, cgi, 5);
|
|
936
|
+
|
|
937
|
+
// If we reach here, the CGI command was at least sent.
|
|
938
|
+
// We'll return a basic object representing success for now.
|
|
939
|
+
WritableMap response = Arguments.createMap();
|
|
940
|
+
response.putString("serialNumber", clientInfo.deviceId);
|
|
941
|
+
response.putString("model", "VStarCam Device");
|
|
942
|
+
response.putBoolean("responsive", true);
|
|
943
|
+
promise.resolve(response);
|
|
944
|
+
} catch (Exception e) {
|
|
945
|
+
Log.e(TAG, "clientGetDeviceInfo failed", e);
|
|
946
|
+
promise.reject("E_GET_INFO_FAILED", e.getMessage());
|
|
947
|
+
}
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
|
|
886
951
|
/**
|
|
887
952
|
* Get the current Wi-Fi SSID of the Android device
|
|
888
953
|
*/
|