Уважаемые коллеги, у меня проблема с подключением к FP430S.dll. Вы можете посоветовать?
FP430S.dll (18)
Ordinal Hint Function EntryPoint EntryName
1 14 USB_Open 0x00001990
2 16 USB_Send 0x000019C0
3 15 USB_Recv 0x000019F0
4 13 USB_Close 0x00001A20
5 5 Lib_GetSignature 0x00003D60
6 9 Lib_SetLogo 0x00002150
7 8 Lib_SetConfig 0x00002450
8 6 Lib_LoadApp 0x000022D0
9 7 Lib_LoadKey 0x000025D0
10 4 Lib_Encrypt 0x000026F0
11 3 Lib_Deceypt 0x00002830
12 1 Lib_Alignment 0x00002970
13 11 Lib_TransPic 0x00003900
14 0 Lib_AddCustomerInfoItem 0x00002A20
15 10 Lib_ShowCustomerInfo 0x00002A70
16 2 Lib_ClearCustomerInfo 0x00002A00
17 12 ReadPack 0x00001FE0
18 17 WritePack 0x00001AE0
FP430S.dll (18)
Ordinal Hint Function EntryPoint EntryName
1 14 USB_Open 0x00001990
2 16 USB_Send 0x000019C0
3 15 USB_Recv 0x000019F0
4 13 USB_Close 0x00001A20
5 5 Lib_GetSignature 0x00003D60
6 9 Lib_SetLogo 0x00002150
7 8 Lib_SetConfig 0x00002450
8 6 Lib_LoadApp 0x000022D0
9 7 Lib_LoadKey 0x000025D0
10 4 Lib_Encrypt 0x000026F0
11 3 Lib_Deceypt 0x00002830
12 1 Lib_Alignment 0x00002970
13 11 Lib_TransPic 0x00003900
14 0 Lib_AddCustomerInfoItem 0x00002A20
15 10 Lib_ShowCustomerInfo 0x00002A70
16 2 Lib_ClearCustomerInfo 0x00002A00
17 12 ReadPack 0x00001FE0
18 17 WritePack 0x00001AE0
Прикрепленные файлы:
FP430S-DLL-Release(for system Version V1.1.9 and higher).zip
Ответы
Подписаться на ответы
Инфостарт бот
Сортировка:
Древо развёрнутое
Свернуть все
FP430S Application Development Guide
Прикрепленные файлы:
FP430S Application Development Guide (V1.6).pdf
Скрытый текст |
---|
package com.szfptech.signature;
import java.awt.Image; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.Arrays; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import com.sun.jna.*; /** * @author GiraffeTree * @date 2019/10/25 */ public class signature { public interface JnaLibrary extends Library { JnaLibrary INSTANCE = Native.load("FP430S", JnaLibrary.class); int USB_Open(); int USB_Close(); int Lib_GetSignature(int encryptType, byte c[], int timeout); } static JFrame window; static JButton open; static JButton signature; static JButton close; static Image myImage; static JButton button = new JButton(); public static void main(String[] args) { Demo(); } static void Demo() { window = new JFrame("签名"); window.setLayout(null); window.setSize(1000, 800);// 设置大小 window.setLocationRelativeTo(null);//设置居中 window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setResizable(false);// 设置窗口不可拉伸改变大小 //设置按钮 open = new JButton("open"); open.setBounds(150, 50, 100, 50); signature = new JButton("signature"); signature.setBounds(250, 50, 100, 50); close = new JButton("close"); close.setBounds(350, 50, 100, 50); window.add(open); window.add(signature); window.add(close); open.addActionListener(new openListener()); signature.addActionListener(new displayListener()); close.addActionListener(new closeListener()); window.setVisible(true);// 设置面板可见 } static class openListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { int i = JnaLibrary.INSTANCE.USB_Open(); System.out.println("open" + i); } } static class displayListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { new signature.PrintThread().start(); } } static class closeListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { int i = JnaLibrary.INSTANCE.USB_Close(); System.out.println("close" + i); } } public static void createFile(String path, String filename) { File file_p = new File(path); File file_s = new File(path + "/" + filename); if (!file_p.exists()) { file_p.mkdirs(); } else { try { if (file_s.exists()) try { file_s.createNewFile(); } catch (IOException e) { e.printStackTrace(); } else { file_s.delete(); file_s.createNewFile(); } } catch (IOException e) { e.printStackTrace(); } } } public static void deleteFile(String path, String filename) { File file = new File(path + "/" + filename); if (file.exists()) { file.delete(); } } static class PrintThread extends Thread { public void run() { try { PrintThread.sleep(0000); } catch (InterruptedException e) { e.printStackTrace(); } String writePath = "C:\\temp"; deleteFile(writePath, "test.jpg"); button.setIcon(null); byte c[] = new byte[1024 * 400]; byte b[] = new byte[1024 * 400]; Arrays.fill(c, (byte) 0); Arrays.fill(b, (byte) 0); int i = JnaLibrary.INSTANCE.Lib_GetSignature(0, c, 60000); System.out.println("signature: " + i); if (i == 0) { //int len1 = c[0] * 256 * 256 + c[1] * 256 + c[2]; //int len2 = c[3] * 256 * 256 + c[4] * 256 + c[5]; int len1 = b2i(c[0]) * 256 * 256 + b2i(c[1]) * 256 + b2i(c[2]); int len2 = b2i(c[3]) * 256 * 256 + b2i(c[4]) * 256 + b2i(c[5]); saveFile(c, 6 + len1 + len2); b = Arrays.copyOfRange(c, len1 + 6, len1 + 6 + len2); createFile(writePath, "test.jpg"); byteArrayToFile(b, writePath + "\\test.jpg", len2); System.out.println("signature: " + "len1=" + len1 + ", len2=" + len2); System.out.println("text: " + "c_1=" + c[len1 + 6] + ", b_1=" + b[0] + "\tc_2=" + c[len2 + len1 + 6 - 1] + ", b_2=" + b[len2 - 1]); } ImageIcon icon = new ImageIcon(); icon.setImage(Toolkit.getDefaultToolkit().getImage("C:\\temp\\test.jpg")); icon.getImage().flush(); button.setIcon(icon); button.setBounds(150, 100, 480, 217); window.getContentPane().add(button); window.setVisible(true);// 设置面板可见 } } public static void byteArrayToFile(byte[] b, String filePath, int n) { if (b.length < 3 || filePath.equals("")) return; try { FileOutputStream imageOutput = new FileOutputStream(new File(filePath)); for (int i = 0; i < b.length; i++) { imageOutput.write(b[i]); } imageOutput.flush(); imageOutput.close(); } catch (Exception ex) { System.out.println("Exception: " + ex); ex.printStackTrace(); } } public static int b2i(byte b) { return (int) (b & 0xff); } public static void saveFile(byte[] data, int length) { try { FileOutputStream fos = new FileOutputStream("C:\\temp\\test_data.txt"); for (int i = 0; i < length; i++) { if (i % 16 == 0) fos.write("\n".getBytes()); fos.write(String.format("%02X ", data[i]).getBytes()); } fos.close(); } catch (Exception e) { e.printStackTrace(); } } } |
Для получения уведомлений об ответах подключите телеграм бот:
Инфостарт бот