@bits-innovate/react-native-vstarcam 1.0.13 → 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,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
|
}
|
|
@@ -601,7 +630,7 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
601
630
|
@ReactMethod
|
|
602
631
|
public void getSdkVersion(Promise promise) {
|
|
603
632
|
WritableMap result = Arguments.createMap();
|
|
604
|
-
result.putString("version", "1.0.
|
|
633
|
+
result.putString("version", "1.0.14");
|
|
605
634
|
result.putBoolean("nativeLoaded", isNativeLibraryLoaded);
|
|
606
635
|
result.putString("nativeLib", "OKSMARTPPCS");
|
|
607
636
|
result.putBoolean("p2pInitialized", isP2PInitialized);
|