TinyB  0.5.1
TinyB - The Tiny Bluetooth LE library
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
tinyb.BluetoothManager Class Reference

Classes

interface  BluetoothDeviceDiscoveryListener
 

Public Member Functions

native BluetoothType getBluetoothType ()
 
BluetoothObject find (BluetoothType type, String name, String identifier, BluetoothObject parent, Duration timeout)
 
BluetoothObject find (BluetoothType type, String name, String identifier, BluetoothObject parent)
 
BluetoothObject getObject (BluetoothType type, String name, String identifier, BluetoothObject parent)
 
List< BluetoothObjectgetObjects (BluetoothType type, String name, String identifier, BluetoothObject parent)
 
native List< BluetoothAdaptergetAdapters ()
 
native List< BluetoothDevicegetDevices ()
 
native List< BluetoothGattServicegetServices ()
 
native boolean setDefaultAdapter (BluetoothAdapter adapter)
 
native boolean startDiscovery () throws BluetoothException
 
native boolean stopDiscovery () throws BluetoothException
 
native boolean getDiscovering () throws BluetoothException
 
void startNearbyDiscovery (final BluetoothDeviceDiscoveryListener listener, final int pollingRate, final boolean onlyManufacturerFilled)
 
void stopNearbyDiscovery ()
 

Static Public Member Functions

static synchronized BluetoothManager getBluetoothManager () throws RuntimeException, BluetoothException
 

Protected Member Functions

void finalize ()
 

Member Function Documentation

BluetoothObject tinyb.BluetoothManager.find ( BluetoothType  type,
String  name,
String  identifier,
BluetoothObject  parent,
Duration  timeout 
)

Find a BluetoothObject of a type matching type. If parameters name, identifier and parent 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. type specify the type of the object you are waiting for, NONE means anything. name optionally specify the name of the object you are waiting for (for Adapter or Device) identifier optionally specify the identifier of the object you are waiting for (UUID for GattService, GattCharacteristic or GattDescriptor, address for Adapter or Device) parent optionally specify the parent of the object 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, identifier, parent or null if not found before timeout expires or event is canceled.
BluetoothObject tinyb.BluetoothManager.find ( BluetoothType  type,
String  name,
String  identifier,
BluetoothObject  parent 
)

Find a BluetoothObject of a type matching type. If parameters name, identifier and parent 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. type specify the type of the object you are waiting for, NONE means anything. name optionally specify the name of the object you are waiting for (for Adapter or Device) identifier optionally specify the identifier of the object you are waiting for (UUID for GattService, GattCharacteristic or GattDescriptor, address for Adapter or Device) parent optionally specify the parent of the object you are waiting for

Returns
An object matching the name, identifier and parent.
native List<BluetoothAdapter> tinyb.BluetoothManager.getAdapters ( )

Returns a list of BluetoothAdapters available in the system

Returns
A list of BluetoothAdapters available in the system
static synchronized BluetoothManager tinyb.BluetoothManager.getBluetoothManager ( ) throws RuntimeException, BluetoothException
static

Returns an instance of BluetoothManager, to be used instead of constructor.

Returns
An initialized BluetoothManager instance.
native List<BluetoothDevice> tinyb.BluetoothManager.getDevices ( )

Returns a list of discovered BluetoothDevices

Returns
A list of discovered BluetoothDevices
native boolean tinyb.BluetoothManager.getDiscovering ( ) throws BluetoothException

Returns if the discovers is running or not.

Returns
TRUE if discovery is running
BluetoothObject tinyb.BluetoothManager.getObject ( BluetoothType  type,
String  name,
String  identifier,
BluetoothObject  parent 
)

Return a BluetoothObject of a type matching type. If parameters name, identifier and parent are not null, the returned object will have to match them. Only objects which are already in the system will be returned. type specify the type of the object you are waiting for, NONE means anything. name optionally specify the name of the object you are waiting for (for Adapter or Device) identifier optionally specify the identifier of the object you are waiting for (UUID for GattService, GattCharacteristic or GattDescriptor, address for Adapter or Device) parent optionally specify the parent of the object you are waiting for

Returns
An object matching the name, identifier, parent or null if not found.
List<BluetoothObject> tinyb.BluetoothManager.getObjects ( BluetoothType  type,
String  name,
String  identifier,
BluetoothObject  parent 
)

Return a List of BluetoothObject of a type matching type. If parameters name, identifier and parent are not null, the returned object will have to match them. Only objects which are already in the system will be returned. type specify the type of the object you are waiting for, NONE means anything. name optionally specify the name of the object you are waiting for (for Adapter or Device) identifier optionally specify the identifier of the object you are waiting for (UUID for GattService, GattCharacteristic or GattDescriptor, address for Adapter or Device) parent optionally specify the parent of the object you are waiting for

Returns
A vector of object matching the name, identifier, parent.
native List<BluetoothGattService> tinyb.BluetoothManager.getServices ( )

Returns a list of available BluetoothGattServices

Returns
A list of available BluetoothGattServices
native boolean tinyb.BluetoothManager.setDefaultAdapter ( BluetoothAdapter  adapter)

Sets a default adapter to use for discovery.

Returns
TRUE if the device was set
native boolean tinyb.BluetoothManager.startDiscovery ( ) throws BluetoothException

Turns on device discovery on the default adapter if it is disabled.

Returns
TRUE if discovery was successfully enabled
void tinyb.BluetoothManager.startNearbyDiscovery ( final BluetoothDeviceDiscoveryListener  listener,
final int  pollingRate,
final boolean  onlyManufacturerFilled 
)

When called, each new device found will fire an event to the passed listener

This method will create a new thread to handle the discovery process which is a simple polling of the current list (getDevices)

The thread is stopped when the nearbyStopDiscovery is called

Parameters
listener
pollingRateThe polling rate is miliseconds (1000 = 1s)
onlyManufacturerFilledIf true, then only if the manufacturer data is filled, the event will be fired
native boolean tinyb.BluetoothManager.stopDiscovery ( ) throws BluetoothException

Turns off device discovery on the default adapter if it is enabled.

Returns
TRUE if discovery was successfully disabled
void tinyb.BluetoothManager.stopNearbyDiscovery ( )

Stop the nearby thread


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