Back

GetPairedBtDevices

Hello World

Returns a list of objects containing the name and bluetooth address of paired devices.

app.GetPairedBtDevices() → list: of objects: [{ name, address }]

Note that Bluetooth must be turned on to receive this information.

See Also: UnpairBtDevice, CreateBluetoothSerial, DiscoverBtDevices

Example - Show

var itv;

function OnStart()
{
    lay = app.CreateLayout( "linear", "fillxy,vcenter" );

    lst = app.CreateList( "", .8, .8 );
    lay.AddChild( lst );

    app.AddLayout( lay );


    if( !app.IsBluetoothEnabled() )
        app.SetBluetoothEnabled( true );

    itv = setInterval( checkBtOn, 200 );
}

function checkBtOn()
{
    if( app.IsBluetoothOn() )
    {
        app.HideProgress();
        clearInterval( itv );

        var devices = app.GetPairedBtDevices();

        for( var i in devices )
            lst.AddItem( devices[i].name, devices[i].address );

    }
}
    Copy     Copy All       Run      
string