Description of the client entity
The Client
entity does not implement an interface, so all you need to do is declare the entity name in its EDL description:
Client.edl
/* Client entity description. */
entity Client
Server entity description
The description of the Server
entity must contain information stating that it implements the Ping
interface. Using static descriptions, you need to insert the implementation of the Ping
interface into the new component (for example, Ping
) and insert the instance of this component into the Server
entity.
The Server
entity contains an instance of the Ping
component:
Server.edl
/* Server entity description. */
entity Server
/* pingComp is a named instance of the Ping component. */
components {
pingComp: Ping
}
The Ping
component contains the implementation of the Ping
interface:
Ping.cdl
/* Ping component description. */
component Ping
* pingImpl is the Ping interface implementation. */
interfaces {
pingImpl: Ping
}
The Ping
package contains a declaration of the Ping
interface:
Ping.idl
/* Ping package description. */
package Ping
interface {
Ping(in UInt32 value, out UInt32 result);
}
Init description
To enable the Client
entity to call a method of the Server
entity, a connection (IPC channel) must be created between them.
To do so, in the init description indicate that the Client
and Server
entities must be started and connect them:
init.yaml
entities:
- name: Client
connections:
- target: Server
id: server_connection
- name: Server
The Server
entity is indicated as - target
, so it will perform the server entity role, meaning it will accept requests from the Client
entity and respond to them.
The created IPC channel is named server_connection
. You can obtain the handle of this channel by using the Service Locator.