Compare commits

..

1 Commits

Author SHA1 Message Date
edc58c3269 update 2025-11-12 21:28:41 +00:00
16 changed files with 183 additions and 363 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;

260
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.13", "updaterweblibrary": "^1.0.4",
"vue": "^3.3.0", "vue": "^3.3.0",
"vue-router": "^4.2.0" "vue-router": "^4.2.0"
}, },
@@ -2307,9 +2306,9 @@
} }
}, },
"node_modules/@ionic/core": { "node_modules/@ionic/core": {
"version": "8.7.11", "version": "8.7.9",
"resolved": "https://registry.npmjs.org/@ionic/core/-/core-8.7.11.tgz", "resolved": "https://registry.npmjs.org/@ionic/core/-/core-8.7.9.tgz",
"integrity": "sha512-9UX9IeEztWWXymi+xCUMEBnnY+TbaR8crZLOwFnxPUEq4FFWSUCSv5XeHHQBpgZjBO2MJuDGcNv0GCQumIjVcQ==", "integrity": "sha512-6cYp3LHjCGX32MiYR09l/O+8klkJ27WpKzllvnLRe5bxX3nOuqJvJJIshzT85qTdZNTFu7zJJrjWkgEOXGarzg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@stencil/core": "4.38.0", "@stencil/core": "4.38.0",
@@ -2460,23 +2459,23 @@
} }
}, },
"node_modules/@ionic/vue": { "node_modules/@ionic/vue": {
"version": "8.7.11", "version": "8.7.9",
"resolved": "https://registry.npmjs.org/@ionic/vue/-/vue-8.7.11.tgz", "resolved": "https://registry.npmjs.org/@ionic/vue/-/vue-8.7.9.tgz",
"integrity": "sha512-HDEcjhxWfimVQxvXfghrqlAWpXnJvcUDTIVE2Mvq8ul+s7gL/OZCpXTAODJOfFCBAGJ0o9QXyC7OPjyN4UbO8Q==", "integrity": "sha512-chpnclhnL8dC+Wi2/Fd/muI4FPzTqyVvFgIKfMDaz00tF8xmhHI9AXwaRvtt7AJh8CWGAw1QCp/FMboFSQ7D7A==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@ionic/core": "8.7.11", "@ionic/core": "8.7.9",
"@stencil/vue-output-target": "0.10.7", "@stencil/vue-output-target": "0.10.7",
"ionicons": "^8.0.13" "ionicons": "^8.0.13"
} }
}, },
"node_modules/@ionic/vue-router": { "node_modules/@ionic/vue-router": {
"version": "8.7.11", "version": "8.7.9",
"resolved": "https://registry.npmjs.org/@ionic/vue-router/-/vue-router-8.7.11.tgz", "resolved": "https://registry.npmjs.org/@ionic/vue-router/-/vue-router-8.7.9.tgz",
"integrity": "sha512-6k/bWLORJucLIPYqcrXnSs3KEI69qaWo6V4bGAEOSkt9dISdTy65gafi4gtFFyV+n81LIU00WnajJYLadDG3Cg==", "integrity": "sha512-kVrYvOyh3rIdNdx8fpxz2vXloZKzbY7K9V9Lm4yw79NMgAN2X8uMIIuXYmQheiAed5j7wU0w1y8DV1BXNb4Rwg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@ionic/vue": "8.7.11" "@ionic/vue": "8.7.9"
} }
}, },
"node_modules/@ionic/vue/node_modules/ionicons": { "node_modules/@ionic/vue/node_modules/ionicons": {
@@ -3556,13 +3555,13 @@
} }
}, },
"node_modules/@vue/compiler-core": { "node_modules/@vue/compiler-core": {
"version": "3.5.25", "version": "3.5.24",
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.25.tgz", "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.24.tgz",
"integrity": "sha512-vay5/oQJdsNHmliWoZfHPoVZZRmnSWhug0BYT34njkYTPqClh3DNWLkZNJBVSjsNMrg0CCrBfoKkjZQPM/QVUw==", "integrity": "sha512-eDl5H57AOpNakGNAkFDH+y7kTqrQpJkZFXhWZQGyx/5Wh7B1uQYvcWkvZi11BDhscPgj8N7XV3oRwiPnx1Vrig==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/parser": "^7.28.5", "@babel/parser": "^7.28.5",
"@vue/shared": "3.5.25", "@vue/shared": "3.5.24",
"entities": "^4.5.0", "entities": "^4.5.0",
"estree-walker": "^2.0.2", "estree-walker": "^2.0.2",
"source-map-js": "^1.2.1" "source-map-js": "^1.2.1"
@@ -3581,26 +3580,26 @@
} }
}, },
"node_modules/@vue/compiler-dom": { "node_modules/@vue/compiler-dom": {
"version": "3.5.25", "version": "3.5.24",
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.25.tgz", "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.24.tgz",
"integrity": "sha512-4We0OAcMZsKgYoGlMjzYvaoErltdFI2/25wqanuTu+S4gismOTRTBPi4IASOjxWdzIwrYSjnqONfKvuqkXzE2Q==", "integrity": "sha512-1QHGAvs53gXkWdd3ZMGYuvQFXHW4ksKWPG8HP8/2BscrbZ0brw183q2oNWjMrSWImYLHxHrx1ItBQr50I/q2zw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@vue/compiler-core": "3.5.25", "@vue/compiler-core": "3.5.24",
"@vue/shared": "3.5.25" "@vue/shared": "3.5.24"
} }
}, },
"node_modules/@vue/compiler-sfc": { "node_modules/@vue/compiler-sfc": {
"version": "3.5.25", "version": "3.5.24",
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.25.tgz", "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.24.tgz",
"integrity": "sha512-PUgKp2rn8fFsI++lF2sO7gwO2d9Yj57Utr5yEsDf3GNaQcowCLKL7sf+LvVFvtJDXUp/03+dC6f2+LCv5aK1ag==", "integrity": "sha512-8EG5YPRgmTB+YxYBM3VXy8zHD9SWHUJLIGPhDovo3Z8VOgvP+O7UP5vl0J4BBPWYD9vxtBabzW1EuEZ+Cqs14g==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/parser": "^7.28.5", "@babel/parser": "^7.28.5",
"@vue/compiler-core": "3.5.25", "@vue/compiler-core": "3.5.24",
"@vue/compiler-dom": "3.5.25", "@vue/compiler-dom": "3.5.24",
"@vue/compiler-ssr": "3.5.25", "@vue/compiler-ssr": "3.5.24",
"@vue/shared": "3.5.25", "@vue/shared": "3.5.24",
"estree-walker": "^2.0.2", "estree-walker": "^2.0.2",
"magic-string": "^0.30.21", "magic-string": "^0.30.21",
"postcss": "^8.5.6", "postcss": "^8.5.6",
@@ -3608,13 +3607,13 @@
} }
}, },
"node_modules/@vue/compiler-ssr": { "node_modules/@vue/compiler-ssr": {
"version": "3.5.25", "version": "3.5.24",
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.25.tgz", "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.24.tgz",
"integrity": "sha512-ritPSKLBcParnsKYi+GNtbdbrIE1mtuFEJ4U1sWeuOMlIziK5GtOL85t5RhsNy4uWIXPgk+OUdpnXiTdzn8o3A==", "integrity": "sha512-trOvMWNBMQ/odMRHW7Ae1CdfYx+7MuiQu62Jtu36gMLXcaoqKvAyh+P73sYG9ll+6jLB6QPovqoKGGZROzkFFg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@vue/compiler-dom": "3.5.25", "@vue/compiler-dom": "3.5.24",
"@vue/shared": "3.5.25" "@vue/shared": "3.5.24"
} }
}, },
"node_modules/@vue/compiler-vue2": { "node_modules/@vue/compiler-vue2": {
@@ -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"
@@ -3712,53 +3711,53 @@
} }
}, },
"node_modules/@vue/reactivity": { "node_modules/@vue/reactivity": {
"version": "3.5.25", "version": "3.5.24",
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.25.tgz", "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.24.tgz",
"integrity": "sha512-5xfAypCQepv4Jog1U4zn8cZIcbKKFka3AgWHEFQeK65OW+Ys4XybP6z2kKgws4YB43KGpqp5D/K3go2UPPunLA==", "integrity": "sha512-BM8kBhtlkkbnyl4q+HiF5R5BL0ycDPfihowulm02q3WYp2vxgPcJuZO866qa/0u3idbMntKEtVNuAUp5bw4teg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@vue/shared": "3.5.25" "@vue/shared": "3.5.24"
} }
}, },
"node_modules/@vue/runtime-core": { "node_modules/@vue/runtime-core": {
"version": "3.5.25", "version": "3.5.24",
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.25.tgz", "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.24.tgz",
"integrity": "sha512-Z751v203YWwYzy460bzsYQISDfPjHTl+6Zzwo/a3CsAf+0ccEjQ8c+0CdX1WsumRTHeywvyUFtW6KvNukT/smA==", "integrity": "sha512-RYP/byyKDgNIqfX/gNb2PB55dJmM97jc9wyF3jK7QUInYKypK2exmZMNwnjueWwGceEkP6NChd3D2ZVEp9undQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@vue/reactivity": "3.5.25", "@vue/reactivity": "3.5.24",
"@vue/shared": "3.5.25" "@vue/shared": "3.5.24"
} }
}, },
"node_modules/@vue/runtime-dom": { "node_modules/@vue/runtime-dom": {
"version": "3.5.25", "version": "3.5.24",
"resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.25.tgz", "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.24.tgz",
"integrity": "sha512-a4WrkYFbb19i9pjkz38zJBg8wa/rboNERq3+hRRb0dHiJh13c+6kAbgqCPfMaJ2gg4weWD3APZswASOfmKwamA==", "integrity": "sha512-Z8ANhr/i0XIluonHVjbUkjvn+CyrxbXRIxR7wn7+X7xlcb7dJsfITZbkVOeJZdP8VZwfrWRsWdShH6pngMxRjw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@vue/reactivity": "3.5.25", "@vue/reactivity": "3.5.24",
"@vue/runtime-core": "3.5.25", "@vue/runtime-core": "3.5.24",
"@vue/shared": "3.5.25", "@vue/shared": "3.5.24",
"csstype": "^3.1.3" "csstype": "^3.1.3"
} }
}, },
"node_modules/@vue/server-renderer": { "node_modules/@vue/server-renderer": {
"version": "3.5.25", "version": "3.5.24",
"resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.25.tgz", "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.24.tgz",
"integrity": "sha512-UJaXR54vMG61i8XNIzTSf2Q7MOqZHpp8+x3XLGtE3+fL+nQd+k7O5+X3D/uWrnQXOdMw5VPih+Uremcw+u1woQ==", "integrity": "sha512-Yh2j2Y4G/0/4z/xJ1Bad4mxaAk++C2v4kaa8oSYTMJBJ00/ndPuxCnWeot0/7/qafQFLh5pr6xeV6SdMcE/G1w==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@vue/compiler-ssr": "3.5.25", "@vue/compiler-ssr": "3.5.24",
"@vue/shared": "3.5.25" "@vue/shared": "3.5.24"
}, },
"peerDependencies": { "peerDependencies": {
"vue": "3.5.25" "vue": "3.5.24"
} }
}, },
"node_modules/@vue/shared": { "node_modules/@vue/shared": {
"version": "3.5.25", "version": "3.5.24",
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.25.tgz", "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.24.tgz",
"integrity": "sha512-AbOPdQQnAnzs58H2FrrDxYj/TJfmeS2jdfEEhgiKINy+bnOANmVizIEgq1r+C5zsbs6l1CCQxtcj71rwNQ4jWg==", "integrity": "sha512-9cwHL2EsJBdi8NY22pngYYWzkTDhld6fAD6jlaeloNGciNSJL6bLpbxVgXl96X00Jtc6YWQv96YA/0sxex/k1A==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/@vue/test-utils": { "node_modules/@vue/test-utils": {
@@ -4153,9 +4152,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/baseline-browser-mapping": { "node_modules/baseline-browser-mapping": {
"version": "2.8.31", "version": "2.8.27",
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.31.tgz", "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.27.tgz",
"integrity": "sha512-a28v2eWrrRWPpJSzxc+mKwm0ZtVx/G8SepdQZDArnXYU/XS+IF6mp8aB/4E+hH1tyGCoDo3KlUCdlSxGDsRkAw==", "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.30001757", "version": "1.0.30001754",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001757.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001754.tgz",
"integrity": "sha512-r0nnL/I28Zi/yjk1el6ilj27tKcdjLsNqAOZr0yVjWPrSQyHgKI2INaEWw21bAQSv2LXRt1XuCS/GomNpWOxsQ==", "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.261", "version": "1.5.250",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.261.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.250.tgz",
"integrity": "sha512-cmyHEWFqEt3ICUNF93ShneOF47DHoSDbLb7E/AonsWcbzg95N+kPXeLNfkdzgTT/vEUcoW76fxbLBkeYtfoM8A==", "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": {
@@ -8136,13 +8129,13 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/rimraf": { "node_modules/rimraf": {
"version": "6.1.2", "version": "6.1.0",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.1.2.tgz", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.1.0.tgz",
"integrity": "sha512-cFCkPslJv7BAXJsYlK1dZsbP8/ZNLkCAQ0bi1hf5EKX2QHegmDFEFA6QhuYJlk7UDdc+02JjO80YSOrWPpw06g==", "integrity": "sha512-DxdlA1bdNzkZK7JiNWH+BAx1x4tEJWoTofIopFo6qWUU94jYrFZ0ubY05TqH3nWPJ1nKa1JWVFDINZ3fnrle/A==",
"dev": true, "dev": true,
"license": "BlueOak-1.0.0", "license": "BlueOak-1.0.0",
"dependencies": { "dependencies": {
"glob": "^13.0.0", "glob": "^11.0.3",
"package-json-from-dist": "^1.0.1" "package-json-from-dist": "^1.0.1"
}, },
"bin": { "bin": {
@@ -8156,15 +8149,37 @@
} }
}, },
"node_modules/rimraf/node_modules/glob": { "node_modules/rimraf/node_modules/glob": {
"version": "13.0.0", "version": "11.0.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-13.0.0.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.3.tgz",
"integrity": "sha512-tvZgpqk6fz4BaNZ66ZsRaZnbHvP/jG3uKJvAZOwEVUL4RTA5nJeeLYfyN9/VA8NX/V3IBG+hkeuGpKjvELkVhA==", "integrity": "sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==",
"dev": true,
"license": "ISC",
"dependencies": {
"foreground-child": "^3.3.1",
"jackspeak": "^4.1.1",
"minimatch": "^10.0.3",
"minipass": "^7.1.2",
"package-json-from-dist": "^1.0.0",
"path-scurry": "^2.0.0"
},
"bin": {
"glob": "dist/esm/bin.mjs"
},
"engines": {
"node": "20 || >=22"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/rimraf/node_modules/jackspeak": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.1.tgz",
"integrity": "sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==",
"dev": true, "dev": true,
"license": "BlueOak-1.0.0", "license": "BlueOak-1.0.0",
"dependencies": { "dependencies": {
"minimatch": "^10.1.1", "@isaacs/cliui": "^8.0.2"
"minipass": "^7.1.2",
"path-scurry": "^2.0.0"
}, },
"engines": { "engines": {
"node": "20 || >=22" "node": "20 || >=22"
@@ -9268,13 +9283,12 @@
} }
}, },
"node_modules/updaterweblibrary": { "node_modules/updaterweblibrary": {
"version": "1.0.13", "version": "1.0.9",
"resolved": "https://registry.npmjs.org/updaterweblibrary/-/updaterweblibrary-1.0.13.tgz", "resolved": "https://registry.npmjs.org/updaterweblibrary/-/updaterweblibrary-1.0.9.tgz",
"integrity": "sha512-AFVU+0yabdFL7tfdH5HMLoqtTukP9EaSWpM0yAZvDcJEOSeNXc6sst9+BXy2n2G+aQCRWjGjCr34CZXajIDR+A==", "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": {
@@ -9497,17 +9511,17 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/vue": { "node_modules/vue": {
"version": "3.5.25", "version": "3.5.24",
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.25.tgz", "resolved": "https://registry.npmjs.org/vue/-/vue-3.5.24.tgz",
"integrity": "sha512-YLVdgv2K13WJ6n+kD5owehKtEXwdwXuj2TTyJMsO7pSeKw2bfRNZGjhB7YzrpbMYj5b5QsUebHpOqR3R3ziy/g==", "integrity": "sha512-uTHDOpVQTMjcGgrqFPSb8iO2m1DUvo+WbGqoXQz8Y1CeBYQ0FXf2z1gLRaBtHjlRz7zZUBHxjVB5VTLzYkvftg==",
"license": "MIT", "license": "MIT",
"peer": true, "peer": true,
"dependencies": { "dependencies": {
"@vue/compiler-dom": "3.5.25", "@vue/compiler-dom": "3.5.24",
"@vue/compiler-sfc": "3.5.25", "@vue/compiler-sfc": "3.5.24",
"@vue/runtime-dom": "3.5.25", "@vue/runtime-dom": "3.5.24",
"@vue/server-renderer": "3.5.25", "@vue/server-renderer": "3.5.24",
"@vue/shared": "3.5.25" "@vue/shared": "3.5.24"
}, },
"peerDependencies": { "peerDependencies": {
"typescript": "*" "typescript": "*"

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.13", "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,41 +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, (e: "home"):void}>(); const emit = defineEmits<{(e:"back"):void}>();
const archive = useArchiveStore();
const view = ref<number>(0);
const version = ref<string>("");
const logValue = ref<string>("");
const back = () => { const back = () => {
emit("back"); emit("back");
} }
async function flash() {
view.value = 1;
logValue.value = "Downloading file";
await updater.obj.getFirmware( archive.getArchive[archive.getShownI]);
logValue.value = "File recieved";
logValue.value = "Starting to flash (0%)";
const fileSize = updater.obj.getFileSize();
logValue.value = `FileSize: ${fileSize}`;
// await updater.obj.flashFirmware();
// logValue.value = "Flash complete!";
view.value = 2;
}
function home() {
emit("home");
}
onBeforeMount(async () => {
version.value = await updater.obj.getBoardVersion();
});
</script> </script>
<template> <template>
@@ -44,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>-->
@@ -53,22 +24,10 @@ 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>
<!-- BEFORE FLASHING -->
<ion-button @click="flash" v-if="view==0">Flash</ion-button>
<ion-button @click="back" v-if="view==0">Cancel</ion-button>
<!-- DURING FLASHING -->
<p v-if="view!=0">Status info</p><br />
<p v-if="view!=0">{{ logValue }}</p>
<!-- AFTER FLASHING -->
<ion-button @click="home" v-if="view==2">Finish</ion-button>
<ion-button @click="back">Cancel</ion-button>
</ion-card-content> </ion-card-content>
</ion-card> </ion-card>
</template> </template>

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,32 +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';
const emit = defineEmits<{ (e: "connect"): void }>(); const emit = defineEmits<{(e: "connect"):void}>();
const bleStore = useBluetoothStore();
const devices = ref<BLECentralPlugin.PeripheralData[]>([]); const connect = () => {
const connect = (device: BLECentralPlugin.PeripheralData) => {
bleStore.connect(device);
emit("connect"); emit("connect");
} }
const scan = () => {
bleStore.scan();
}
onBeforeMount(async () => {
bleStore.enableBLE();
});
watch(() => bleStore.devices, (newValue) => {devices.value = newValue}, {immediate: true});
</script> </script>
<template> <template>
@@ -39,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,66 +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 | undefined>{}}
),
actions: {
async enableBLE(): Promise<boolean> {
return new Promise((resolve, reject) => {
ble.enable(
() => {
},
() => {
reject("Failed to enable");
}
);
ble.isEnabled(
() => {
resolve(true);
},
() => {
reject("Failed to enable");
});
})
},
scan(): void {
this.devices = [];
ble.scan([], 5, (device: BLECentralPlugin.PeripheralData) => {
console.log(device);
this.devices.push(device);
}, (e) => {
console.log(e)
})
},
async connect(device: BLECentralPlugin.PeripheralData): Promise<boolean> {
return new Promise( (resolve, reject) => {
ble.connect(device.id,
(data: BLECentralPlugin.PeripheralDataExtended) => {
console.log(`Connected: ${data}`);
updater.obj.setDeviceId(device.id);
this.device = device;
resolve(true);
},
(error: string | BLECentralPlugin.BLEError) => {
console.error(`Connection error: ${error}`);
reject(false);
}
);
});
},
async disconnect(): Promise<boolean> {
return new Promise((resolve, reject) => {
ble.disconnect(this.device?.id as string, () => {
this.device = undefined;
resolve(true);
}, (err: string | BLECentralPlugin.BLEError) => {
reject(err);
})
})
}
}
});
export default useBluetoothStore;

View File

@@ -1,5 +0,0 @@
import Updater from "updaterweblibrary";
const updater = {obj: new Updater()}
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" @home="goHome"></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,13 +32,10 @@ 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 useBluetoothStore from '@/stores/bluetooth';
let prevCard = 0; let prevCard = 0;
const shownCard = ref<number>(0); const shownCard = ref<number>(0);
const bleStore = useBluetoothStore();
const showArchive = () => { const showArchive = () => {
prevCard = shownCard.value; prevCard = shownCard.value;
shownCard.value = 3; shownCard.value = 3;
@@ -73,11 +70,6 @@ const showSettings = () => {
prevCard = shownCard.value; prevCard = shownCard.value;
shownCard.value = 5; shownCard.value = 5;
} }
async function disconnect() {
await bleStore.disconnect();
showScan();
}
</script> </script>
<style scoped> <style scoped>