Back

DiscoverBtDevices

JS Py
Hello World

Use DiscoverBtDevices to search for other bluetooth devices which are not paired with the current device.

app.DiscoverBtDevices( filter, onFound?, onComplete? )

If any was found it will be forwarded directly to the onFound callback. If the search has finished onComplete function will be called.

See Also: CreateBluetoothSerial, PairBtDevice, IsBtDevicePaired

Example - Discover Bluetooth Devices

function OnStart()
{
    app.SetBluetoothEnabled(true);
    lay = app.CreateLayout( "linear", "VCenter,FillXY" );

    lst = app.CreateList( "", 0.8, 0.4 );
    lst.SetBackColor("#11ffffff");
    lay.AddChild( lst );

    app.AddLayout( lay );

    app.ShowProgress();

    app.DiscoverBtDevices( "", OnFound, OnComplete );
}

function OnFound( name, address)
{
    lst.AddItem( name, address );
}

function OnComplete()
{
    app.HideProgress();
}
def OnStart():
    app.SetBluetoothEnabled(true)
    lay = app.CreateLayout( "linear", "VCenter,FillXY" )

    lst = app.CreateList( "", 0.8, 0.4 )
    lst.SetBackColor("#11ffffff")
    lay.AddChild( lst )

    app.AddLayout( lay )

    app.ShowProgress()

    app.DiscoverBtDevices( "", OnFound, OnComplete )

def OnFound( name, address):
    lst.AddItem( name, address )

def OnComplete():
    app.HideProgress()
    Copy     Copy All       Run      
String
function( name, address )
function()