View Single Post
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, Espańa
#89
Originally Posted by velox View Post
I love you. In a non-sexual, nerdy way.

[…awkward pause…]

Anyway, if anyone is a beginner like me and wants to enable or disable Bluetooth via QML, feel free to copy and paste this working example:
Code:
    DBusInterface {
        id:dbif
        bus: DBus.SystemBus
        service: 'net.connman'
        path: '/net/connman/technology/bluetooth'
        iface: 'net.connman.Technology'
        function enable(){
            var valueVariant = true; 
            dbif.typedCall('SetProperty', [
                {'type':'s', 'value': 'Powered'}, 
                {'type':'v', 'value': valueVariant}
            ]);
        }

        function disable(){
            var valueVariant = false;
            dbif.typedCall('SetProperty', [
                {'type':'s', 'value': 'Powered'}, 
                {'type':'v', 'value': valueVariant}
            ]);
        }
    }
Note: I found the extra var statement to be necessary – from what I understand, writing true/false directly seems to be cast as Boolean, not as Variant.
Yep, I'm a beginner and I'd like to know how to do this, rather, I would like to know where to put this information?, is it being added to an existing file?, I have read the comments but don't fully understand...help!
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..