FileDocCategorySizeDatePackage
BluetoothEventRedirector.javaAPI DocAndroid 1.5 API6982Wed May 06 22:42:48 BST 2009com.android.settings.bluetooth

BluetoothEventRedirector

public class BluetoothEventRedirector extends Object
BluetoothEventRedirector receives broadcasts and callbacks from the Bluetooth API and dispatches the event on the UI thread to the right class in the Settings.

Fields Summary
private static final String
TAG
private static final boolean
V
private LocalBluetoothManager
mManager
private android.content.BroadcastReceiver
mBroadcastReceiver
Constructors Summary
public BluetoothEventRedirector(LocalBluetoothManager localBluetoothManager)


       
        mManager = localBluetoothManager;
    
Methods Summary
public voidstart()

        IntentFilter filter = new IntentFilter();
        
        // Bluetooth on/off broadcasts
        filter.addAction(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION);
        
        // Discovery broadcasts
        filter.addAction(BluetoothIntent.DISCOVERY_STARTED_ACTION);
        filter.addAction(BluetoothIntent.DISCOVERY_COMPLETED_ACTION);
        filter.addAction(BluetoothIntent.REMOTE_DEVICE_DISAPPEARED_ACTION);
        filter.addAction(BluetoothIntent.REMOTE_DEVICE_FOUND_ACTION);
        filter.addAction(BluetoothIntent.REMOTE_NAME_UPDATED_ACTION);
        
        // Pairing broadcasts
        filter.addAction(BluetoothIntent.BOND_STATE_CHANGED_ACTION);
        
        // Fine-grained state broadcasts
        filter.addAction(BluetoothA2dp.SINK_STATE_CHANGED_ACTION);
        filter.addAction(BluetoothIntent.HEADSET_STATE_CHANGED_ACTION);
        filter.addAction(BluetoothIntent.REMOTE_DEVICE_CLASS_UPDATED_ACTION);
        
        mManager.getContext().registerReceiver(mBroadcastReceiver, filter);
    
public voidstop()

        mManager.getContext().unregisterReceiver(mBroadcastReceiver);