简体   繁体   English

如何使用简单的双向刷卡磁卡阅读器开始从磁卡读取数据?

[英]How to get started reading data from magnetic card with a simple bi-direction swipe magnetic card reader?

Let's say I have a USB magnetic card reader假设我有一个 USB 磁卡读卡器

( http://image.ec21.com/image/szttce09/oimg_GC03950917_CA03950946/Triple_Track_USB_Magnetic_Credit_Card_Reader.jpg ) ( http://image.ec21.com/image/szttce09/oimg_GC03950917_CA03950946/Triple_Track_USB_Magnetic_Credit_Card_Reader.jpg )

I am running windows 10 on my machine.我在我的机器上运行 Windows 10。 All I want to do is read data from the magnetic card and use that data in a java Application.我想要做的就是从磁卡读取数据并在 java 应用程序中使用该数据。 How can I do this ?我怎样才能做到这一点 ? I heard the java communications api is suitable for what I want.我听说java通信api适合我想要的。 How exactly do I use this api or any other api to read data from the card reader and show that data in my java application.我究竟如何使用这个 api 或任何其他 api 从读卡器读取数据并在我的 java 应用程序中显示该数据。 Assume I have eclipse opened.假设我打开了日食。 Now what?怎么办? Do I import the communications api ?我要导入通信 api 吗? If yes , what do I do next ?如果是,我下一步该怎么做? If you can give a simple example of how to do this it would be greatly appreciated.如果你能给出一个简单的例子来说明如何做到这一点,将不胜感激。

The first thing to do is search the internet for a Java library, which allows you to communicate with that device.首先要做的是在 Internet 上搜索 Java 库,它允许您与该设备进行通信。 Put in the model and serial number, and see what comes up.输入型号和序列号,看看会出现什么。 If nothing comes up, and that is quite likely to happen, you will need to find the native driver, and wrap it in Java.如果什么也没有发生,而且很可能会发生,您将需要找到本机驱动程序,并将其包装在 Java 中。

This is not normally a straight forward or easy process.这通常不是一个直接或简单的过程。 When dealing with third party hardware, most vendors don't supply a little Java library that you can use.在处理第三方硬件时,大多数供应商不提供您可以使用的小型 Java 库。 If you can find the native drivers, you can wrap them from C to Java, but you might not even be able to find the drivers at all.如果您能找到本机驱动程序,您可以将它们从 C 包装到 Java,但您甚至可能根本无法找到驱动程序。

Start by going to the manufacturer's page, and looking around.首先转到制造商的页面,然后环顾四周。 If you find the driver, great.如果你找到司机,那就太好了。 If you find documentation for the driver, even better.如果您找到驱动程序的文档,那就更好了。 You will need to read the documentation, and understand how to use the driver from C code, which implicitly requires you to have a basic understanding of C.您将需要阅读文档,并从 C 代码中了解如何使用驱动程序,这隐含地要求您对 C 有基本的了解。

Then you will need to link it in to Java, using the Java Native Interface.然后,您需要使用 Java 本机接口将其链接到 Java。

In Summary: If it didn't say "For Java developers" in the description when you bought it, you're going to have to do a lot of work just to get it usable in Java.总结:如果您购买它时的说明中没有说“对于 Java 开发人员”,那么您将不得不做很多工作才能使其在 Java 中可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM