mirror of
https://github.com/meshcore-dev/meshcore.js.git
synced 2026-04-20 22:13:49 +00:00
add disconnect button
This commit is contained in:
parent
30c918a09a
commit
f2e56f3924
1 changed files with 9 additions and 0 deletions
|
|
@ -26,6 +26,9 @@
|
|||
<button @click="askForSerialPort" class="border border-gray-500 px-2 bg-gray-100 hover:bg-gray-200 rounded">
|
||||
Connect
|
||||
</button>
|
||||
<button @click="disconnect" class="border border-gray-500 px-2 bg-gray-100 hover:bg-gray-200 rounded">
|
||||
Disconnect
|
||||
</button>
|
||||
<button @click="sendCommandAppStart" class="border border-gray-500 px-2 bg-gray-100 hover:bg-gray-200 rounded">
|
||||
Send AppStart
|
||||
</button>
|
||||
|
|
@ -83,6 +86,12 @@
|
|||
this.device = await Device.fromSerialPort(serialPort);
|
||||
|
||||
},
|
||||
async disconnect() {
|
||||
if(this.device){
|
||||
await this.device.close();
|
||||
this.device = null;
|
||||
}
|
||||
},
|
||||
async sendCommandAppStart() {
|
||||
await this.device.sendCommandAppStart();
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue