Class CCommunicationControl#

Inheritance Relationships#

Base Types#

Class Documentation#

class CCommunicationControl : public sdv::CSdvObject, public sdv::IObjectControl, public sdv::com::IConnectionControl, public sdv::ps::IMarshallAccess#

Test object simulating an component isolation service implementation for channel implementation testing.

Public Functions

CCommunicationControl()#

Constructor.

virtual ~CCommunicationControl() override#

Destructor added to cleanly stop service in case process is stopped (without shutdown via repository service)

virtual void Initialize(const sdv::u8string &ssObjectConfig) override#

Initialize the object. Overload of sdv::IObjectControl::Initialize.

Parameters:

ssObjectConfig[in] Optional configuration string.

virtual sdv::EObjectStatus GetStatus() const override#

Get the current status of the object. Overload of sdv::IObjectControl::GetStatus.

Returns:

Return the current status of the object.

virtual void SetOperationMode(sdv::EOperationMode eMode) override#

Set the component operation mode. Overload of sdv::IObjectControl::SetOperationMode.

Parameters:

eMode[in] The operation mode, the component should run in.

virtual void Shutdown() override#

Shutdown called before the object is destroyed. Overload of sdv::IObjectControl::Shutdown.

virtual sdv::com::TConnectionID CreateServerConnection(sdv::com::EChannelType eChannelType, sdv::IInterfaceAccess *pObject, uint32_t uiTimeoutMs, sdv::u8string &ssConnectionString) override#

Create an IPC channel endpoint and use it for SDV communication. Overload of sdv::com::IConnectionControl::CreateServerConnection.

Remark

The channel will be destroyed automatically when a timeout occurs (no initial connection took place within the specified time).

Remark

The function doesn’t wait until a connection has been made, but returns straight after the channel creation.

Parameters:
  • eChannelType[in] Type of channel to create. Must be local or remote.

  • pObject[in] Initial object to start the communication with.

  • uiTimeoutMs[in] Timeout for waiting for a connection.

  • ssConnectionString[out] String describing the connection details to connect to this channel.

Returns:

Channel connection ID if successful or 0 if not.

virtual sdv::com::TConnectionID CreateClientConnection(const sdv::u8string &ssConnectionString, uint32_t uiTimeoutMs, sdv::IInterfaceAccess *&pProxy) override#

Connect to an SDV channel (an IPC channel managed by the channel control and waiting for an initial connection. Overload of sdv::com::IConnectionControl::CreateClientConnection.

Remark

The connection will be destroyed automatically when a timeout occurs (no initial connection took place within the specified time).

Parameters:
  • ssConnectionString[in] The string describing the connection details.

  • uiTimeoutMs[in] Timeout for waiting for a connection.

  • pProxy[out] Pointer to the object representing the remote object (a proxy to the remote object). Or nullptr when a timeout occurred.

Returns:

Channel connection ID if successful or 0 if not.

virtual sdv::com::TConnectionID AssignServerEndpoint(sdv::IInterfaceAccess *pChannelEndpoint, sdv::IInterfaceAccess *pObject, uint32_t uiTimeoutMs, bool bAllowReconnect) override#

Assign and take over an already initialized IPC channel server endpoint for use with SDV communication. Overload of sdv::com::IConnectionControl::AssignServerEndpoint.

Remark

The channel will be destroyed automatically when a timeout occurs (no initial connection took place within the specified time) unless the flag bAllowReconnect has been set.

Remark

The channel uses the interface sdv::IObjectLifetime to control the lifetime of the channel. If IObjectLifetime is not available, IObjectDestroy will be used.

Remark

The function doesn’t wait until a connection has been made, but returns straight after the assignment.

Parameters:
  • pChannelEndpoint[in] Pointer to the channel endpoint to be assigned.

  • pObject[in] Initial object to start the communication with.

  • uiTimeoutMs[in] Timeout for waiting for an initial connection. Not used when the bAllowReconnect flag has been set.

  • bAllowReconnect[in] When set, the channel is allowed to be disconnected and reconnected again.

Returns:

Channel connection ID if successful or 0 if not.

virtual sdv::com::TConnectionID AssignClientEndpoint(sdv::IInterfaceAccess *pChannelEndpoint, uint32_t uiTimeoutMs, sdv::IInterfaceAccess *&pProxy) override#

Assign and take over an already initialized IPC channel client endpoint for use with SDV communication. Overload of sdv::com::IConnectionControl::AssignClientEndpoint.

Remark

The connection will be destroyed automatically when a timeout occurs (no initial connection took place within the specified time).

Remark

The channel uses the interface sdv::IObjectLifetime to control the lifetime of the channel. If IObjectLifetime is not available, IObjectDestroy will be used.

Parameters:
  • pChannelEndpoint[in] Pointer to the channel endpoint to be assigned.

  • uiTimeoutMs[in] Timeout for waiting for an initial connection. Not used when the bAllowReconnect flag has been set.

  • pProxy[out] Pointer to the object representing the remote object (a proxy to the remote object). Or nullptr when a timeout occurred.

Returns:

Channel connection ID if successful or 0 if not.

virtual void RemoveConnection(const sdv::com::TConnectionID &tConnectionID) override#

Remove a connection with the provided connection ID. Overload of sdv::com::IConnectionControl::RemoveConnection.

Parameters:

tConnectionID[in] The connection ID of the connection to remove.

virtual sdv::interface_t GetProxy(const sdv::ps::TMarshallID &tStubID, sdv::interface_id id) override#

Get a proxy for the interface connection to the stub. Overload of sdv::ps::IMarshallAcess::GetProxy.

Parameters:
  • tStubID[in] Reference to the ID of the stub to connect to.

  • id[in] The interface ID to get the proxy for.

Returns:

Returns the interface to the proxy object.

virtual sdv::ps::TMarshallID GetStub(sdv::interface_t ifc) override#

Get a stub for the interface with the supplied ID. Overload of sdv::ps::IMarshallAcess::GetStub.

Parameters:

ifc[in] The interface to get the stub for..

Returns:

Returns the Stub ID that is assigned to the interface. Or an empty ID when no stub could be found.

std::shared_ptr<CMarshallObject> CreateProxy(sdv::interface_id id, sdv::ps::TMarshallID tStubID, CChannelConnector &rConnector)#

Create a proxy for the interface connection to the stub.

Remark

Unlike stubs, which are unique for the process they run in, proxy objects are unique within the channel they are used - using the identification of the stub ID of the process the call. The proxy object is not stored here; just created.

Parameters:
  • id[in] The ID of the interface this object marshalls the calls for.

  • tStubID[in] The stub ID this proxy is communicating to.

  • rConnector[in] Reference to channel connector.

Returns:

Returns a shared pointer to the proxy object.

std::shared_ptr<CMarshallObject> GetOrCreateStub(sdv::interface_t ifc)#

Get a stub for the interface with the supplied ID. Overload of sdv::ps::IMarshallAcess::GetStub.

Parameters:

ifc[in] The interface to get the stub for..

Returns:

Returns the Stub ID that is assigned to the interface. Or an empty ID when no stub could be found.

uint64_t CreateUniqueCallIndex()#

To identify the send and receive packets belonging to one call, the call is identified with a unique index, which is created here.

Returns:

The unique call index.

void SetConnectorContext(CChannelConnector *pConnectorContext)#

Set the channel connector context for the current thread. This is used to marshall interfaces over the same connector.

Parameters:

pConnectorContext[in] Pointer to the connector currently being used.

sdv::sequence<sdv::pointer<uint8_t>> CallStub(sdv::ps::TMarshallID tStubID, sdv::sequence<sdv::pointer<uint8_t>> &seqInputData)#

Call the stub function.

Remark

This function call is synchronous and does not return until the call has been finalized or a timeout exception has occurred.

Remark

The sequence contains all data to make the call. It is important that the data in the sequence is complete and in the correct order.

Parameters:
  • tStubID[in] ID of the stub to call.

  • seqInputData[inout] Reference to sequence of input data pointers. The first data pointer contains the marshalling header. The second contains the parameters (if available) and the others contain raw data pointers (if available). The call is allowed to change the sequence to be able to add additional information during the communication without having to copy the existing data.

Returns:

Sequence of output data pointers. The first data pointer contains the marshalling header. The second contains the return value and parameters (if available) and the others contain raw data pointers (if available).