Trying using socket.io instead of websocket, because some device incompatibility

This commit is contained in:
2024-11-13 14:52:17 +07:00
parent 19da5914ac
commit 10fad0e192
6 changed files with 631 additions and 307 deletions

View File

@@ -60,7 +60,7 @@ public class PanTiltController {
byte[] command = new byte[]{0, cameraid, 0, 0, 0, 0, 0};
command[6] = Checksum(command); // add checksum
command[0] = (byte) 0xFF; // add synchronization byte
serialPort.writeBytes(command, command.length);
if (serialPort!=null && serialPort.isOpen()) serialPort.writeBytes(command, command.length);
}
/**
@@ -74,7 +74,7 @@ public class PanTiltController {
byte[] command = new byte[]{0, cameraid, 0, 4, speed, 0, 0};
command[6] = Checksum(command); // add checksum
command[0] = (byte) 0xFF; // add synchronization byte
serialPort.writeBytes(command, command.length);
if (serialPort!=null && serialPort.isOpen()) serialPort.writeBytes(command, command.length);
}
/**
@@ -88,7 +88,7 @@ public class PanTiltController {
byte[] command = new byte[]{0, cameraid, 0, 2, speed, 0, 0};
command[6] = Checksum(command); // add checksum
command[0] = (byte) 0xFF; // add synchronization byte
serialPort.writeBytes(command, command.length);
if (serialPort!=null && serialPort.isOpen()) serialPort.writeBytes(command, command.length);
}
/**
@@ -102,7 +102,7 @@ public class PanTiltController {
byte[] command = new byte[]{0, cameraid, 0, 8, speed, 0, 0};
command[6] = Checksum(command); // add checksum
command[0] = (byte) 0xFF; // add synchronization byte
serialPort.writeBytes(command, command.length);
if (serialPort!=null && serialPort.isOpen()) serialPort.writeBytes(command, command.length);
}
/**
@@ -116,7 +116,7 @@ public class PanTiltController {
byte[] command = new byte[]{0, cameraid, 0, 16, speed, 0, 0};
command[6] = Checksum(command); // add checksum
command[0] = (byte) 0xFF; // add synchronization byte
serialPort.writeBytes(command, command.length);
if (serialPort!=null && serialPort.isOpen()) serialPort.writeBytes(command, command.length);
}
/**