GithubHelp home page GithubHelp logo

gs1 / gs1-syntax-engine Goto Github PK

View Code? Open in Web Editor NEW
27.0 27.0 5.0 1.92 MB

GS1 Syntax Engine

License: Apache License 2.0

Makefile 1.10% C++ 11.49% C 71.19% Perl 0.30% C# 3.64% HTML 0.42% JavaScript 3.11% CMake 0.04% Kotlin 1.88% Swift 3.17% Java 2.52% Ruby 0.01% Rust 0.62% Python 0.51%
application-identifiers digital-link gs1-digital-link gs1-syntax

gs1-syntax-engine's People

Contributors

terryburton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gs1-syntax-engine's Issues

Java wrapper: Create multi-architecture JAR distributed via Maven Central

Housekeeping to capture discussion that occurred in PR#4 as a separate issue to allow that PR to be closed...

2024/04/09: @terryburton

The major decision to be made is whether to publish a Java and/or Android library, and where to. My intent so far has been to release a Java library package consisting of a single multi-architecture JAR published on Maven Central. The reasoning is that this benefits all Java developers and if there is no Android app specific helper code in the library then there is little point in also creating and maintaining an Android library — but I'm happy to be educated if this analysis is lacking.

(Because the library is based on native C code, it must be compiled for each of the common target architectures, e.g. x64, x86, arm, arm64. Creating multi-architecture Java library packages is challenging, but there are projects that appear to do this successfully, e.g. https://github.com/OddSource/ifaddrs4u/tree/main/ifaddrs4j)

2024/04/18: @vinaygopinath

... I'm on board with your proposal of publishing a JAR accessible from Maven Central purely to parse the scanned string, leaving the task of scanning codes to the application developer.

2024/04/19: @terryburton

Thank you for taking the time to consider the approach that I outlined concerning the multi-architecture JAR. I conducted some brief testing, but I have had to set things aside for now because of the amount of effort involved. It may be prioritised in the future as a result of community feedback such as what you have provided.

Building the multi-architecture JAR:

  • There is a project that provides cross-compiler toolchains in the form of Docker images that might be usable to create the Syntax Engine shared library and JNI for a variety of platforms: https://github.com/multiarch/crossbuild — hopefully all relevant platforms (for servers and mobile / embedded) are supported.
  • To automate the generation of assets it would be necessary to create a CI workflow based on this which can assemble the final multi-architecture JAR file.

How the JAR would work:

  • The Java library (in the JAR file) can include a custom class loader routine that can probe the OS and architecture at runtime in order to attempt to System.load the correct JNI library for the platform — hopefully all relevant platforms can be detected reliably so that a single JAR is all that is necessary.
  • In order to System.load the native code it is necessary for the custom class loader to first copy it out of the JAR to temporary storage. This seems to work well for regular Java platforms, at least on Linux which I have tested.

Considerations for Android:

  • The above approach does not appear to work for Android since the native library .so files are stripped out of the APK during the build, i.e. the JAR doesn't appear to be manifested in the same way once the app is assembled. I haven't looked at how and why this occurs.
  • Assuming that you can avoid the above issue then there is still the issue that recent versions of Android introduce "W^X" enforcement, i.e. that they do not allow code to be loaded and executed from writable parts of the app storage, i.e. you cannot System.load what the application has written at runtime.
  • So a "supplementary" approach might be required for Android: Project may include a separate Gradle task in the app build process that performs the native library from JAR this extraction immediately prior to assembling the APK, effectively placing the native code in the typical project lib/ location (e.g. lib/arm64) so that it gets built into the APK in that same way that a "vendored-in" shared library (or output of an NDK build step) would be, such that it is accessible to the app at runtime. The custom class loader would need to be programmed to not attempt library extraction when running on Android and when the library can be loaded from the default native library location for the current platform.
  • So to use the packaged library for Android development, in addition to declaring an implementation dependency you would also need to add a task to the gradle.build, which sounds like it may be preferable to vendoring in the Syntax Engine code in the way shown by the current example Android app.

That's a lot of steps to put in order and there is still some risk of something critical not working out as intended, so the idea is shelved for now...

Of course if anyone would like to have a go at the above then this will be welcome.

Java wrapper usage documentation

Could you please add documentation to the README on how to use the Java wrapper? I see build.xml in the java subfolder. Is this wrapped intended to be used by the Ant build system?

For context, I'm trying to use the Java wrapper from a Gradle-based Android project. @terryburton Reading through #4, it sounds like publishing a multi-architecture JAR on Maven is/was being considered. Is that still on the cards? I wasn't able to find this library on Maven Central.

My intent so far has been to release a Java library package consisting of a single multi-architecture JAR published on Maven Central

const/non-const differences in c/h files

  • some of the methods have const-arguments in the implementation, but the function declaration lacks the const qualifier.
    This creates issues with commit 90b4bac
  • char* gs1_encoder_getDLuri(gs1_encoder *ctx, char *stem); should be changed to char* gs1_encoder_getDLuri(gs1_encoder *ctx, const char *stem); to allow passing const char pointers to stem URIs.

Where can i find any image decoder lib ?

i am trying do develop and app to read GS1 barcodes, and the only one i can't read is GS1 databar, my app is written in javascript and uses zbar and zxing in parallel, i've tried opencv as wall but no success, i've tested literally hundreds of apps and tools online for gs1 and none of them can read databar except for a japanese app called "添文ナビ"...
can somebody please help me ? anything could help ....

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.