TinyB  0.5.1
TinyB - The Tiny Bluetooth LE library
Public Member Functions | List of all members
tinyb.BluetoothAdapter Class Reference
Inheritance diagram for tinyb.BluetoothAdapter:
tinyb.BluetoothObject

Public Member Functions

native BluetoothType getBluetoothType ()
 
native BluetoothAdapter clone ()
 
BluetoothDevice find (String name, String address, Duration duration)
 
BluetoothDevice find (String name, String address)
 
native boolean startDiscovery () throws BluetoothException
 
native boolean stopDiscovery () throws BluetoothException
 
native List< BluetoothDevicegetDevices ()
 
native int removeDevices () throws BluetoothException
 
native String getAddress ()
 
native String getName ()
 
native String getAlias ()
 
native void setAlias (String value)
 
native long getBluetoothClass ()
 
native boolean getPowered ()
 
native void enablePoweredNotifications (BluetoothNotification< Boolean > callback)
 
native void disablePoweredNotifications ()
 
native void setPowered (boolean value)
 
native boolean getDiscoverable ()
 
native void enableDiscoverableNotifications (BluetoothNotification< Boolean > callback)
 
native void disableDiscoverableNotifications ()
 
native void setDiscoverable (boolean value)
 
native long getDiscoverableTimeout ()
 
native void setDiscoverableTimout (long value)
 
native boolean getPairable ()
 
native void enablePairableNotifications (BluetoothNotification< Boolean > callback)
 
native void disablePairableNotifications ()
 
native void setPairable (boolean value)
 
native long getPairableTimeout ()
 
native void setPairableTimeout (long value)
 
native boolean getDiscovering ()
 
native void enableDiscoveringNotifications (BluetoothNotification< Boolean > callback)
 
native void disableDiscoveringNotifications ()
 
native String[] getUUIDs ()
 
native String getModalias ()
 
void setDiscoveryFilter (List< UUID > uuids, int rssi, int pathloss, TransportType transportType)
 
void setRssiDiscoveryFilter (int rssi)
 
String getInterfaceName ()
 
- Public Member Functions inherited from tinyb.BluetoothObject
native BluetoothType getBluetoothType ()
 
native BluetoothObject clone ()
 
boolean equals (Object obj)
 
int hashCode ()
 
synchronized void close ()
 

Additional Inherited Members

- Protected Member Functions inherited from tinyb.BluetoothObject
 BluetoothObject (long instance)
 
void finalize ()
 
native String getObjectPath ()
 
- Protected Attributes inherited from tinyb.BluetoothObject
long nativeInstance
 

Detailed Description

Provides access to Bluetooth adapters. Follows the BlueZ adapter API available at: http://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/adapter-api.txt

Member Function Documentation

native void tinyb.BluetoothAdapter.disableDiscoverableNotifications ( )

Disables notifications of the discoverable property and unregisters the callback object passed through the corresponding enable method.

native void tinyb.BluetoothAdapter.disableDiscoveringNotifications ( )

Disables notifications of the discovering property and unregisters the discovering object passed through the corresponding enable method.

native void tinyb.BluetoothAdapter.disablePairableNotifications ( )

Disables notifications of the pairable property and unregisters the callback object passed through the corresponding enable method.

native void tinyb.BluetoothAdapter.disablePoweredNotifications ( )

Disables notifications of the powered property and unregisters the callback object passed through the corresponding enable method.

native void tinyb.BluetoothAdapter.enableDiscoverableNotifications ( BluetoothNotification< Boolean >  callback)

Enables notifications for the discoverable property and calls run function of the BluetoothNotification object.

Parameters
callbackA BluetoothNotification<Boolean> object. Its run function will be called when a notification is issued. The run function will deliver the new value of the discoverable property.
native void tinyb.BluetoothAdapter.enableDiscoveringNotifications ( BluetoothNotification< Boolean >  callback)

Enables notifications for the discovering property and calls run function of the BluetoothNotification object.

Parameters
callbackA BluetoothNotification<Boolean> object. Its run function will be called when a notification is issued. The run function will deliver the new value of the discovering property.
native void tinyb.BluetoothAdapter.enablePairableNotifications ( BluetoothNotification< Boolean >  callback)

Enables notifications for the pairable property and calls run function of the BluetoothNotification object.

Parameters
callbackA BluetoothNotification<Boolean> object. Its run function will be called when a notification is issued. The run function will deliver the new value of the pairable property.
native void tinyb.BluetoothAdapter.enablePoweredNotifications ( BluetoothNotification< Boolean >  callback)

Enables notifications for the powered property and calls run function of the BluetoothNotification object.

Parameters
callbackA BluetoothNotification<Boolean> object. Its run function will be called when a notification is issued. The run function will deliver the new value of the powered property.
BluetoothDevice tinyb.BluetoothAdapter.find ( String  name,
String  address,
Duration  duration 
)

Find a BluetoothDevice. If parameters name and address are not null, the returned object will have to match them. It will first check for existing objects. It will not turn on discovery or connect to devices. name optionally specify the name of the object you are waiting for address optionally specify the MAC address of the device you are waiting for timeout the function will return after timeout time, a value of zero means wait forever. If object is not found during this time null will be returned.

