@leonardojc/capacitor-ioboard 2.0.12 → 2.0.13
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.
|
@@ -18,7 +18,7 @@ public class CapacitorIoboardPlugin extends Plugin implements SerialConnectionMa
|
|
|
18
18
|
|
|
19
19
|
// Debug mode control
|
|
20
20
|
// Set to false for production to minimize logs
|
|
21
|
-
private static final boolean DEBUG_MODE =
|
|
21
|
+
private static final boolean DEBUG_MODE = false;
|
|
22
22
|
|
|
23
23
|
private SerialConnectionManager serialManager;
|
|
24
24
|
private IOBoardManager ioBoardManager;
|
|
@@ -506,7 +506,7 @@ public class CapacitorIoboardPlugin extends Plugin implements SerialConnectionMa
|
|
|
506
506
|
boolean sent = serialManager.writeData(commandBytes);
|
|
507
507
|
|
|
508
508
|
if (sent) {
|
|
509
|
-
|
|
509
|
+
// Log.i(TAG, "✅ Command successfully written to serial port");
|
|
510
510
|
Log.i(TAG, "HEX sent: " + bytesToHex(commandBytes));
|
|
511
511
|
} else {
|
|
512
512
|
Log.e(TAG, "❌ Failed to write command to serial port");
|
|
@@ -535,7 +535,7 @@ public class CapacitorIoboardPlugin extends Plugin implements SerialConnectionMa
|
|
|
535
535
|
@Override
|
|
536
536
|
public void onDataReceived(byte[] data) {
|
|
537
537
|
String dataString = new String(data);
|
|
538
|
-
Log.d(TAG, "Data received: " + dataString);
|
|
538
|
+
//Log.d(TAG, "Data received: " + dataString);
|
|
539
539
|
|
|
540
540
|
// Store response for getStatus() waiting
|
|
541
541
|
synchronized (responseLock) {
|
|
@@ -725,8 +725,8 @@ public class CapacitorIoboardPlugin extends Plugin implements SerialConnectionMa
|
|
|
725
725
|
System.arraycopy(validFrame, 4, result.data, 0, dataLength);
|
|
726
726
|
}
|
|
727
727
|
|
|
728
|
-
Log.d(TAG, String.format("🔍 Parsed - Address: %d, Type: %d, Data length: %d",
|
|
729
|
-
|
|
728
|
+
// Log.d(TAG, String.format("🔍 Parsed - Address: %d, Type: %d, Data length: %d",
|
|
729
|
+
// result.address, result.type, dataLength));
|
|
730
730
|
|
|
731
731
|
// Verificar CRC (antes del EOI final)
|
|
732
732
|
// Frame estructura: [SOI][LEN][ADDR][TYPE][DATA][CRC_LOW][CRC_HIGH][EOI]
|
|
@@ -764,11 +764,11 @@ public class CapacitorIoboardPlugin extends Plugin implements SerialConnectionMa
|
|
|
764
764
|
StringBuilder crc3Hex = new StringBuilder();
|
|
765
765
|
for (byte b : frameForCRC3) { crc3Hex.append(String.format("%02X ", b & 0xFF)); }
|
|
766
766
|
|
|
767
|
-
Log.d(TAG, String.format("🔍 CRC V1 (LEN+): %s = 0x%04X", crc1Hex.toString().trim(), calculatedCRC1));
|
|
768
|
-
Log.d(TAG, String.format("🔍 CRC V2 (ADDR+): %s = 0x%04X", crc2Hex.toString().trim(), calculatedCRC2));
|
|
769
|
-
Log.d(TAG, String.format("🔍 CRC V3 (SOI+): %s = 0x%04X", crc3Hex.toString().trim(), calculatedCRC3));
|
|
770
|
-
Log.d(TAG, String.format("🔍 CRC Debug - CRC bytes: 0x%02X 0x%02X at positions %d,%d",
|
|
771
|
-
|
|
767
|
+
// Log.d(TAG, String.format("🔍 CRC V1 (LEN+): %s = 0x%04X", crc1Hex.toString().trim(), calculatedCRC1));
|
|
768
|
+
// Log.d(TAG, String.format("🔍 CRC V2 (ADDR+): %s = 0x%04X", crc2Hex.toString().trim(), calculatedCRC2));
|
|
769
|
+
// Log.d(TAG, String.format("🔍 CRC V3 (SOI+): %s = 0x%04X", crc3Hex.toString().trim(), calculatedCRC3));
|
|
770
|
+
// Log.d(TAG, String.format("🔍 CRC Debug - CRC bytes: 0x%02X 0x%02X at positions %d,%d",
|
|
771
|
+
// validFrame[crcPos] & 0xFF, validFrame[crcPos + 1] & 0xFF, crcPos, crcPos + 1));
|
|
772
772
|
|
|
773
773
|
// También probar interpretando el CRC como byte único
|
|
774
774
|
int receivedCRC_Single = validFrame[crcPos] & 0xFF; // Solo el primer byte del "CRC"
|
|
@@ -826,8 +826,8 @@ public class CapacitorIoboardPlugin extends Plugin implements SerialConnectionMa
|
|
|
826
826
|
}
|
|
827
827
|
|
|
828
828
|
if (!crcValid) {
|
|
829
|
-
Log.w(TAG, "❌ CRC/Checksum mismatch in all variants and formats!");
|
|
830
|
-
Log.i(TAG, "ℹ️ IOBoard may use proprietary checksum algorithm - data parsing will continue");
|
|
829
|
+
//Log.w(TAG, "❌ CRC/Checksum mismatch in all variants and formats!");
|
|
830
|
+
//Log.i(TAG, "ℹ️ IOBoard may use proprietary checksum algorithm - data parsing will continue");
|
|
831
831
|
} else {
|
|
832
832
|
Log.i(TAG, String.format("🎯 IOBoard CRC/Checksum format identified: %s", validVariant));
|
|
833
833
|
}
|
|
@@ -841,7 +841,7 @@ public class CapacitorIoboardPlugin extends Plugin implements SerialConnectionMa
|
|
|
841
841
|
}
|
|
842
842
|
|
|
843
843
|
result.isValid = true;
|
|
844
|
-
Log.d(TAG, String.format("✅ Valid IOBoard response parsed: %s", result.toString()));
|
|
844
|
+
//Log.d(TAG, String.format("✅ Valid IOBoard response parsed: %s", result.toString()));
|
|
845
845
|
|
|
846
846
|
return result;
|
|
847
847
|
}
|
|
@@ -864,7 +864,7 @@ public class CapacitorIoboardPlugin extends Plugin implements SerialConnectionMa
|
|
|
864
864
|
if (response.data.length >= 6) {
|
|
865
865
|
int systemInfo1 = response.data[4] & 0xFF;
|
|
866
866
|
int systemInfo2 = response.data[5] & 0xFF;
|
|
867
|
-
|
|
867
|
+
// Log.d(TAG, String.format("🔧 System Info: 0x%02X 0x%02X", systemInfo1, systemInfo2));
|
|
868
868
|
}
|
|
869
869
|
}
|
|
870
870
|
}
|
|
@@ -360,7 +360,7 @@ public class SerialConnectionManager {
|
|
|
360
360
|
try {
|
|
361
361
|
CapacitorIoboardPlugin.IOBoardResponse response = CapacitorIoboardPlugin.parseIOBoardResponse(data);
|
|
362
362
|
if (response.isValid) {
|
|
363
|
-
|
|
363
|
+
// logDebug(String.format("🎯 IOBoard Response Parsed Successfully: %s", response.toString()));
|
|
364
364
|
|
|
365
365
|
// Logging específico según tipo de respuesta
|
|
366
366
|
if (response.type == 0x00) { // Status Response
|
|
@@ -400,7 +400,7 @@ public class SerialConnectionManager {
|
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
-
|
|
403
|
+
// Log.d(TAG, "=== END RECEIVED DATA ===");
|
|
404
404
|
|
|
405
405
|
notifyDataReceived(data);
|
|
406
406
|
}
|
|
@@ -451,7 +451,7 @@ public class SerialConnectionManager {
|
|
|
451
451
|
|
|
452
452
|
private void notifyDataReceived(byte[] data) {
|
|
453
453
|
if (listener != null) {
|
|
454
|
-
|
|
454
|
+
// Log.d(TAG, "Notifying listener of received data: " + bytesToHex(data));
|
|
455
455
|
mainHandler.post(() -> listener.onDataReceived(data));
|
|
456
456
|
} else {
|
|
457
457
|
Log.w(TAG, "No listener set for received data: " + bytesToHex(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.13",
|
|
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",
|