FileDocCategorySizeDatePackage
DataChannel.javaAPI DocAndroid 1.5 API3506Wed May 06 22:42:46 BST 2009com.android.im.imps

DataChannel

public abstract class DataChannel extends Object
The IMPS transport binding is divided into two channels: a mandatory data channel and a conditional CIR channel. All the exchange of CSP primitives is done in the data channel.

Fields Summary
protected ImpsConnection
mConnection
protected PrimitiveParser
mParser
protected PrimitiveSerializer
mSerializer
protected long
mMinPollMillis
Constructors Summary
protected DataChannel(ImpsConnection connection)

        mConnection = connection;
    
Methods Summary
public abstract voidconnect()
Establishes a data channel with the IMPS server.

throws
ImException if an error occur during establishing the data channel.

public abstract longgetLastActiveTime()
Gets the time when the last primitive was sent to the server through the data channel.

return
the time last primitive was sent.

public abstract booleanisSendingQueueEmpty()
Tells if there is any primitive waiting to send.

return
true if there is one or more primitives waiting to send.

public abstract PrimitivereceivePrimitive()
Receives a primitive from this data channel, waiting until a primitive from the server arrived or being interrupted.

return
the received primitive
throws
InterruptedException

public abstract booleanresume()
Resume the suspended data channel.

return
true if the channel is resumed successfully; false if the channel is timeout and a new one must be established.

public abstract voidsendPrimitive(Primitive p)
Sends a CSP primitive to the IMPS server through this data channel.

param
p the primitive to send.

public voidsetServerMinPoll(long interval)
Set the ServerMinPoll value (in seconds) after capability negotiation. The DataChannel MUST NOT send more than 1 PollingRequest within this interval.

        mMinPollMillis = interval * 1000;
    
public abstract voidshutdown()
Shutdown the data channel.

public abstract voidstartKeepAlive(long interval)
Starts the keep alive task. KeepAliveRequest will be sent to the server if no other transaction has occurred during the KeepAliveTime interval.

public abstract voidsuspend()
Suspend the data channel. No data will be sent through the data channel after suspended. It can be recovered from {@link #resume()}.