@leonardojc/capacitor-ioboard 2.0.16 → 2.0.18
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.
|
@@ -204,7 +204,7 @@ public class CapacitorIoboardPlugin extends Plugin implements SerialConnectionMa
|
|
|
204
204
|
logDebug("📤 Sending raw frame: " + bytesToHex(frame));
|
|
205
205
|
|
|
206
206
|
// Send frame directly via serial port
|
|
207
|
-
serialManager.
|
|
207
|
+
serialManager.writeData(frame);
|
|
208
208
|
|
|
209
209
|
JSObject result = new JSObject();
|
|
210
210
|
result.put("success", true);
|
|
@@ -526,62 +526,6 @@ public class CapacitorIoboardPlugin extends Plugin implements SerialConnectionMa
|
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
528
|
|
|
529
|
-
@PluginMethod
|
|
530
|
-
public void sendRawCommand(PluginCall call) {
|
|
531
|
-
if (!isConnected) {
|
|
532
|
-
JSObject errorResult = new JSObject();
|
|
533
|
-
errorResult.put("success", false);
|
|
534
|
-
errorResult.put("error", "Not connected to device");
|
|
535
|
-
call.resolve(errorResult);
|
|
536
|
-
return;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
String command = call.getString("command");
|
|
540
|
-
if (command == null) {
|
|
541
|
-
JSObject errorResult = new JSObject();
|
|
542
|
-
errorResult.put("success", false);
|
|
543
|
-
errorResult.put("error", "Command is required");
|
|
544
|
-
call.resolve(errorResult);
|
|
545
|
-
return;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
try {
|
|
549
|
-
// Detailed logging before sending
|
|
550
|
-
Log.d(TAG, "=== SENDING COMMAND ===");
|
|
551
|
-
Log.d(TAG, "Command details: " + getDetailedCommandInfo(command));
|
|
552
|
-
|
|
553
|
-
byte[] commandBytes = command.getBytes();
|
|
554
|
-
Log.d(TAG, "Bytes to send (length=" + commandBytes.length + "): " + bytesToHex(commandBytes));
|
|
555
|
-
Log.d(TAG, "Raw bytes: " + java.util.Arrays.toString(commandBytes));
|
|
556
|
-
|
|
557
|
-
boolean sent = serialManager.writeData(commandBytes);
|
|
558
|
-
|
|
559
|
-
if (sent) {
|
|
560
|
-
// Log.i(TAG, "✅ Command successfully written to serial port");
|
|
561
|
-
Log.i(TAG, "HEX sent: " + bytesToHex(commandBytes));
|
|
562
|
-
} else {
|
|
563
|
-
Log.e(TAG, "❌ Failed to write command to serial port");
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
JSObject result = new JSObject();
|
|
567
|
-
result.put("success", sent);
|
|
568
|
-
result.put("command", command);
|
|
569
|
-
result.put("hexSent", bytesToHex(commandBytes));
|
|
570
|
-
result.put("bytesLength", commandBytes.length);
|
|
571
|
-
if (!sent) {
|
|
572
|
-
result.put("error", "Failed to send command");
|
|
573
|
-
}
|
|
574
|
-
call.resolve(result);
|
|
575
|
-
} catch (Exception e) {
|
|
576
|
-
String error = "Error sending raw command: " + e.getMessage();
|
|
577
|
-
Log.e(TAG, error, e);
|
|
578
|
-
JSObject errorResult = new JSObject();
|
|
579
|
-
errorResult.put("success", false);
|
|
580
|
-
errorResult.put("error", error);
|
|
581
|
-
call.resolve(errorResult);
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
|
|
585
529
|
// SerialDataListener implementation
|
|
586
530
|
@Override
|
|
587
531
|
public void onDataReceived(byte[] data) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leonardojc/capacitor-ioboard",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.18",
|
|
4
4
|
"description": "A comprehensive Capacitor plugin for IOBoard devices with integrated serial communication and complete MTC3P08L protocol support including OTA updates",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|