bluetooth: allow detection of bluetooth enabled 93/9293/3
authorMatt Ranostay <matt.ranostay@konsulko.com>
Mon, 1 May 2017 01:33:25 +0000 (18:33 -0700)
committerMatt Ranostay <matt.ranostay@konsulko.com>
Sat, 13 May 2017 05:38:47 +0000 (22:38 -0700)
Bluetooth can now be enabled via connmand dbus service, and needs
to detect if already enabled.

Change-Id: I279a571b89381579eb05705410210a9266039377
Bug-AGL: SPEC-570
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
app/Settings.qml
app/bluetooth/Bluetooth.qml

index 0d74c3b..56767f3 100644 (file)
@@ -50,6 +50,7 @@ ApplicationWindow {
                     settingsModel.append({'icon': app.icon, 'title': app.title, 'checkable': app.checkable, 'app': app})
                     app.visible = false
 
+                    if (app.isBluetooth) app.checkBluetooth()
                     if (app.isWifi) app.activateWifi()
                 }
             }
index a1cc5ae..71e3635 100644 (file)
@@ -25,6 +25,7 @@ SettingPage {
     icon: '/bluetooth/images/HMI_Settings_BluetoothIcon.svg'
     title: 'Bluetooth'
     checkable: true
+    readonly property bool isBluetooth: true
 
     property string btAPIpath: bindingAddress + '/Bluetooth-manager/'
     property var jsonObjectBT: []
@@ -431,6 +432,15 @@ SettingPage {
           clip: true
       }
 
+      function checkBluetooth() {
+          request(btAPIpath + 'power', function (o) {
+                // log the json response
+                var msg = JSON.parse(o.responseText)
+                console.log(o.responseText)
+                checked = msg.response.power == "on"
+          })
+      }
+
       function findDevice(address){
           for (var i = 0; i < btDeviceList.count; i++) {
               if (address === btDeviceList.get(i).deviceAddress){