@bits-innovate/react-native-vstarcam 1.0.9 → 1.0.11
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.
|
@@ -40,8 +40,43 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
40
40
|
private static final String TAG = "VStarCamModule";
|
|
41
41
|
private static final String MODULE_NAME = "VStarCam";
|
|
42
42
|
|
|
43
|
-
// P2P Server
|
|
44
|
-
private static final String
|
|
43
|
+
// P2P Server parameters by DID prefix (from Flutter SDK)
|
|
44
|
+
private static final Map<String, String> SERVICE_PARAM_MAP = new HashMap<String, String>() {{
|
|
45
|
+
put("VSTC", "EBGBEMBMKGJMGAJPEIGIFKEGHBMCHMNFGKEGBFCBBMJELILDCJADCIOLHHLLJBKEAMMBLCDGONMDBJCJJPNFJP");
|
|
46
|
+
put("VSTB", "EBGBEMBMKGJMGAJPEIGIFKEGHBMCHMNFGKEGBFCBBMJELILDCJADCIOLHHLLJBKEAMMBLCDGONMDBJCJJPNFJP");
|
|
47
|
+
put("VSTA", "EFGBFFBJKDJKGGJMEAHKFHEJHNNHHANIHIFBBKDFAMJDLKKODNANCBPJGGLEIELOBGNDKADKPGNJBNCNIF");
|
|
48
|
+
put("VSTE", "EEGDFHBAKKIOGNJHEGHMFEEDGLNOHJMPHAFPBEDLADILKEKPDLBDDNPOHKKCIFKJBNNNKLCPPPNDBFDL");
|
|
49
|
+
put("VSTG", "EEGDFHBLKGJIGEJLEKGOFMEDHAMHHJNAGGFABMCOBGJOLHLJDFAFCPPHGILKIKLMANNHKEDKOINIBNCPJOMK:vstarcam2018");
|
|
50
|
+
put("VSTH", "EEGDFHBLKGJIGEJLEKGOFMEDHAMHHJNAGGFABMCOBGJOLHLJDFAFCPPHGILKIKLMANNHKEDKOINIBNCPJOMK:vstarcam2018");
|
|
51
|
+
put("VSTJ", "EEGDFHBLKGJIGEJNEOHEFBEIGANCHHMBHIFEAHDEAMJCKCKJDJAFDDPPHLKJIHLMBENHKDCHPHNJBODA:vstarcam2019");
|
|
52
|
+
put("VSTK", "EBGDEJBJKGJFGJJBEFHPFCEKHGNMHNNMHMFFBICPAJJNLDLLDHACCNONGLLPJGLKANMJLDDHODMEBOCIJEMA:vstarcam2019");
|
|
53
|
+
put("VSTL", "EEGDFHBLKGJIGEJIEIGN FPEEHGNMHPNBGOFIBECEBLJDLMLGDKAPCNPFGOLLJFLJAOMKLBDFOGMAAFCJJPNFJP:vstarcam2019");
|
|
54
|
+
put("VSTM", "EBGEEOBOKHJNHGJGEAGAEPEPHDMGHINBGIECBBCBBJIKLKLCCDBBCFODHLKLJJKPBOMELECKPNMNAICEJCNNJH:vstarcam2019");
|
|
55
|
+
put("VSTN", "EEGDFHBBKBIFGAIAFGHDFLFJGJNIGEMOHFFPAMDMAAIIKBKNCDBDDMOGHLKCJCKFBFMPLMCBPEMG:vstarcam2019");
|
|
56
|
+
put("VSTP", "EEGDFHBLKGJIGEJLEIGJFLENHLNBHCNMGAFGBNCOAIJMLKKODNALCCPKGBLHJLLHAHMBKNDFOGNGBDCIJFMB:vstarcam2019");
|
|
57
|
+
put("VSGG", "EBGDEJBJKGJEGIJHELGKFIEEHBMPHBNNGEFCBGCAAGJBLOLFDJAMCPODGFLEJIKNAFMBKNDHPLNEAM:vstarcam2021");
|
|
58
|
+
put("VSKK", "EIHGFNBAKMIIGLJHECHIFFECGKNNHONAHAFOBBDOAEJGLLKPDMAMCAPIGGLBIBLCAEMIKEDPOEMMBGCFJHNMJG:veepai2023");
|
|
59
|
+
put("VSKM", "EIHGFNBAKMIIGLJEEAHKFEEJHLNBHCNIGFFDBLCMAKJNLELPDDAGCNOOGILMJFLJAOMKLADEOEMJAPCDJCNPJF:veepai2024");
|
|
60
|
+
put("VSLL", "EIHGFOBBKKIOGNJKENHHFKEEGMNOHLMNHBFKBBDOAHJBLMKIDLAJCAPIGDLBJGLKAOMILNDJOJMGAHCLJHNMJG:veepai2024");
|
|
61
|
+
put("ACAE", "EEGDFHBLKGJIGEJLEKGOFMEDHAMHHJNAGGFABMCOBGJOLHLJDFAFCPPHGILKIKLMANNHKEDKOINIBNCPJOMK:vstarcam2018"); // Try VSTH params
|
|
62
|
+
// Fallback for unknown prefixes
|
|
63
|
+
put("DEFAULT", "EBGBEMBMKGJMGAJPEIGIFKEGHBMCHMNFGKEGBFCBBMJELILDCJADCIOLHHLLJBKEAMMBLCDGONMDBJCJJPNFJP");
|
|
64
|
+
}};
|
|
65
|
+
|
|
66
|
+
// Get service parameter for a DID
|
|
67
|
+
private static String getServiceParam(String did) {
|
|
68
|
+
if (did == null || did.length() < 4) {
|
|
69
|
+
return SERVICE_PARAM_MAP.get("DEFAULT");
|
|
70
|
+
}
|
|
71
|
+
String prefix = did.substring(0, 4).toUpperCase();
|
|
72
|
+
String param = SERVICE_PARAM_MAP.get(prefix);
|
|
73
|
+
if (param == null) {
|
|
74
|
+
Log.w(TAG, "No service param for prefix: " + prefix + ", using DEFAULT");
|
|
75
|
+
param = SERVICE_PARAM_MAP.get("DEFAULT");
|
|
76
|
+
}
|
|
77
|
+
Log.d(TAG, "Using service param for prefix " + prefix + ": " + (param.length() > 20 ? param.substring(0, 20) + "..." : param));
|
|
78
|
+
return param;
|
|
79
|
+
}
|
|
45
80
|
|
|
46
81
|
private final ReactApplicationContext reactContext;
|
|
47
82
|
private final ExecutorService executor;
|
|
@@ -241,13 +276,15 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
241
276
|
}
|
|
242
277
|
|
|
243
278
|
// Call JNIApi.create(did, serverParam)
|
|
279
|
+
String serviceParam = getServiceParam(deviceId);
|
|
244
280
|
Method createMethod = jniApiClass.getMethod("create", String.class, String.class);
|
|
245
|
-
Object result = createMethod.invoke(null, deviceId,
|
|
281
|
+
Object result = createMethod.invoke(null, deviceId, serviceParam);
|
|
246
282
|
long sdkClientPtr = (Long) result;
|
|
247
283
|
|
|
248
284
|
Log.d(TAG, "JNIApi.create result: " + sdkClientPtr);
|
|
249
285
|
|
|
250
|
-
|
|
286
|
+
// Note: pointer can be negative (unsigned long cast to signed) - only 0 is invalid
|
|
287
|
+
if (sdkClientPtr == 0) {
|
|
251
288
|
promise.reject("CREATE_ERROR", "Failed to create client, result: " + sdkClientPtr);
|
|
252
289
|
return;
|
|
253
290
|
}
|
|
@@ -298,7 +335,7 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
298
335
|
|
|
299
336
|
String param = (serverParam != null && !serverParam.isEmpty())
|
|
300
337
|
? serverParam
|
|
301
|
-
:
|
|
338
|
+
: getServiceParam(clientInfo.deviceId);
|
|
302
339
|
|
|
303
340
|
// Call JNIApi.connect(sdkClientPtr, timeout, serverParam, connectType)
|
|
304
341
|
// Signature: connect([long, int, class java.lang.String, int])
|
|
@@ -548,7 +585,7 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
548
585
|
@ReactMethod
|
|
549
586
|
public void getSdkVersion(Promise promise) {
|
|
550
587
|
WritableMap result = Arguments.createMap();
|
|
551
|
-
result.putString("version", "1.0.
|
|
588
|
+
result.putString("version", "1.0.11");
|
|
552
589
|
result.putBoolean("nativeLoaded", isNativeLibraryLoaded);
|
|
553
590
|
result.putString("nativeLib", "OKSMARTPPCS");
|
|
554
591
|
result.putBoolean("p2pInitialized", isP2PInitialized);
|