Implemented connect/disconnect call on BluetoothService component.

This commit is contained in:
Fabio Manganiello 2023-03-20 01:27:47 +01:00
parent 714f853751
commit 0a4b22c12e
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -14,7 +14,7 @@
<div class="col-2 connector pull-right">
<ToggleSwitch
:value="parent.connected"
:value="value.connected"
:disabled="loading"
@input="connect"
@click.stop />
@ -37,9 +37,13 @@ export default {
async connect(event) {
event.stopPropagation()
this.$emit('loading', true)
const method = (
'bluetooth.' +
(this.value.connected ? 'disconnect' : 'connect')
)
try {
await this.request('bluetooth.connect', {
await this.request(method, {
device: this.parent.address,
service_uuid: this.uuid,
})