All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class calypso.clients.tv.CtrlMessage

java.lang.Object
   |
   +----calypso.clients.tv.CtrlMessage

public class CtrlMessage
extends Object
CtrlMsgHandler class for creating and handling control messages. Control messages are stored in a byte buffer. The control message frame format is as follows: first two bytes describe the type of the frame. The next two bytes is a length indicator. All normal control messages (requests) are thus four bytes long. There are two types of acknowledgements: normal and volume level acknowledgements. Normal acknowledgements are four bytes and their structure is like that of normal control messages. Volume acknowledgement messages contain current volume level information in addition to the normal control message structure and are thus six bytes long. At the moment the volume acknowledgements are only sent from the mpeg forwarding process so creating this type of messages is not supported.

Author:
Olli-Pekka Auvinen / TCM laboratory / HUT

Variable Index

 o CTRL_MUTE
Control message MUTE identifier.
 o CTRL_MUTE_ACK
Control messge MUTE acknowledgement identifier.
 o CTRL_PLAY
Control message PLAY identifier.
 o CTRL_PLAY_ACK
Control message PLAY acknowledgement identifier.
 o CTRL_STOP
Control message STOP identifier.
 o CTRL_STOP_ACK
Control message STOP acknowledgement identifier.
 o CTRL_VOLDOWN
Control message VOLDOWN identifier.
 o CTRL_VOLDOWN_ACK
Control message VOLDOWN acknowledgement identifier.
 o CTRL_VOLUP
Control message VOLUP identifier.
 o CTRL_VOLUP_ACK
Control message VOLUP acknowledgement identifier.
 o CTRL_ZOOM
Control message ZOOM identifier.
 o CTRL_ZOOM_ACK
Control message ZOOM acknowledgement identifier.
 o LENGTH
Control message length field access code (index).
 o msgBuffer
Control message data buffer.
 o TYPE
Control message type field access code (index).
 o VOL_LEVEL
Control message volume level field access code (index).

Constructor Index

 o CtrlMessage(byte[])
Constructor for making CtrlMessage of a message frame byte buffer.
 o CtrlMessage(int)
Constructor for building control messages.

Method Index

 o getField(int)
Method for getting specified field from a control message.
 o getPacket()
Method for getting the contents of msgBuffer.
 o getShort(int)
Method for getting a short value from msgBuffer from a given position.
 o testType(int)
The testType method for testing the type of the message.

Variables

 o msgBuffer
 protected byte msgBuffer[]
Control message data buffer.

 o CTRL_STOP
 public static final int CTRL_STOP
Control message STOP identifier.

 o CTRL_STOP_ACK
 public static final int CTRL_STOP_ACK
Control message STOP acknowledgement identifier.

 o CTRL_PLAY
 public static final int CTRL_PLAY
Control message PLAY identifier.

 o CTRL_PLAY_ACK
 public static final int CTRL_PLAY_ACK
Control message PLAY acknowledgement identifier.

 o CTRL_VOLUP
 public static final int CTRL_VOLUP
Control message VOLUP identifier.

 o CTRL_VOLUP_ACK
 public static final int CTRL_VOLUP_ACK
Control message VOLUP acknowledgement identifier.

 o CTRL_VOLDOWN
 public static final int CTRL_VOLDOWN
Control message VOLDOWN identifier.

 o CTRL_VOLDOWN_ACK
 public static final int CTRL_VOLDOWN_ACK
Control message VOLDOWN acknowledgement identifier.

 o CTRL_MUTE
 public static final int CTRL_MUTE
Control message MUTE identifier.

 o CTRL_MUTE_ACK
 public static final int CTRL_MUTE_ACK
Control messge MUTE acknowledgement identifier.

 o CTRL_ZOOM
 public static final int CTRL_ZOOM
Control message ZOOM identifier.

 o CTRL_ZOOM_ACK
 public static final int CTRL_ZOOM_ACK
Control message ZOOM acknowledgement identifier.

 o TYPE
 public static final int TYPE
Control message type field access code (index).

 o LENGTH
 public static final int LENGTH
Control message length field access code (index).

 o VOL_LEVEL
 public static final int VOL_LEVEL
Control message volume level field access code (index).

Constructors

 o CtrlMessage
 public CtrlMessage(int messageType_)
Constructor for building control messages. Used to create normal control messages (requests). These include for example stopping the video, initiating zoom and notching the volume level up by one unit.

Parameters:
messageType_ - Integer value indicating the type of the message.
 o CtrlMessage
 public CtrlMessage(byte message_[])
Constructor for making CtrlMessage of a message frame byte buffer. Used mainly in the acknowledgement reception. This naturally supports receiving the volume acknowledgements in addition to normal acknowledgements.

Parameters:
message_ - A byte array holding the control message.

Methods

 o testType
 public boolean testType(int messageType_)
The testType method for testing the type of the message.

Parameters:
messageType_ - The integer value (type) of the message to be tested.
Returns:
True if the types match, false otherwise.
 o getPacket
 public byte[] getPacket()
Method for getting the contents of msgBuffer. For debugging purposes.

Returns:
A byte array holding the packet data.
 o getShort
 public short getShort(int position_)
Method for getting a short value from msgBuffer from a given position. For debugging.

Parameters:
position_ - An integer value index to the returned short field.
Returns:
The short value of the indexed two-byte field.
 o getField
 protected short getField(int index_) throws ArrayIndexOutOfBoundsException
Method for getting specified field from a control message.

Parameters:
index_ - An integer value index to the short field to be got.
Returns:
The contents of the indexed field in control message.
Throws: ArrayIndexOutOfBoundsException
The exception is thrown in case of an invalid index.

All Packages  Class Hierarchy  This Package  Previous  Next  Index