Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand the process of Java calling Minghua RF Reader DLL File

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail for you how to understand the process of Java calling Minghua RF reader DLL file, the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

First of all, jdk must be 32-bit, and IDE must be 32-bit (I use idea, so I downloaded the January 2018 version in order to use 32-bit).

The Minghua RF reader demo provides a dynamic link library file called mwrf32.dll

If you want to call java, you must use JNI or JNA. After all, it is cross-language.

First of all, in the blank space in the pom.xml file, right-select Dependency, search for jna inside, and select jna:5.4.0 or jna-platform enter to import the dependency.

After the dependency import is successful

Create a folder named impl

Create an interface named Connect inherit Library in it

Public interface Connect extends Library {Connect jihiseaDLL = Native.loadLibrary ("mwrf32.dll", Connect.class); int rf_init (int port,int baud); / / declare the rf_init function to be used in mwrf32.dll}

Create a ConnectImpl class to introduce the Connect interface.

Public class ConnectImpl implements Connect {public int rf_init (int port,int baud) {int icdev = jihiseaDLL.rf_init (0mem9600); / / set the port number and baud rate and initialize the port return icdev;}}

This can then be called to complete the initialization of the reader.

ConnectImpl systeminit = new ConnectImpl (); / / Global initialization here icdev int icdev = systeminit.rf_init (0Magne9600)

After the reader is plugged into the computer, System.out.println returns to icdev to see if it is successful.

On how to understand how Java calls Minghua RF reader DLL file process to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report