OpenRTM-aist-Python 1.1.2
Public Member Functions | List of all members
OpenRTM_aist.PublisherNew.PublisherNew Class Reference

PublisherNew class. More...

Inheritance diagram for OpenRTM_aist.PublisherNew.PublisherNew:
OpenRTM_aist.PublisherBase.PublisherBase OpenRTM_aist.DataPortStatus.DataPortStatus

Public Member Functions

def __init__
 Constructor.
 
def __del__
 Destructor. More...
 
def setPushPolicy
 Setting PushPolicyvoid PublisherNew::setPushPolicy(const coil::Properties& prop)
 
def createTask
 Setting Taskbool PublisherNew::createTask(const coil::Properties& prop)
 
def init
 Initialization. More...
 
def setConsumer
 Store InPort consumer. More...
 
def setBuffer
 Setting buffer pointer. More...
 
def setListener
 Set the listener. More...
 
def write
 Write data. More...
 
def isActive
 If publisher is active state. More...
 
def activate
 activation More...
 
def deactivate
 deactivation More...
 
def svc
 Thread execution function. More...
 
def pushAll
 push all policy More...
 
def pushFifo
 push "fifo" policy More...
 
def pushSkip
 push "skip" policy More...
 
def pushNew
 push "new" policy More...
 
def convertReturn
 Convertion from BufferStatus to DataPortStatus. More...
 
def invokeListener
 Call listeners according to the DataPortStatus. More...
 
def onBufferWrite
 Notify an ON_BUFFER_WRITE event to listeners. More...
 
def onBufferFull
 Notify an ON_BUFFER_FULL event to listeners. More...
 
def onBufferWriteTimeout
 Notify an ON_BUFFER_WRITE_TIMEOUT event to listeners. More...
 
def onBufferWriteOverwrite
 Notify an ON_BUFFER_OVERWRITE event to listeners. More...
 
def onBufferRead
 Notify an ON_BUFFER_READ event to listeners. More...
 
def onSend
 Notify an ON_SEND event to listners. More...
 
def onReceived
 Notify an ON_RECEIVED event to listeners. More...
 
def onReceiverFull
 Notify an ON_RECEIVER_FULL event to listeners. More...
 
def onReceiverTimeout
 Notify an ON_RECEIVER_TIMEOUT event to listeners. More...
 
def onReceiverError
 Notify an ON_RECEIVER_ERROR event to listeners. More...
 
def onSenderError
 Notify an ON_SENDER_ERROR event to listeners. More...
 
- Public Member Functions inherited from OpenRTM_aist.PublisherBase.PublisherBase
def init
 Initializing configuration. More...
 
def setConsumer
 virtual ReturnCode setConsumer(InPortConsumer* consumer) = 0;
 
def setBuffer
 virtual ReturnCode setBuffer(BufferBase<cdrMemoryStream>* buffer) = 0;
 
def isActive
 virtual bool isActive() = 0;
 
def activate
 virtual ReturnCode activate() = 0;
 
def deactivate
 virtual ReturnCode deactivate() = 0;
 
def release
 Release the Publisher. More...
 
- Public Member Functions inherited from OpenRTM_aist.DataPortStatus.DataPortStatus
def toString
 Convert DataPortStatus into the string. More...
 

Additional Inherited Members

- Static Public Attributes inherited from OpenRTM_aist.DataPortStatus.DataPortStatus
int PORT_OK = 0
 DataPortStatus return codes. More...
 

Detailed Description

PublisherNew class.

Send new data at timing of when it is stored into the buffer. This class is used when operating Consumer that waits for the data send timing in different thread from one of the send side. Publisher's driven is blocked until the data send timing reaches, if the send timing notification is received, the Consumer's send processing will be invoked immediately.

Constructor & Destructor Documentation

def OpenRTM_aist.PublisherNew.PublisherNew.__del__ (   self)

Destructor.

Member Function Documentation

def OpenRTM_aist.PublisherNew.PublisherNew.activate (   self)

activation

This function activates the publisher. By calling this function, this publisher starts the thread that pushes data to InPort. If precondition such as initialization process and so on is not met, the error code PRECONDITION_NOT_MET is returned.

Returns
PORT_OK normal return PRECONDITION_NOT_MET precondition is not met

PublisherBase::ReturnCode PublisherNew::activate()

def OpenRTM_aist.PublisherNew.PublisherNew.convertReturn (   self,
  status,
  data 
)

Convertion from BufferStatus to DataPortStatus.

This function converts return value from the buffer to DataPortStatus::Enum typed return value. The conversion rule is as follows. Callback functions are also shown, if it exists.

  • BUFFER_OK: PORT_OK
    • None
  • BUFFER_ERROR: BUFFER_ERROR
    • None
  • BUFFER_FULL: BUFFER_FULL
  • NOT_SUPPORTED: PORT_ERROR
    • None
  • TIMEOUT: BUFFER_TIMEOUT
  • PRECONDITION_NOT_MET: PRECONDITION_NOT_MET
    • None
  • other: PORT_ERROR
    • None
