jp.go.aist.rtm.RTC.port
Class InPortPushConnector

java.lang.Object
  extended by jp.go.aist.rtm.RTC.port.ConnectorBase
      extended by jp.go.aist.rtm.RTC.port.InPortConnector
          extended by jp.go.aist.rtm.RTC.port.InPortPushConnector

public class InPortPushConnector
extends InPortConnector


Nested Class Summary
 
Nested classes/interfaces inherited from class jp.go.aist.rtm.RTC.port.ConnectorBase
ConnectorBase.ConnectorInfo, ConnectorBase.ConnectorInfoHolder
 
Field Summary
 
Fields inherited from class jp.go.aist.rtm.RTC.port.InPortConnector
m_buffer, m_isLittleEndian, m_orb, m_profile, m_spi_orb, rtcout
 
Constructor Summary
InPortPushConnector(ConnectorBase.ConnectorInfo profile, InPortProvider provider, ConnectorListeners listeners, BufferBase<org.omg.CORBA.portable.OutputStream> buffer)
           Constructor
 
Method Summary
 void activate()
           Connector activation
protected  ReturnCode convertReturn(ReturnCode status)
           Converts buffer.ReturnCode into port.ReturnCode.
protected  BufferBase<org.omg.CORBA.portable.OutputStream> createBuffer(ConnectorBase.ConnectorInfo profile)
           create buffer
 void deactivate()
           Connector deactivation
 ReturnCode disconnect()
           disconnect
protected  void onConnect()
           Invoke callback when connection is established
protected  void onDisconnect()
           Invoke callback when connection is destroied
 ReturnCode read(DataRef<org.omg.CORBA.portable.InputStream> data)
           Reading data
 void setListener(ConnectorBase.ConnectorInfo profile, ConnectorListeners listeners)
           Set the listener.
 
Methods inherited from class jp.go.aist.rtm.RTC.port.InPortConnector
getBuffer, id, isLittleEndian, name, profile, setEndian
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InPortPushConnector

public InPortPushConnector(ConnectorBase.ConnectorInfo profile,
                           InPortProvider provider,
                           ConnectorListeners listeners,
                           BufferBase<org.omg.CORBA.portable.OutputStream> buffer)
                    throws java.lang.Exception
Constructor

InPortPushConnector's constructor is given the following arguments. According to ConnectorInfo which includes connection information, a buffer is created. It is also given a pointer to the provider object for the InPort interface. The owner-ship of the pointer is owned by this InPortPushConnector, it has responsibility to destruct the InPortProvider. InPortPushConnector also has ConnectorListeners to provide event callback mechanisms, and they would be called at the proper timing. If data buffer is given by InPortBase, the pointer to the buffer is also given as arguments.

Parameters:
profile - ConnectorInfo
provider - InPortProvider
listeners - ConnectorListeners type lsitener object list
buffer - CdrBufferBase type buffer
Throws:
java.lang.Exception
Method Detail

setListener

public void setListener(ConnectorBase.ConnectorInfo profile,
                        ConnectorListeners listeners)
Description copied from class: InPortConnector
Set the listener.

Specified by:
setListener in class InPortConnector
Parameters:
profile - Connector information
listeners - Listener objects

read

public ReturnCode read(DataRef<org.omg.CORBA.portable.InputStream> data)
Reading data

This function reads data from the buffer. If data is read properly, this function will return PORT_OK return code. Except normal return, BUFFER_EMPTY, TIMEOUT, PRECONDITION_NOT_MET and PORT_ERROR will be returned as error codes.

Specified by:
read in class InPortConnector
Returns:
PORT_OK Normal return BUFFER_EMPTY Buffer empty TIMEOUT Timeout PRECONDITION_NOT_MET Preconditin not met PORT_ERROR Other error

disconnect

public ReturnCode disconnect()
disconnect

This operation destruct and delete the consumer, the publisher and the buffer.

Specified by:
disconnect in class InPortConnector
Returns:
ReturnCode

activate

public void activate()
Connector activation

This operation activates this connector

Specified by:
activate in class ConnectorBase

deactivate

public void deactivate()
Connector deactivation

This operation deactivates this connector

Specified by:
deactivate in class ConnectorBase

createBuffer

protected BufferBase<org.omg.CORBA.portable.OutputStream> createBuffer(ConnectorBase.ConnectorInfo profile)
create buffer

This function creates a buffer based on given information.

Parameters:
profile - Connector information
Returns:
The poitner to the buffer

onConnect

protected void onConnect()
Invoke callback when connection is established


onDisconnect

protected void onDisconnect()
Invoke callback when connection is destroied


convertReturn

protected ReturnCode convertReturn(ReturnCode status)
Converts buffer.ReturnCode into port.ReturnCode.

Parameters:
status - jp.go.aist.rtm.RTC.buffer.ReturnCode
Returns:
jp.go.aist.rtm.RTC.port.ReturnCode