package com.project.base;
import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.Enumeration; import java.util.List; import java.util.TooManyListenersException;
import javax.imageio.ImageIO;
import gnu.io.CommPort; import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import gnu.io.SerialPortEventListener; import gnu.io.UnsupportedCommOperationException;
public class SerialTool {
private static SerialTool serialTool = null;
static {
//在该类被ClassLoader加载时就初始化一个SerialTool对象
if (serialTool == null) {
serialTool = new SerialTool();
}
}
//私有化SerialTool类的构造方法,不允许其他类生成SerialTool对象
private SerialTool() {}
/**
* 获取提供服务的SerialTool对象
* [@return](https://my.oschina.net/u/556800) serialTool
*/
public static SerialTool getSerialTool() {
if (serialTool == null) {
serialTool = new SerialTool();
}
return serialTool;
}
/**
* 查找所有可用端口
* [@return](https://my.oschina.net/u/556800) 可用端口名称列表
*/
public static ArrayList<String> findPort() {
//获得当前所有可用串口
Enumeration<CommPortIdentifier> portList = CommPortIdentifier.getPortIdentifiers();
ArrayList<String> portNameList = new ArrayList<>();
//将可用串口名添加到List并返回该List
while (portList.hasMoreElements()) {
String portName = portList.nextElement().getName();
portNameList.add(portName);
}
return portNameList;
}
/**
* 打开串口
* [@param](https://my.oschina.net/u/2303379) portName 端口名称
* [@param](https://my.oschina.net/u/2303379) baudrate 波特率
* [@return](https://my.oschina.net/u/556800) 串口对象
* @throws SerialPortParameterFailure 设置串口参数失败
* @throws NotASerialPort 端口指向设备不是串口类型
* @throws NoSuchPort 没有该端口对应的串口设备
* @throws PortInUse 端口已被占用
*/
public static SerialPort openPort(String portName, int baudrate) {
try {
//通过端口名识别端口
CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName);
//打开端口,并给端口名字和一个timeout(打开操作的超时时间)
date = new Date();
System.out.println("before commPort:"+sdf.format(date));
CommPort commPort = portIdentifier.open(portName, 2000);
date = new Date();
System.out.println("affter commPort:"+sdf.format(date));
//判断是不是串口
if (commPort instanceof SerialPort) {
SerialPort serialPort = (SerialPort) commPort;
try {
//设置一下串口的波特率等参数
date = new Date();
System.out.println("before baudrate:"+sdf.format(date));
serialPort.setSerialPortParams(baudrate, SerialPort.DATABITS_8, SerialPort.STOPBITS_2, SerialPort.PARITY_NONE);
date = new Date();
System.out.println("affter baudrate:"+sdf.format(date));
} catch (UnsupportedCommOperationException e) {
//throw new UnsupportedCommOperationException();
}
//System.out.println("Open " + portName + " sucessfully !");
return serialPort;
}
else {
//不是串口
//throw new UnsupportedCommOperationException();
return null;
}
} catch (NoSuchPortException e1) {
//throw new NoSuchPortException();
return null;
} catch (PortInUseException e2) {
//throw new PortInUseException();
return null;
}
}
/**
* 关闭串口
* @param serialport 待关闭的串口对象
*/
public static void closePort(SerialPort serialPort) {
if (serialPort != null) {
serialPort.close();
serialPort = null;
}
}
/**
* 往串口发送数据
* @param serialPort 串口对象
* @param order 待发送数据
* @throws SendDataToSerialPortFailure 向串口发送数据失败
* @throws SerialPortOutputStreamCloseFailure 关闭串口对象的输出流出错
*/
public static void sendToPort(SerialPort serialPort, byte[] order) {
OutputStream out = null;
try {
out = serialPort.getOutputStream();
out.write(order);
out.flush();
} catch (IOException e) {
//throw new SendDataToSerialPortFailure();
} finally {
try {
if (out != null) {
out.close();
out = null;
}
} catch (IOException e) {
//throw new SerialPortOutputStreamCloseFailure();
}
}
}
/**
* 从串口读取数据
* @param serialPort 当前已建立连接的SerialPort对象
* @return 读取到的数据
* @throws ReadDataFromSerialPortFailure 从串口读取数据时出错
* @throws SerialPortInputStreamCloseFailure 关闭串口对象输入流出错
*/
public static byte[] readFromPort(SerialPort serialPort) {
InputStream in = null;
byte[] bytes = null;
try {
in = serialPort.getInputStream();
int bufflenth = in.available(); //获取buffer里的数据长度
while (bufflenth != 0) {
bytes = new byte[bufflenth]; //初始化byte数组为buffer中数据的长度
in.read(bytes);
bufflenth = in.available();
}
} catch (IOException e) {
//throw new ReadDataFromSerialPortFailure();
} finally {
try {
if (in != null) {
in.close();
in = null;
}
} catch(IOException e) {
//throw new SerialPortInputStreamCloseFailure();
}
}
return bytes;
}
/**
* 添加监听器
* @param port 串口对象
* @param listener 串口监听器
* @throws TooManyListeners 监听类对象过多
*/
public static void addListener(SerialPort port, SerialPortEventListener listener) {
try {
//给串口添加监听器
port.addEventListener(listener);
//设置当有数据到达时唤醒监听接收线程
port.notifyOnDataAvailable(true);
//设置当通信中断时唤醒中断线程
port.notifyOnBreakInterrupt(true);
} catch (TooManyListenersException e) {
//throw new TooManyListeners();
}
}
public static Date date = new Date();
public static SimpleDateFormat sdf = new SimpleDateFormat("YYYY/MM/dd HH:mm:ss.SSS");
public static void main(String[] args) {
/*
SerialPort sp = SerialTool.openPort("COM8", 9600);
byte[] turnOffAll = new byte[]{ 0x68,0x05,0x1f,0x55,0x00,0x79,0x43};
byte[] turnOnLED1 = new byte[]{ 0x68,0x05,0x10,0x02,0x00,0x17,0x43};
byte[] flashLED2 = new byte[]{ 0x68,0x05,0x11,0x01,0x00,0x17,0x43};
if (sp != null)
SerialTool.sendToPort(sp, turnOffAll);
if (sp != null)
SerialTool.sendToPort(sp, turnOnLED1);
if (sp != null)
SerialTool.sendToPort(sp, flashLED2);
SerialTool.closePort(sp);
*/ date = new Date(); System.out.println("before openCom:"+sdf.format(date));
SerialPort sp = SerialTool.openPort("COM2", 9600); int[] rgb = new int[3]; List<Byte> cmdList = new ArrayList<Byte>(); byte[] data = new byte[] { 0x00, 0x00, 0x00 }; // ESC * m nL nH
byte[] escBmp = new byte[] { 0x1B, 0x2A, 0x00, 0x00, 0x00 }; byte[] GSVM = { 0x1d, 0x56, 0x42, 0x00 }; //切纸 escBmp[2] = 0x21; date = new Date(); System.out.println("start:"+sdf.format(date));
try { File f = new File("d:\temp.bmp"); BufferedImage bi = ImageIO.read(f); Graphics g = bi.getGraphics(); Font font = new Font("隶书", Font.BOLD, 20); g.setColor(Color.BLACK); g.setFont(font); g.drawString("这是套打的文字12345678", 250, 200); //g.create(0,0,352,264); //g.drawImage(bi, 0, 0,null); int width=bi.getWidth(); int height=bi.getHeight(); int minx=bi.getMinX(); int miny=bi.getMinY(); System.out.println("width="+width+",height="+height+"."); System.out.println("minx="+minx+",miniy="+miny+"."); //nL, nH
escBmp[3] = (byte)(width % 256); escBmp[4] = (byte)(width / 256);
date = new Date();
System.out.println("before data:"+sdf.format(date));
// data
for (int i = 0; i < (height / 24) + 1; i++)
{
for (int n = 0; n < 5; n++)
cmdList.add(escBmp[n]);
for (int j = 0; j < width; j++)
{
for (int k = 0; k < 24; k++)
{
if (((i * 24) + k) < height) // if within the BMP size
{
int pixel=bi.getRGB(j, (i * 24) + k);
rgb[0] = (pixel & 0xff0000 ) >> 16 ;
//rgb[1] = (pixel & 0xff00 ) >> 8 ;
//rgb[2] = (pixel & 0xff);
//System.out.println("i="+i+",j="+j+":("+rgb[0]+","+rgb[1]+","+rgb[2]+")");
if ((rgb[0]) < 75)
{
data[k / 8] += (byte)(128 >> (k % 8));
}
}
}
for (int n = 0; n < 3; n++)
cmdList.add(data[n]);
data[0] = 0x00;
data[1] = 0x00;
data[2] = 0x00; // Clear to Zero.
}
} // data
date = new Date();
System.out.println("after data:"+sdf.format(date));
}
catch(Exception e)
{
}
finally{
}
// for (int i=0;i<cmdList.size();i++) // System.out.println(cmdList.get(i)); date = new Date(); System.out.println("before array to byte[]:"+sdf.format(date)); Byte[] order = new Byte[cmdList.size()]; cmdList.toArray(order); // ; // for (int i=0;i<cmdList.size();i++) // { // //System.out.println(cmdList.get(i)); // order[i] = (int)cmdList.get(i); // } date = new Date(); System.out.println("after array to byte[]:"+sdf.format(date));
// TODO Auto-generated method stub // int[] order = {0x1b,0x2a,0x21,0x60,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,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,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3f,0xff,0xff,0x3f,0xff,0xff,0x3f,0xff,0xff,0x3f,0xff,0xff,0x3f,0xff,0xff,0x38,0x38,0x70,0x38,0x38,0x70,0x38,0x38,0x70,0x38,0x38,0x70,0x38,0x38,0x70,0x38,0x38,0x70,0x38,0x38,0x70,0x38,0x38,0x70,0x38,0x38,0x70,0x38,0x3f,0xf8,0x38,0x3f,0xfe,0x38,0x3f,0xff,0x38,0x3f,0xff,0x38,0x3f,0xff,0x38,0x38,0x7f,0x38,0x38,0x70,0x38,0x38,0x70,0x38,0x78,0x70,0x3f,0xf8,0x70,0x3f,0xf0,0x70,0x3f,0xf0,0x70,0x3f,0xf0,0x70,0x3f,0xc0,0x70,0x0,0x0,0x70,0x0,0x0,0x70,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3f,0xff,0xff,0x3f,0xff,0xff,0x3f,0xff,0xff,0x3f,0xff,0xff,0x3f,0xff,0xff,0x38,0x0,0x0,0x38,0x0,0xc0,0x38,0x1c,0xe0,0x38,0x38,0xe0,0x38,0x78,0xe0,0x3b,0xf0,0xe0,0x3b,0xf0,0xe1,0x3b,0xe0,0xe3,0x3b,0xe0,0xc3,0x3a,0xe0,0xc7,0x38,0xe0,0xff,0x38,0xf5,0xff,0x38,0xff,0xfe,0x38,0xff,0xfc,0x38,0xff,0xfc,0x38,0xff,0xfe,0x38,0xe0,0xff,0x38,0xe0,0xef,0x38,0xe0,0xc7,0x38,0xe0,0xe3,0x38,0xe0,0xc1,0x38,0xe0,0xe1,0x38,0xe0,0xe0,0x38,0x60,0xe0,0x38,0x0,0xc0,0x30,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3f,0xff,0xff,0x3f,0xff,0xff,0x3f,0xff,0xff,0x38,0x0,0x0,0x38,0x0,0x0,0x38,0x1e,0x0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,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}; //SerialTool.findPort();
if (sp != null)
SerialTool.sendToPort(sp, ByteArrayTobyteArray(order));
date = new Date();
System.out.println("after print:"+sdf.format(date));
SerialTool.sendToPort(sp, GSVM);
SerialTool.closePort(sp);
/* byte[] HRI = { 0x1d, 0x48 ,0x00}; //可读字符打印位置-不打印 byte[] HRI_01 = { 0x1d, 0x48, 0x01 }; //可读字符打印位置-条码上方 byte[] HRI_02 = { 0x1d, 0x48, 0x02 }; //可读字符打印位置-条码下方 byte[] HRI_03 = { 0x1d, 0x48, 0x03 }; //可读字符打印位置-条码上方和下方 byte[] BARHIGHT = { 0x1d, 0x68, 0x00 }; //条码高度,最后一字节需换成实际的高1-255 byte[] BARWIDTH = { 0x1d, 0x77, 0x00 }; //条码宽度,最后一字节需换成实际的宽1-6 byte[] CODE_39 = { 0x1d, 0x6b, 0x45, 0x00}; //CODE39,最后一字节需替换成实际条码长度 byte[] CODE_128 = { 0x1d, 0x6b, 0x49, 0x00 }; //CODE128,最后一字节需替换成实际条码长度 byte[] UPC_A = {0x1d, 0x6b, 0x41, 0x00 }; //CPC_A,最后一字节需替换成实际条码长度 byte[] CODABAR = { 0x1d, 0x6b, 0x47, 0x00 }; //CODABAR,最后一字节需替换成实际条码长度 byte[] ESCAT = { 0x1b, 0x40 };//初始化打印机
byte[] GSVM = { 0x1d, 0x56, 0x42, 0x00 }; //切纸
byte[] feedCmd = { 0x1b, 0x64, 0x03 }; byte[] CRLF = { 0x1d, 0x0a}; //换行走纸 byte[] FSAND = { 0x1c, 0x26 };//选择汉字模式 byte[] FSDEL = { 0x1c, 0x2e };//取消汉字模式
SerialPort sp = SerialTool.openPort("COM2", 9600);
if (sp != null)
{
SerialTool.sendToPort(sp, ESCAT);
BARHIGHT[2] = 0x64;
SerialTool.sendToPort(sp, BARHIGHT);
BARWIDTH[2] = 0x02;
SerialTool.sendToPort(sp, BARWIDTH);
SerialTool.sendToPort(sp, HRI_02);
String str = "320102197809240813";
byte[] order = str.getBytes();
CODE_39[3] = (byte) order.length;
byte[] data = new byte[4 + order.length];
for (int i=0;i < 4; i++)
data[i] = CODE_39[i];
for (int i = 0; i < order.length; i++)
data[4 + i] = order[i];
SerialTool.sendToPort(sp, data);
for (int i = 0; i < 4; i++)
{
SerialTool.sendToPort(sp, ESCAT);
SerialTool.sendToPort(sp, FSAND);
SerialTool.sendToPort(sp, new byte[]{0x0A});
SerialTool.sendToPort(sp,CRLF);
SerialTool.sendToPort(sp,FSDEL);
}
SerialTool.sendToPort(sp,GSVM);
}
SerialTool.closePort(sp);
*/
}
public static byte[] IntArrayToByteArray(int[] intArray)
{
byte[] iretVal = new byte[intArray.length];
for (int i=0 ; i < iretVal.length ; i++)
iretVal[i] = (byte)intArray[i];
return iretVal;
}
public static byte[] ByteArrayTobyteArray(Byte[] ByteArray)
{
date = new Date();
System.out.println("before Byte to byte:"+sdf.format(date));
byte[] iretVal = new byte[ByteArray.length];
for (int i=0 ; i < iretVal.length ; i++)
iretVal[i] = ByteArray[i];
date = new Date();
System.out.println("after Byte to byte:"+sdf.format(date));
return iretVal;
}
}