* Copyright (c) OSGi Alliance (2000, 2013). All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
Driverservice object must be registered by each Driver bundle wishing to attach to Device services provided by other drivers. For each newly discovered
object, the device manager enters a bidding phase. The
method bids the highest for a particular
Deviceobject will be instructed by the device manager to attach to the
and returns a value indicating how well this driver can support the given Device service, or
if it cannot support the given Device service at all.
The return value must be one of the possible match values defined in the
device category definition for the given Device service, or
Device.MATCH_NONE if the category of the Device service is not
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.
ServiceReferenceobject of the device to match
Device.MATCH_NONEif it cannot support the Device service at all
java.lang.Exceptionif this Driver service cannot examine the Device service
A return value of
null indicates that this Driver service has
successfully attached to the given Device service. If this Driver service
is unable to attach to the given Device service, but knows of a more
suitable Driver service, it must return the
DRIVER_ID of that
Driver service. This allows for the implementation of referring drivers
whose only purpose is to refer to other drivers capable of handling a
given Device service.
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.
ServiceReferenceobject of the device to attach to
nullif this Driver service has successfully attached to the given Device service, or the
DRIVER_IDof a more suitable driver
java.lang.Exceptionif the driver cannot attach to the given device and does not know of a more suitable driver