Comments (6)
The C runtime environment of Android has diverged from that of "stock" Linux so this might be a bit more challenging than a "pure" POSIX system. I will look into it when I get a chance. However, my current priority is working on version 2.0 which has a very different internal structure so I probably will not be able to get to this for a while.
I will keep this in mind as I work on 2.0 and hopefully I can make sure that the Android port will be fairly painless.
from libplctag.
Understood. But by "a while", do you mean months or years?
from libplctag.
Months. Hopefully only a few. I am really busy right now and the 2.0 code
is taking a lot longer than I had hoped.
On Sun, Feb 14, 2016 at 7:52 PM nmnhero [email protected] wrote:
Understood. But by "a while", do you mean months or years?
—
Reply to this email directly or view it on GitHub
#26 (comment)
.
from libplctag.
I am moving to a CMake-based build system. I think this will help isolate platform dependencies, but I have only just managed to get Linux builds working.
from libplctag.
@kyle-github I just compiled this with Termux, the only thing I had to change was to replace pthread_cancel() with pthread_kill() since Android's standard C library (Bionic) doesn't have pthread_cancel(). I can't test though, I can't get the dang OpenVPN app to work.
from libplctag.
To find all Android related deficiencies in any of the new plctag library releases, these would probably be the good steps to follow in Android Studio:
-
Start a new Android Studio project
-
Select "Native C++" template
-
Choose Name / PackageName / Location, Java Language (or Kotlin) and Minimum SDK
-
On the next screen "Customize C++ Support" select "Toolchain Default" (or if you know what you are doing one of C++11 / C++14 / C++17)
-
In the newly created project, remove CMakeLists.txt and native-lib.cpp files from the "cpp" folder as well as all related entries in the MainActivity.java and activity_main.xml layout
-
Copy all your libplctag project files and folders to the "cpp" folder
-
Copy Tag.java file from the library project, wrappers/java/libplctag folder, to the folder where the MainActivity.java file is (normally app/src/main/java/{PackageName folders}). Modifications are needed to this file in order to make it usable:
-
Change package from "libplctag" to your PackageName (which might be: com.example.plctagtest)
-
Change all the jna imports to read "com.sun.jna" instead of "dev.java.net.jna"
-
Remove "void" from: private static native int plc_tag_get_lib_version(void);
-
Replace "private static native int plc_tag_check_lib_version(int encoded_version);" with "private static native int plc_tag_check_lib_version(int req_major, int req_minor, int req_patch);"
-
Comment out the following entries, which are at the beginning of the class:
public static final String JNA_LIBRARY_NAME = "plctag";
public static final NativeLibrary JNA_NATIVE_LIB = NativeLibrary.getInstance(Tag.JNA_LIBRARY_NAME);
Native.register(Tag.JNA_LIBRARY_NAME);
System.err.printLn("Library must be compatible with version 2.1.0!");
System.abort();You should instead register the library in your MainActivity with: static { Native.register(Tag.class, "plctag"); }
-
-
Download jna.aar file: https://github.com/java-native-access/jna/blob/master/dist/jna.aar
-
On the menu click File/Project Structure, in the new window select Modules, click "+", select "Import .JAR/.AAR package" and browse to the download location to select the file
-
Add to the app's build.gradle file "implementation project(':jna')" as a part of the "dependencies"
-
On the menu click File/Save All and then File/Sync Project with Gradle Files
-
Build/Rebuild Project (infrequent use of Build/Refresh Linked C++ Projects, File/Invalidate Caches / Restart might also help)
One of the first errors might be related to the deleted native-lib.cpp, so just do Build/Rebuild Project again.
Plctag related errors should be within CMakeLists.txt file, related to "examples" and "tests".
Otherwise the library should compile fine.
from libplctag.
Related Issues (20)
- Notification when all of the tags have been read with "auto_sync_read_ms"...? HOT 5
- Many "INFO" messages output in command prompt after .AddTag(something) command HOT 2
- how many characters can we write using libplctag write?
- Problems with Greek letters in tag names HOT 1
- Connection Issue When Processor Is Deep In Rack ex.. Slot16 HOT 3
- Access AB L73 PLC through Private LAN HOT 1
- Can we use unconnected messaging with multi service request? HOT 3
- Use Libplctag Library as Server HOT 2
- path
- ErrorBadParam when reading a value from bool dimension HOT 3
- Data checking HOT 1
- libplctag never stops after disconnect / reconnect (AB CLX) HOT 3
- String Write is not working for Omron NJ/NX Controller HOT 5
- Multiple request are not packed into single request for Omron NX/NJ PLC HOT 2
- Symbol ID Addressing and quote request for additions to the library HOT 11
- Message packing on OmronNJ/NX beyond max response size HOT 2
- Standalone website to host documentation HOT 4
- Write is not working for SINT and USINT (1 byte) datatype for Omron NX/NJ PLC HOT 5
- MSR is not working for modbus_tcp protocol using libplctag library HOT 3
- MinGW timeapi.h issue HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libplctag.