Back

GetBtProfileState

JS Py
Hello World

Returns the Bluetooth State of a given Bt connection type.

app.GetBtProfileState( type ) → String: “Connected” or “Disconnected”

See Also: CreateBluetoothSerial

Example - Show Bluetooth Profile State

function OnStart()
{
    var states = "a2dp|headset|gatt|health".split( "|" );
    var lst = [];

    for( var i in states )
    {
        var state = app.GetBtProfileState( states[i] );
        lst.push( states[i] + + ": " + state);
    }

    app.Alert( lst.join( "\n" ) );
}
from native import app

def OnStart():
    states = ["a2dp", "headset", "gatt", "health"]
    lst = []

    for state in states:
        state_value = app.GetBtProfileState(state)
        lst.append(state + ": " + str(state_value))

    app.Alert('\n'.join(lst))
    Copy     Copy All       Run      
String: “a2dp” or “headset” or “gatt” or “health”