diff --git a/package-lock.json b/package-lock.json index 7f59c73..9cb89a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.1", "license": "MIT", "dependencies": { - "@liamcottle/meshcore.js": "^1.0.5", + "@liamcottle/meshcore.js": "^1.0.6", "@tailwindcss/forms": "^0.5.10", "@vitejs/plugin-vue": "^5.2.1", "autoprefixer": "^10.4.20", @@ -27,7 +27,7 @@ }, "../meshcore.js": { "name": "@liamcottle/meshcore.js", - "version": "1.0.4", + "version": "1.0.6", "extraneous": true, "license": "MIT" }, @@ -1122,9 +1122,9 @@ } }, "node_modules/@liamcottle/meshcore.js": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@liamcottle/meshcore.js/-/meshcore.js-1.0.5.tgz", - "integrity": "sha512-XXQP57T9FM625KrXvLTv+kP9vyWpsxVe5miNA+CTAfdn6gQTe7yGIlfIgN9fr2jznRVHiVE3CQRt3urw7ZRbEA==" + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@liamcottle/meshcore.js/-/meshcore.js-1.0.6.tgz", + "integrity": "sha512-xdebsV1qWG+gXVVB2GBwoJi17dZgBcXmfWPzAGpmUMBEQAvbIs0DAc66zue+X3cHv7+29zKATa9JWMNOC/VEjg==" }, "node_modules/@mongodb-js/saslprep": { "version": "1.2.0", diff --git a/package.json b/package.json index bff6639..5bf6feb 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "author": "Liam Cottle ", "license": "MIT", "dependencies": { - "@liamcottle/meshcore.js": "^1.0.5", + "@liamcottle/meshcore.js": "^1.0.6", "@tailwindcss/forms": "^0.5.10", "@vitejs/plugin-vue": "^5.2.1", "autoprefixer": "^10.4.20", diff --git a/src/components/pages/SettingsPage.vue b/src/components/pages/SettingsPage.vue index 83beebb..d58b228 100644 --- a/src/components/pages/SettingsPage.vue +++ b/src/components/pages/SettingsPage.vue @@ -31,6 +31,7 @@
+
Public Info
@@ -52,6 +53,7 @@
+
Radio Settings
@@ -106,6 +108,34 @@
+ +
+ +
Commands
+ +
+ + +
+ + + +
+ + +
Reboot
+ + +
+ + + +
+ +
+ +
+
@@ -237,11 +267,6 @@ export default { // show success alert alert("Settings saved."); - // go back to main page - this.$router.push({ - name: "main", - }); - } catch(e) { console.log(e); alert("Failed to save settings!"); @@ -252,6 +277,31 @@ export default { } + }, + async reboot() { + + // ask user to confirm action + if(!confirm("Are you sure you want to reboot this device?")){ + return; + } + + // tell radio to reboot + try { + await Connection.reboot(); + } catch(e) { + alert("Failed to reboot device!"); + console.log(e); + return; + } + + // tell user device is rebooting + alert("Device is rebooting. You will need to reconnect!"); + + // go back to main page + this.$router.push({ + name: "main", + }); + }, bytesToHex(uint8Array) { return Utils.bytesToHex(uint8Array); diff --git a/src/js/Connection.js b/src/js/Connection.js index 11d504c..26b4637 100644 --- a/src/js/Connection.js +++ b/src/js/Connection.js @@ -266,6 +266,10 @@ class Connection { } } + static async reboot() { + await GlobalState.connection.reboot(); + } + static async onContactMessageReceived(message) { console.log("onContactMessageReceived", message);