Parameters
statusBufferStatus
datacdrMemoryStream
Returns
DataPortStatus typed return code

PublisherBase::ReturnCode PublisherNew::convertReturn(BufferStatus::Enum status, const cdrMemoryStream& data) BufferStatus -> DataPortStatus

BUFFER_OK -> PORT_OK BUFFER_ERROR -> BUFFER_ERROR BUFFER_FULL -> BUFFER_FULL NOT_SUPPORTED -> PORT_ERROR TIMEOUT -> BUFFER_TIMEOUT PRECONDITION_NOT_MET -> PRECONDITION_NOT_MET

def OpenRTM_aist.PublisherNew.PublisherNew.deactivate (   self)

deactivation

This function deactivates the publisher. By calling this function, this publisher stops the thread that pushes data to InPort. If precondition such as initialization process and so on is not met, the error code PRECONDITION_NOT_MET is returned.

Returns
PORT_OK normal return PRECONDITION_NOT_MET precondition is not met

PublisherBase::ReturnCode PublisherNew::deactivate()

def OpenRTM_aist.PublisherNew.PublisherNew.init (   self,
  prop 
)

Initialization.

This function have to be called before using this class object. Properties object that includes certain configuration information should be given as an argument. all, fifo, skip, new can be given as a data push policy in a value of the key "publisher.push_policy."

The following options are available.

  • thread_type: Thread type (string, default: default)
  • publisher.push_policy: Push policy (all, fifo, skip, new)
  • publisher.skip_count: The number of skip count in the "skip" policy
  • measurement.exec_time: Task execution time measurement (enable/disable)
  • measurement.exec_count: Task execution time measurement count (numerical, number of times)
  • measurement.period_time: Task period time measurement (enable/disable)
  • measurement.period_count: Task period time measurement count (number, count)
Parameters
propertyProperty objects that includes the control information of this Publisher
Returns
ReturnCode PORT_OK normal return INVALID_ARGS Properties with invalid values.

PublisherBase::ReturnCode PublisherNew::init(coil::Properties& prop)

def OpenRTM_aist.PublisherNew.PublisherNew.invokeListener (   self,
  status,
  data 
)

Call listeners according to the DataPortStatus.

Parameters
statusDataPortStatus
datacdrMemoryStream
Returns
Return code

PublisherNew::ReturnCode PublisherNew::invokeListener(DataPortStatus::Enum status, const cdrMemoryStream& data)

def OpenRTM_aist.PublisherNew.PublisherNew.isActive (   self)

If publisher is active state.

A Publisher can be activated/deactivated synchronized with the data port. The active state and the non-active state are made transition by the "activate()" and the "deactivate()" functions respectively. This function confirms if the publisher is in active state.

Returns
Result of state confirmation (Active state:true, Inactive state:false)

bool PublisherNew::isActive()

def OpenRTM_aist.PublisherNew.PublisherNew.onBufferFull (   self,
  data 
)

Notify an ON_BUFFER_FULL event to listeners.

Parameters
datacdrMemoryStream

inline void onBufferFull(const cdrMemoryStream& data)

def OpenRTM_aist.PublisherNew.PublisherNew.onBufferRead (   self,
  data 
)

Notify an ON_BUFFER_READ event to listeners.

Parameters
datacdrMemoryStream

inline void onBufferRead(const cdrMemoryStream& data)

def OpenRTM_aist.PublisherNew.PublisherNew.onBufferWrite (   self,
  data 
)

Notify an ON_BUFFER_WRITE event to listeners.

Parameters
datacdrMemoryStream

inline void onBufferWrite(const cdrMemoryStream& data)

def OpenRTM_aist.PublisherNew.PublisherNew.onBufferWriteOverwrite (   self,
  data 
)

Notify an ON_BUFFER_OVERWRITE event to listeners.

Parameters
datacdrMemoryStream

inline void onBufferWriteOverwrite(const cdrMemoryStream& data)

def OpenRTM_aist.PublisherNew.PublisherNew.onBufferWriteTimeout (   self,
  data 
)

Notify an ON_BUFFER_WRITE_TIMEOUT event to listeners.

Parameters
datacdrMemoryStream

inline void onBufferWriteTimeout(const cdrMemoryStream& data)

def OpenRTM_aist.PublisherNew.PublisherNew.onReceived (   self,
  data 
)

Notify an ON_RECEIVED event to listeners.

Parameters
datacdrMemoryStream

inline void onReceived(const cdrMemoryStream& data)

def OpenRTM_aist.PublisherNew.PublisherNew.onReceiverError (   self,
  data 
)

Notify an ON_RECEIVER_ERROR event to listeners.

Parameters
datacdrMemoryStream

inline void onReceiverError(const cdrMemoryStream& data)

def OpenRTM_aist.PublisherNew.PublisherNew.onReceiverFull (   self,
  data 
)

Notify an ON_RECEIVER_FULL event to listeners.

Parameters
datacdrMemoryStream

inline void onReceiverFull(const cdrMemoryStream& data)

