├── OnexOS ├── OnexKernel ├── OnexLang ├── android ├── onexapp │ ├── src │ │ └── main │ │ │ ├── assets │ │ │ ├── res │ │ │ ├── xml │ │ │ │ └── device_filter.xml │ │ │ ├── drawable │ │ │ │ ├── icon.png │ │ │ │ └── icon1k.png │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ └── layout │ │ │ │ ├── device_element.xml │ │ │ │ └── device_list.xml │ │ │ ├── java │ │ │ └── android │ │ │ │ └── network │ │ │ │ └── object │ │ │ │ └── onexapp │ │ │ │ ├── AlarmReceiver.java │ │ │ │ ├── EternalServiceJob.java │ │ │ │ ├── BluetoothReceiver.java │ │ │ │ ├── EternalServiceRestarter.java │ │ │ │ ├── DeviceListActivity.java │ │ │ │ ├── EternalService.java │ │ │ │ └── OnexNativeActivity.java │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ └── CMakeLists.txt ├── settings.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradle.properties ├── build.gradle └── gradlew ├── src ├── behaviours_2.c ├── display.h ├── calendar.h ├── ux-features.h ├── im-gui.h ├── gui.h ├── OnexAppBL.c ├── display.cpp ├── onex.cpp └── ux-features.cpp ├── data ├── fonts │ ├── OpenSans-Bold.ttf │ ├── OpenSans-Light.ttf │ ├── OpenSansEmoji.ttf │ ├── OpenSans-Italic.ttf │ ├── OpenSans-Regular.ttf │ ├── OpenSans-BoldItalic.ttf │ ├── OpenSans-ExtraBold.ttf │ ├── OpenSans-SemiBold.ttf │ ├── OpenSans-LightItalic.ttf │ ├── OpenSans-ExtraBoldItalic.ttf │ └── OpenSans-SemiBoldItalic.ttf └── shaders │ └── imgui │ ├── ui.frag.spv │ ├── ui.vert.spv │ ├── ui.frag │ └── ui.vert ├── gdb-commands-jlink.txt ├── .gitignore ├── sascha ├── CMakeLists.txt ├── VulkanDebug.h ├── VulkanTools.h ├── keycodes.hpp ├── VulkanBuffer.hpp ├── camera.hpp ├── VulkanAndroid.h ├── VulkanDebug.cpp └── VulkanTools.cpp ├── .gitmodules ├── external ├── fonts │ ├── noto_sans_numeric_60.h │ ├── noto_sans_numeric_80.h │ └── fonts_noto_sans_numeric_60.c └── imgui │ ├── LICENSE.txt │ ├── LICENSE │ └── imconfig.h ├── README.md ├── LICENSE ├── cmake ├── FindXCB.cmake └── FindWayland.cmake └── CMakeLists.txt /OnexOS: -------------------------------------------------------------------------------- 1 | ../OnexOS -------------------------------------------------------------------------------- /OnexKernel: -------------------------------------------------------------------------------- 1 | ../OnexKernel -------------------------------------------------------------------------------- /OnexLang: -------------------------------------------------------------------------------- 1 | ../OnexLang -------------------------------------------------------------------------------- /android/onexapp/src/main/assets: -------------------------------------------------------------------------------- 1 | ../../../../data -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':onexapp' 2 | -------------------------------------------------------------------------------- /src/behaviours_2.c: -------------------------------------------------------------------------------- 1 | ../OnexKernel/src/onp/behaviours.c -------------------------------------------------------------------------------- /src/display.h: -------------------------------------------------------------------------------- 1 | 2 | void draw_display(char* path, int16_t width, int16_t height); 3 | 4 | -------------------------------------------------------------------------------- /android/onexapp/src/main/res/xml/device_filter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /data/fonts/OpenSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncanCragg/OnexApp/HEAD/data/fonts/OpenSans-Bold.ttf -------------------------------------------------------------------------------- /data/fonts/OpenSans-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncanCragg/OnexApp/HEAD/data/fonts/OpenSans-Light.ttf -------------------------------------------------------------------------------- /data/fonts/OpenSansEmoji.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncanCragg/OnexApp/HEAD/data/fonts/OpenSansEmoji.ttf -------------------------------------------------------------------------------- /data/fonts/OpenSans-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncanCragg/OnexApp/HEAD/data/fonts/OpenSans-Italic.ttf -------------------------------------------------------------------------------- /data/fonts/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncanCragg/OnexApp/HEAD/data/fonts/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /data/shaders/imgui/ui.frag.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncanCragg/OnexApp/HEAD/data/shaders/imgui/ui.frag.spv -------------------------------------------------------------------------------- /data/shaders/imgui/ui.vert.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncanCragg/OnexApp/HEAD/data/shaders/imgui/ui.vert.spv -------------------------------------------------------------------------------- /data/fonts/OpenSans-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncanCragg/OnexApp/HEAD/data/fonts/OpenSans-BoldItalic.ttf -------------------------------------------------------------------------------- /data/fonts/OpenSans-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncanCragg/OnexApp/HEAD/data/fonts/OpenSans-ExtraBold.ttf -------------------------------------------------------------------------------- /data/fonts/OpenSans-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncanCragg/OnexApp/HEAD/data/fonts/OpenSans-SemiBold.ttf -------------------------------------------------------------------------------- /data/fonts/OpenSans-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncanCragg/OnexApp/HEAD/data/fonts/OpenSans-LightItalic.ttf -------------------------------------------------------------------------------- /data/fonts/OpenSans-ExtraBoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncanCragg/OnexApp/HEAD/data/fonts/OpenSans-ExtraBoldItalic.ttf -------------------------------------------------------------------------------- /data/fonts/OpenSans-SemiBoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncanCragg/OnexApp/HEAD/data/fonts/OpenSans-SemiBoldItalic.ttf -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncanCragg/OnexApp/HEAD/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/onexapp/src/main/res/drawable/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncanCragg/OnexApp/HEAD/android/onexapp/src/main/res/drawable/icon.png -------------------------------------------------------------------------------- /android/onexapp/src/main/res/drawable/icon1k.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncanCragg/OnexApp/HEAD/android/onexapp/src/main/res/drawable/icon1k.png -------------------------------------------------------------------------------- /src/calendar.h: -------------------------------------------------------------------------------- 1 | 2 | bool evaluate_event(object* o, void* d); 3 | void draw_calendar(char* path, int16_t width, int16_t height); 4 | void set_time_save_days(); 5 | 6 | -------------------------------------------------------------------------------- /gdb-commands-jlink.txt: -------------------------------------------------------------------------------- 1 | target extended-remote localhost:2331 2 | mon speed 10000 3 | mon flash download=1 4 | file _build/OnexOS.out 5 | set print pretty on 6 | break HardFault_Handler 7 | set unwindonsignal on 8 | mon reset 0 9 | continue 10 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Oct 03 21:53:06 BST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .*.sw? 2 | _build/ 3 | sdk 4 | dfu.zip 5 | CMakeFiles/ 6 | CMakeCache.txt 7 | Makefile 8 | cmake_install.cmake 9 | bin/ 10 | doc/local 11 | android/doc 12 | ,* 13 | .gradle 14 | .idea 15 | *.iml 16 | build/ 17 | .cxx/ 18 | local.properties 19 | *.a 20 | *.o 21 | *.hex 22 | *.elf 23 | -------------------------------------------------------------------------------- /data/shaders/imgui/ui.frag: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout (binding = 0) uniform sampler2D fontSampler; 4 | 5 | layout (location = 0) in vec2 inUV; 6 | layout (location = 1) in vec4 inColor; 7 | 8 | layout (location = 0) out vec4 outColor; 9 | 10 | void main() 11 | { 12 | outColor = inColor * texture(fontSampler, inUV); 13 | } -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536m 2 | 3 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 4 | org.gradle.parallel=true 5 | 6 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 7 | android.useAndroidX=true 8 | android.enableJetifier=true 9 | 10 | -------------------------------------------------------------------------------- /sascha/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB SASCHA_SRC *.cpp) 2 | file(GLOB SASCHA_HEADERS *.hpp) 3 | 4 | if(WIN32) 5 | add_library(sascha STATIC ${SASCHA_SRC}) 6 | target_link_libraries(sascha ${Vulkan_LIBRARY} ${WINLIBS}) 7 | else(WIN32) 8 | add_library(sascha STATIC ${SASCHA_SRC}) 9 | target_link_libraries(sascha) 10 | endif(WIN32) 11 | 12 | -------------------------------------------------------------------------------- /android/onexapp/src/main/java/android/network/object/onexapp/AlarmReceiver.java: -------------------------------------------------------------------------------- 1 | package network.object.onexapp; 2 | 3 | import android.content.*; 4 | import android.app.*; 5 | 6 | public class AlarmReceiver extends BroadcastReceiver { 7 | @Override 8 | public void onReceive(Context context, Intent intent) { 9 | OnexNativeActivity.alarmReceived(context, intent); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "external/glm"] 2 | path = external/glm 3 | url = https://github.com/g-truc/glm 4 | [submodule "OnexKernel"] 5 | path = OnexKernel 6 | url = git@github.com:DuncanCragg/OnexKernel.git 7 | [submodule "OnexLang"] 8 | path = OnexLang 9 | url = git@github.com:DuncanCragg/OnexLang.git 10 | [submodule "external/lvgl"] 11 | path = external/lvgl 12 | url = git@github.com:littlevgl/lvgl.git 13 | -------------------------------------------------------------------------------- /external/fonts/noto_sans_numeric_60.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Koen Zandberg 3 | * 4 | * This file is subject to the terms and conditions of the GNU Lesser 5 | * General Public License v2.1. See the file LICENSE in the top level 6 | * directory for more details. 7 | */ 8 | 9 | #ifndef _APP_FONTS_NOTO_SANS_NUMERIC_60_H 10 | #define _APP_FONTS_NOTO_SANS_NUMERIC_60_H 11 | 12 | #include "lvgl.h" 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | extern lv_font_t noto_sans_numeric_60; 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif 24 | -------------------------------------------------------------------------------- /external/fonts/noto_sans_numeric_80.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Koen Zandberg 3 | * 4 | * This file is subject to the terms and conditions of the GNU Lesser 5 | * General Public License v2.1. See the file LICENSE in the top level 6 | * directory for more details. 7 | */ 8 | 9 | #ifndef _APP_FONTS_NOTO_SANS_NUMERIC_80_H 10 | #define _APP_FONTS_NOTO_SANS_NUMERIC_80_H 11 | 12 | #include "lvgl.h" 13 | 14 | #ifdef __cplusplus 15 | extern "C" { 16 | #endif 17 | 18 | 19 | extern lv_font_t noto_sans_numeric_80; 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /data/shaders/imgui/ui.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | layout (location = 0) in vec2 inPos; 4 | layout (location = 1) in vec2 inUV; 5 | layout (location = 2) in vec4 inColor; 6 | 7 | layout (push_constant) uniform PushConstants { 8 | vec2 scale; 9 | vec2 translate; 10 | } pushConstants; 11 | 12 | layout (location = 0) out vec2 outUV; 13 | layout (location = 1) out vec4 outColor; 14 | 15 | out gl_PerVertex 16 | { 17 | vec4 gl_Position; 18 | }; 19 | 20 | void main() 21 | { 22 | outUV = inUV; 23 | outColor = inColor; 24 | gl_Position = vec4(inPos * pushConstants.scale + pushConstants.translate, 0.0, 1.0); 25 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Onex 3 | 4 | ### Quickstart: 5 | 6 | ``` 7 | $ git clone --recursive git@github.com:DuncanCragg/OnexApp.git 8 | $ cd OnexApp/ 9 | $ cmake . 10 | $ make 11 | $ cd bin; ./OnexApp 12 | 13 | $ cd android 14 | $ (copy your local.properties over) 15 | $ ./gradlew build --parallel 16 | $ adb -d uninstall network.object.onexapp && adb -d install ./onexapp/build/outputs/apk/onexapp-debug.apk 17 | 18 | $ adb logcat OnexApp:D \*:S 19 | $ adb logcat | grep -F "`adb shell ps | grep network.object.onexapp | cut -c10-15`" 20 | ``` 21 | 22 | 23 | Read about the [initial plans for Onex here](http://object.network/onex-app.html). 24 | 25 | 26 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | google() 6 | mavenCentral() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.3.0' 10 | } 11 | } 12 | 13 | allprojects { 14 | repositories { 15 | google() 16 | mavenCentral() 17 | maven { url "https://jitpack.io" } 18 | } 19 | gradle.projectsEvaluated { 20 | tasks.withType(JavaCompile) { 21 | options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" 22 | } 23 | } 24 | } 25 | 26 | task clean(type: Delete) { 27 | delete rootProject.buildDir 28 | } 29 | 30 | -------------------------------------------------------------------------------- /src/ux-features.h: -------------------------------------------------------------------------------- 1 | 2 | extern char* dragPathId; 3 | 4 | void kill_drag(); 5 | void track_drag(char* pathId, bool twodimensions); 6 | void set_drag_scroll(char* path); 7 | 8 | 9 | extern int linkDirection; 10 | extern char* linkFrom; 11 | extern char* linkTo; 12 | extern ImVec2 linkToPos; 13 | extern ImVec2 linkFromPos; 14 | 15 | void track_link(bool from, char* path, int width, int height); 16 | void draw_link(); 17 | 18 | 19 | bool is_open(char* path); 20 | void toggle_open(char* path); 21 | void close_all_starting(char* prefix); 22 | 23 | void show_keyboard(float multy); 24 | void hide_keyboard(); 25 | 26 | bool filter_auto_input_text(const char* id, char* buf, int buflen, ImGuiTextEditCallback fafn); 27 | int filter_and_autocomplete_calendar_tags(ImGuiTextEditCallbackData* data); 28 | int filter_and_autocomplete_default(ImGuiTextEditCallbackData* data); 29 | int filter_and_autocomplete_property_names(ImGuiTextEditCallbackData* data); 30 | -------------------------------------------------------------------------------- /android/onexapp/src/main/java/android/network/object/onexapp/EternalServiceJob.java: -------------------------------------------------------------------------------- 1 | // THANKS to https://fabcirablog.weebly.com/blog/creating-a-never-ending-background-service-in-android-gt-7 2 | 3 | package network.object.onexapp; 4 | 5 | import android.app.job.JobParameters; 6 | import android.content.*; 7 | import android.util.Log; 8 | 9 | public class EternalServiceJob extends android.app.job.JobService { 10 | private static String LOGNAME="Onex EternalServiceJob"; 11 | 12 | @Override 13 | public boolean onStartJob(JobParameters jobParameters) { 14 | Log.d(LOGNAME, "*onStartJob"); 15 | 16 | startForegroundService(new Intent(this, EternalService.class)); 17 | return false; 18 | } 19 | 20 | @Override 21 | public boolean onStopJob(JobParameters jobParameters) { 22 | Log.d(LOGNAME, "*onStopJob"); 23 | 24 | OnexNativeActivity.restartEternal(); 25 | 26 | return false; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /android/onexapp/src/main/java/android/network/object/onexapp/BluetoothReceiver.java: -------------------------------------------------------------------------------- 1 | package network.object.onexapp; 2 | 3 | import android.util.Log; 4 | import android.content.BroadcastReceiver; 5 | import android.content.Context; 6 | import android.content.Intent; 7 | import android.bluetooth.BluetoothAdapter; 8 | 9 | public class BluetoothReceiver extends BroadcastReceiver { 10 | private static String LOGNAME="Onex BluetoothReceiver"; 11 | 12 | @Override 13 | public void onReceive(Context context, Intent intent) { 14 | if(!BluetoothAdapter.ACTION_STATE_CHANGED.equals(intent.getAction())) return; 15 | if(intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1)==BluetoothAdapter.STATE_OFF){ 16 | EternalService.bluetoothOff(); 17 | } 18 | else 19 | if(intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1)==BluetoothAdapter.STATE_ON){ 20 | EternalService.bluetoothOn(); 21 | } 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Duncan Cragg 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /external/imgui/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2018 Omar Cornut 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /external/imgui/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2015 Omar Cornut and ImGui contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /android/onexapp/src/main/java/android/network/object/onexapp/EternalServiceRestarter.java: -------------------------------------------------------------------------------- 1 | // THANKS to https://fabcirablog.weebly.com/blog/creating-a-never-ending-background-service-in-android-gt-7 2 | 3 | package network.object.onexapp; 4 | 5 | import android.content.BroadcastReceiver; 6 | import android.app.job.JobInfo; 7 | import android.app.job.JobScheduler; 8 | import android.content.*; 9 | import android.util.Log; 10 | 11 | import static android.content.Context.JOB_SCHEDULER_SERVICE; 12 | 13 | public class EternalServiceRestarter extends BroadcastReceiver { 14 | private static String LOGNAME="Onex EternalServiceRestarter"; 15 | 16 | private static JobScheduler jobScheduler; 17 | 18 | @Override 19 | public void onReceive(final Context context, Intent intent) { 20 | Log.d(LOGNAME, "*onReceive"); 21 | if(jobScheduler==null) jobScheduler=(JobScheduler)context.getSystemService(JOB_SCHEDULER_SERVICE); 22 | ComponentName componentName = new ComponentName(context, EternalServiceJob.class); 23 | JobInfo jobInfo = new JobInfo.Builder(1, componentName).setOverrideDeadline(0).setPersisted(true).build(); 24 | jobScheduler.schedule(jobInfo); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /android/onexapp/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | 5 | namespace "network.object.onexapp" 6 | 7 | compileSdkVersion 33 8 | 9 | defaultConfig { 10 | applicationId "network.object.onexapp" 11 | minSdkVersion 29 12 | targetSdkVersion 33 13 | 14 | ndk { 15 | abiFilters 'arm64-v8a' 16 | } 17 | externalNativeBuild { 18 | cmake { 19 | cppFlags "-std=c++14" 20 | arguments "-DANDROID_STL=c++_shared", '-DANDROID_TOOLCHAIN=clang' 21 | } 22 | } 23 | } 24 | 25 | buildTypes { 26 | release { 27 | minifyEnabled false 28 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 29 | } 30 | } 31 | 32 | externalNativeBuild { 33 | cmake { 34 | version "3.22.1" 35 | path "CMakeLists.txt" 36 | } 37 | } 38 | 39 | ndkVersion "25.2.9519653" 40 | 41 | sourceSets { 42 | main { 43 | } 44 | } 45 | 46 | lintOptions { 47 | abortOnError false 48 | } 49 | 50 | dependencies { 51 | implementation 'com.github.felHR85:UsbSerial:6.1.0' 52 | implementation 'androidx.core:core:1.10.1' 53 | } 54 | 55 | compileOptions { 56 | sourceCompatibility 1.8 57 | targetCompatibility 1.8 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /cmake/FindXCB.cmake: -------------------------------------------------------------------------------- 1 | # - FindXCB 2 | # 3 | # Copyright 2015 Valve Coporation 4 | 5 | find_package(PkgConfig) 6 | 7 | if(NOT XCB_FIND_COMPONENTS) 8 | set(XCB_FIND_COMPONENTS xcb) 9 | endif() 10 | 11 | include(FindPackageHandleStandardArgs) 12 | set(XCB_FOUND true) 13 | set(XCB_INCLUDE_DIRS "") 14 | set(XCB_LIBRARIES "") 15 | foreach(comp ${XCB_FIND_COMPONENTS}) 16 | # component name 17 | string(TOUPPER ${comp} compname) 18 | string(REPLACE "-" "_" compname ${compname}) 19 | # header name 20 | string(REPLACE "xcb-" "" headername xcb/${comp}.h) 21 | # library name 22 | set(libname ${comp}) 23 | 24 | pkg_check_modules(PC_${comp} QUIET ${comp}) 25 | 26 | find_path(${compname}_INCLUDE_DIR NAMES ${headername} 27 | HINTS 28 | ${PC_${comp}_INCLUDEDIR} 29 | ${PC_${comp}_INCLUDE_DIRS} 30 | ) 31 | 32 | find_library(${compname}_LIBRARY NAMES ${libname} 33 | HINTS 34 | ${PC_${comp}_LIBDIR} 35 | ${PC_${comp}_LIBRARY_DIRS} 36 | ) 37 | 38 | find_package_handle_standard_args(${comp} 39 | FOUND_VAR ${comp}_FOUND 40 | REQUIRED_VARS ${compname}_INCLUDE_DIR ${compname}_LIBRARY) 41 | mark_as_advanced(${compname}_INCLUDE_DIR ${compname}_LIBRARY) 42 | 43 | list(APPEND XCB_INCLUDE_DIRS ${${compname}_INCLUDE_DIR}) 44 | list(APPEND XCB_LIBRARIES ${${compname}_LIBRARY}) 45 | 46 | if(NOT ${comp}_FOUND) 47 | set(XCB_FOUND false) 48 | endif() 49 | endforeach() 50 | 51 | list(REMOVE_DUPLICATES XCB_INCLUDE_DIRS) -------------------------------------------------------------------------------- /android/onexapp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | project(OnexApp) 3 | 4 | cmake_minimum_required(VERSION 3.19 FATAL_ERROR) 5 | 6 | set(TOP_DIR ../..) 7 | set(ONEX_KERNEL ../../../OnexKernel) 8 | set(ONEX_LANG ../../../OnexLang) 9 | set(EXTERNAL_DIR ../../external) 10 | 11 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Werror -Wno-incompatible-pointer-types-discards-qualifiers -DVK_USE_PLATFORM_ANDROID_KHR -DVK_NO_PROTOTYPES") 12 | 13 | file(GLOB SOURCE_FILES "${ONEX_KERNEL}/src/onl/unix/channel-serial.c" "${ONEX_KERNEL}/src/onl/unix/mem.c" "${ONEX_KERNEL}/src/onl/unix/persistence.c" "${ONEX_KERNEL}/src/onl/unix/properties.c" "${ONEX_KERNEL}/src/onl/unix/random.c" "${ONEX_KERNEL}/src/onl/unix/serial.c" "${ONEX_KERNEL}/src/onl/unix/time.c" "${ONEX_KERNEL}/src/lib/lib.c" "${ONEX_KERNEL}/src/lib/list.c" "${ONEX_KERNEL}/src/lib/value.c" "${ONEX_KERNEL}/src/onn/*.c" "${ONEX_KERNEL}/src/onp/*.c" "${ONEX_LANG}/src/*.c" "${EXTERNAL_DIR}/imgui/*.cpp" "${TOP_DIR}/sascha/*.cpp" "${TOP_DIR}/src/*.cpp") 14 | 15 | add_library(native-lib SHARED ${SOURCE_FILES}) 16 | 17 | add_library(native-app-glue STATIC ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c) 18 | 19 | #add_subdirectory(../base ${CMAKE_SOURCE_DIR}/../base) 20 | 21 | set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate") 22 | 23 | include_directories(${EXTERNAL_DIR}/imgui) 24 | include_directories(${EXTERNAL_DIR}/glm) 25 | include_directories(${ONEX_KERNEL}/include) 26 | include_directories(${ONEX_KERNEL}/src) 27 | include_directories(${ONEX_KERNEL}/src/onn) 28 | include_directories(${ONEX_KERNEL}/src/onp) 29 | include_directories(${ONEX_LANG}/include) 30 | include_directories(${ANDROID_NDK}/sources/android/native_app_glue) 31 | 32 | target_link_libraries( 33 | native-lib 34 | native-app-glue 35 | android 36 | log 37 | z 38 | ) 39 | -------------------------------------------------------------------------------- /src/im-gui.h: -------------------------------------------------------------------------------- 1 | 2 | #include "gui.h" 3 | 4 | extern GUI* static_gui; 5 | extern VulkanBase* app; 6 | extern object* user; 7 | extern object* config; 8 | extern char* userUID; 9 | 10 | 11 | extern unsigned char* fontData; 12 | extern int texWidth, texHeight; 13 | 14 | extern bool keyboardCancelled; 15 | 16 | extern uint16_t buttonHeight; 17 | extern uint16_t paddingHeight; 18 | extern uint16_t objectHeight; 19 | extern uint16_t listHeight; 20 | 21 | extern uint16_t shorterValWidth; 22 | extern uint16_t buttonWidth; 23 | extern uint16_t smallButtonWidth; 24 | extern uint16_t rhsPadding; 25 | 26 | extern uint16_t workspace1Width; 27 | extern uint16_t workspace1Height; 28 | extern uint16_t workspace2Width; 29 | extern uint16_t workspace2Height; 30 | 31 | #if defined(__ANDROID__) || defined(TEST_ANDROID_KEYBOARD) 32 | extern uint16_t yOffsetTarget; 33 | extern uint16_t yOffset; 34 | extern uint16_t yOffsetCounter; 35 | #endif 36 | 37 | extern bool calendarView; 38 | extern bool tableView; 39 | 40 | extern ImVec4 actionColour; 41 | extern ImVec4 actionBackground; 42 | extern ImVec4 actionBackgroundActive; 43 | 44 | extern ImVec4 propertyColour; 45 | extern ImVec4 propertyBackground; 46 | extern ImVec4 propertyBackgroundActive; 47 | 48 | extern ImVec4 valueBackground; 49 | extern ImVec4 valueBackgroundActive; 50 | 51 | extern ImVec4 listBackground; 52 | extern ImVec4 listBackgroundDark; 53 | 54 | extern ImVec4 renderColour; 55 | extern ImVec4 renderColourSoft; 56 | extern ImVec4 renderBackground; 57 | extern ImVec4 renderBackgroundActive; 58 | 59 | extern ImVec4 ledOff; 60 | extern ImVec4 ledOn; 61 | 62 | extern ImVec4 btDisconnected; 63 | extern ImVec4 btConnected; 64 | 65 | extern ImVec4 schemeBrown; 66 | extern ImVec4 schemeYellow; 67 | extern ImVec4 schemeMauve; 68 | extern ImVec4 schemePurple; 69 | extern ImVec4 schemeGreen; 70 | extern ImVec4 schemeLightPurple; 71 | extern ImVec4 schemeDarkerPurple; 72 | extern ImVec4 schemePlum; 73 | 74 | void init_imgui(float width, float height); 75 | void get_font_info(); 76 | void set_scaling(); 77 | 78 | void invoke_single_set(char* uid, char* key, char* val); 79 | void invoke_single_add(char* uid, char* key, char* val); 80 | 81 | -------------------------------------------------------------------------------- /android/onexapp/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 23 | 24 | 25 | Onxidium 26 | Onex Onxidium 27 | 28 | Onex devices 29 | Scan 30 | Cancel 31 | paired 32 | Select a device 33 | Scanning for devices... 34 | Bluetooth Low Energy not supported 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/gui.h: -------------------------------------------------------------------------------- 1 | #ifndef GUI_H 2 | #define GUI_H 3 | 4 | /* 5 | * Vulkan Example - imGui (https://github.com/ocornut/imgui) 6 | * 7 | * Copyright (C) 2017 by Sascha Willems - www.saschawillems.de 8 | * 9 | * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) 10 | */ 11 | 12 | #include 13 | #include 14 | #include 15 | extern void ImStrncpy(char* dst, const char* src, size_t count); 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | extern "C" { 22 | #include 23 | #include 24 | #include 25 | #include 26 | } 27 | 28 | #include 29 | #include 30 | 31 | #include 32 | #include "../sascha/VulkanBase.h" 33 | #include "../sascha/VulkanDevice.hpp" 34 | #include "../sascha/VulkanBuffer.hpp" 35 | 36 | class GUI { 37 | public: 38 | VkSampler sampler; 39 | vks::Buffer vertexBuffer; 40 | vks::Buffer indexBuffer; 41 | int32_t vertexCount = 0; 42 | int32_t indexCount = 0; 43 | VkDeviceMemory fontMemory = VK_NULL_HANDLE; 44 | VkImage fontImage = VK_NULL_HANDLE; 45 | VkImageView fontView = VK_NULL_HANDLE; 46 | VkPipelineCache pipelineCache; 47 | VkPipelineLayout pipelineLayout; 48 | VkPipeline pipeline; 49 | VkDescriptorPool descriptorPool; 50 | VkDescriptorSetLayout descriptorSetLayout; 51 | VkDescriptorSet descriptorSet; 52 | vks::VulkanDevice *device; 53 | 54 | struct PushConstBlock { 55 | glm::vec2 scale; 56 | glm::vec2 translate; 57 | } pushConstBlock; 58 | 59 | GUI(VulkanBase *app); 60 | 61 | void prepare(); 62 | void setUpKeyMap(); 63 | void createFontImage(); 64 | void setupImageBuffer(VkQueue copyQueue); 65 | void createSampler(); 66 | void setupDescriptorPool(); 67 | void setupDescriptorSetLayout(); 68 | void setupDescriptorSets(); 69 | void createPipelineCache(); 70 | void createPipelines(VkRenderPass renderPass); 71 | void updateBuffers(); 72 | void drawFrame(VkCommandBuffer commandBuffer); 73 | void buildCommandBuffers(int32_t i); 74 | void updateUniformBuffers(){} 75 | void addAnyKeySym(); 76 | void keyPressed(int32_t keyCode, char32_t u32key); 77 | void keyReleased(int32_t keyCode); 78 | void render(); 79 | 80 | ~GUI(); 81 | }; 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /android/onexapp/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 23 | 24 | 25 | 29 | 36 | 37 | 38 | 41 | 42 | #FF000000 43 | #FFF2F2F2 44 | 45 | 46 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /android/onexapp/src/main/res/layout/device_element.xml: -------------------------------------------------------------------------------- 1 | 2 | 23 | 30 | 31 | 39 | 40 | 48 | 49 | 55 | 56 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /cmake/FindWayland.cmake: -------------------------------------------------------------------------------- 1 | # Try to find Wayland on a Unix system 2 | # 3 | # This will define: 4 | # 5 | # WAYLAND_FOUND - True if Wayland is found 6 | # WAYLAND_LIBRARIES - Link these to use Wayland 7 | # WAYLAND_INCLUDE_DIR - Include directory for Wayland 8 | # WAYLAND_DEFINITIONS - Compiler flags for using Wayland 9 | # 10 | # In addition the following more fine grained variables will be defined: 11 | # 12 | # WAYLAND_CLIENT_FOUND WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES 13 | # WAYLAND_SERVER_FOUND WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES 14 | # WAYLAND_EGL_FOUND WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES 15 | # 16 | # Copyright (c) 2013 Martin Gräßlin 17 | # 18 | # Redistribution and use is allowed according to the terms of the BSD license. 19 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 20 | 21 | IF (NOT WIN32) 22 | IF (WAYLAND_INCLUDE_DIR AND WAYLAND_LIBRARIES) 23 | # In the cache already 24 | SET(WAYLAND_FIND_QUIETLY TRUE) 25 | ENDIF () 26 | 27 | # Use pkg-config to get the directories and then use these values 28 | # in the FIND_PATH() and FIND_LIBRARY() calls 29 | FIND_PACKAGE(PkgConfig) 30 | PKG_CHECK_MODULES(PKG_WAYLAND QUIET wayland-client wayland-server wayland-egl wayland-cursor) 31 | 32 | SET(WAYLAND_DEFINITIONS ${PKG_WAYLAND_CFLAGS}) 33 | 34 | FIND_PATH(WAYLAND_CLIENT_INCLUDE_DIR NAMES wayland-client.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) 35 | FIND_PATH(WAYLAND_SERVER_INCLUDE_DIR NAMES wayland-server.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) 36 | FIND_PATH(WAYLAND_EGL_INCLUDE_DIR NAMES wayland-egl.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) 37 | FIND_PATH(WAYLAND_CURSOR_INCLUDE_DIR NAMES wayland-cursor.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS}) 38 | 39 | FIND_LIBRARY(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client HINTS ${PKG_WAYLAND_LIBRARY_DIRS}) 40 | FIND_LIBRARY(WAYLAND_SERVER_LIBRARIES NAMES wayland-server HINTS ${PKG_WAYLAND_LIBRARY_DIRS}) 41 | FIND_LIBRARY(WAYLAND_EGL_LIBRARIES NAMES wayland-egl HINTS ${PKG_WAYLAND_LIBRARY_DIRS}) 42 | FIND_LIBRARY(WAYLAND_CURSOR_LIBRARIES NAMES wayland-cursor HINTS ${PKG_WAYLAND_LIBRARY_DIRS}) 43 | 44 | set(WAYLAND_INCLUDE_DIR ${WAYLAND_CLIENT_INCLUDE_DIR} ${WAYLAND_SERVER_INCLUDE_DIR} ${WAYLAND_EGL_INCLUDE_DIR} ${WAYLAND_CURSOR_INCLUDE_DIR}) 45 | 46 | set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES} ${WAYLAND_CURSOR_LIBRARIES}) 47 | 48 | list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIR) 49 | 50 | include(FindPackageHandleStandardArgs) 51 | 52 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CLIENT DEFAULT_MSG WAYLAND_CLIENT_LIBRARIES WAYLAND_CLIENT_INCLUDE_DIR) 53 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_SERVER DEFAULT_MSG WAYLAND_SERVER_LIBRARIES WAYLAND_SERVER_INCLUDE_DIR) 54 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_EGL DEFAULT_MSG WAYLAND_EGL_LIBRARIES WAYLAND_EGL_INCLUDE_DIR) 55 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CURSOR DEFAULT_MSG WAYLAND_CURSOR_LIBRARIES WAYLAND_CURSOR_INCLUDE_DIR) 56 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND DEFAULT_MSG WAYLAND_LIBRARIES WAYLAND_INCLUDE_DIR) 57 | 58 | MARK_AS_ADVANCED( 59 | WAYLAND_INCLUDE_DIR WAYLAND_LIBRARIES 60 | WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES 61 | WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES 62 | WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES 63 | WAYLAND_CURSOR_INCLUDE_DIR WAYLAND_CURSOR_LIBRARIES 64 | ) 65 | 66 | ENDIF () 67 | -------------------------------------------------------------------------------- /android/onexapp/src/main/res/layout/device_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 23 | 24 | 28 | 29 | 33 | 34 | 44 | 45 | 52 | 53 | 54 | 55 | 58 | 64 | 65 | 73 | 74 |