javaclient
Class MComInterface

java.lang.Object
  extended by javaclient.PlayerDevice
      extended by javaclient.MComInterface

public class MComInterface
extends PlayerDevice

The mcom interface is designed for exchanging information between clients. A client sends a message of a given "type" and "channel". This device stores adds the message to that channel's stack. A second client can then request data of a given "type" and "channel". Push, Pop, Read, and Clear operations are defined, but their semantics can vary, based on the stack discipline of the underlying driver. For example, the lifomcom driver enforces a last-in-first-out stack.

Version:
Author:
Radu Bogdan Rusu

Field Summary
static short MCOM_CHANNEL_LEN
          size of channel name
protected static short MCOM_COMMAND_BUFFER_SIZE
           
protected static short MCOM_DATA_BUFFER_SIZE
           
static short MCOM_DATA_LEN
          size of the data field in messages
static java.lang.String MCOM_EMPTY_STRING
          returns this if empty
static short MCOM_N_BUFS
          number of buffers to keep per channel
static short PLAYER_MCOM_CLEAR_REQ
           
static short PLAYER_MCOM_POP_REQ
           
static short PLAYER_MCOM_PUSH_REQ
           
static short PLAYER_MCOM_READ_REQ
           
static short PLAYER_MCOM_SET_CAPACITY_REQ
           
 
Fields inherited from class javaclient.PlayerDevice
device, DIFFERENCE_SYNCH_FACTOR, index, is, os, pc, PLAYER_MAX_REQREP_SIZE, PLAYER_STXX, reserved, size, t_sec, t_usec, ts_sec, ts_usec
 
Constructor Summary
MComInterface(PlayerClient pc, short indexOfDevice)
          Constructor for MComInterface.
 
Method Summary
 void Clear(int type, java.lang.String channel)
          Configuration request: Clear (PLAYER_MCOM_CLEAR_REQ)
 char[] getChannelName()
          Returns the name of the channel after a sendConfigReq () call.
 char[] getData()
          Returns the data.
 short getDataType()
          Returns the type of data after a sendConfigReq () call.
 char getFlag()
          Returns the flag.
 char[] getRData()
          Returns the data after a sendConfigReq () call.
 char getRFlag()
          Returns the flag after a sendConfigReq () call.
 void handleResponse(int size)
          Handle acknowledgement response messages (threaded mode).
 boolean isDataReady()
          Check if data is available.
 void Pop(int type, java.lang.String channel)
          Configuration request: Pop (PLAYER_MCOM_POP_REQ)
 void Push(int type, java.lang.String channel, char[] dataT)
          Configuration request: Push (PLAYER_MCOM_PUSH_REQ)
 void Read(int type, java.lang.String channel)
          Configuration request: Read (PLAYER_MCOM_READ_REQ)
 void readData()
          Read a piece of data.
 void sendConfigReq(int whichReq, int type, java.lang.String channel, boolean fullT, char[] dataT)
          Configuration request: Config requests sent to server.
 void setCapacity(int type, java.lang.String channel, char capacity)
          Configuration request: Set capacity (PLAYER_MCOM_SET_CAPACITY_REQ)
 
Methods inherited from class javaclient.PlayerDevice
getTimeForDataSampled_sec, getTimeForDataSampled_usec, getTimeForDataSampled, getTimeForDataSent_sec, getTimeForDataSent_usec, getTimeForDataSent, handleEARMessage, handleNARMessage, readHeader, sendHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MCOM_DATA_LEN

public static final short MCOM_DATA_LEN
size of the data field in messages

See Also:
Constant Field Values

MCOM_N_BUFS

public static final short MCOM_N_BUFS
number of buffers to keep per channel

See Also:
Constant Field Values

MCOM_CHANNEL_LEN

public static final short MCOM_CHANNEL_LEN
size of channel name

See Also:
Constant Field Values

MCOM_EMPTY_STRING

public static final java.lang.String MCOM_EMPTY_STRING
returns this if empty

See Also:
Constant Field Values

MCOM_COMMAND_BUFFER_SIZE

protected static final short MCOM_COMMAND_BUFFER_SIZE
See Also:
Constant Field Values

MCOM_DATA_BUFFER_SIZE

protected static final short MCOM_DATA_BUFFER_SIZE
See Also:
Constant Field Values

PLAYER_MCOM_PUSH_REQ

public static final short PLAYER_MCOM_PUSH_REQ
See Also:
Constant Field Values

PLAYER_MCOM_POP_REQ

public static final short PLAYER_MCOM_POP_REQ
See Also:
Constant Field Values

PLAYER_MCOM_READ_REQ

public static final short PLAYER_MCOM_READ_REQ
See Also:
Constant Field Values

PLAYER_MCOM_CLEAR_REQ

public static final short PLAYER_MCOM_CLEAR_REQ
See Also:
Constant Field Values

PLAYER_MCOM_SET_CAPACITY_REQ

public static final short PLAYER_MCOM_SET_CAPACITY_REQ
See Also:
Constant Field Values
Constructor Detail

MComInterface

public MComInterface(PlayerClient pc,
                     short indexOfDevice)
Constructor for MComInterface.

Parameters:
pc - a reference to the PlayerClient object
indexOfDevice - the index of the device
Method Detail

readData

public void readData()
Read a piece of data.

Overrides:
readData in class PlayerDevice

getFlag

public char getFlag()
Returns the flag.

Returns:
the flag as a char

getData

public char[] getData()
Returns the data.

Returns:
the data as a array of chars

sendConfigReq

public void sendConfigReq(int whichReq,
                          int type,
                          java.lang.String channel,
                          boolean fullT,
                          char[] dataT)
Configuration request: Config requests sent to server.

See the player_mcom_config structure from player.h

Parameters:
whichReq - which request (should be one of the defined request ids)
type - the "type" of the data

Push

public void Push(int type,
                 java.lang.String channel,
                 char[] dataT)
Configuration request: Push (PLAYER_MCOM_PUSH_REQ)


Pop

public void Pop(int type,
                java.lang.String channel)
Configuration request: Pop (PLAYER_MCOM_POP_REQ)


Read

public void Read(int type,
                 java.lang.String channel)
Configuration request: Read (PLAYER_MCOM_READ_REQ)


Clear

public void Clear(int type,
                  java.lang.String channel)
Configuration request: Clear (PLAYER_MCOM_CLEAR_REQ)


setCapacity

public void setCapacity(int type,
                        java.lang.String channel,
                        char capacity)
Configuration request: Set capacity (PLAYER_MCOM_SET_CAPACITY_REQ)


isDataReady

public boolean isDataReady()
Check if data is available.

Returns:
true if ready, false if not ready

handleResponse

public void handleResponse(int size)
Handle acknowledgement response messages (threaded mode).

Overrides:
handleResponse in class PlayerDevice
Parameters:
size - size of the payload

getRFlag

public char getRFlag()
Returns the flag after a sendConfigReq () call.

Returns:
the flag as a char

getRData

public char[] getRData()
Returns the data after a sendConfigReq () call.

Returns:
the data as a array of chars

getDataType

public short getDataType()
Returns the type of data after a sendConfigReq () call.

Returns:
the type of data as a short

getChannelName

public char[] getChannelName()
Returns the name of the channel after a sendConfigReq () call.

Returns:
the name of the channel as a array of chars