Methods Summary |
---|
public java.lang.String | getBluetoothAddress()
return BCC.getInstance().getBluetoothAddress();
|
public javax.bluetooth.DeviceClass | getDeviceClass()
return BCC.getInstance().getDeviceClass();
|
public int | getDiscoverable()
return BCC.getInstance().getAccessCode();
|
public java.lang.String | getFriendlyName()
return BCC.getInstance().getFriendlyName();
|
public static synchronized com.sun.kvem.jsr082.bluetooth.LocalDeviceImpl | getInstance()Retrieves singleton instance.
if (instance == null) {
instance = new LocalDeviceImpl();
}
return instance;
|
public java.lang.String | getProperty(java.lang.String property)
return System.getProperty(property);
|
public javax.bluetooth.ServiceRecord | getRecord(javax.microedition.io.Connection notifier)
if (notifier == null) {
throw new NullPointerException("Null notifier specified.");
}
if (!(notifier instanceof BluetoothNotifier)) {
if (!(notifier instanceof SessionNotifierImpl)) {
throw new IllegalArgumentException("Invalid notifier class.");
}
Connection transport =
((SessionNotifierImpl)notifier).getTransport();
if (!(transport instanceof BluetoothNotifier)) {
throw new IllegalArgumentException("Invalid notifier class.");
}
return ((BluetoothNotifier)transport).getServiceRecord();
}
return ((BluetoothNotifier)notifier).getServiceRecord();
|
public boolean | isPowerOn()Checks if Bluetooth device is turned on.
return BCC.getInstance().isBluetoothEnabled();
|
public boolean | setDiscoverable(int accessCode)
// Check if the specified mode has a valid value
if (accessCode != DiscoveryAgent.GIAC &&
accessCode != DiscoveryAgent.LIAC &&
accessCode != DiscoveryAgent.NOT_DISCOVERABLE &&
(accessCode < 0x9E8B00 || accessCode > 0x9E8B3F)) {
throw new IllegalArgumentException("Access code is out of range: "
+ "0x" + Integer.toHexString(accessCode).toUpperCase());
}
synchronized (cancelerOfLIAC) {
/*
* Accroding to the spec, the device should only be limited
* discoverable (DiscoveryAgent.LIAC) for 1 minute -
* then back to the PREVIOUS discoverable mode.
*/
int oldAccessCode = BCC.getInstance().getAccessCode();
if (BCC.getInstance().setAccessCode(accessCode)) {
cancelerOfLIAC.notifyNewAccessCode(oldAccessCode, accessCode);
if (accessCode != DiscoveryAgent.NOT_DISCOVERABLE) {
// Start SDDB if discoverable mode was set successfully
// IMPL_NOTE: Do we really need this step?
SDDB.getInstance();
}
return true;
}
}
return false;
|
public void | updateRecord(javax.bluetooth.ServiceRecord srvRecord)
if (DEBUG) {
System.out.println("LocalDeviceImpl.updateRecord");
}
if (srvRecord == null) {
throw new NullPointerException("Null record specified.");
}
if (!(srvRecord instanceof ServiceRecordImpl)) {
throw new IllegalArgumentException("Invalid service record class.");
}
ServiceRecordImpl record = (ServiceRecordImpl)srvRecord;
BluetoothNotifier notifier = record.getNotifier();
if (notifier == null) {
throw new IllegalArgumentException(
"Service record is not from local SDDB.");
}
notifier.updateServiceRecord(record);
|