OpenSCADAWiki: Home Page En/Works/ Adapt Android ...

Home | Каталог | Изменения | Комментарии | Пользователи | Регистрация | Вход  Пароль:  
 
Ukrainian (1 Кб) Українська?
Russian (1 Кб) Русская?

OpenSCADA adaption to the software platform "Android"

Name: AdaptAndroid
Founded: February 2017
Status: Qt5 work out
Achievement: Qt5 work out. Full-featured compiling and execution as a native executable "openscada" with the core library "liboscada.3 and some main modules as included and external ones.
Current difficulty (spent time): 18 (Android) + 3 (OpenSCADA and core libs) + 2(Qt5) days
Members: Roman Savochenko
Description: The sub-project's purpose is to adapt the project OpenSCADA to run on the software platform Android which wide used on more mobile, TV, SmartWatch and other devices.
Task: http://oscada.org/en/development/tasks/posts/implementation_vnedrenie/openscada_adapting_to_the_android_os_tablet_asus_nexus_7_ii_workout.
Android logotype (32 Кб)


Оглавление

Introduction

Android is an operation system initially developed by Android Inc., which Google bought in 2005, Android was unveiled in 2007, along with the founding of the Open Handset Alliance — a consortium of hardware, software, and telecommunication companies devoted to advancing open standards for mobile devices.


Android's kernel is based on one of the Linux kernel's long-term support (LTS) branches. Since April 2014, Android devices mainly use versions 3.4, 3.10 or 3.18 of the Linux kernel.


Android is far away from a Linux distribution by it does not include the GNU C Library (it uses Bionic as an alternative C library) and some of other components typically found in Linux distributions. Moreover it has a graphical and application stack built on Java VM which excludes initially writing any other program than on the Java language. But in the performance reason JNI uses here to link external native libraries written on C/C++ by a native development kit (NDK). But the LibC Bionic and the core libraries are mostly POSIX compatible. Due more lacks and more limitations into the original Android NDK there was used an user expanded one CrystaX NDK.


For developers Google provides Android software development kit (SDK). All projects written to build by Android Development Tools (ADT) and the IDE Eclipse allowed to the packages assemble from the command line and then can be automated, but new projects (see to the current samples) written on/for Android Studio can be built only from the environment and without the command line using. The sub-project implements and tests on Asus Nexus 7 II with the original Android 4.4.4 (Krait) then there uses Andoid-19 SDK version.


Before an action for same OpenSCADA adaption there were read some books, learned some links, created several examples and executed some tests, those are:


Due the method of linking native programs is the primarily and exclusively only through JNI by connecting a share library then all dependent code of the program must be placed and pre-loaded into shared libraries against the common one or builtin as the static parts to the common one. Placing and loading the dependent code as the shared libraries will cause to extra memory consumption but it's will exclusively the program's libraries. Then compiling the dependent libraries of the program as the static ones is a preferred way for Android!

OpenSCADA

To simplify and early preparing OpenSCADA to JNI in all its parts there is decided to build the program as a native executable and start it from the command-line. Then:





Current compiling and adapting status of the OpenSCADA core, it parts and the dependent libraries condensed and placed to the next table:

Part Compiling
(Builtin for modules)
Tests Commentaries and problems
The dependent libraries
PCRE, for the core OK OK Configuring command:
OpenSSL, for: Transport.SSL, DAQ.OPC_UA, Special.FLibSYS (opt) OK OK Configuring command:
LibGD, for: the core (opt), UI.WebCfgD (opt), UI.WebVision OK OK
Dependent from: libpng, jpeg, freetype, fontconfig
Also has links to macro __GNUC_PREREQ which missed on Android => a workaround placed to "features.h":

Configuring command:
-> libpng OK OK A version of "libpng" used from CrystaX.
-> jpeg OK OK A version of "libjpg" used from CrystaX.
-> fontconfig OK OK Configure for proper folders of the fonts. Configuring command:
--> freetype OK OK Configuring command:
--> expat OK OK Configuring command:
libfftw3, for UI.{Vision,WebVision} (opt), Special.FLibSYS (opt) OK OK Configuring command:
libiconv, for the core (opt) OK OK Successful built and used an external library. Configuring command:

Builtin one into CrystaX wrong and unfinished.
libintl (gettext), for the core (opt) OK OK configure.ac fixed to check symbol libintl_bindtextdomain into the library "libintl" and the symbol "libiconv_open" into the library "libiconv" checking before.
Successful built and used the external "libiconv".
Needed for "iconv" implementation but into CrystaX it is broken:
CRYSTAX_PANI: issetugid() not implemented!!!
Configuring command:
libcrypt (GlibC), for the core (opt) ?
libQt5, for UI.{QTStarter,QTCfg,Vision} OK Too specific for configuration and have some building's bugs, then it has fixed and adapted to architecture "armeabi-v7a-hard", for details see here.
Configuring command:
OpenSCADA
Generic and the core library OK OK
  • Test for some different for C(EN) locale => successful for uk_UA.UTF-8.
  • Move the project AGLKS files to the device and try it from UI.WebVision.
  • Build mostly modules of OpenSCADA as separated "SO" and move them to a different folder.
  • Move all files of OpenSCADA to a separated folder. Prepare an environment to open external modules of OpenSCADA on an example of the module Special.SystemTests.
  • Performance tests executing for different options of the compiler.
  • Make the performance tests without "-mthumb".
  • Mostly modules included/builtin to the OpenSCADA core library.
  • The "pthread" library checking added by a macro AX_PTHREAD.
  • Core libraries moved from direct pointing to checking, for: -lm, -ldl, -lcrypt, -lz, -lpcre.
  • Some conditional definitions added for the program code:
    • ResAlloc: Check and define "__GLIBC_PREREQ" but into Android the LibC implementation Bionic; pthread_condattr_setclock() disabled for Android;
    • SYS: Needed parts moved from ieee754.h to the same file.
    • SYS: Multi CPU management and pthread_attr_setinheritsched() disabled for Android.
    • Mess: Messages encoding disabled for charset "US-ASCII", it's default one on Android.
    • Security: libcrypt checking expanded for crypt.h and to locked using for the function crypt().
    • Schedule: The core library name points straight into dlopen() for included/builtin modules but Bionic is wrong for the typical "NULL" into GLibC, by the definition "CoreLibNmToDlOpen".
