@bits-innovate/react-native-vstarcam 1.0.12 → 1.0.14
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,12 +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
|
-
|
|
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);
|
|
174
188
|
}
|
|
175
189
|
return null;
|
|
176
190
|
}
|
|
@@ -184,13 +198,26 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
184
198
|
new InvocationHandler() {
|
|
185
199
|
@Override
|
|
186
200
|
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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);
|
|
194
221
|
}
|
|
195
222
|
return null;
|
|
196
223
|
}
|
|
@@ -204,7 +231,11 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
204
231
|
new InvocationHandler() {
|
|
205
232
|
@Override
|
|
206
233
|
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
|
207
|
-
|
|
234
|
+
try {
|
|
235
|
+
Log.d(TAG, "ClientReleaseListener." + method.getName() + " called");
|
|
236
|
+
} catch (Exception e) {
|
|
237
|
+
Log.e(TAG, "Error in releaseListener callback", e);
|
|
238
|
+
}
|
|
208
239
|
return null;
|
|
209
240
|
}
|
|
210
241
|
}
|
|
@@ -599,7 +630,7 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
599
630
|
@ReactMethod
|
|
600
631
|
public void getSdkVersion(Promise promise) {
|
|
601
632
|
WritableMap result = Arguments.createMap();
|
|
602
|
-
result.putString("version", "1.0.
|
|
633
|
+
result.putString("version", "1.0.14");
|
|
603
634
|
result.putBoolean("nativeLoaded", isNativeLibraryLoaded);
|
|
604
635
|
result.putString("nativeLib", "OKSMARTPPCS");
|
|
605
636
|
result.putBoolean("p2pInitialized", isP2PInitialized);
|