> hi! I'm a university student and I try to create a chat room for
> digital television using JAVA with Multimedia home platform (MHP), but
> i don't know how make a return channel connection....can you help me?
>
> i've just create a game application for mhp with xletview, so I have
> just used Xlet.
Use the RCInterfaceManager, which is a singleton, to get access to the
available interfaces, then check that whether the interface is an RC
connection (and thus needs a session manager) or if it's a permanent
connection.
Here's a template code that I found online:
<code>
// First, we get a reference to the RCInterfaceManager
RCInterfaceManager rcm =
RCInterfaceManager.getInstance();
// Now, we get the list of return channel interfaces that
// are available to our application. This returns all
// the available interfaces
RCInterface[] interfaces = rcm.getInterfaces();
// Now choose which interface we use.
// Since we get all the interfaces, we need to check that
// we get the right type. So, we check if the first
// interface is a ConnectionRCInterface
if (interfaces[0] instanceof ConnectionRCInterface) {
// If it's a ConnectionRCInterface, it's not
// permanently connected, so we need to connect it
// first
ConnectionRCInterface myInterface;
myInterface = (ConnectionRCInterface)interfaces[0];
// Now that we've got a reference to the interface, we
// can start to use it
try {
// First,we reserve the connection
myInterface.reserve();
// Set up the connection parameters
ConnectionParameters myConnectionParameters;
myConnectionParameters = new ConnectionParameters
("0199604235697", "username", "password");
// Then we set the target to point to our phone
// number
myInterface.setTarget(myConnectionParameters);
// Now that we've done that, we can actually connect
myInterface.connect();
// do whatever we want to now that we've got a
// connection
// Once we're done, we disconnect the interface and
// release the resource
myInterface.disconnect();
myInterface.release();
} catch (permissionDeniedException e) {
// we can't reserve the interface, so return
return;
}
}
else {
// we have a permanent connection, so just use it
}
</code>