Returns
An object matching the name and address or null if not found before timeout expires.
BluetoothDevice tinyb.BluetoothAdapter.find ( String  name,
String  address 
)

Find a BluetoothDevice. If parameters name and address are not null, the returned object will have to match them. It will first check for existing objects. It will not turn on discovery or connect to devices. name optionally specify the name of the object you are waiting for address optionally specify the MAC address of the device you are waiting for

Returns
An object matching the name and address.
native String tinyb.BluetoothAdapter.getAddress ( )

Returns the hardware address of this adapter.

Returns
The hardware address of this adapter.
native String tinyb.BluetoothAdapter.getAlias ( )

Returns the friendly name of this adapter.

Returns
The friendly name of this adapter, or NULL if not set.
native long tinyb.BluetoothAdapter.getBluetoothClass ( )

Returns the Bluetooth class of the adapter.

Returns
The Bluetooth class of the adapter.
native List<BluetoothDevice> tinyb.BluetoothAdapter.getDevices ( )

Returns a list of BluetoothDevices visible from this adapter.

Returns
A list of BluetoothDevices visible on this adapter, NULL if an error occurred
native boolean tinyb.BluetoothAdapter.getDiscoverable ( )

Returns the discoverable state the adapter.

Returns
The discoverable state of the adapter.
native long tinyb.BluetoothAdapter.getDiscoverableTimeout ( )

Returns the discoverable timeout the adapter.

Returns
The discoverable timeout of the adapter.
native boolean tinyb.BluetoothAdapter.getDiscovering ( )

Returns the discovering state the adapter. It can be modified through start_discovery/stop_discovery functions.

Returns
The discovering state of the adapter.
String tinyb.BluetoothAdapter.getInterfaceName ( )

Returns the interface name of the adapter.

Returns
The interface name of the adapter.
native String tinyb.BluetoothAdapter.getModalias ( )

Returns the local ID of the adapter.

Returns
The local ID of the adapter.
native String tinyb.BluetoothAdapter.getName ( )

Returns the system name of this adapter.

Returns
The system name of this adapter.
native boolean tinyb.BluetoothAdapter.getPairable ( )

Returns the pairable state the adapter.

Returns
The pairable state of the adapter.
native long tinyb.BluetoothAdapter.getPairableTimeout ( )

Returns the timeout in seconds after which pairable state turns off automatically, 0 means never.

Returns
The pairable timeout of the adapter.
native boolean tinyb.BluetoothAdapter.getPowered ( )

Returns the power state the adapter.

Returns
The power state of the adapter.
native String [] tinyb.BluetoothAdapter.getUUIDs ( )

Returns the UUIDs of the adapter.

Returns
Array containing the UUIDs of the adapter, ends with NULL.
native int tinyb.BluetoothAdapter.removeDevices ( ) throws BluetoothException

Remove all the known devices

Returns
The number of devices removed from internal list
Exceptions
BluetoothException
native void tinyb.BluetoothAdapter.setAlias ( String  value)

Sets the friendly name of this adapter.

native void tinyb.BluetoothAdapter.setDiscoverable ( boolean  value)

Sets the discoverable state the adapter.

native void tinyb.BluetoothAdapter.setDiscoverableTimout ( long  value)

Sets the discoverable timeout the adapter. A value of 0 disables the timeout.

void tinyb.BluetoothAdapter.setDiscoveryFilter ( List< UUID >  uuids,
int  rssi,
int  pathloss,
TransportType  transportType 
)

This method sets the device discovery filter for the caller. When this method is called with no filter parameter, filter is removed.

When a remote device is found that advertises any UUID from UUIDs, it will be reported if:

  • Pathloss and RSSI are both empty.
  • only Pathloss param is set, device advertise TX pwer, and computed pathloss is less than Pathloss param.
  • only RSSI param is set, and received RSSI is higher than RSSI param.

If one or more discovery filters have been set, the RSSI delta-threshold, that is imposed by StartDiscovery by default, will not be applied.

If "auto" transport is requested, scan will use LE, BREDR, or both, depending on what's currently enabled on the controller.

Parameters
uuidsa list of device UUIDs
rssia rssi value
pathlossa pathloss value
native void tinyb.BluetoothAdapter.setPairable ( boolean  value)

Sets the discoverable state the adapter.

native void tinyb.BluetoothAdapter.setPairableTimeout ( long  value)

Sets the timeout after which pairable state turns off automatically, 0 means never.

native void tinyb.BluetoothAdapter.setPowered ( boolean  value)

Sets the power state the adapter.

void tinyb.BluetoothAdapter.setRssiDiscoveryFilter ( int  rssi)

This method sets RSSI device discovery filter for the caller. When this method is called with 0, filter is removed.

Parameters
rssia rssi value
native boolean tinyb.BluetoothAdapter.startDiscovery ( ) throws BluetoothException

Turns on device discovery if it is disabled.

Returns
TRUE if discovery was successfully enabled
native boolean tinyb.BluetoothAdapter.stopDiscovery ( ) throws BluetoothException

Turns off device discovery if it is enabled.

Returns
TRUE if discovery was successfully disabled

The documentation for this class was generated from the following file: