CHAI SDK  Version 1.3
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
CPNS::IPipe Class Referenceabstract

The Pipe is used to exchange messages between two peers in bidirectional ways. More...

+ Inheritance diagram for CPNS::IPipe:
+ Collaboration diagram for CPNS::IPipe:

Public Member Functions

virtual CPNS::IBaseLocalDeviceGetDevice () const =0
 Get the related Local DeviceCHAI. More...
 
virtual void RegisterNotificationHandler (CPNS::IPipe_NotificationHandler *const pHandler)=0
 Register an Pipe notification handler. More...
 
virtual void UnregisterNotificationHandler (CPNS::IPipe_NotificationHandler *const pHandler)=0
 Unregister an Pipe notification handler. More...
 
virtual CPNS::uint16 GetPipeID () const =0
 Get the Pipe ID. More...
 
virtual CPNS::boolean IsSynapse () const =0
 Check if the Pipe is a Synapse. More...
 
virtual CPNS::boolean HasConnections ()=0
 Check if the Pipe has connections. More...
 
virtual void ClearConnections ()=0
 Clear all connections. More...
 
virtual CPNS::Enums::Errors AddConnection (CPNS::Endpoint const &peer)=0
 Add a connection There is no effect if the connection is already set for the Pipe. More...
 
virtual CPNS::Enums::Errors RemoveConnection (CPNS::Endpoint const &peer)=0
 Remove a connection. More...
 
virtual CPNS::Enums::Errors RemoveAllConnectionsExcept (CPNS::Endpoint const &peer)=0
 Remove a connection, except the specified. More...
 
virtual CPNS::uint16 GetNumConnections ()=0
 Get the number of connections. More...
 
virtual CPNS::Endpoint GetConnection (CPNS::uint16 const wConnectionIndex)=0
 Get a connection. More...
 
virtual CPNS::boolean IsReadyToSend ()=0
 Check if the Pipe is ready to send Part of the flow control sub-system. More...
 
virtual CPNS::Enums::Errors Send (CPNS::IBaseMessage const *const pMsg, CPNS::boolean const fFlush)=0
 Send a message with flush control, allowing multipart messages. More...
 
virtual CPNS::Enums::Errors Send (CPNS::IBaseMessage const *const pMsg)=0
 Send a message immediately. More...
 
virtual CPNS::Enums::Errors Flush ()=0
 Send pending messages. More...
 
virtual CPNS::Enums::Errors Signal (CPNS::uint16 const wSignalNumber, CPNS::uint16 const wOptionalData0, CPNS::uint16 const wOptionalData1, CPNS::uint16 const wOptionalData2, CPNS::uint16 const wOptionalData3, CPNS::char8 const *const utf8OptionalData, CPNS::Endpoint const &optionalEndpoint)=0
 Send a multicast signal directed to all devices present in the peer set. More...
 
virtual CPNS::Enums::Errors DataConsumed ()=0
 Tells the sources that incoming SysEx or DataTransfer message has been processed. More...
 
- Public Member Functions inherited from CPNS::IObject
virtual CPNS::ICHAIGetCHAI ()=0
 Get a pointer to the CHAI hosting this object. More...
 
virtual void RegisterObjectNotificationHandler (CPNS::IObject_NotificationHandler *const pHandler)=0
 Register an Object's notification handler. More...
 
virtual void UnregisterObjectNotificationHandler (CPNS::IObject_NotificationHandler *const pHandler)=0
 Unregister an Object's notification handler. More...
 
virtual CPNS::Enums::ObjectTypes GetObjectType () const =0
 Get the object type. More...
 
virtual CPNS::uint32 GetHandle () const =0
 Get a unique handle to the object if this object is handled by the trashcan. More...
 
virtual void SetUserDataPtr (void const *const pData)=0
 Set a custom user ptr data. More...
 
virtual void * GetUserDataPtr () const =0
 Get custom user ptr data. More...
 
virtual void SetUserDataUInt32 (const CPNS::uint32 dwData)=0
 Set a custom user uint32 data. More...
 
virtual CPNS::uint32 GetUserDataUInt32 () const =0
 Get custom user uint32 data. More...
 

Detailed Description

The Pipe is used to exchange messages between two peers in bidirectional ways.

This is a PROPRIETARY communication system to be used between two pipes knowing each others. It does not support parameter synchronization nor recording.

Member Function Documentation

virtual CPNS::Enums::Errors CPNS::IPipe::AddConnection ( CPNS::Endpoint const &  peer)
pure virtual

Add a connection There is no effect if the connection is already set for the Pipe.

Add a connection to the Pipe. The peer endpoint must point to another Pipe. Once the connection added from this side, an internal message is automatically sent to the peer in order to make it know this side and establish back communication. Both peers will be notified with other's description.

Parameters
[in]peerThis endpoint MUST point to a Pipe.
Returns
CPNS::Enums::ERR_None | CPNS::Enums::ERR_TooManyDestinations | CPNS::Enums::ERR_InvalidEndpoint
virtual void CPNS::IPipe::ClearConnections ( )
pure virtual

Clear all connections.

virtual CPNS::Enums::Errors CPNS::IPipe::DataConsumed ( )
pure virtual

Tells the sources that incoming SysEx or DataTransfer message has been processed.

If this command is not used, the sender wait for 500ms before sending next SysEx or DataTransferMessage.

virtual CPNS::Enums::Errors CPNS::IPipe::Flush ( )
pure virtual
virtual CPNS::Endpoint CPNS::IPipe::GetConnection ( CPNS::uint16 const  wConnectionIndex)
pure virtual

Get a connection.

Parameters
[in]wConnectionIndexIndex, from 0 to GetNumConnections()-1
Returns
Peer's endpoint, or empty Endpoint if wConnectionIndex is out of range
virtual CPNS::IBaseLocalDevice* CPNS::IPipe::GetDevice ( ) const
pure virtual

Get the related Local DeviceCHAI.

Returns
the local device pointer
virtual CPNS::uint16 CPNS::IPipe::GetNumConnections ( )
pure virtual

Get the number of connections.

Returns
the number of connections
virtual CPNS::uint16 CPNS::IPipe::GetPipeID ( ) const
pure virtual

Get the Pipe ID.

Returns
the Pipe ID
virtual CPNS::boolean CPNS::IPipe::HasConnections ( )
pure virtual

Check if the Pipe has connections.

Returns
TRUE if connections exists
virtual CPNS::boolean CPNS::IPipe::IsReadyToSend ( )
pure virtual

Check if the Pipe is ready to send Part of the flow control sub-system.

Returns
TRUE if a message can be sent
virtual CPNS::boolean CPNS::IPipe::IsSynapse ( ) const
pure virtual

Check if the Pipe is a Synapse.

A Synapse automatically forward incoming messages to every connected Pipes, except the message source.

Returns
TRUE if the Pipe is a Synapse
virtual void CPNS::IPipe::RegisterNotificationHandler ( CPNS::IPipe_NotificationHandler *const  pHandler)
pure virtual

Register an Pipe notification handler.

Parameters
[in]pHandlerPointer to the application object implementing IPipe_NotificationHandler. If pHandler is NULL, clear all registered handlers.
virtual CPNS::Enums::Errors CPNS::IPipe::RemoveAllConnectionsExcept ( CPNS::Endpoint const &  peer)
pure virtual

Remove a connection, except the specified.

Warning
calling this method implicitly flush before performing the action.
Parameters
[in]peerthe remote Pipe endpoint to keep connected
Returns
CPNS::Enums::ERR_None | CPNS::Enums::ERR_ItemNotFound
virtual CPNS::Enums::Errors CPNS::IPipe::RemoveConnection ( CPNS::Endpoint const &  peer)
pure virtual

Remove a connection.

Warning
calling this method implicitly flush before performing the action.
Parameters
[in]peerthe remote Pipe endpoint to be removed
Returns
CPNS::Enums::ERR_None | CPNS::Enums::ERR_ItemNotFound
virtual CPNS::Enums::Errors CPNS::IPipe::Send ( CPNS::IBaseMessage const *const  pMsg,
CPNS::boolean const  fFlush 
)
pure virtual

Send a message with flush control, allowing multipart messages.

Parameters
[in]pMsgPointer to the message to send. This message object can be released as soon this method returns.
[in]fFlushIf TRUE, the message is immediately prepared and sent, including prospective multipart messages added before. Setting fFlush at TRUE is the normal way to send a single message, or to specify the last and send the whole of a multipart message. If FALSE, the message is added to the multipart buffer, except if the buffer is full. In this case, the multipart message is sent, and a new one is created to store the new message.
Returns
CPNS::Enums::ERR_None | CPNS::Enums::ERR_SentToNotYetValidatedDestination | CPNS::Enums::ERR_NoDestination | CPNS::Enums::ERR_NotReadyToSend | CPNS::Enums::ERR_Failed | CPNS::Enums::ERR_TooManyDestinations | CPNS::Enums::ERR_TooManyRecordingDestinations
Remarks
If some destination is not yet validated, the method returns CPNS::Enums::ERR_SentToNotYetValidatedDestination. The message delivery is not guaranteed for those destinations.
virtual CPNS::Enums::Errors CPNS::IPipe::Send ( CPNS::IBaseMessage const *const  pMsg)
pure virtual

Send a message immediately.

Parameters
[in]pMsgPointer to the message to send. This message object can be released as soon this method returns.
Returns
CPNS::Enums::ERR_None | CPNS::Enums::ERR_SentToNotYetValidatedDestination | CPNS::Enums::ERR_NoDestination | CPNS::Enums::ERR_NotReadyToSend | CPNS::Enums::ERR_Failed | CPNS::Enums::ERR_TooManyDestinations | CPNS::Enums::ERR_TooManyRecordingDestinations
Remarks
If some destination is not yet validated, the method returns CPNS::Enums::ERR_SentToNotYetValidatedDestination. The message delivery is not guaranteed for those destinations.
virtual CPNS::Enums::Errors CPNS::IPipe::Signal ( CPNS::uint16 const  wSignalNumber,
CPNS::uint16 const  wOptionalData0,
CPNS::uint16 const  wOptionalData1,
CPNS::uint16 const  wOptionalData2,
CPNS::uint16 const  wOptionalData3,
CPNS::char8 const *const  utf8OptionalData,
CPNS::Endpoint const &  optionalEndpoint 
)
pure virtual

Send a multicast signal directed to all devices present in the peer set.

Only one signal per device is sent.

Remarks
This method send directed signals. So the signal number MUST have SIGB_Directed bit set
Parameters
[in]wSignalNumberStandard Signal numbers are available from CPNS::Enums::Signals
[in]wOptionalData0Optional value, depending on the signal number
[in]wOptionalData1Optional value, depending on the signal number
[in]wOptionalData2Optional value, depending on the signal number
[in]wOptionalData3Optional value, depending on the signal number
[in]utf8OptionalDataOptional value, depending on the signal number
[in]optionalEndpointOptional value, depending on the signal number
Returns
CPNS::Enums::ERR_None | CPNS::Enums::ERR_BadSignalType | CPNS::Enums::ERR_NoDestination | CPNS::Enums::ERR_TooManyDestinations | CPNS::Enums::ERR_Failed
virtual void CPNS::IPipe::UnregisterNotificationHandler ( CPNS::IPipe_NotificationHandler *const  pHandler)
pure virtual

Unregister an Pipe notification handler.

Parameters
[in]pHandlerPointer to the application object implementing IPipe_NotificationHandler. If pHandler is NULL, clear all registered handlers.