Copyright 2008 Motorola Inc. and Nokia Corporation. All Rights Reserved.
Specification License

javax.microedition.broadcast.connection
Interface BroadcastConnection

All Superinterfaces:
javax.microedition.io.Connection
All Known Subinterfaces:
BroadcastDatagramConnection, BroadcastFileConnection

public interface BroadcastConnection
extends javax.microedition.io.Connection

BroadcastConnection is the base interface to provide access to data that comes with a broadcast service.

Auxiliary Broadcast Data

Broadcast services may carry auxiliary data complementary to the media streams. The underlying data delivery mechanism is abstracted in the API. In practice a connection might provide access to either files in a file carousel or even data piggy-backed on audio/video streams.

These broadcast connections may take the form of a file system with a directory structure and files; or it could be a source for receiving a stream of packet data. Broadcast connections are for reading of the data; it is not possible to write data to broadcast files or streams.

BroadcastFileConnection and BroadcastDatagramConnection extend from BroadcastConnection. BroadcastFileConnection abstracts a file or directory. BroadcastDatagramConnection provides access to read from a packet data stream.

BroadcastFileConnections are retrieved from the Generic Connection Framework given the URI of the connection. The javax.microedition.io.Connector.open() method can be used to create the broadcast connections. URIs are persistent as long as the files they are referring to remain in their location. Change of a platform provider changes the file system as well. URIs associated with PlatformProvider that currently is not selected most likely will not work until the correct PlatformProvider is selected. Some of the well-defined URIs are provided in the ESG.

For example, the content logo of a program, CommonMetadataSet.PROGRAM_CONTENT_AUX_LOGO can be retrieved as a BroadcastFileConnection.

Auxiliary broadcast data may also be delivered as packets of data via a BroadcastDatagramConnection. A BroadcastDatagramConnection is associated with an individual ServiceComponent. Once a Service is selected and the ServiceContext reached the PREPARING_MEDIA state and the COMPONENTS_SET event is delivered, the connections may be retrieved with getBroadcastDatagramConnection(ServiceComponent) as long as ServiceContext is not closed or stopped.

Filecast Service

A filecast service is a service which delivers content as files without other streaming audio or video content. When a filecast service is chosen, ServiceContext returns ServiceComponents with type ServiceComponent.FILECAST. Since there are no associated audio and video streams, no Player object will be associated with the ServiceComponent.

The CommonMetadataSet.PROGRAM_CONTENT_LOCATION attribute can be used to retrieve the URI of the content from the service guide. The URI will point to a directory where the files will be placed. Application will be notified of the arrival of the new files via the BroadcastConnectionListener.

By definition, all BroadcastConnections are read-only. Connector.open(uri) uses by default the READ_WRITE access parameter. Connector.open(uri, READ) should be used to open read-only BroadcastConnections.

Whether the broadcast data is transmitted as a BroadcastFileConnection or a BroadcastDatagramConnection is implementation specific. Applications can use instanceof to check for the specific type of BroadcastConnections obtained from the API.

In some implementations of the broadcast medium, not all the broadcast connections are accessible immediately. At any given time, some of the broadcast connections may not be available possibly because the data has not yet arrived to the device. This interface provides some utilities to determine the availability of the connection and to possibly control the caching behavior. A BroadcastConnectionListener is also provided to receive runtime status changes of the individual broadcast connection.

Broadcast connections are always supported at least as BroadcastFileConnection objects. However, it is quite likely that when the platform provider is changed the files associated with the previous platform provider can't be accessed any longer. In that case isAvailable() returns false.

See broadcast connection examples for some usage examples.


Method Summary
 void addListener(BroadcastConnectionListener listener)
          Add a new listener to this broadcast connection.
 java.lang.String getMimeType()
          Get the type of the connection.
 java.util.Hashtable getProperties()
          Get properties available for this connection as available from the provider.
 boolean isAvailable()
          Check availability of the connection.
 void removeListener(BroadcastConnectionListener listener)
          Remove the given listener from the broadcast connection.
 
Methods inherited from interface javax.microedition.io.Connection
close
 

Method Detail

addListener

void addListener(BroadcastConnectionListener listener)
Add a new listener to this broadcast connection. If the given listener is null or if the given listener is already added, the method will be ignored.

Parameters:
listener - the BroadcastConnectionListener to add.

getMimeType

java.lang.String getMimeType()
Get the type of the connection.

Returns:
mime type of the connection or null if no mime type can be associated with the connection.

getProperties

java.util.Hashtable getProperties()
Get properties available for this connection as available from the provider.

Returns:
Hashtable for properties for this connection or null if no properties are available.

isAvailable

boolean isAvailable()
Check availability of the connection. Meaning, is the file or packet stream actually available for use (can data be read from it).

Returns:
whether this connection is currently available.

removeListener

void removeListener(BroadcastConnectionListener listener)
Remove the given listener from the broadcast connection. If the given listener is null or the listener is already removed, the method will be ignored.

Parameters:
listener - the BroadcastConnectionListener to remove.


Copyright 2008 Motorola Inc. and Nokia Corporation. All Rights Reserved.
Specification License