| | |
| | | package com.zy.core.thread; |
| | | |
| | | import HslCommunication.BasicFramework.SoftBasic; |
| | | import com.zy.core.Slave; |
| | | import com.zy.core.ThreadHandler; |
| | | import lombok.Data; |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | BarcodeThread barcodeThread = new BarcodeThread(); |
| | | BarcodeThread barcodeThread = new BarcodeThread(new Slave()); |
| | | barcodeThread.getSlave().setIp("192.168.2.150"); |
| | | barcodeThread.getSlave().setPort(51236); |
| | | boolean connect = barcodeThread.connect(); |
| | | System.out.println(connect); |
| | | barcodeThread.write("T".getBytes(), "T".length()); |
| | | byte[] read = barcodeThread.read(11, 1000); |
| | | System.out.println(SoftBasic.ByteToHexString(read)); |
| | | System.out.println(new String(read)); |
| | | } |
| | | } |