Compare commits
3 Commits
archive
...
6f081d3054
| Author | SHA1 | Date | |
|---|---|---|---|
|
6f081d3054
|
|||
|
60c207ffc5
|
|||
| e81f4b9d64 |
@@ -13,7 +13,7 @@ dependencies {
|
||||
implementation project(':capacitor-haptics')
|
||||
implementation project(':capacitor-keyboard')
|
||||
implementation project(':capacitor-status-bar')
|
||||
|
||||
implementation "androidx.annotation:annotation:*"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
android:theme="@style/AppTheme"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
>
|
||||
|
||||
<activity
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation"
|
||||
|
||||
9
android/app/src/main/res/xml/network_security_config.xml
Normal file
9
android/app/src/main/res/xml/network_security_config.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<network-security-config>
|
||||
<!-- Allow clear‑text 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>
|
||||
@@ -3,7 +3,21 @@ import type { CapacitorConfig } from '@capacitor/cli';
|
||||
const config: CapacitorConfig = {
|
||||
appId: 'io.ionic.starter',
|
||||
appName: 'UpdaterApp',
|
||||
webDir: 'dist'
|
||||
webDir: 'dist',
|
||||
cordova: {
|
||||
preferences: {
|
||||
bluetooth_restore_state: "true",
|
||||
accessBackgroundLocation: "true",
|
||||
},
|
||||
},
|
||||
"server": {
|
||||
"androidScheme": "http",
|
||||
},
|
||||
// plugins: {
|
||||
// CapacitorHttp: {
|
||||
// enabled: true,
|
||||
// },
|
||||
// },
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
||||
100
package-lock.json
generated
100
package-lock.json
generated
@@ -16,9 +16,10 @@
|
||||
"@capacitor/status-bar": "7.0.3",
|
||||
"@ionic/vue": "^8.0.0",
|
||||
"@ionic/vue-router": "^8.0.0",
|
||||
"cordova-plugin-ble-central": "^2.0.0",
|
||||
"ionicons": "^7.0.0",
|
||||
"pinia": "^3.0.3",
|
||||
"updaterweblibrary": "^1.0.4",
|
||||
"updaterweblibrary": "1.0.11",
|
||||
"vue": "^3.3.0",
|
||||
"vue-router": "^4.2.0"
|
||||
},
|
||||
@@ -3628,21 +3629,21 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/devtools-api": {
|
||||
"version": "7.7.8",
|
||||
"resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-7.7.8.tgz",
|
||||
"integrity": "sha512-BtFcAmDbtXGwurWUFf8ogIbgZyR+rcVES1TSNEI8Em80fD8Anu+qTRN1Fc3J6vdRHlVM3fzPV1qIo+B4AiqGzw==",
|
||||
"version": "7.7.9",
|
||||
"resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-7.7.9.tgz",
|
||||
"integrity": "sha512-kIE8wvwlcZ6TJTbNeU2HQNtaxLx3a84aotTITUuL/4bzfPxzajGBOoqjMhwZJ8L9qFYDU/lAYMEEm11dnZOD6g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vue/devtools-kit": "^7.7.8"
|
||||
"@vue/devtools-kit": "^7.7.9"
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/devtools-kit": {
|
||||
"version": "7.7.8",
|
||||
"resolved": "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.7.8.tgz",
|
||||
"integrity": "sha512-4Y8op+AoxOJhB9fpcEF6d5vcJXWKgHxC3B0ytUB8zz15KbP9g9WgVzral05xluxi2fOeAy6t140rdQ943GcLRQ==",
|
||||
"version": "7.7.9",
|
||||
"resolved": "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.7.9.tgz",
|
||||
"integrity": "sha512-PyQ6odHSgiDVd4hnTP+aDk2X4gl2HmLDfiyEnn3/oV+ckFDuswRs4IbBT7vacMuGdwY/XemxBoh302ctbsptuA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vue/devtools-shared": "^7.7.8",
|
||||
"@vue/devtools-shared": "^7.7.9",
|
||||
"birpc": "^2.3.0",
|
||||
"hookable": "^5.5.3",
|
||||
"mitt": "^3.0.1",
|
||||
@@ -3652,9 +3653,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@vue/devtools-shared": {
|
||||
"version": "7.7.8",
|
||||
"resolved": "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.7.8.tgz",
|
||||
"integrity": "sha512-XHpO3jC5nOgYr40M9p8Z4mmKfTvUxKyRcUnpBAYg11pE78eaRFBKb0kG5yKLroMuJeeNH9LWmKp2zMU5LUc7CA==",
|
||||
"version": "7.7.9",
|
||||
"resolved": "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.7.9.tgz",
|
||||
"integrity": "sha512-iWAb0v2WYf0QWmxCGy0seZNDPdO3Sp5+u78ORnyeonS6MT4PC7VPrryX2BpMJrwlDeaZ6BD4vP4XKjK0SZqaeA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"rfdc": "^1.4.1"
|
||||
@@ -4152,9 +4153,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/baseline-browser-mapping": {
|
||||
"version": "2.8.27",
|
||||
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.27.tgz",
|
||||
"integrity": "sha512-2CXFpkjVnY2FT+B6GrSYxzYf65BJWEqz5tIRHCvNsZZ2F3CmsCB37h8SpYgKG7y9C4YAeTipIPWG7EmFmhAeXA==",
|
||||
"version": "2.8.29",
|
||||
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.29.tgz",
|
||||
"integrity": "sha512-sXdt2elaVnhpDNRDz+1BDx1JQoJRuNk7oVlAlbGiFkLikHCAQiccexF/9e91zVi6RCgqspl04aP+6Cnl9zRLrA==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
@@ -4405,9 +4406,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/caniuse-lite": {
|
||||
"version": "1.0.30001754",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001754.tgz",
|
||||
"integrity": "sha512-x6OeBXueoAceOmotzx3PO4Zpt4rzpeIFsSr6AAePTZxSkXiYDUmpypEl7e2+8NCd9bD7bXjqyef8CJYPC1jfxg==",
|
||||
"version": "1.0.30001755",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001755.tgz",
|
||||
"integrity": "sha512-44V+Jm6ctPj7R52Na4TLi3Zri4dWUljJd+RDm+j8LtNCc/ihLCT+X1TzoOAkRETEWqjuLnh9581Tl80FvK7jVA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
@@ -4715,10 +4716,16 @@
|
||||
"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": {
|
||||
"version": "3.46.0",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.46.0.tgz",
|
||||
"integrity": "sha512-vDMm9B0xnqqZ8uSBpZ8sNtRtOdmfShrvT6h2TuQGLs0Is+cR0DYbj/KWP6ALVNbWPpqA/qPLoOuppJN07humpA==",
|
||||
"version": "3.47.0",
|
||||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.47.0.tgz",
|
||||
"integrity": "sha512-c3Q2VVkGAUyupsjRnaNX6u8Dq2vAdzm9iuPj5FW0fRxzlxgq9Q39MDq10IvmQSpLgHQNyQzQmOo6bgGHmH3NNg==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
@@ -4728,13 +4735,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/core-js-compat": {
|
||||
"version": "3.46.0",
|
||||
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.46.0.tgz",
|
||||
"integrity": "sha512-p9hObIIEENxSV8xIu+V68JjSeARg6UVMG5mR+JEUguG3sI6MsiS1njz2jHmyJDvA+8jX/sytkBHup6kxhM9law==",
|
||||
"version": "3.47.0",
|
||||
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.47.0.tgz",
|
||||
"integrity": "sha512-IGfuznZ/n7Kp9+nypamBhvwdwLsW6KC8IOaURw2doAK5e98AG3acVLdh0woOnEqCfUtS+Vu882JE4k/DAm3ItQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"browserslist": "^4.26.3"
|
||||
"browserslist": "^4.28.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
@@ -4790,9 +4797,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/csstype": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
|
||||
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
|
||||
"version": "3.2.3",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
|
||||
"integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/cypress": {
|
||||
@@ -5116,9 +5123,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/electron-to-chromium": {
|
||||
"version": "1.5.250",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.250.tgz",
|
||||
"integrity": "sha512-/5UMj9IiGDMOFBnN4i7/Ry5onJrAGSbOGo3s9FEKmwobGq6xw832ccET0CE3CkkMBZ8GJSlUIesZofpyurqDXw==",
|
||||
"version": "1.5.255",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.255.tgz",
|
||||
"integrity": "sha512-Z9oIp4HrFF/cZkDPMpz2XSuVpc1THDpT4dlmATFlJUIBVCy9Vap5/rIXsASP1CscBacBqhabwh8vLctqBwEerQ==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
@@ -5855,9 +5862,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/form-data": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz",
|
||||
"integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==",
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz",
|
||||
"integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -6047,9 +6054,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/glob": {
|
||||
"version": "10.4.5",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",
|
||||
"integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==",
|
||||
"version": "10.5.0",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz",
|
||||
"integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
@@ -8149,15 +8156,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/rimraf/node_modules/glob": {
|
||||
"version": "11.0.3",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-11.0.3.tgz",
|
||||
"integrity": "sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==",
|
||||
"version": "11.1.0",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-11.1.0.tgz",
|
||||
"integrity": "sha512-vuNwKSaKiqm7g0THUBu2x7ckSs3XJLXE+2ssL7/MfTGPLLcrJQ/4Uq1CjPTtO5cCIiRxqvN6Twy1qOwhL0Xjcw==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"license": "BlueOak-1.0.0",
|
||||
"dependencies": {
|
||||
"foreground-child": "^3.3.1",
|
||||
"jackspeak": "^4.1.1",
|
||||
"minimatch": "^10.0.3",
|
||||
"minimatch": "^10.1.1",
|
||||
"minipass": "^7.1.2",
|
||||
"package-json-from-dist": "^1.0.0",
|
||||
"path-scurry": "^2.0.0"
|
||||
@@ -9283,12 +9290,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/updaterweblibrary": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/updaterweblibrary/-/updaterweblibrary-1.0.9.tgz",
|
||||
"integrity": "sha512-c4uMy+0jhkSu3mIsjVb0qkuMJEjziPzvlHGeZQzNOMCvg4POWH3gtSbYTC6OBmb6w9Cg1ucYynFrXzwbIcnXqg==",
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/updaterweblibrary/-/updaterweblibrary-1.0.11.tgz",
|
||||
"integrity": "sha512-iQggd1YW/LMzw912Dg5M3tEk5jA8WSp4LA8o7grco2eC3mUnx8ThoS5pWG0lKqgmBIxhZLsIIldv+bSB75f7Qw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@rgrove/parse-xml": "^4.2.0"
|
||||
"@rgrove/parse-xml": "^4.2.0",
|
||||
"cordova-plugin-ble-central": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/uri-js": {
|
||||
|
||||
@@ -21,9 +21,10 @@
|
||||
"@capacitor/status-bar": "7.0.3",
|
||||
"@ionic/vue": "^8.0.0",
|
||||
"@ionic/vue-router": "^8.0.0",
|
||||
"cordova-plugin-ble-central": "^2.0.0",
|
||||
"ionicons": "^7.0.0",
|
||||
"pinia": "^3.0.3",
|
||||
"updaterweblibrary": "^1.0.4",
|
||||
"updaterweblibrary": "1.0.11",
|
||||
"vue": "^3.3.0",
|
||||
"vue-router": "^4.2.0"
|
||||
},
|
||||
|
||||
@@ -6,4 +6,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { IonApp, IonRouterOutlet } from '@ionic/vue';
|
||||
import updater from './utils/updater';
|
||||
|
||||
updater.obj.bleObject = ble;
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import useArchiveStore from "@/stores/archive";
|
||||
import { versionNotes } from "@/utils/types";
|
||||
import updater from "@/utils/updater";
|
||||
import {
|
||||
IonButton,
|
||||
IonCard,
|
||||
@@ -14,11 +15,12 @@ IonLabel, IonItem,
|
||||
IonList
|
||||
} from "@ionic/vue";
|
||||
import {chevronForward} from "ionicons/icons";
|
||||
import { ref, watch } from "vue";
|
||||
import { onBeforeMount, ref, watch } from "vue";
|
||||
|
||||
const archive = useArchiveStore();
|
||||
const emit = defineEmits<{(e: "back"): void, (e: "disconnect"): void, (e: "details"):void}>();
|
||||
const versions = ref<versionNotes[]>([]);
|
||||
const version = ref<string>("");
|
||||
|
||||
const back = () => {
|
||||
emit("back");
|
||||
@@ -35,6 +37,9 @@ const details = (index: number) => {
|
||||
|
||||
watch(() => archive.getArchive, (newValue) => versions.value = newValue, {immediate: true});
|
||||
|
||||
onBeforeMount(async () => {
|
||||
version.value = await updater.obj.getBoardVersion();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -43,7 +48,7 @@ watch(() => archive.getArchive, (newValue) => versions.value = newValue, {immedi
|
||||
<div class="header-column">
|
||||
<ion-card-title>ARCHIVE</ion-card-title>
|
||||
<ion-card-title>Board</ion-card-title>
|
||||
<ion-card-subtitle>v1.1.1</ion-card-subtitle>
|
||||
<ion-card-subtitle>{{ version }}</ion-card-subtitle>
|
||||
</div>
|
||||
<div style="flex-grow: 1"></div>
|
||||
<div>
|
||||
|
||||
@@ -9,11 +9,13 @@ import {
|
||||
IonCardTitle,
|
||||
} from "@ionic/vue";
|
||||
import { versionNotes } from "@/utils/types";
|
||||
import { ref } from "vue";
|
||||
import { onBeforeMount, ref } from "vue";
|
||||
import updater from "@/utils/updater";
|
||||
|
||||
const archive = useArchiveStore();
|
||||
const emit = defineEmits<{(e:"back"):void, (e: "disconnect"): void, (e:"choose"): void}>();
|
||||
const record = ref<versionNotes>(archive.getArchive[archive.getShownI]);
|
||||
const version = ref<string>("");
|
||||
|
||||
const back = () => {
|
||||
emit("back");
|
||||
@@ -27,7 +29,12 @@ const choose = () => {
|
||||
emit("choose");
|
||||
};
|
||||
|
||||
console.log(archive.getArchive)
|
||||
// TODO: remove
|
||||
// console.log(archive.getArchive)
|
||||
|
||||
onBeforeMount(async () => {
|
||||
version.value = await updater.obj.getBoardVersion();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -36,7 +43,7 @@ console.log(archive.getArchive)
|
||||
<div>
|
||||
<ion-card-title>DETAILS</ion-card-title>
|
||||
<ion-card-title>Board</ion-card-title>
|
||||
<ion-card-subtitle>v1.1.1</ion-card-subtitle>
|
||||
<ion-card-subtitle>{{ version }}</ion-card-subtitle>
|
||||
</div>
|
||||
<div style="flex-grow: 1"></div>
|
||||
<div>
|
||||
|
||||
@@ -1,12 +1,22 @@
|
||||
<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 { onBeforeMount, ref } from "vue";
|
||||
|
||||
const emit = defineEmits<{(e:"back"):void}>();
|
||||
const archive = useArchiveStore();
|
||||
|
||||
const version = ref<string>("");
|
||||
|
||||
const back = () => {
|
||||
emit("back");
|
||||
}
|
||||
|
||||
onBeforeMount(async () => {
|
||||
version.value = await updater.obj.getBoardVersion();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -15,7 +25,7 @@ const back = () => {
|
||||
<div class="header-column">
|
||||
<ion-card-title>FLASH</ion-card-title>
|
||||
<ion-card-title>Board</ion-card-title>
|
||||
<ion-card-subtitle>v1.1.1</ion-card-subtitle>
|
||||
<ion-card-subtitle>{{ version }}</ion-card-subtitle>
|
||||
</div>
|
||||
<!-- <div style="flex-grow: 1"></div>-->
|
||||
<!-- <div>-->
|
||||
@@ -24,7 +34,7 @@ const back = () => {
|
||||
</ion-card-header>
|
||||
|
||||
<ion-card-content>
|
||||
<p>v1.1.1 -> v1.1.2</p> <br>
|
||||
<p>{{ version }} -> {{ archive.getArchive[archive.getShownI].title }}</p> <br>
|
||||
<ion-button>Flash</ion-button>
|
||||
|
||||
<ion-button @click="back">Cancel</ion-button>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="header-column">
|
||||
<ion-card-title>HOME</ion-card-title>
|
||||
<ion-card-title>Board</ion-card-title>
|
||||
<ion-card-subtitle>v1.1.1</ion-card-subtitle>
|
||||
<ion-card-subtitle>{{ version }}</ion-card-subtitle>
|
||||
</div>
|
||||
<div style="flex-grow: 1"></div>
|
||||
<div>
|
||||
@@ -13,24 +13,33 @@
|
||||
</ion-card-header>
|
||||
|
||||
<ion-card-content>
|
||||
<ion-button @click="update">Update</ion-button>
|
||||
<ion-button @click="update" v-if="showUpdater">Update</ion-button>
|
||||
<br>
|
||||
<ion-button @click="archive">View older versions</ion-button>
|
||||
<ion-button @click="openArchive">View older versions</ion-button>
|
||||
<br>
|
||||
<ion-button @click="settings">Settings</ion-button>
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
</template>
|
||||
<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 { onBeforeMount, ref } from "vue";
|
||||
|
||||
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 = () => {
|
||||
archive.setShownI(0);
|
||||
emit("update");
|
||||
};
|
||||
|
||||
const archive = () => {
|
||||
const openArchive = () => {
|
||||
emit("archive");
|
||||
};
|
||||
|
||||
@@ -42,6 +51,10 @@ const settings = () => {
|
||||
emit("settings")
|
||||
}
|
||||
|
||||
onBeforeMount(async () => {
|
||||
version.value = await updater.obj.getBoardVersion();
|
||||
showUpdater.value = await updater.obj.checkForUpdate();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -1,13 +1,57 @@
|
||||
/// <reference types="cordova-plugin-ble-central" />
|
||||
<script setup lang="ts">
|
||||
import {IonCard, IonCardContent, IonCardHeader, IonCardSubtitle, IonCardTitle, IonButton, IonIcon, IonNote, IonLabel, IonItem, IonList
|
||||
import useBluetoothStore from '@/stores/bluetooth';
|
||||
import {
|
||||
IonCard, IonCardContent, IonCardHeader, IonCardSubtitle, IonCardTitle, IonButton, IonIcon, IonNote, IonLabel, IonItem, IonList
|
||||
} from '@ionic/vue';
|
||||
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 connect = () => {
|
||||
emit("connect");
|
||||
const devices = ref<BLECentralPlugin.PeripheralData[]>([]);
|
||||
|
||||
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>
|
||||
|
||||
<template>
|
||||
@@ -20,29 +64,28 @@ const connect = () => {
|
||||
</div>
|
||||
<div style="flex-grow: 1"></div>
|
||||
<div>
|
||||
<ion-button>Scan</ion-button>
|
||||
<ion-button @click="scan">Scan</ion-button>
|
||||
</div>
|
||||
</ion-card-header>
|
||||
|
||||
<ion-card-content class="item-scroll">
|
||||
<ion-list lines="full" :inset="true">
|
||||
<ion-item button v-for="i in 10" :key="i" @click="connect">
|
||||
<ion-label>
|
||||
<strong>Device {{i}}</strong> <br>
|
||||
<ion-note>EA-EA-EA-EA-EA</ion-note>
|
||||
</ion-label>
|
||||
<div slot="end" class="metadata-end-wrapper">
|
||||
<ion-note>{{(i*Math.random()).toFixed(2)}}dB</ion-note>
|
||||
<ion-icon color="medium" :icon="chevronForward"></ion-icon>
|
||||
</div>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
<ion-list lines="full" :inset="true">
|
||||
<ion-item button v-for="(device, index) in devices" :key="index" @click="connect(device)">
|
||||
<ion-label>
|
||||
<strong>Device: {{ device.name }}</strong> <br>
|
||||
<ion-note>{{ device.id }}</ion-note>
|
||||
</ion-label>
|
||||
<div slot="end" class="metadata-end-wrapper">
|
||||
<ion-note>{{ device.rssi }} dB</ion-note>
|
||||
<ion-icon color="medium" :icon="chevronForward"></ion-icon>
|
||||
</div>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.two-column {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { defineStore } from "pinia";
|
||||
import Updater from "updaterweblibrary";
|
||||
import type { versionNotes } from "@/utils/types";
|
||||
import updater from "@/utils/updater";
|
||||
|
||||
const useArchiveStore = defineStore("archive", {
|
||||
state: () => (
|
||||
{updater: new Updater(), archive: <versionNotes[]>[], shownI: 0}
|
||||
{ archive: <versionNotes[]>[], shownI: 0}
|
||||
),
|
||||
getters: {
|
||||
getUrl(): string {
|
||||
if (this.updater.archiveURL == "/")
|
||||
if (updater.obj.archiveURL == "/")
|
||||
return ""
|
||||
else
|
||||
return this.updater.archiveURL;
|
||||
return updater.obj.archiveURL;
|
||||
},
|
||||
getArchive(): versionNotes[] {
|
||||
console.log(this.archive)
|
||||
@@ -23,8 +23,10 @@ const useArchiveStore = defineStore("archive", {
|
||||
},
|
||||
actions: {
|
||||
async setUrl(value: string): Promise<void> {
|
||||
this.updater = new Updater(value, "atom");
|
||||
this.archive = await this.updater.getArchive()
|
||||
// updater.obj = new Updater(value, "atom");
|
||||
updater.obj.archiveURL = value;
|
||||
updater.obj.feedType = "atom";
|
||||
this.archive = await updater.obj.getArchive()
|
||||
},
|
||||
setShownI(value: number): void {
|
||||
this.shownI = value;
|
||||
|
||||
25
src/stores/bluetooth.ts
Normal file
25
src/stores/bluetooth.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/// <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;
|
||||
5
src/utils/updater.ts
Normal file
5
src/utils/updater.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import Updater from "updaterweblibrary";
|
||||
|
||||
const updater = {obj: new Updater(), device: ""}
|
||||
|
||||
export default updater;
|
||||
@@ -13,12 +13,12 @@
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<home-card v-if="shownCard == 1" @archive="showArchive" @disconnect="showScan" @update="showDetails" @settings="showSettings"></home-card>
|
||||
<home-card v-if="shownCard == 1" @archive="showArchive" @disconnect="disconnect" @update="showDetails" @settings="showSettings"></home-card>
|
||||
<scan-card v-else-if="shownCard == 0" @connect="goHome"></scan-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"></archive-card>
|
||||
<details-card v-else-if="shownCard == 2" @back="goBack" @choose="showFlash" @disconnect="disconnect"></details-card>
|
||||
<archive-card v-else-if="shownCard == 3" @back="goBack" @details="showDetails" @disconnect="disconnect"></archive-card>
|
||||
<flash-card v-else-if="shownCard == 4" @back="goBack"></flash-card>
|
||||
<settings-card v-else-if="shownCard == 5" @back="goBack"></settings-card>
|
||||
<settings-card v-else-if="shownCard == 5" @back="goBack" @disconnect="disconnect"></settings-card>
|
||||
</ion-content>
|
||||
</ion-page>
|
||||
</template>
|
||||
@@ -32,6 +32,7 @@ import ArchiveCard from "@/components/ArchiveCard.vue";
|
||||
import FlashCard from "@/components/FlashCard.vue";
|
||||
import {ref} from "vue";
|
||||
import SettingsCard from "@/components/SettingsCard.vue";
|
||||
import updater from '@/utils/updater';
|
||||
|
||||
let prevCard = 0;
|
||||
const shownCard = ref<number>(0);
|
||||
@@ -70,6 +71,20 @@ const showSettings = () => {
|
||||
prevCard = shownCard.value;
|
||||
shownCard.value = 5;
|
||||
}
|
||||
|
||||
function disconnect() {
|
||||
ble.disconnect(
|
||||
updater.device,
|
||||
() => {
|
||||
console.log("Disconnected.");
|
||||
showScan();
|
||||
},
|
||||
(failure) => {
|
||||
console.error(failure);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user