DiscoveryAgent
class provides methods to perform device and service discovery. A local device must have only one DiscoveryAgent
object. This object must be retrieved by a call to getDiscoveryAgent()
on the LocalDevice
object. startInquiry()
to start an inquiry to find devices in proximity to the local device. Discovered devices are returned via the deviceDiscovered()
method of the interface DiscoveryListener
. The second way to discover devices is via the retrieveDevices()
method. This method will return devices that have been discovered via a previous inquiry or devices that are classified as pre-known. (Pre-known devices are those devices that are defined in the Bluetooth Control Center as devices this device frequently contacts.) The retrieveDevices()
method does not perform an inquiry, but provides a quick way to get a list of devices that may be in the area. DiscoveryAgent
class also encapsulates the functionality provided by the service discovery application profile. The class provides an interface for an application to search and retrieve attributes for a particular service. There are two ways to search for services. To search for a service on a single device, the searchServices()
method should be used. On the other hand, if you don't care which device a service is on, the selectService()
method does a service search on a set of remote devices.
@author Christian Lorenz
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|