diff --git a/libs/code_scan/BarcodeDetectorJNI.dll b/libs/code_scan/BarcodeDetectorJNI.dll index 24507ff..360865b 100644 Binary files a/libs/code_scan/BarcodeDetectorJNI.dll and b/libs/code_scan/BarcodeDetectorJNI.dll differ diff --git a/libs/code_scan/BarcodeDetectorJNI_bak.dll b/libs/code_scan/BarcodeDetectorJNI_bak.dll new file mode 100644 index 0000000..24507ff Binary files /dev/null and b/libs/code_scan/BarcodeDetectorJNI_bak.dll differ diff --git a/libs/code_scan/TestJNI.dll b/libs/code_scan/TestJNI.dll deleted file mode 100644 index 5b1f10b..0000000 Binary files a/libs/code_scan/TestJNI.dll and /dev/null differ diff --git a/web/src/main/java/com/zhehekeji/web/controller/StreetController.java b/web/src/main/java/com/zhehekeji/web/controller/StreetController.java index aa21a45..d4ea78e 100644 --- a/web/src/main/java/com/zhehekeji/web/controller/StreetController.java +++ b/web/src/main/java/com/zhehekeji/web/controller/StreetController.java @@ -91,6 +91,8 @@ public class StreetController { log.info("ip:{},status:{}",lightSource.getIp(),status); equip.DisConnect(); + }else if(configProperties.getLightSource().getType() == 2){ + } }); diff --git a/web/src/main/java/com/zhehekeji/web/service/hikLightSource/HikControlSocket.java b/web/src/main/java/com/zhehekeji/web/service/hikLightSource/HikControlSocket.java new file mode 100644 index 0000000..1b74241 --- /dev/null +++ b/web/src/main/java/com/zhehekeji/web/service/hikLightSource/HikControlSocket.java @@ -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(); + } + +} diff --git a/web/src/main/resources/application-prod.yml b/web/src/main/resources/application-prod.yml index 31ab46f..c6012db 100644 --- a/web/src/main/resources/application-prod.yml +++ b/web/src/main/resources/application-prod.yml @@ -49,11 +49,13 @@ videoStyleConfig: videoStyleRow: 2 videoStyleColumn: 2 # ------------光源--- -# -------------type 0:没有光源 1:JYDam -# -----------1:JYDam 配置num和index +# -------------type 0:没有光源 1:JYDam 2:视觉控制器 +# -----------1:JYDam 配置num和index num:总共多少个控制口 index:需要控制的是哪个 lightSource: type: 1 info: "{'num':2,'index':0}" + num: 2 + index: 0 # -----------扫码枪 # ------------type 1: sick sensor: