Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Can we adopt Eclipse IoT projects on Android Em...

Can we adopt Eclipse IoT projects on Android Embedded Devices

Android is gaining traction among different industries, and today, its integration with existing open-source projects is an actual need to avoid reinventing the wheel. This premise applies to the Eclipse IoT ecosystem, which provides great technologies for products and services.

In this session, we’ll explore strategies and approaches we could adopt when porting the code base of an existing Eclipse project to Android. We'll examine the boundary conditions for success and showcase three case studies: Eclipse Hara, Eclipse Leshan, and Eclipse Mosquitto.

Matteo Di Pirro

November 12, 2024
Tweet

More Decks by Matteo Di Pirro

Other Decks in Programming

Transcript

  1. Can we adopt Eclipse IoT projects on Android Embedded Devices?

    Matteo Di Pirro - Nicola La Gloria - Saeed Rezaee
  2. About us 2 • Since 2012 Kynetics has been a

    global provider of Embedded Operating Systems • Kynetics is recognized as global partner, supporting a variety of vendors, ODMs and Chipmakers • Over 150 projects developed for Fortune 500 companies and large enterprises • Kynetics is active in the embedded software community, as member and contributor ◦ Member of the Eclipse Foundation since 2017 ◦ Leader of the Eclipse Hara Project • Offices: Santa Clara, CA (USA), Los Angeles CA (USA), Padova (Italy)
  3. Agenda • Java Native Interface • Remarkable differences between Android

    and Java • Case studies ◦ Eclipse Hara ◦ Eclipse Leshan ◦ Eclipse Mosquitto • Conclusions 3
  4. Java Native Interface • Used to incorporate native code (e.g.

    C/C++) in Java applications ◦ Java apps to call native libraries ◦ Native apps to use the JVM • Applications using JNI may lose Java benefits ◦ Portability ◦ Safety 4
  5. APK vs JAR (vs AAR) • JAR ◦ Designed for

    distribution of Java applications ◦ Contains .class files • APK ◦ Designed for distribution of Android applications ◦ Similar to JAR, but with DEX files ◦ AAR ▪ Similar to APKs, but for Android libraries 5
  6. Runtime • Android Runtime (ART) is optimized for mobile devices

    • Different than JVM! ◦ Different bytecode (.dex vs .class) ◦ Different language level • Some Java features are not available in Android ◦ Or come with restrictions 6
  7. Eclipse Hara • Kotlin library to speed up the development

    of hawkBit DDI native clients • OS independent • Architecture independent ◦ Based on the JVM and available for many architectures • Designed to facilitate the integration of native update Services 8
  8. Eclipse Leshan • Server/client implementation of LWM2M ◦ Remote device

    management and telemetry • Set of Java libraries ◦ Using Maven • Provides sample client and server • We focused on running the demo client on Android 9
  9. Eclipse Leshan Client on Android • Build System Tweaks ◦

    JAR Metadata files ◦ Duplicated transitive dependencies ◦ SLF4J • Code Tweaks ◦ NetworkOnMainThreadException ◦ Use of unsupported Java features ◦ Resource loading ◦ Permissions 10
  10. Eclipse Mosquitto • Message broker implementing MQTT • Provides C

    libraries to implement clients • We focused on running the sample C-based client to Android • Using C libraries required JNI ◦ Android wrapper around native code 12
  11. Eclipse Mosquitto - Import Native Library • Build the library

    using CMake ◦ Using Android Native Development Kit ◦ Specifying target architecture and Android API level • Copy .so file in the Android project • Develop native wrapper • CMakeLists.txt file ◦ Include library headers and binary files ◦ Link native wrapper 13
  12. Conclusions Can we adopt Eclipse IoT projects on Android Embedded

    Devices? Yes, … but the porting effort depends on the project!
  13. Conclusions • We analyzed projects with different premises for the

    porting ◦ Java compatible or with some incompatibilities to cure ◦ Native ▪ JNI required ▪ Android native toolchain • Port or create Android supported building scripts ◦ Different artifact packaging • Isolate and port specific unsupported Java features
  14. Android's user-space is so different from stock Linux, you can

    easily say that Android is not in any way a Linux system, except for the kernel. Robert Love Reach out! [email protected]