public void Find(Action<IList<IAvailableSphero>> onSuccess, Action<Exception> onError)
{
ThreadPool.QueueUserWorkItem(ignored =>
{
try
{
// Get the local Bluetooth adapter
var adapter = BluetoothAdapter.DefaultAdapter;
var devices = adapter.BondedDevices
.Where(p => p.Name.Contains("Sphero"))
.Select(p => new AvailableSphero(p) as IAvailableSphero)
.ToList();
onSuccess(devices);
}
catch (Exception exception)
{
onError(exception);
}
});
}
}