public class NetworkInterfaceController extends Object implements ResourceProxy
The capability to tune a network interface is a resource and the network interface controller acts as a resource proxy for this resource.
| Constructor and Description |
|---|
NetworkInterfaceController(ResourceClient rc)
Creates a NetworkInterfaceController
|
| Modifier and Type | Method and Description |
|---|---|
ResourceClient |
getClient()
Returns the resource client that is associated with
this NetworkInterfaceController.
|
NetworkInterface |
getNetworkInterface()
Returns the network interface associated with this
controller.
|
void |
release()
Releases the tuner.
|
void |
reserve(NetworkInterface ni,
Object requestData)
Tries to reserve exclusively the control
over the specified network interface.
|
void |
reserveFor(Locator locator,
Object requestData)
Tries to reserve exclusively the control over a network
interface that can receive the transport stream
specified by the locator parameter.
|
void |
tune(Locator locator)
Tunes asynchronously to the given stream (specified
by a Locator).
|
void |
tune(TransportStream ts)
Tunes asynchronously to the given transport stream.
|
public NetworkInterfaceController(ResourceClient rc)
rc - The ResourceClient that the controller is associated withpublic void tune(Locator locator) throws NetworkInterfaceException
If tuning fails for one of the reasons which generate an exception, the status of the network interface will be unchanged and no events generated. If failure of tuning is reported by the event code of the NetworkInterfaceTuningOverEvent then the state of the network interface is not defined and it may be tuned to any transport stream or be left in a state where it is not tuned to any transport stream.
locator - The locator describing the transport stream to tune toStreamNotFoundException - raised if the specified locator
does not point to any known
transport stream or the currently
reserved NetworkInterface cannot
tune to the specified transport streamIncorrectLocatorException - raised if locator does not references a broadcast transport
streamNotOwnerException - raised if no network interface is reserved at
the momentNetworkInterfaceExceptionpublic void tune(TransportStream ts) throws NetworkInterfaceException
This method causes the NetworkInterfaceTuningEvent and the NetworkInterfaceTuningOverEvent to be sent to the listeners of the NetworkInterface reserved by this NetworkInterfaceController. If tuning fails for one of the reasons which generate an exception, the status of the network interface will be unchanged and no events generated. If failure of tuning is reported by the event code of the NetworkInterfaceTuningOverEvent then the state of the network interface is not defined and it may be tuned to any transport stream or be left in a state where it is not tuned to any transport stream.
ts - Transport stream object to tune toStreamNotFoundException - raised if the specified
transport stream is not associated
with the currently reserved
network interfaceNotOwnerException - raised if no network interface is
reserved at the momentNetworkInterfaceExceptionpublic void reserve(NetworkInterface ni, Object requestData) throws NetworkInterfaceException
If the reservation succeeds, a NetworkInterfaceReservedEvent is sent to the listeners of the NetworkInterfaceManager. If this NetworkInterfaceController has currently reserved another NetworkInterface, then it will either release that NetworkInterface and reserve an appropriate one, or throw an exception. If a NetworkInterface that is able to tune to the specified transport stream is currently reserved by this NetworkInterfaceController, then this method does nothing.
ni - Network Interface to be reservedrequestData - Used by the Resource Notification
API in the requestRelease method
of the ResourceClient interface.
The usage of this parameter is optional and
a null reference may be supplied.NoFreeInterfaceException - raised if the requested
network interface can not
be reservedSecurityException - raised if the application does not have
an instance of TunerPermissionNetworkInterfaceExceptionpublic void reserveFor(Locator locator, Object requestData) throws NetworkInterfaceException
The specific network interface is selected by the method implementation.
If the reservation succeeds, a NetworkInterfaceReservedEvent is sent to the listeners of the NetworkInterfaceManager. If this NetworkInterfaceController has currently reserved another NetworkInterface, then it will either release that NetworkInterface and reserve an appropriate one, or throw an exception. If a NetworkInterface that is able to tune to the specified transport stream is currently reserved by this NetworkInterfaceController, then this method does nothing.
locator - a Locator that points to a transport stream that
the reserved network interface should be able to
tune torequestData - Used by the Resource Notification
API in the requestRelease method
of the ResourceClient interface.
The usage of this parameter is optional and
a null reference may be supplied.NoFreeInterfaceException - raised if a network interface
can not be reservedStreamNotFoundException - raised if the specified locator
does not point to any known
transport streamIncorrectLocatorException - raised if the locator does not
references a broadcast transport
streamSecurityException - raised if the application does not have
an instance of TunerPermissionNetworkInterfaceExceptionpublic void release()
throws NetworkInterfaceException
This method causes a NetworkInterfaceReleasedEvent to be sent to the listeners of the NetworkInterfaceManager.
NotOwnerException - raised if the controller does not
currently have a network interface
reservedNetworkInterfaceExceptionpublic NetworkInterface getNetworkInterface()
public ResourceClient getClient()
getClient in interface ResourceProxyCopyright © 2012 code4tv.com. All Rights Reserved.