Driver service object must be registered by each Driver bundle
wishing to attach to Device services provided by other drivers. For each
newly discovered Device object, the device manager enters a bidding
phase. The Driver object whose match(ServiceReference)
method bids the highest for a particular Device object will be
instructed by the device manager to attach to the Device object.
Device, DriverLocator
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: null if this Driver service has successfully attached to
the given Device service, or the DRIVER_ID of a more
suitable driverthe reference)ServiceReference object of the device to
attach toAttaches this Driver service to the Device service represented by the
given |
| public int | Returns: value indicating how well this driver can support the given Device service, orDevice.MATCH_NONE if it cannot support
the Device service at allthe reference)ServiceReference object of the device to
matchChecks whether this Driver service can be attached to the Device service. |
| attach | back to summary |
|---|---|
| public String attach(ServiceReference<?> reference) throws Exception Attaches this Driver service to the Device service represented by the
given
A return value of After having attached to the Device service, this driver may register the underlying device as a new service exposing driver-specific functionality. This method is called by the device manager.
| |
| match | back to summary |
|---|---|
| public int match(ServiceReference<?> reference) throws Exception Checks whether this Driver service can be attached to the Device service.
The Device service is represented by the given
The return value must be one of the possible match values defined in the
device category definition for the given Device service, or
In order to make its decision, this Driver service may examine the properties associated with the given Device service, or may get the referenced service object (representing the actual physical device) to talk to it, as long as it ungets the service and returns the physical device to a normal state before this method returns. A Driver service must always return the same match code whenever it is presented with the same Device service. The match function is called by the device manager during the matching process.
| |