DB.SQLite OK OK
  • Execute the DB tests.
  • Configure to store configuration here.
A version of "libsqlite3" used from CrystaX.
DB.DBF OK OK Execute the DB tests.
DAQ.JavaLikeCalc OK OK Performance tests.
DAQ.LogicLev OK OK -
DAQ.BlockCalc OK OK -
DAQ.DAQGate OK OK -
DAQ.System OK OK (as a module) Create an automatic controller object and see for what sources are allowed. Allowed types of sensors: "CPU", "Net statistic", "Memory", "HDD statistic", "Up time".
DAQ.ModBus OK OK -
DAQ.DCON OK OK -
DAQ.OPC_UA OK OK (as a module) Create an input transport, an endpoint and connect remotely to it. Adapted to include/builtin into the OpenSCADA core.
Archive.FSArch OK OK -
Archive.DBArch OK OK -
Transport.Sockets OK OK Configure an input transport to remote connect to it. The function getservbyname_r() switched to getservbyname() for Android.
Transport.Serial OK OK (as a module) - Checking for linux/serial.h added and for linux/i2c-dev.h fixed.
Transport.SSL OK OK Configure an input transport to remote connect to it.
  • "/tmp" folder missed then we must use some other here but tmpnam() uses itself => switched to a local file for Android.
  • The function getservbyname_r() switched to getservbyname() for Android.
Protocol.SelfSystem OK OK Remote connect to it. The dependence to "libcrypto" of OpenSSL moved to be optional.
Protocol.UserProtocol OK OK -
Protocol.HTTP OK OK -
UI.VCAEngine OK OK (as a module)
UI.QTStarter OK (-) Adapt to start up from JNI. Crashes now at start in the typical way.
UI.QTCfg ?
UI.Vision ?
UI.WebCfg OK OK (as a module)
UI.WebCfgD OK OK (as a module) Move the images to the OpenSCADA folder and try its and the module. A strong dependence from GD removed.
UI.WebVision OK OK (as a module) The library LibGD test on a trend of the primitive "Diagram" and a widget of the primitive "ElFigure" of the project AGLKS. Dependence to LibGD expanded by: -lpng -ljpeg -lfontconfig -lexpat -lfreetype
UI.WebUser OK OK (as a module)
Special.FLibSYS OK OK - Conditional test and using to SSL, for md5().
Special.SystemTests OK OK (as a module)
Special.FLibMath OK OK (as a module) Performance tests.
Special.FLibComplex1 OK OK (as a module)

In process of adaptation OpenSCADA to work on Android there was performed the significant approaches into the autotool based build environment OpenSCADA which can help further for adaption to work on other software platforms:

Appending B. Extended performance tests on Asus Nexus7 II (Qualcomm Snapdragon APQ8064-1AA, Cortex-A15, 1.5 GHz, 4 Cores)

Test Operation sin(Pi), us , into JavaLikeCalc Operation pow(Pi,2), us , into JavaLikeCalc liboscada.so, MiB
Soft, VFP2 0.9 1.58 0.15 0.88 13.79
Soft, NEON 0.87 1.65 0.14 0.95 13.79
Soft, NEON, Thumb 0.88 1.5 0.14 0.9 13
Hard, VFP2 0.162 0.776 0.138 0.844 13.85
Hard, NEON 0.168 0.793 0.123 0.854 13.85
Hard, NEON, Thumb 0.17 0.85 0.15 0.87 12.82

Appending A. List of the generic progress of the task

+ purchase a modern internet tablet with Android;
+ read a book about Android NDK, using of Android NDK and Crystalx-NDK;
+ compiling for tests, education and execution;
+ initially (minimum) build and execute OpenSCADA for console (without GUI): PCRE, OpenSCADA Core, builtin modules: Transport.Sockets, Protocol.SelfSystem, DAQ.JavaLikeCalc, Special.FLibMath;
+ make the performance tests for Soft and Hard float;
+ compile for all OpenSCADA key modules to include/builtin them into the core;
+ compile for needed external libraries: OpenSSL, SQLite, GD [expat,libpng,jpeg,fontconfig,freetype], intl, iconv;
+ rebuild all already built parts into the original Ndk (outward the standalone one);
+ build Qt5: in the default configuration, with the early built libraries;
+ initial build OpenSCADA with Qt5;
- build and observe an example of Qt5 as a Java package (APK), see also to UAExpert;
- adapt OpenSCADA to Qt5 on Android and build as a Java package (APK);
- write a start manager on Java, like to "openscada_start" script, or expand the module UI.QTStarter for the OpenSCADA projects management function;
- add for using QtWebView for last Qt5 and at QtWebKit miss.
- expand for the module DAQ.System by the Android sensors.


 
Один файл.[Показать файлы/форму]
Комментариев нет. [Показать комментарии/форму]