扫码算法增加锐化、旋转

merge-requests/5/merge
yiming 4 years ago
parent 36981ba1a5
commit a6bf5deee8

Binary file not shown.

@ -91,6 +91,8 @@ public class StreetController {
log.info("ip:{},status:{}",lightSource.getIp(),status); log.info("ip:{},status:{}",lightSource.getIp(),status);
equip.DisConnect(); equip.DisConnect();
}else if(configProperties.getLightSource().getType() == 2){
} }
}); });

@ -0,0 +1,91 @@
package com.zhehekeji.web.service.hikLightSource;
import lombok.extern.slf4j.Slf4j;
import java.io.*;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
/**
*
*/
@Slf4j
public class HikControlSocket {
/**
*
* <${},${0 1},${get\post}>
*/
public static void main(String[] args) {
String code = openLight("192.168.8.236", 2002,2,0);
System.out.println(code);
}
public static String openLight(String ip,int port,int index,int bool){
Socket socket = new Socket();
String code = null;
OutputStream os = null;
InputStream is = null;
try {
socket.connect(new InetSocketAddress(ip,port),3000);
os = socket.getOutputStream();
controlCmd(os,bool,index);
is = socket.getInputStream();
code = read(is);
if(code!= null){
code = code.replace("\\n","");
}
} catch (IOException e) {
log.error("sick time out,ip:{},info:{}",ip,e);
}finally {
if(os != null){
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if(is != null){
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try {
socket.close();
} catch (IOException e) {
e.printStackTrace();
}
return code;
}
}
/**
* num
* @param os
*
* @param bool 1 0
* @param index
* @throws IOException
*/
private static void controlCmd(OutputStream os,int bool,int index) throws IOException {
String startCmd = "<"+index+","+bool+","+"post>";
byte [] bytes = startCmd.getBytes(StandardCharsets.UTF_8);
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 {
BufferedReader bd = new BufferedReader(new InputStreamReader(inStream));
return bd.readLine();
}
}

@ -49,11 +49,13 @@ videoStyleConfig:
videoStyleRow: 2 videoStyleRow: 2
videoStyleColumn: 2 videoStyleColumn: 2
# ------------光源--- # ------------光源---
# -------------type 0:没有光源 1JYDam # -------------type 0:没有光源 1JYDam 2视觉控制器
# -----------1:JYDam 配置num和index # -----------1:JYDam 配置num和index num:总共多少个控制口 index:需要控制的是哪个
lightSource: lightSource:
type: 1 type: 1
info: "{'num':2,'index':0}" info: "{'num':2,'index':0}"
num: 2
index: 0
# -----------扫码枪 # -----------扫码枪
# ------------type 1: sick # ------------type 1: sick
sensor: sensor:

Loading…
Cancel
Save