def OpenRTM_aist.PublisherNew.PublisherNew.onReceiverTimeout (   self,
  data 
)

Notify an ON_RECEIVER_TIMEOUT event to listeners.

Parameters
datacdrMemoryStream

inline void onReceiverTimeout(const cdrMemoryStream& data)

def OpenRTM_aist.PublisherNew.PublisherNew.onSend (   self,
  data 
)

Notify an ON_SEND event to listners.

Parameters
datacdrMemoryStream

inline void onSend(const cdrMemoryStream& data)

def OpenRTM_aist.PublisherNew.PublisherNew.onSenderError (   self)

Notify an ON_SENDER_ERROR event to listeners.

Parameters
datacdrMemoryStream

inline void onSenderError()

def OpenRTM_aist.PublisherNew.PublisherNew.pushAll (   self)

push all policy

PublisherNew::ReturnCode PublisherNew::pushAll()

def OpenRTM_aist.PublisherNew.PublisherNew.pushFifo (   self)

push "fifo" policy

PublisherNew::ReturnCode PublisherNew::pushFifo()

def OpenRTM_aist.PublisherNew.PublisherNew.pushNew (   self)

push "new" policy

PublisherNew::ReturnCode PublisherNew::pushNew()

def OpenRTM_aist.PublisherNew.PublisherNew.pushSkip (   self)

push "skip" policy

PublisherNew::ReturnCode PublisherNew::pushSkip()

def OpenRTM_aist.PublisherNew.PublisherNew.setBuffer (   self,
  buffer 
)

Setting buffer pointer.

This operation sets a buffer that is associated with this object. If the buffer object is NULL, INVALID_ARGS will be returned.

Parameters
bufferA pointer to a CDR buffer object.
Returns
ReturnCode PORT_OK normal return INVALID_ARGS given argument has invalid value

PublisherBase::ReturnCode PublisherNew::setBuffer(CdrBufferBase* buffer)

def OpenRTM_aist.PublisherNew.PublisherNew.setConsumer (   self,
  consumer 
)

Store InPort consumer.

This operation sets a consumer that is associated with this object. If the consumer object is NULL, INVALID_ARGS will be returned.

Parameters
consumerA pointer to a consumer object.
Returns
ReturnCode PORT_OK normal return INVALID_ARGS given argument has invalid value

PublisherBase::ReturnCode PublisherNew::setConsumer(InPortConsumer* consumer)

def OpenRTM_aist.PublisherNew.PublisherNew.setListener (   self,
  info,
  listeners 
)

Set the listener.

This function sets ConnectorListeners listener object to the Publisher. By setting ConnectorListeners containing various listeners objects, these listeners are called at the time of reading and writing of a buffer, and transmission of data etc. Since the ownership of the ConnectorListeners object is owned by Port or RTObject, the Publisher never deletes the ConnectorListeners object. If the given ConnectorListeners' pointer is NULL, this function returns INVALID_ARGS.

Parameters
infoConnectorInfo that is localized object of ConnectorProfile
listenersConnectorListeners that holds various listeners
Returns
PORT_OK Normal return INVALID_ARGS Invalid arguments

virtual ReturnCode setListener(ConnectorInfo& info, ConnectorListeners* listeners);

def OpenRTM_aist.PublisherNew.PublisherNew.svc (   self)

Thread execution function.

A task execution function to be executed by coil::PeriodicTask.

int PublisherNew::svc(void)

def OpenRTM_aist.PublisherNew.PublisherNew.write (   self,
  data,
  sec,
  usec 
)

Write data.

This function writes data into the buffer associated with this Publisher. If a Publisher object calls this function, without initializing correctly such as a consumer, a buffer, listeners, etc., error code PRECONDITION_NOT_MET will be returned and no operation of the writing to a buffer etc. will be performed.

Since writing into the buffer and sending data to InPort are performed asynchronously, occasionally this function returns return-codes such as CONNECTION_LOST and BUFFER_FULL that indicate the result of sending data to InPort. In this case, writing data into buffer will not be performed.

When publisher writes data to the buffer, if the buffer is filled, returns error, is returned with timeout and returns precondition error, error codes BUFFER_FULL, BUFFER_ERROR, BUFFER_TIMEOUT and PRECONDITION_NOT_MET will be returned respectively.

In other cases, PROT_ERROR will be returned.

Parameters
dataData to be wrote to the buffer
secTimeout time in unit seconds
nsecTimeout time in unit nano-seconds
Returns
PORT_OK Normal return PRECONDITION_NO_MET Precondition does not met. A consumer, a buffer, listenes are not set properly. CONNECTION_LOST detected that the connection has been lost BUFFER_FULL The buffer is full status. BUFFER_ERROR Some kind of error occurred in the buffer. NOT_SUPPORTED Some kind of operation that is not supported has been performed. TIMEOUT Timeout occurred when writing to the buffer.

PublisherBase::ReturnCode PublisherNew::write(const cdrMemoryStream& data, unsigned long sec, unsigned long usec)


The documentation for this class was generated from the following file: