diff --git a/ACKNOWLEDGEMENTS b/ACKNOWLEDGEMENTS new file mode 100644 index 00000000..3d9393c0 --- /dev/null +++ b/ACKNOWLEDGEMENTS @@ -0,0 +1,4 @@ +Many thanks to g2-kit-unofficial: https://github.com/Commute773/g2-kit-unofficial/ +and others who contributed to documenting the G2's bluetooth protocol. It has enabled me +to keep my room clean, so to speak. + diff --git a/App_Resources/Android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/App_Resources/Android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index 7353dbd1..036d09bc 100644 --- a/App_Resources/Android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/App_Resources/Android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file diff --git a/App_Resources/Android/src/main/res/mipmap-hdpi/ic_launcher.png b/App_Resources/Android/src/main/res/mipmap-hdpi/ic_launcher.png index 69948d22..00e4cf14 100644 Binary files a/App_Resources/Android/src/main/res/mipmap-hdpi/ic_launcher.png and b/App_Resources/Android/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/App_Resources/Android/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/App_Resources/Android/src/main/res/mipmap-hdpi/ic_launcher_foreground.png new file mode 100644 index 00000000..5325cbf4 Binary files /dev/null and b/App_Resources/Android/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/App_Resources/Android/src/main/res/mipmap-mdpi/ic_launcher.png b/App_Resources/Android/src/main/res/mipmap-mdpi/ic_launcher.png index 90a58cd7..df6b391a 100644 Binary files a/App_Resources/Android/src/main/res/mipmap-mdpi/ic_launcher.png and b/App_Resources/Android/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/App_Resources/Android/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/App_Resources/Android/src/main/res/mipmap-mdpi/ic_launcher_foreground.png new file mode 100644 index 00000000..20755afc Binary files /dev/null and b/App_Resources/Android/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/App_Resources/Android/src/main/res/mipmap-xhdpi/ic_launcher.png b/App_Resources/Android/src/main/res/mipmap-xhdpi/ic_launcher.png index 70a2a0d0..8f8ff7f8 100644 Binary files a/App_Resources/Android/src/main/res/mipmap-xhdpi/ic_launcher.png and b/App_Resources/Android/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/App_Resources/Android/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/App_Resources/Android/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png new file mode 100644 index 00000000..d3a9ee62 Binary files /dev/null and b/App_Resources/Android/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/App_Resources/Android/src/main/res/mipmap-xxhdpi/ic_launcher.png b/App_Resources/Android/src/main/res/mipmap-xxhdpi/ic_launcher.png index 1ee5a941..711cec40 100644 Binary files a/App_Resources/Android/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/App_Resources/Android/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/App_Resources/Android/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/App_Resources/Android/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 00000000..4e5790ab Binary files /dev/null and b/App_Resources/Android/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/App_Resources/Android/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/App_Resources/Android/src/main/res/mipmap-xxxhdpi/ic_launcher.png index 66e9d4bb..1bf449d1 100644 Binary files a/App_Resources/Android/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/App_Resources/Android/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/App_Resources/Android/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/App_Resources/Android/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 00000000..a5aedb7e Binary files /dev/null and b/App_Resources/Android/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/App_Resources/Android/src/main/res/values/ic_launcher_background.xml b/App_Resources/Android/src/main/res/values/ic_launcher_background.xml index c5d5899f..a30f9a7e 100644 --- a/App_Resources/Android/src/main/res/values/ic_launcher_background.xml +++ b/App_Resources/Android/src/main/res/values/ic_launcher_background.xml @@ -1,4 +1,4 @@ - #FFFFFF + #00000000 \ No newline at end of file diff --git a/app/g2/dashboard-controller.ts b/app/g2/dashboard-controller.ts index fcf9359a..f509a1d3 100644 --- a/app/g2/dashboard-controller.ts +++ b/app/g2/dashboard-controller.ts @@ -1,5 +1,5 @@ -import { EventSourceType, EventSourceTypeName, OsEventTypeList, OsEventTypeName, } from "g2-kit/lite"; import { ImageSource } from "@nativescript/core"; +import { EventSourceType, EventSourceTypeName, OsEventTypeList, OsEventTypeName } from "./events"; import { loadDeviceAddresses } from "./device-addresses"; import { ensureBlePermissions } from "./android-permissions"; import { FaceclawCommunicatorBridge, type FrameMetrics, type RawInputEvent } from "../native/faceclaw-communicator"; @@ -15,6 +15,7 @@ import { getDashboardNightscoutSettings, getDashboardSystemCardName, receiveInput, + resetDashboardSleepTimerAndWake, setDashboardBatteryLevels, setDashboardActions, setDashboardNightscoutApiToken, @@ -238,6 +239,7 @@ class DashboardController { this.log = ""; this.lastInput = "waiting..."; this.lastSys = "none yet"; + resetDashboardSleepTimerAndWake(); this.refreshEvenAppStatus(); this.setPhase("connecting"); this.setStatus("Connecting to the glasses..."); diff --git a/app/g2/events.ts b/app/g2/events.ts new file mode 100644 index 00000000..2b7fba7e --- /dev/null +++ b/app/g2/events.ts @@ -0,0 +1,37 @@ +export const EventSourceType = { + TOUCH_EVENT_FORM_DUMMY_NULL: 0, + TOUCH_EVENT_FROM_GLASSES_R: 1, + TOUCH_EVENT_FROM_RING: 2, + TOUCH_EVENT_FROM_GLASSES_L: 3, +} as const; + +export const EventSourceTypeName: Record = { + 0: "TOUCH_EVENT_FORM_DUMMY_NULL", + 1: "TOUCH_EVENT_FROM_GLASSES_R", + 2: "TOUCH_EVENT_FROM_RING", + 3: "TOUCH_EVENT_FROM_GLASSES_L", +}; + +export const OsEventTypeList = { + CLICK_EVENT: 0, + SCROLL_TOP_EVENT: 1, + SCROLL_BOTTOM_EVENT: 2, + DOUBLE_CLICK_EVENT: 3, + FOREGROUND_ENTER_EVENT: 4, + FOREGROUND_EXIT_EVENT: 5, + ABNORMAL_EXIT_EVENT: 6, + SYSTEM_EXIT_EVENT: 7, + IMU_DATA_REPORT: 8, +} as const; + +export const OsEventTypeName: Record = { + 0: "CLICK_EVENT", + 1: "SCROLL_TOP_EVENT", + 2: "SCROLL_BOTTOM_EVENT", + 3: "DOUBLE_CLICK_EVENT", + 4: "FOREGROUND_ENTER_EVENT", + 5: "FOREGROUND_EXIT_EVENT", + 6: "ABNORMAL_EXIT_EVENT", + 7: "SYSTEM_EXIT_EVENT", + 8: "IMU_DATA_REPORT", +}; diff --git a/app/ui/dashboard.ts b/app/ui/dashboard.ts index d01b0dbb..da74a0db 100644 --- a/app/ui/dashboard.ts +++ b/app/ui/dashboard.ts @@ -8,7 +8,7 @@ import { nightscoutBridge } from "../native/nightscout"; import { readActiveNotificationIcons } from "../native/notification-icons"; import { readPhoneBatteryState } from "../native/phone-battery"; import { readSystemStatusIcons } from "../native/system-status-icons"; -import { OsEventTypeList, EventSourceType } from "g2-kit/lite"; +import { EventSourceType, OsEventTypeList } from "../g2/events"; import { getDashboardPlugin, isBlankDashboardPlugin, @@ -219,6 +219,17 @@ export function applyDashboardScreenTimeout(nowMs = Date.now()): boolean { return true; } +export function resetDashboardSleepTimerAndWake(nowMs = Date.now()): boolean { + dashboardState.lastInputAtMs = nowMs; + if (dashboardState.screenOn) return false; + + dashboardState.screenOn = true; + dashboardState.tiledWakePaintPending = dashboardState.wakeMode === "tiled"; + dashboardLayers.clearToBase(); + dashboardLayers.push(createRootMenuLayer()); + return true; +} + export function setDashboardBatteryLevels(levels: Partial): void { dashboardState.battery = { ...dashboardState.battery, @@ -411,12 +422,12 @@ function createRootMenuLayer(): MenuLayer { return new RootMenuLayer( "Menu", [ - { + /*{ label: "Apps", onSelect: (ctx) => { ctx.stack.push(createAppsMenuLayer()); }, - }, + },*/ { label: "Settings", onSelect: (ctx) => { @@ -720,7 +731,6 @@ class AboutLayer implements Layer { paint(): GrayImage { const image = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0); const logo = getDashboardLogo(); - image.drawRect(12, 12, G2_LENS_WIDTH - 24, G2_LENS_HEIGHT - 24, 52); image.drawText(dashboardFont, 22, 16, "About Faceclaw", 220); if (logo) { image.bitBlt(logo, 22, 42); @@ -729,17 +739,13 @@ class AboutLayer implements Layer { image.drawText(dashboardFont, 108, 64, "Dashboard prototype", 180); const aboutLines = [ - "A lobster on top of a smiley face.", - "Perching on the faces of giants.", - "", - "The menu opens dashboard cards.", - "Settings configure card slots.", - "Double-click backs out of menus.", + "By James Babcock. Distributed under the GNU General Public License, version 3.", + "Version 0.1.0. Too much of an early janky development prototype to have", + "proper numbered releases." ]; for (let index = 0; index < aboutLines.length; index++) { image.drawText(dashboardFont, 22, 128 + index * 14, aboutLines[index]!, 180); } - image.drawText(dashboardFont, 22, 252, "Double-click to go back", 110); return image; } diff --git a/images/FaceclawAppIcon.png b/images/FaceclawAppIcon.png new file mode 100644 index 00000000..3ce3e1ce Binary files /dev/null and b/images/FaceclawAppIcon.png differ diff --git a/package-lock.json b/package-lock.json index 8c99357d..62a1f5ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "dependencies": { "@nativescript/core": "~9.0.0", "@nativescript/theme": "^3.1.0", - "g2-kit": "file:../g2-kit-unofficial", "lodash": "^4.18.1", "upng-js": "^2.1.0" }, @@ -21,21 +20,6 @@ "typescript": "~5.4.0" } }, - "../g2-kit-unofficial": { - "name": "g2-kit", - "version": "0.1.0", - "license": "MIT", - "dependencies": { - "@bufbuild/protobuf": "^2.11.0", - "@stoprocent/noble": "^2.4.0", - "ws": "^8.20.0" - }, - "devDependencies": { - "@types/bun": "latest", - "@types/ws": "^8.18.1", - "typescript": "^6.0.2" - } - }, "node_modules/@babel/code-frame": { "version": "7.29.0", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz", @@ -2517,10 +2501,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/g2-kit": { - "resolved": "../g2-kit-unofficial", - "link": true - }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", diff --git a/package.json b/package.json index 0be3fae7..cb345599 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,6 @@ "dependencies": { "@nativescript/core": "~9.0.0", "@nativescript/theme": "^3.1.0", - "g2-kit": "file:../g2-kit-unofficial", "lodash": "^4.18.1", "upng-js": "^2.1.0" },