forked from platypush/platypush
Implemented connect/disconnect call on BluetoothService component.
This commit is contained in:
parent
714f853751
commit
0a4b22c12e
1 changed files with 6 additions and 2 deletions
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
<div class="col-2 connector pull-right">
|
<div class="col-2 connector pull-right">
|
||||||
<ToggleSwitch
|
<ToggleSwitch
|
||||||
:value="parent.connected"
|
:value="value.connected"
|
||||||
:disabled="loading"
|
:disabled="loading"
|
||||||
@input="connect"
|
@input="connect"
|
||||||
@click.stop />
|
@click.stop />
|
||||||
|
@ -37,9 +37,13 @@ export default {
|
||||||
async connect(event) {
|
async connect(event) {
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
this.$emit('loading', true)
|
this.$emit('loading', true)
|
||||||
|
const method = (
|
||||||
|
'bluetooth.' +
|
||||||
|
(this.value.connected ? 'disconnect' : 'connect')
|
||||||
|
)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.request('bluetooth.connect', {
|
await this.request(method, {
|
||||||
device: this.parent.address,
|
device: this.parent.address,
|
||||||
service_uuid: this.uuid,
|
service_uuid: this.uuid,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue