Compare commits

..

1 Commits

Author SHA1 Message Date
edc58c3269 update 2025-11-12 21:28:41 +00:00
16 changed files with 89 additions and 251 deletions

View File

@@ -13,7 +13,7 @@ dependencies {
implementation project(':capacitor-haptics') implementation project(':capacitor-haptics')
implementation project(':capacitor-keyboard') implementation project(':capacitor-keyboard')
implementation project(':capacitor-status-bar') implementation project(':capacitor-status-bar')
implementation "androidx.annotation:annotation:*"
} }

View File

@@ -7,9 +7,7 @@
android:label="@string/app_name" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme" android:theme="@style/AppTheme">
android:networkSecurityConfig="@xml/network_security_config"
>
<activity <activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation"

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<!-- Allow cleartext only for the CORS proxy used by the library -->
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">cors.emaker.limited</domain>
</domain-config>
<!-- Optional: keep everything else blocked (default) -->
</network-security-config>

View File

@@ -3,21 +3,7 @@ import type { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = { const config: CapacitorConfig = {
appId: 'io.ionic.starter', appId: 'io.ionic.starter',
appName: 'UpdaterApp', appName: 'UpdaterApp',
webDir: 'dist', webDir: 'dist'
cordova: {
preferences: {
bluetooth_restore_state: "true",
accessBackgroundLocation: "true",
},
},
"server": {
"androidScheme": "http",
},
// plugins: {
// CapacitorHttp: {
// enabled: true,
// },
// },
}; };
export default config; export default config;

100
package-lock.json generated
View File

@@ -16,10 +16,9 @@
"@capacitor/status-bar": "7.0.3", "@capacitor/status-bar": "7.0.3",
"@ionic/vue": "^8.0.0", "@ionic/vue": "^8.0.0",
"@ionic/vue-router": "^8.0.0", "@ionic/vue-router": "^8.0.0",
"cordova-plugin-ble-central": "^2.0.0",
"ionicons": "^7.0.0", "ionicons": "^7.0.0",
"pinia": "^3.0.3", "pinia": "^3.0.3",
"updaterweblibrary": "1.0.11", "updaterweblibrary": "^1.0.4",
"vue": "^3.3.0", "vue": "^3.3.0",
"vue-router": "^4.2.0" "vue-router": "^4.2.0"
}, },
@@ -3629,21 +3628,21 @@
} }
}, },
"node_modules/@vue/devtools-api": { "node_modules/@vue/devtools-api": {
"version": "7.7.9", "version": "7.7.8",
"resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-7.7.9.tgz", "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-7.7.8.tgz",
"integrity": "sha512-kIE8wvwlcZ6TJTbNeU2HQNtaxLx3a84aotTITUuL/4bzfPxzajGBOoqjMhwZJ8L9qFYDU/lAYMEEm11dnZOD6g==", "integrity": "sha512-BtFcAmDbtXGwurWUFf8ogIbgZyR+rcVES1TSNEI8Em80fD8Anu+qTRN1Fc3J6vdRHlVM3fzPV1qIo+B4AiqGzw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@vue/devtools-kit": "^7.7.9" "@vue/devtools-kit": "^7.7.8"
} }
}, },
"node_modules/@vue/devtools-kit": { "node_modules/@vue/devtools-kit": {
"version": "7.7.9", "version": "7.7.8",
"resolved": "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.7.9.tgz", "resolved": "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.7.8.tgz",
"integrity": "sha512-PyQ6odHSgiDVd4hnTP+aDk2X4gl2HmLDfiyEnn3/oV+ckFDuswRs4IbBT7vacMuGdwY/XemxBoh302ctbsptuA==", "integrity": "sha512-4Y8op+AoxOJhB9fpcEF6d5vcJXWKgHxC3B0ytUB8zz15KbP9g9WgVzral05xluxi2fOeAy6t140rdQ943GcLRQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@vue/devtools-shared": "^7.7.9", "@vue/devtools-shared": "^7.7.8",
"birpc": "^2.3.0", "birpc": "^2.3.0",
"hookable": "^5.5.3", "hookable": "^5.5.3",
"mitt": "^3.0.1", "mitt": "^3.0.1",
@@ -3653,9 +3652,9 @@
} }
}, },
"node_modules/@vue/devtools-shared": { "node_modules/@vue/devtools-shared": {
"version": "7.7.9", "version": "7.7.8",
"resolved": "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.7.9.tgz", "resolved": "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.7.8.tgz",
"integrity": "sha512-iWAb0v2WYf0QWmxCGy0seZNDPdO3Sp5+u78ORnyeonS6MT4PC7VPrryX2BpMJrwlDeaZ6BD4vP4XKjK0SZqaeA==", "integrity": "sha512-XHpO3jC5nOgYr40M9p8Z4mmKfTvUxKyRcUnpBAYg11pE78eaRFBKb0kG5yKLroMuJeeNH9LWmKp2zMU5LUc7CA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"rfdc": "^1.4.1" "rfdc": "^1.4.1"
@@ -4153,9 +4152,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/baseline-browser-mapping": { "node_modules/baseline-browser-mapping": {
"version": "2.8.29", "version": "2.8.27",
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.29.tgz", "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.27.tgz",
"integrity": "sha512-sXdt2elaVnhpDNRDz+1BDx1JQoJRuNk7oVlAlbGiFkLikHCAQiccexF/9e91zVi6RCgqspl04aP+6Cnl9zRLrA==", "integrity": "sha512-2CXFpkjVnY2FT+B6GrSYxzYf65BJWEqz5tIRHCvNsZZ2F3CmsCB37h8SpYgKG7y9C4YAeTipIPWG7EmFmhAeXA==",
"dev": true, "dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"bin": { "bin": {
@@ -4406,9 +4405,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001755", "version": "1.0.30001754",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001755.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001754.tgz",
"integrity": "sha512-44V+Jm6ctPj7R52Na4TLi3Zri4dWUljJd+RDm+j8LtNCc/ihLCT+X1TzoOAkRETEWqjuLnh9581Tl80FvK7jVA==", "integrity": "sha512-x6OeBXueoAceOmotzx3PO4Zpt4rzpeIFsSr6AAePTZxSkXiYDUmpypEl7e2+8NCd9bD7bXjqyef8CJYPC1jfxg==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -4716,16 +4715,10 @@
"url": "https://github.com/sponsors/mesqueeb" "url": "https://github.com/sponsors/mesqueeb"
} }
}, },
"node_modules/cordova-plugin-ble-central": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/cordova-plugin-ble-central/-/cordova-plugin-ble-central-2.0.0.tgz",
"integrity": "sha512-IYXIR6EeKJiIprKiGV/9shNktBqAI8AVgACSlJKbF6pqCOXuFXdjaUG9f6ODssSGnV0LEaL9gKtoLLHGaW+FzA==",
"license": "Apache-2.0"
},
"node_modules/core-js": { "node_modules/core-js": {
"version": "3.47.0", "version": "3.46.0",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.47.0.tgz", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.46.0.tgz",
"integrity": "sha512-c3Q2VVkGAUyupsjRnaNX6u8Dq2vAdzm9iuPj5FW0fRxzlxgq9Q39MDq10IvmQSpLgHQNyQzQmOo6bgGHmH3NNg==", "integrity": "sha512-vDMm9B0xnqqZ8uSBpZ8sNtRtOdmfShrvT6h2TuQGLs0Is+cR0DYbj/KWP6ALVNbWPpqA/qPLoOuppJN07humpA==",
"dev": true, "dev": true,
"hasInstallScript": true, "hasInstallScript": true,
"license": "MIT", "license": "MIT",
@@ -4735,13 +4728,13 @@
} }
}, },
"node_modules/core-js-compat": { "node_modules/core-js-compat": {
"version": "3.47.0", "version": "3.46.0",
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.47.0.tgz", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.46.0.tgz",
"integrity": "sha512-IGfuznZ/n7Kp9+nypamBhvwdwLsW6KC8IOaURw2doAK5e98AG3acVLdh0woOnEqCfUtS+Vu882JE4k/DAm3ItQ==", "integrity": "sha512-p9hObIIEENxSV8xIu+V68JjSeARg6UVMG5mR+JEUguG3sI6MsiS1njz2jHmyJDvA+8jX/sytkBHup6kxhM9law==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"browserslist": "^4.28.0" "browserslist": "^4.26.3"
}, },
"funding": { "funding": {
"type": "opencollective", "type": "opencollective",
@@ -4797,9 +4790,9 @@
} }
}, },
"node_modules/csstype": { "node_modules/csstype": {
"version": "3.2.3", "version": "3.1.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
"integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/cypress": { "node_modules/cypress": {
@@ -5123,9 +5116,9 @@
} }
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.5.255", "version": "1.5.250",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.255.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.250.tgz",
"integrity": "sha512-Z9oIp4HrFF/cZkDPMpz2XSuVpc1THDpT4dlmATFlJUIBVCy9Vap5/rIXsASP1CscBacBqhabwh8vLctqBwEerQ==", "integrity": "sha512-/5UMj9IiGDMOFBnN4i7/Ry5onJrAGSbOGo3s9FEKmwobGq6xw832ccET0CE3CkkMBZ8GJSlUIesZofpyurqDXw==",
"dev": true, "dev": true,
"license": "ISC" "license": "ISC"
}, },
@@ -5862,9 +5855,9 @@
} }
}, },
"node_modules/form-data": { "node_modules/form-data": {
"version": "4.0.5", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz",
"integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==", "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -6054,9 +6047,9 @@
} }
}, },
"node_modules/glob": { "node_modules/glob": {
"version": "10.5.0", "version": "10.4.5",
"resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",
"integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==",
"dev": true, "dev": true,
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
@@ -8156,15 +8149,15 @@
} }
}, },
"node_modules/rimraf/node_modules/glob": { "node_modules/rimraf/node_modules/glob": {
"version": "11.1.0", "version": "11.0.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-11.1.0.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.3.tgz",
"integrity": "sha512-vuNwKSaKiqm7g0THUBu2x7ckSs3XJLXE+2ssL7/MfTGPLLcrJQ/4Uq1CjPTtO5cCIiRxqvN6Twy1qOwhL0Xjcw==", "integrity": "sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==",
"dev": true, "dev": true,
"license": "BlueOak-1.0.0", "license": "ISC",
"dependencies": { "dependencies": {
"foreground-child": "^3.3.1", "foreground-child": "^3.3.1",
"jackspeak": "^4.1.1", "jackspeak": "^4.1.1",
"minimatch": "^10.1.1", "minimatch": "^10.0.3",
"minipass": "^7.1.2", "minipass": "^7.1.2",
"package-json-from-dist": "^1.0.0", "package-json-from-dist": "^1.0.0",
"path-scurry": "^2.0.0" "path-scurry": "^2.0.0"
@@ -9290,13 +9283,12 @@
} }
}, },
"node_modules/updaterweblibrary": { "node_modules/updaterweblibrary": {
"version": "1.0.11", "version": "1.0.9",
"resolved": "https://registry.npmjs.org/updaterweblibrary/-/updaterweblibrary-1.0.11.tgz", "resolved": "https://registry.npmjs.org/updaterweblibrary/-/updaterweblibrary-1.0.9.tgz",
"integrity": "sha512-iQggd1YW/LMzw912Dg5M3tEk5jA8WSp4LA8o7grco2eC3mUnx8ThoS5pWG0lKqgmBIxhZLsIIldv+bSB75f7Qw==", "integrity": "sha512-c4uMy+0jhkSu3mIsjVb0qkuMJEjziPzvlHGeZQzNOMCvg4POWH3gtSbYTC6OBmb6w9Cg1ucYynFrXzwbIcnXqg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@rgrove/parse-xml": "^4.2.0", "@rgrove/parse-xml": "^4.2.0"
"cordova-plugin-ble-central": "^2.0.0"
} }
}, },
"node_modules/uri-js": { "node_modules/uri-js": {

View File

@@ -21,10 +21,9 @@
"@capacitor/status-bar": "7.0.3", "@capacitor/status-bar": "7.0.3",
"@ionic/vue": "^8.0.0", "@ionic/vue": "^8.0.0",
"@ionic/vue-router": "^8.0.0", "@ionic/vue-router": "^8.0.0",
"cordova-plugin-ble-central": "^2.0.0",
"ionicons": "^7.0.0", "ionicons": "^7.0.0",
"pinia": "^3.0.3", "pinia": "^3.0.3",
"updaterweblibrary": "1.0.11", "updaterweblibrary": "^1.0.4",
"vue": "^3.3.0", "vue": "^3.3.0",
"vue-router": "^4.2.0" "vue-router": "^4.2.0"
}, },

