Author: Masanori Maruyama

Shall not use confluence comment, shall use Jira at https://jira.automotivelinux.org/browse/SPEC-3960

Fixed.

Table of Contents

1. Executive Summary

This document shows a design of program structure, the communication protocol, and the data of IPC between IC-Service and Cluster.

2. Indexes and tables

2.1 Change history

RevisionDateAuthorDescription
0.12021/03/22
New entry.

2.2 Referenced documents

TagDocument nameLocation of documents

IC-Service_API_rev0.4.docx

Size_list_of_Data_Pool.xlsx

IC-EG Architecture Overview - Draft_200803a.pptx

2.3. Glossary

TermMean
--

3. Scope

4. Use case

4.1. The whole system

This chapter describes the whole system including the developmental target of this document. The following picture is quoted from the system architecture, "IC-EG Architecture Overview - Draft_200803a.pptx".

The outline of the system is following:

4.2. IC-Service IPC

IC-Service IPC in the system shown in 4.1 has the following functionalities.

Components of use cases are described in the following table.

ComponentDescription
AppApp is a part of Cluster UI. App calls API functions for Cluster.
ClusterCluster is the library provides APIs to get data of IC-Service.
It provides App the signal information received from IC-Service.たb
Cluster runs as a part of App process because it is the layer called as function from App.
IPCInter Process Communication.
This part provides functionalities to communicate to send signal information from IC-Service to Cluster or the reverse.
It has data protocols and it is designed and implemented as the divertable part used by not only Cluster and IC-Service but also other domains.
IC-ServiceIC-Service is a part to have vehicle internal information.
It sends signal information to Cluster.
It runs as another process from App process.



4.2.1. Use cases of sending data through IPC

IPC enables communication between client and server. Use cases of client-server communication are shown below.


4.2.1.1. One server to one client

One server can send data to one client through IPC with one domain.


4.2.1.2. One server to multiple clients with multiple domains

One server can send data to multiple clients with different domains.

4.2.1.3. One server to multiple clients with single domain

One server can send data to multiple clients with the same domain.

4.2.1.4. Multiple server to one client with single domain

Multiple servers cannot send data to same client with the same domain.

5. Requirements

The following requirements are derived from the use cases in 4.2. and the external API specification.

6. Architectural design

Architectual design of IPC and components associated with IPC is shown below.

6.1. Design Consideration

6.1.1. Outline of IPC design

Outline of IPC design is shown below.

6.1.2. How to define data protocol

Data sent/received for each usage and Unix Domain names for communication are defined in ipc_protocol.h. When the usage of IPC divertable part is expanded, new definition of them are added to ipc_protocol.h.

The defined items in ipc_protocol.h are as follows:

6.2. External view

6.2.1. Component structure of IPC

Source and header files in the components associated with IPC is shown below.

6.2.2. Inter-component sequence of IPC

This chapter shows sequences between component elements of the architecture in 6. About APIs between App and Cluster API in the sequences, refer to the external API specification. About APIs between Cluster API or IC-Service and IPC API, refer to 7.2.

6.2.2.1. Startup/Initialization


6.2.2.2. Update DataPool

6.2.2.3. Process of getter API


6.2.2.4. Register/Notify

6.2.3. Pkg-config

IPC and Cluster API prepare pkg-config. Names of metadata files are the followings:

7. Interface definition

7.1. External API

Refer to "IC-Service_API_rev0.4.docx".

7.2. Internal API

IPC has the following internal apis. Details of the apis and how to use them in case of IC-Service are described in 8.2.1.

Function nameExplanationUserSection
ipcServerStart()Start IPC Server.Server8.2.1.1
ipcSendMessage()Send data to Client.Server8.2.1.3
ipcServerStop()Stop IPC Server.Server8.2.1.5
ipcClientStart()Start IPC Client and connect to the IPC Server which has same Domain.Client8.2.1.1
ipcReadDataPool()Read the Data Pool which stores data received from Server.Client8.2.1.4
ipcRegisterCallback()Register a callback function for notification of change of Data Pool.Client8.2.1.2
ipcClientStop()Stop IPC Client.Client8.2.1.5

7.3. Communication protocol

7.3.1. Communication protocol design

This chapter shows the communication data between IC-Service and Cluster.

7.3.1.1. Data and communication framework

7.3.1.2. Data protocol

7.3.2. Data Pool design

8. Component details

8.1. Other component

Refer to 6.2.2.

8.2. Designed component

8.2.1. Detailed design of internal APIs

8.2.1.1. IPC start for Client/Server

ipcServerStart() and ipcClientStart() are called with usage (enum) as argument. For IC-Service, these APIs are called as the following:

8.2.1.2. Callback function for Client

ipcRegisterCallback() is called with usage (enum) and callback function. It is called only by Client, which calls ipcClientStart(). If the process which does not call ipcClientStart() calls this function, it returns an error. The specified callback function is used for notification of the change of a data received from Server. For IC-Service, for example, these APIs are executed as the following:

8.2.1.3. Send message from Server

ipcSendMessage() is called with usage (enum) and sending data (address, size). It is called only by Server, which calls ipcServerStart(). If the process which does not call ipcServerStart() calls this function, it returns an error. For IC-Service, for example, these APIs are executed as the following:

8.2.1.4. Read received data by Client

ipcReadDataPool() is called with usage (enum), address to store received data and the size enough to store the received data. It is called only by Client, which calls ipcClientStart(). If the process which does not call ipcClientStart() calls this function, it returns an error. For IC-Service, for example, these APIs are executed as the following:

8.2.1.5. IPC stop for Client/Server

ipcServerStop() and ipcClientStop() are called with usage (enum) as argument. For IC-Service, these APIs are called in the following way:

8.2.2. Detection of change of data and callback notification

When Server sends data to Client, then the Client detects change of the data and call a callback function for notification of the change.

typedef void (*IPC_CHANGE_NOTIFY_CB)(void * pData, signed long size, int kind);
    - pData: an address to store a changed data
    - size: size of data
    - kind: usage of data (enum value corresponding to the usage)

8.2.3. Setting path of socket file

When ipcServerStart() is executed, a socket file for Server-Client communication is generated because of using Unix Domain Socket. This socket file is generated in the location an application for Server runs in default. However, it is possible to specify a path of the socket file by the environmental variable, which is IPC_DOMAIN_PATH. For example, If IPC_DOMAIN_PATH is set to "/tmp", the socket file for IC-Service usage is generated in the path and the name of socket file is "/tmp/ipcIcService".

8.3 Deployment view

None in particular.