FileDocCategorySizeDatePackage
LocalDevice.javaAPI DocphoneME MR2 API (J2ME)5743Wed May 02 18:00:30 BST 2007javax.bluetooth

LocalDevice

public class LocalDevice extends Object
This class is defined by the JSR-82 specification Java™ APIs for Bluetooth™ Wireless Technology, Version 1.1.

Fields Summary
private static LocalDevice
localDevice
Keeps this singleton object.
private static com.sun.kvem.jsr082.bluetooth.LocalDeviceImpl
localDeviceImpl
Keeps the reference to implementation object.
private DiscoveryAgent
discoveryAgent
Keeps the discovery agen reference - because the DiscoveryAgent. is package private, so it can't be created ffrom the implemetation.
Constructors Summary
private LocalDevice()
The default constructor is hidden so that no one can create a new instance of the LocalDevice. To get the LocalDevice object for this device, use the getLocalDevice() static method in this class.

see
#getLocalDevice

Methods Summary
public java.lang.StringgetBluetoothAddress()

        return localDeviceImpl.getBluetoothAddress();
    
public DeviceClassgetDeviceClass()

        return localDeviceImpl.getDeviceClass();
    
public intgetDiscoverable()

        return localDeviceImpl.getDiscoverable();
    
public DiscoveryAgentgetDiscoveryAgent()


        /*
         * This is an only exception for the "API/IMPL wrapper"
         * scheme, i.e. the DiscoveryAgent object is stored
         * locally in this class.
         */
        return discoveryAgent;
    
public java.lang.StringgetFriendlyName()

        return localDeviceImpl.getFriendlyName();
    
public static javax.bluetooth.LocalDevicegetLocalDevice()


        /*
         * The method is not declared as synchronized to keep
         * its signature unchanged.
         */
        synchronized (LocalDevice.class) {
            if (localDevice == null) {
                try {
                    // create a shared impl object and 'this'
                    localDevice = new LocalDevice();

                    /*
                     * create a DiscoveryAgent from here.
                     * This should be done one time only
                     * regardless whether or not the system is
                     * initialized for the first time.
                     *
                     * We suppose the getLocalDevice() may be called
                     * for the next time if the first try failed.
                     */
                    if (localDevice.discoveryAgent == null) {
                        localDevice.discoveryAgent = new DiscoveryAgent();
                    }

                    /*
                     * Constructing LocaldeviceImpl causes initialization 
                     * of device properties and attributes.
                     */
                    localDeviceImpl = LocalDeviceImpl.getInstance();
                } catch (BluetoothStateException bse) {
                    localDevice = null;
                    throw bse;
                } catch (Throwable e) {
                    localDevice = null;
                    throw new BluetoothStateException(e.toString());
                }
            }
        }
        return localDevice;
    
public static java.lang.StringgetProperty(java.lang.String property)

        return localDevice != null ? localDeviceImpl.getProperty(property) :
                null;
    
public ServiceRecordgetRecord(javax.microedition.io.Connection notifier)

        return localDeviceImpl.getRecord(notifier);
    
public static booleanisPowerOn()

        return localDeviceImpl.isPowerOn();
    
public booleansetDiscoverable(int mode)

        return localDeviceImpl.setDiscoverable(mode);
    
public voidupdateRecord(ServiceRecord srvRecord)

        localDeviceImpl.updateRecord(srvRecord);