View File

@@ -6,7 +6,4 @@
<script setup lang="ts"> <script setup lang="ts">
import { IonApp, IonRouterOutlet } from '@ionic/vue'; import { IonApp, IonRouterOutlet } from '@ionic/vue';
import updater from './utils/updater';
updater.obj.bleObject = ble;
</script> </script>

View File

@@ -1,7 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import useArchiveStore from "@/stores/archive"; import useArchiveStore from "@/stores/archive";
import { versionNotes } from "@/utils/types"; import { versionNotes } from "@/utils/types";
import updater from "@/utils/updater";
import { import {
IonButton, IonButton,
IonCard, IonCard,
@@ -15,12 +14,11 @@ IonLabel, IonItem,
IonList IonList
} from "@ionic/vue"; } from "@ionic/vue";
import {chevronForward} from "ionicons/icons"; import {chevronForward} from "ionicons/icons";
import { onBeforeMount, ref, watch } from "vue"; import { ref, watch } from "vue";
const archive = useArchiveStore(); const archive = useArchiveStore();
const emit = defineEmits<{(e: "back"): void, (e: "disconnect"): void, (e: "details"):void}>(); const emit = defineEmits<{(e: "back"): void, (e: "disconnect"): void, (e: "details"):void}>();
const versions = ref<versionNotes[]>([]); const versions = ref<versionNotes[]>([]);
const version = ref<string>("");
const back = () => { const back = () => {
emit("back"); emit("back");
@@ -37,9 +35,6 @@ const details = (index: number) => {
watch(() => archive.getArchive, (newValue) => versions.value = newValue, {immediate: true}); watch(() => archive.getArchive, (newValue) => versions.value = newValue, {immediate: true});
onBeforeMount(async () => {
version.value = await updater.obj.getBoardVersion();
});
</script> </script>
<template> <template>
@@ -48,7 +43,7 @@ onBeforeMount(async () => {
<div class="header-column"> <div class="header-column">
<ion-card-title>ARCHIVE</ion-card-title> <ion-card-title>ARCHIVE</ion-card-title>
<ion-card-title>Board</ion-card-title> <ion-card-title>Board</ion-card-title>
<ion-card-subtitle>{{ version }}</ion-card-subtitle> <ion-card-subtitle>v1.1.1</ion-card-subtitle>
</div> </div>
<div style="flex-grow: 1"></div> <div style="flex-grow: 1"></div>
<div> <div>

View File

@@ -9,13 +9,11 @@ import {
IonCardTitle, IonCardTitle,
} from "@ionic/vue"; } from "@ionic/vue";
import { versionNotes } from "@/utils/types"; import { versionNotes } from "@/utils/types";
import { onBeforeMount, ref } from "vue"; import { ref } from "vue";
import updater from "@/utils/updater";
const archive = useArchiveStore(); const archive = useArchiveStore();
const emit = defineEmits<{(e:"back"):void, (e: "disconnect"): void, (e:"choose"): void}>(); const emit = defineEmits<{(e:"back"):void, (e: "disconnect"): void, (e:"choose"): void}>();
const record = ref<versionNotes>(archive.getArchive[archive.getShownI]); const record = ref<versionNotes>(archive.getArchive[archive.getShownI]);
const version = ref<string>("");
const back = () => { const back = () => {
emit("back"); emit("back");
@@ -29,12 +27,7 @@ const choose = () => {
emit("choose"); emit("choose");
}; };
// TODO: remove console.log(archive.getArchive)
// console.log(archive.getArchive)
onBeforeMount(async () => {
version.value = await updater.obj.getBoardVersion();
});
</script> </script>
<template> <template>
@@ -43,7 +36,7 @@ onBeforeMount(async () => {
<div> <div>
<ion-card-title>DETAILS</ion-card-title> <ion-card-title>DETAILS</ion-card-title>
<ion-card-title>Board</ion-card-title> <ion-card-title>Board</ion-card-title>
<ion-card-subtitle>{{ version }}</ion-card-subtitle> <ion-card-subtitle>v1.1.1</ion-card-subtitle>
</div> </div>
<div style="flex-grow: 1"></div> <div style="flex-grow: 1"></div>
<div> <div>

View File

@@ -1,22 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import useArchiveStore from "@/stores/archive";
import updater from "@/utils/updater";
import {IonButton, IonCard, IonCardContent, IonCardHeader, IonCardSubtitle, IonCardTitle} from "@ionic/vue"; import {IonButton, IonCard, IonCardContent, IonCardHeader, IonCardSubtitle, IonCardTitle} from "@ionic/vue";
import { onBeforeMount, ref } from "vue";
const emit = defineEmits<{(e:"back"):void}>(); const emit = defineEmits<{(e:"back"):void}>();
const archive = useArchiveStore();
const version = ref<string>("");
const back = () => { const back = () => {
emit("back"); emit("back");
} }
onBeforeMount(async () => {
version.value = await updater.obj.getBoardVersion();
});
</script> </script>
<template> <template>
@@ -25,7 +15,7 @@ onBeforeMount(async () => {
<div class="header-column"> <div class="header-column">
<ion-card-title>FLASH</ion-card-title> <ion-card-title>FLASH</ion-card-title>
<ion-card-title>Board</ion-card-title> <ion-card-title>Board</ion-card-title>
<ion-card-subtitle>{{ version }}</ion-card-subtitle> <ion-card-subtitle>v1.1.1</ion-card-subtitle>
</div> </div>
<!-- <div style="flex-grow: 1"></div>--> <!-- <div style="flex-grow: 1"></div>-->
<!-- <div>--> <!-- <div>-->
@@ -34,7 +24,7 @@ onBeforeMount(async () => {
</ion-card-header> </ion-card-header>
<ion-card-content> <ion-card-content>
<p>{{ version }} -> {{ archive.getArchive[archive.getShownI].title }}</p> <br> <p>v1.1.1 -> v1.1.2</p> <br>
<ion-button>Flash</ion-button> <ion-button>Flash</ion-button>
<ion-button @click="back">Cancel</ion-button> <ion-button @click="back">Cancel</ion-button>

View File

@@ -4,7 +4,7 @@
<div class="header-column"> <div class="header-column">
<ion-card-title>HOME</ion-card-title> <ion-card-title>HOME</ion-card-title>
<ion-card-title>Board</ion-card-title> <ion-card-title>Board</ion-card-title>
<ion-card-subtitle>{{ version }}</ion-card-subtitle> <ion-card-subtitle>v1.1.1</ion-card-subtitle>
</div> </div>
<div style="flex-grow: 1"></div> <div style="flex-grow: 1"></div>
<div> <div>
@@ -13,33 +13,24 @@
</ion-card-header> </ion-card-header>
<ion-card-content> <ion-card-content>
<ion-button @click="update" v-if="showUpdater">Update</ion-button> <ion-button @click="update">Update</ion-button>
<br> <br>
<ion-button @click="openArchive">View older versions</ion-button> <ion-button @click="archive">View older versions</ion-button>
<br> <br>
<ion-button @click="settings">Settings</ion-button> <ion-button @click="settings">Settings</ion-button>
</ion-card-content> </ion-card-content>
</ion-card> </ion-card>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import useArchiveStore from "@/stores/archive";
import updater from "@/utils/updater";
import {IonButton, IonCard, IonCardContent, IonCardHeader, IonCardSubtitle, IonCardTitle} from "@ionic/vue"; import {IonButton, IonCard, IonCardContent, IonCardHeader, IonCardSubtitle, IonCardTitle} from "@ionic/vue";
import { onBeforeMount, ref } from "vue";
const emit = defineEmits<{(e: 'update'): void, (e: 'archive'): void, (e: "disconnect"): void, (e: "settings"): void}>(); const emit = defineEmits<{(e: 'update'): void, (e: 'archive'): void, (e: "disconnect"): void, (e: "settings"): void}>();
const archive = useArchiveStore();
const showUpdater = ref<boolean>(false);
const version = ref<string>("");
const update = () => { const update = () => {
archive.setShownI(0);
emit("update"); emit("update");
}; };
const openArchive = () => { const archive = () => {
emit("archive"); emit("archive");
}; };
@@ -51,10 +42,6 @@ const settings = () => {
emit("settings") emit("settings")
} }
onBeforeMount(async () => {
version.value = await updater.obj.getBoardVersion();
showUpdater.value = await updater.obj.checkForUpdate();
});
</script> </script>
<style scoped> <style scoped>

View File

@@ -1,57 +1,13 @@
/// <reference types="cordova-plugin-ble-central" />
<script setup lang="ts"> <script setup lang="ts">
import useBluetoothStore from '@/stores/bluetooth'; import {IonCard, IonCardContent, IonCardHeader, IonCardSubtitle, IonCardTitle, IonButton, IonIcon, IonNote, IonLabel, IonItem, IonList
import {
IonCard, IonCardContent, IonCardHeader, IonCardSubtitle, IonCardTitle, IonButton, IonIcon, IonNote, IonLabel, IonItem, IonList
} from '@ionic/vue'; } from '@ionic/vue';
import { chevronForward } from 'ionicons/icons'; import { chevronForward } from 'ionicons/icons';
import { onBeforeMount, ref, watch } from 'vue';
import updater from '@/utils/updater';
const emit = defineEmits<{ (e: "connect"): void }>(); const emit = defineEmits<{(e: "connect"):void}>();
const bleStore = useBluetoothStore();
const devices = ref<BLECentralPlugin.PeripheralData[]>([]); const connect = () => {
emit("connect");
const connect = (device: BLECentralPlugin.PeripheralData) => {
ble.connect(device.id,
(data: BLECentralPlugin.PeripheralDataExtended) => {
console.log(`Connected: ${data}`);
updater.obj.setDeviceId(device.id);
updater.device = device.id;
emit("connect");
},
(error: string | BLECentralPlugin.BLEError) => {
console.error(`Connection error: ${error}`);
}
);
} }
const scan = () => {
bleStore.scan();
}
onBeforeMount(async () => {
ble.enable(
() => {
console.log("BLE enalbed")
},
() => {
console.log("BLE not enalbed")
}
);
ble.isEnabled(
() => {
console.log("BLE enabled.");
},
() => {
console.log("BLE connect error.");
})
});
watch(() => bleStore.devices, (newValue) => {devices.value = newValue}, {immediate: true});
</script> </script>
<template> <template>
@@ -64,28 +20,29 @@ watch(() => bleStore.devices, (newValue) => {devices.value = newValue}, {immedia
</div> </div>
<div style="flex-grow: 1"></div> <div style="flex-grow: 1"></div>
<div> <div>
<ion-button @click="scan">Scan</ion-button> <ion-button>Scan</ion-button>
</div> </div>
</ion-card-header> </ion-card-header>
<ion-card-content class="item-scroll"> <ion-card-content class="item-scroll">
<ion-list lines="full" :inset="true"> <ion-list lines="full" :inset="true">
<ion-item button v-for="(device, index) in devices" :key="index" @click="connect(device)"> <ion-item button v-for="i in 10" :key="i" @click="connect">
<ion-label> <ion-label>
<strong>Device: {{ device.name }}</strong> <br> <strong>Device {{i}}</strong> <br>
<ion-note>{{ device.id }}</ion-note> <ion-note>EA-EA-EA-EA-EA</ion-note>
</ion-label> </ion-label>
<div slot="end" class="metadata-end-wrapper"> <div slot="end" class="metadata-end-wrapper">
<ion-note>{{ device.rssi }} dB</ion-note> <ion-note>{{(i*Math.random()).toFixed(2)}}dB</ion-note>
<ion-icon color="medium" :icon="chevronForward"></ion-icon> <ion-icon color="medium" :icon="chevronForward"></ion-icon>
</div> </div>
</ion-item> </ion-item>
</ion-list> </ion-list>
</ion-card-content> </ion-card-content>
</ion-card> </ion-card>
</template> </template>
<style scoped> <style scoped>
.two-column { .two-column {
display: flex; display: flex;
flex-direction: row; flex-direction: row;

View File

@@ -1,17 +1,17 @@
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import Updater from "updaterweblibrary";
import type { versionNotes } from "@/utils/types"; import type { versionNotes } from "@/utils/types";
import updater from "@/utils/updater";
const useArchiveStore = defineStore("archive", { const useArchiveStore = defineStore("archive", {
state: () => ( state: () => (
{ archive: <versionNotes[]>[], shownI: 0} {updater: new Updater(), archive: <versionNotes[]>[], shownI: 0}
), ),
getters: { getters: {
getUrl(): string { getUrl(): string {
if (updater.obj.archiveURL == "/") if (this.updater.archiveURL == "/")
return "" return ""
else else
return updater.obj.archiveURL; return this.updater.archiveURL;
}, },
getArchive(): versionNotes[] { getArchive(): versionNotes[] {
console.log(this.archive) console.log(this.archive)
@@ -23,10 +23,8 @@ const useArchiveStore = defineStore("archive", {
}, },
actions: { actions: {
async setUrl(value: string): Promise<void> { async setUrl(value: string): Promise<void> {
// updater.obj = new Updater(value, "atom"); this.updater = new Updater(value, "atom");
updater.obj.archiveURL = value; this.archive = await this.updater.getArchive()
updater.obj.feedType = "atom";
this.archive = await updater.obj.getArchive()
}, },
setShownI(value: number): void { setShownI(value: number): void {
this.shownI = value; this.shownI = value;

View File

@@ -1,25 +0,0 @@
/// <reference types="cordova-plugin-ble-central" />
import { defineStore } from "pinia";
import updater from "@/utils/updater";
const useBluetoothStore = defineStore('bluetooth', {
state: () => (
{ devices: <BLECentralPlugin.PeripheralData[]>[], device: <BLECentralPlugin.PeripheralData>{}}
),
actions: {
scan(): void {
this.devices = [];
ble.scan([], 5, (device: BLECentralPlugin.PeripheralData) => {
console.log(device);
this.devices.push(device);
}, (e) => {
console.log(e)
})
},
connect(): void {
}
}
});
export default useBluetoothStore;

View File

@@ -1,5 +0,0 @@
import Updater from "updaterweblibrary";
const updater = {obj: new Updater(), device: ""}
export default updater;

View File

@@ -13,12 +13,12 @@
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<home-card v-if="shownCard == 1" @archive="showArchive" @disconnect="disconnect" @update="showDetails" @settings="showSettings"></home-card> <home-card v-if="shownCard == 1" @archive="showArchive" @disconnect="showScan" @update="showDetails" @settings="showSettings"></home-card>
<scan-card v-else-if="shownCard == 0" @connect="goHome"></scan-card> <scan-card v-else-if="shownCard == 0" @connect="goHome"></scan-card>
<details-card v-else-if="shownCard == 2" @back="goBack" @choose="showFlash" @disconnect="disconnect"></details-card> <details-card v-else-if="shownCard == 2" @back="goBack" @choose="showFlash"></details-card>
<archive-card v-else-if="shownCard == 3" @back="goBack" @details="showDetails" @disconnect="disconnect"></archive-card> <archive-card v-else-if="shownCard == 3" @back="goBack" @details="showDetails"></archive-card>
<flash-card v-else-if="shownCard == 4" @back="goBack"></flash-card> <flash-card v-else-if="shownCard == 4" @back="goBack"></flash-card>
<settings-card v-else-if="shownCard == 5" @back="goBack" @disconnect="disconnect"></settings-card> <settings-card v-else-if="shownCard == 5" @back="goBack"></settings-card>
</ion-content> </ion-content>
</ion-page> </ion-page>
</template> </template>
@@ -32,7 +32,6 @@ import ArchiveCard from "@/components/ArchiveCard.vue";
import FlashCard from "@/components/FlashCard.vue"; import FlashCard from "@/components/FlashCard.vue";
import {ref} from "vue"; import {ref} from "vue";
import SettingsCard from "@/components/SettingsCard.vue"; import SettingsCard from "@/components/SettingsCard.vue";
import updater from '@/utils/updater';
let prevCard = 0; let prevCard = 0;
const shownCard = ref<number>(0); const shownCard = ref<number>(0);
@@ -71,20 +70,6 @@ const showSettings = () => {
prevCard = shownCard.value; prevCard = shownCard.value;
shownCard.value = 5; shownCard.value = 5;
} }
function disconnect() {
ble.disconnect(
updater.device,
() => {
console.log("Disconnected.");
showScan();
},
(failure) => {
console.error(failure);
}
);
}
</script> </script>
<style scoped> <style scoped>