视觉控制器控制光源tcp部分代码

merge-requests/5/merge
yiming 4 years ago
parent edc5cffb66
commit 15ddeaf852

@ -257,7 +257,8 @@ public class HikCameraControlModuleImpl implements CameraControlModule {
}
public void downloadMp4(Integer cameraId, String path, LocalDateTime start, LocalDateTime end) {
start = start.minusMinutes(1);
end = end.minusMinutes(1);
PathUtil.checkDirc(path);
Duration duration = Duration.between(start, end);
Long seconds = duration.getSeconds();

@ -19,13 +19,13 @@ public class HikControlSocket {
* <${},${0 1},${get\post}>
*/
public static void main(String[] args) {
String code = openLight("172.16.0.82", 9000,2,0);
System.out.println(code);
int code = openLight("172.16.0.72", 9000,2,0);
}
public static String openLight(String ip,int port,int index,int bool){
public static int openLight(String ip,int port,int index,int bool){
Socket socket = new Socket();
String code = null;
int status = 0;
OutputStream os = null;
InputStream is = null;
try {
@ -59,8 +59,8 @@ public class HikControlSocket {
} catch (IOException e) {
e.printStackTrace();
}
return status;
return code;
}
}
@ -78,12 +78,6 @@ public class HikControlSocket {
os.write(bytes);
}
private static void getStatus(OutputStream os,int index) throws IOException {
String startCmd = "<"+index+","+0+","+"get>";
byte [] bytes = startCmd.getBytes(StandardCharsets.UTF_8);
os.write(bytes);
}
private static String read(InputStream inStream) throws IOException {
StringBuffer sb = new StringBuffer();
int start = -1;
@ -95,7 +89,7 @@ public class HikControlSocket {
inStream.read(buffer);
String s = new String(buffer, Charset.forName("utf-8"));
sb.append(s);
System.out.println(s);
if(start < 0){
start = sb.indexOf("<");
}
@ -105,7 +99,7 @@ public class HikControlSocket {
}
}while (start <0 || end <= start);
return sb.substring(start,end);
return sb.substring(start,end+1);
}
}

Loading…
Cancel
Save