summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--AUTHORS2
-rw-r--r--CMakeLists.txt39
-rw-r--r--LICENSE54
-rw-r--r--README.md138
-rw-r--r--README.md.ja138
-rw-r--r--cluster_api.pc.in11
-rw-r--r--include/cluster_api.h39
-rw-r--r--include/cluster_api_registernotify.h27
-rw-r--r--include/cluster_api_shiftposition.h54
-rw-r--r--include/cluster_api_speed.h30
-rw-r--r--include/cluster_api_tacho.h23
-rw-r--r--include/cluster_api_telltale.h111
-rw-r--r--include/cluster_api_tripcomputer.h67
-rw-r--r--src/CMakeLists.txt48
-rw-r--r--src/cluster_api.c622
-rw-r--r--src/cluster_api_internal.h67
-rw-r--r--test/client_test/CMakeLists.txt44
-rw-r--r--test/client_test/client_main.c64
-rw-r--r--test/client_test/client_test_common.c118
-rw-r--r--test/client_test/client_test_common.h41
-rw-r--r--test/client_test/client_test_init_term.c86
-rw-r--r--test/client_test/client_test_register_notify.c497
-rw-r--r--test/client_test/client_test_shiftposition.c48
-rw-r--r--test/client_test/client_test_speed.c49
-rw-r--r--test/client_test/client_test_suites.h30
-rw-r--r--test/client_test/client_test_tacho.c47
-rw-r--r--test/client_test/client_test_telltale.c149
-rw-r--r--test/client_test/client_test_tripcomputer.c85
-rw-r--r--test/client_test/dummy_server.c193
30 files changed, 2923 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ac53bc8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+build*
+cmakeBuild
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..b76a14e
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,2 @@
+N.Abe <nozo_abe@nippon-seiki.co.jp>
+M.Maruyama <mmaru@nippon-seiki.co.jp>
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..bdf2375
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,39 @@
+# Copyright (c) 2021, Nippon Seiki Co., Ltd.
+# SPDX-License-Identifier: Apache-2.0
+
+project(cluster_api C)
+
+cmake_minimum_required(VERSION 2.8)
+
+set(CLUSTER_API_LIBRARY_VERSION "1.0.0")
+
+# Name of library API
+set(TARGET_NAME cluster_api)
+
+find_package(PkgConfig)
+
+# Build option for DEBUG
+option(DEBUG_BUILD "This is debug build." OFF)
+
+# set gcc flags
+set(CMAKE_C_FLAGS "-Wall -O2")
+
+if(DEBUG_BUILD)
+ add_definitions(-DDEBUG)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
+ set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/installdir/usr CACHE PATH "..." FORCE)
+endif()
+
+include(GNUInstallDirs)
+
+# Subdirectories
+add_subdirectory(src)
+if(DEBUG_BUILD)
+ add_subdirectory(test/client_test)
+endif()
+
+configure_file(cluster_api.pc.in cluster_api.pc @ONLY)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cluster_api.pc
+ DESTINATION
+ ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..31c692a
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,54 @@
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+ You must give any other recipients of the Work or Derivative Works a copy of this License; and
+ You must cause any modified files to carry prominent notices stating that You changed the files; and
+ You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+ If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..3edb589
--- /dev/null
+++ b/README.md
@@ -0,0 +1,138 @@
+# IC service Cluster API
+
+## Overview
+
+This repository has 3 main elements:
+
+* Cluster API library code: ./src ./include
+* Test app for client: ./test/client_test
+
+## How to build
+
+```bash
+# ipc library is required by cluster_api, so please check ipc library and headers are installed in the system.
+$ ./buildtest.sh
+```
+
+## How to run
+
+* For client_test
+
+```bash
+$ ./buildtest.sh -d
+$ cd cmakeBuild/test/client_test
+$ ./client_test
+
+
+ CUnit - A Unit testing framework for C - Version 2.1-2
+ http://cunit.sourceforge.net/
+
+
+***************** CUNIT CONSOLE - MAIN MENU ******************************
+(R)un (S)elect (L)ist (A)ctivate (F)ailures (O)ptions (H)elp (Q)uit
+Enter command: ★(r)to run all test automatically ★(q)to terminate
+```
+
+# Source configuration
+
+- cluster_api/
+ - include/
+ - Set of external public headers
+ - src/
+ - cluster_api Library of implementation source
+ - test/
+ - client_test/
+ - Cluster API Test environment of implementation source
+
+# Build Configuration
+
+When ./buildtest.sh run, Build shows as follow:
+
+- cluster_api/
+ - cmakeBuild/
+ - src/
+ - The library of Cluster API as follows:
+ ```bash
+ libcluster_api.so -> libcluster_api.so.1
+ libcluster_api.so.1 -> libcluster_api.so.1.0.0
+ libcluster_api.so.1.0.0
+ ```
+ - test/
+ - client_test/
+ - Cluster API Test running files
+ ```bash
+ client_test
+ dummy_server
+ ```
+
+# Cluster API Implementation Content
+
+- API function which becomes I/F for application Implemented according to IC-Service_API_rev0.4.docx.
+- The main implementation of the process is to manage the data sent from the IC-Service server. When calling API from the application, extract only the relevant data from the managed data.
+- In addition to IC-Service_API_rev0.4.docx, the following two APIs have also been implemented:
+ - bool clusterInit(void)
+ - Initialization process for using the Cluster API.
+ - This API connects to the IC-Service server, assuming that the server has already started.
+ - Return true bool value if processing successfully.
+ - bool clusterTerm(void)
+ - Termination Cluster API Process.
+ - Used to disconnect from the IC-Service server.
+ - Return true bool value if processing successfully.
+- Applications that include cluster_api.h and link with libcluster_api.so can call every API.
+
+# client_test Test content
+
+Implement operation tests for every API of Cluster API. The configuration is as follows:
+
+- The test configures two executable files; client_test and dummy_server:
+ - client_test: Cluster API Test Body
+ - dummy_server: Mock IC-Service server used for Cluster API testing
+- When executing the test, only execute client_test.
+- dummy_server is automatically started within client_test.
+- The wait time for dummy_server to start and for dummy_server to send is 10 msec.
+ (Since it is asynchronous with another process, it does not work as intended without waiting all time)
+- client_test is an automated test program implemented using CUnit. All item tests and unit item tests are both possible according to CUnit specifications.
+- ※ The test may rarely fail due to the timing of inter-process communication.
+(Test all 156 items 20 times, return 1 item FAIL)
+
+Implementation of items test is as follows:
+
+1. InitAndTerm (5 Items)
+ - Verify that clusterInit() and clusterTerm() work as intended:
+ - Verify the operation when calling clusterInit(), and clusterTerm() sequentially、in the state of the IC-Service server exists (normal system).
+ - Verify that an error occurs due to an incorrect API call order:
+ - Call clusterInit() 2 times.
+ - Call clusterInit() then, call clusterTerm() 2 times.
+ - Without calling clusterInit(), call clusterTerm().
+ - Verify an error occurs when calling clusterInit()、in the state of the IC-Service server does not exist.
+2. Telltale (52 Items)
+ - Verify every API can obtain intended value as described in 3-4 Telltale of IC-Service_API_rev0.4.docx:
+ - Each API Implemented one pattern at a time.
+3. ShiftPosition (2 Items)
+ - Verify every API can obtain intended value as described in 3-5 ShiftPosition of IC-Service_API_rev0.4.docx:
+ - Each API Implemented one pattern at a time.
+4. Speed (2 Items)
+ - Verify every API can obtain intended value as described in 3-6 Speed of IC-Service_API_rev0.4.docx:
+ - Each API Implemented one pattern at a time.
+5. Tacho (1 Item)
+ - Verify every API can obtain intended value as described in 3-7 Tacho of IC-Service_API_rev0.4.docx:
+ - Each API Implemented one pattern at a time.
+6. TripComputer (20 Items)
+ - Verify every API can obtain intended value as described in 3-8 TripComputer of IC-Service_API_rev0.4.docx:
+ - Each API Implemented one pattern at a time.
+7. RegisterAndNotify (74 Items)
+ - Verify registerIcHmi() in 3-9 Register/Notify of IC-Service_API_rev0.4.docx works as intended:
+ - In the 1st argument arg_1, if IC_HMI_TT_ALL test assigned:
+ - Verify that the callback function is called whenever any of the 34 signals changed as described in 3-2-1 TellTale.
+ - Verify that the callback function is not called if none of the 34 signals have changed as described in 3-2-1 TellTale.
+ - Verify that the callback function is not called even if other signals than 34 signals have changed as described in 3-2-1 TellTale.
+ - In the 1st argument arg_1, If 0 assigned: Verify the callback function is not called even any of the 34 signals changed as described in 3-2-1 TellTale.
+ - In the 1st argument arg_1, if other flags than the following flags 3-2-1-1~3-2-1-34 are set: Verify the callback function is not called when any of the 34 signals changed as described in 3-2-1 TellTale.
+ - In the 2nd argument addr, if NULL assigned: Verify that an error occurs.
+ - In the 1st argument arg_1, if 3-2-1-1~3-2-1-34 are assigned set values. The following two procedures are implemented:
+ - Verify that the callback function is called only when the signal corresponding to the assigned flag is changed.
+ - Verify that the callback function is not called; even the other 33 signals changed.
+ - In the 1st argument arg_1, if one flag from 3-2-1-1~3-2-1-34 is assigned clear value. The following two procedures are implemented:
+ - Verify that the callback function is not called even if the signal corresponding to the cleared flag changed.
+ - Verify that there is no callback notification for an incorrectly cleared flag; even the other 33 signals changed.
+ (Callback notification for other signal changes occur)
diff --git a/README.md.ja b/README.md.ja
new file mode 100644
index 0000000..f83891a
--- /dev/null
+++ b/README.md.ja
@@ -0,0 +1,138 @@
+# IC service Cluster API
+
+## Overview
+
+This repository has 3 main elements:
+
+* Cluster API library code: ./src ./include
+* Test app for client: ./test/client_test
+
+## How to build
+
+```bash
+# ipc library is required by cluster_api, so please check ipc library and headers are installed in the system.
+$ ./buildtest.sh
+```
+
+## How to run
+
+* For client_test
+
+```bash
+$ ./buildtest.sh -d
+$ cd cmakeBuild/test/client_test
+$ ./client_test
+
+
+ CUnit - A Unit testing framework for C - Version 2.1-2
+ http://cunit.sourceforge.net/
+
+
+***************** CUNIT CONSOLE - MAIN MENU ******************************
+(R)un (S)elect (L)ist (A)ctivate (F)ailures (O)ptions (H)elp (Q)uit
+Enter command: ★rを入力すると全テスト自動実行。 ★q入力で終了
+```
+
+# ソース構成
+
+- cluster_api/
+ - include/
+ - 外部公開ヘッダ一式
+ - src/
+ - cluster_apiライブラリ実装ソース
+ - test/
+ - client_test/
+ - Cluster APIテスト環境実装ソース
+
+# 生成物構成
+
+以下、./buildtest.sh を実行した場合の生成物を示す。
+
+- cluster_api/
+ - cmakeBuild/
+ - src/
+ - 以下、Cluster APIのライブラリ
+ ```bash
+ libcluster_api.so -> libcluster_api.so.1
+ libcluster_api.so.1 -> libcluster_api.so.1.0.0
+ libcluster_api.so.1.0.0
+ ```
+ - test/
+ - client_test/
+ - Cluster APIテスト実行ファイル
+ ```bash
+ client_test
+ dummy_server
+ ```
+
+# Cluster API実装内容
+
+- アプリ向けのI/FとなるAPI関数は IC-Service_API_rev0.4.docx の通りに実装した。
+- 主な実装処理は、IC-Service用サーバから送信されたデータを管理しておき、アプリからAPIが呼ばれたら、管理しているデータから該当データだけを取り出すこと。
+- IC-Service_API_rev0.4.docx に加え、以下の2つのAPIを追加実装した。
+ - bool clusterInit(void)
+ - Cluster APIを使用するための初期化処理。
+ - このAPIによりIC-Service用のサーバと接続するので、サーバが起動済みであることが前提。
+ - 処理成功時をtrueとしたbool値を返す。
+ - bool clusterTerm(void)
+ - Cluster API終了処理。
+ - IC-Service用サーバとの接続を切断するために使用。
+ - 処理成功時をtrueとしたbool値を返す。
+- アプリはcluster_api.hをincludeし、libcluster_api.soとリンクすることで、各種APIを呼び出すことが可能となる。
+
+# client_test テスト内容
+
+Cluster APIの各種APIに対する動作テストを実施する。構成は以下の通り。
+
+- テストは実行ファイルclient_testとdummy_serverの2つで構成される。
+ - client_test : Cluster APIテスト本体
+ - dummy_server : Cluster APIテストに使用する疑似IC-Serviceサーバ
+- テスト実行時はclient_testだけ実行すれば良い。
+- dummy_serverはclient_test内から自動で起動される。
+- dummy_serverの起動待ち、dummy_serverからの送信待ちについては10msecとしている。
+ (別プロセスで非同期であることから、全く待ちがないと意図通りに動作しない)
+- client_testはCUnitを用いて実装した自動テストプログラムである。CUnitの仕様通り全項目テスト、単体項目テスト、いずれも可能である。
+- ※プロセス間通信のタイミングの関係上、稀にテストがFAILすることがある。
+(テスト全156項目を20周繰り返して1項目FAILする程度)
+
+実施するテスト項目については以下の通り。
+
+1. InitAndTerm (5項目)
+ - clusterInit()とclusterTerm()が意図通り動作することを確認する。
+ - IC-Service用サーバが存在する状態でclusterInit()とclusterTerm()を順に呼ぶ時の動作を確認する(正常系)
+ - APIの呼び出し順誤りでエラーになることを確認する。
+ - clusterInit()2連続呼び出し。
+ - clusterInit()後、clusterTerm()を2連続呼び出し。
+ - clusterInit()を呼ばずにclusterTerm()を呼び出し。
+ - IC-Service用サーバが存在しない状態でのclusterInit()呼び出しでエラーになることを確認する。
+2. Telltale (52項目)
+ - IC-Service_API_rev0.4.docx の 3-4 Telltale に記載されている各種APIで意図通りの値が取得できることを確認する。
+ - 各API 1パターンずつ実施。
+3. ShiftPosition (2項目)
+ - IC-Service_API_rev0.4.docx の 3-5 ShiftPosition に記載されている各種APIで意図通りの値が取得できることを確認する。
+ - 各API 1パターンずつ実施。
+4. Speed (2項目)
+ - IC-Service_API_rev0.4.docx の 3-6 Speed に記載されている各種APIで意図通りの値が取得できることを確認する。
+ - 各API 1パターンずつ実施。
+5. Tacho (1項目)
+ - IC-Service_API_rev0.4.docx の 3-7 Tacho に記載されている各種APIで意図通りの値が取得できることを確認する。
+ - 各API 1パターンずつ実施。
+6. TripComputer (20項目)
+ - IC-Service_API_rev0.4.docx の 3-8 TripComputer に記載されている各種APIで意図通りの値が取得できることを確認する。
+ - 各API 1パターンずつ実施。
+7. RegisterAndNotify (74項目)
+ - IC-Service_API_rev0.4.docx の 3-9 Register/Notify にある registerIcHmi()の動作が意図通りであることを確認する。
+ - 第1引数 arg_1 に IC_HMI_TT_ALL を指定した時のテスト。
+ - 3-2-1 TellTaleに記載された34種のどのシグナルが変化してもコールバック関数が呼ばれることを確認する。
+ - 3-2-1 TellTaleに記載された34種いずれのシグナルも変化していなければコールバック関数が呼ばれないことを確認する。
+ - 3-2-1 TellTaleに記載された34種のシグナル以外が変化してもコールバック関数が呼ばれないことを確認する。
+ - 第1引数 arg_1 に 0 を指定した場合に、3-2-1 TellTaleに記載された34種のどのシグナルが変化してもコールバック関数が呼ばれないことを確認する。
+ - 第1引数 arg_1 に 3-2-1-1~3-2-1-34 に示されたフラグ以外全てをセットした場合に、3-2-1 TellTaleに記載された34種のどのシグナルが変化してもコールバック関数が呼ばれないことを確認する。
+ - 第2引数 addr にNULLが指定された場合にエラーとなることを確認する。
+ - 第1引数 arg_1 に 3-2-1-1~3-2-1-34 のいずれか1つをセットした値を指定した場合について以下の2つを実施する。
+ - 指定したフラグに該当するシグナルが変化した時だけコールバック関数が呼ばれることを確認する。
+ - 他の33種のシグナルが変化してもコールバック関数が呼ばれないことを確認する。
+ - 第1引数 arg_1 に 3-2-1-1~3-2-1-34 のいずれか1つのフラグだけクリアした値を指定した場合について以下の2つを実施する。
+ - クリアしたフラグに該当するシグナルが変化しても、コールバック関数が呼ばれないことを確認する。
+ - 他の33種のシグナルが変化しても、誤ってクリアしたフラグに関するコールバック通知が行われないことを確認する。
+ (他のシグナル変化へのコールバック通知は行われること)
diff --git a/cluster_api.pc.in b/cluster_api.pc.in
new file mode 100644
index 0000000..0384465
--- /dev/null
+++ b/cluster_api.pc.in
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
+
+Name: @TARGET_NAME@
+Description: cluster api library using ipc library
+Version: @CLUSTER_API_LIBRARY_VERSION@
+
+Requires:cluster_ipc
+Cflags: -I${includedir}
+Libs: -L${libdir} -lcluster_api
diff --git a/include/cluster_api.h b/include/cluster_api.h
new file mode 100644
index 0000000..39e0367
--- /dev/null
+++ b/include/cluster_api.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef CLUSTER_API_H
+#define CLUSTER_API_H
+
+typedef enum {
+ IC_HMI_OFF = 0,
+ IC_HMI_ON,
+} IC_HMI_ON_OFF;
+
+#include <cluster_api_telltale.h>
+#include <cluster_api_shiftposition.h>
+#include <cluster_api_speed.h>
+#include <cluster_api_tacho.h>
+#include <cluster_api_tripcomputer.h>
+#include <cluster_api_registernotify.h>
+
+bool clusterInit(void);
+bool clusterTerm(void);
+
+// Callback function pointer type
+typedef void (*IC_HMI_FUNC_NOTIFY_IC_HMI)(unsigned long long arg_1, IC_HMI_ON_OFF arg_2);
+
+#endif // CLUSTER_API_H
diff --git a/include/cluster_api_registernotify.h b/include/cluster_api_registernotify.h
new file mode 100644
index 0000000..6340977
--- /dev/null
+++ b/include/cluster_api_registernotify.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef CLUSTER_API_REGISTERNOTIFY_H
+#define CLUSTER_API_REGISTERNOTIFY_H
+
+#include <stdbool.h>
+
+typedef void(* IC_HMI_FUNC_NOTIFY_IC_HMI)(unsigned long long arg_1, IC_HMI_ON_OFF arg_2);
+
+bool registerIcHmi(unsigned long long arg_1, IC_HMI_FUNC_NOTIFY_IC_HMI addr);
+
+#endif // CLUSTER_API_REGISTERNOTIFY_H
diff --git a/include/cluster_api_shiftposition.h b/include/cluster_api_shiftposition.h
new file mode 100644
index 0000000..6cf7b08
--- /dev/null
+++ b/include/cluster_api_shiftposition.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef CLUSTER_API_SHIFTPOSITION_H
+#define CLUSTER_API_SHIFTPOSITION_H
+
+typedef enum
+{
+ IC_HMI_AT_OFF = 0,
+ IC_HMI_AT_PARKING,
+ IC_HMI_AT_REVERSE,
+ IC_HMI_AT_NEUTRAL,
+ IC_HMI_AT_DRIVE,
+ IC_HMI_AT_SECOND,
+ IC_HMI_AT_LOW_GEAR,
+ IC_HMI_AT_FIRST,
+ IC_HMI_AT_MANUAL,
+ IC_HMI_AT_BRAKE,
+ IC_HMI_AT_ALL_ON,
+ IC_HMI_AT_ALL_OFF,
+ IC_HMI_AT_UNUSED,
+} IC_HMI_GEAR_AT_VAL;
+
+typedef enum
+{
+ IC_HMI_MT_OFF = 0,
+ IC_HMI_MT_FIRST,
+ IC_HMI_MT_SECOND,
+ IC_HMI_MT_THIRD,
+ IC_HMI_MT_FOURTH,
+ IC_HMI_MT_FIFTH,
+ IC_HMI_MT_SIXTH,
+ IC_HMI_MT_SEVENTH,
+ IC_HMI_MT_EIGHTTH,
+} IC_HMI_GEAR_MT_VAL;
+
+IC_HMI_GEAR_AT_VAL getGearAtVal(void);
+IC_HMI_GEAR_MT_VAL getGearMtVal(void);
+
+#endif // CLUSTER_API_SHIFTPOSITION_H
diff --git a/include/cluster_api_speed.h b/include/cluster_api_speed.h
new file mode 100644
index 0000000..bb4d1ec
--- /dev/null
+++ b/include/cluster_api_speed.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef CLUSTER_API_SPEED_H
+#define CLUSTER_API_SPEED_H
+
+typedef enum
+{
+ IC_HMI_SP_KM_H = 0,
+ IC_HMI_SP_MPH = 1,
+} IC_HMI_SP_UNIT_VAL;
+
+unsigned long getSpAnalogVal(void);
+IC_HMI_SP_UNIT_VAL getSpAnaDigUnitVal(void);
+
+#endif // CLUSTER_API_SPEED_H
diff --git a/include/cluster_api_tacho.h b/include/cluster_api_tacho.h
new file mode 100644
index 0000000..f8a2a2c
--- /dev/null
+++ b/include/cluster_api_tacho.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef CLUSTER_API_TACHO_H
+#define CLUSTER_API_TACHO_H
+
+unsigned long getTaAnalogVal(void);
+
+#endif // CLUSTER_API_TACHO_H \ No newline at end of file
diff --git a/include/cluster_api_telltale.h b/include/cluster_api_telltale.h
new file mode 100644
index 0000000..ac318ac
--- /dev/null
+++ b/include/cluster_api_telltale.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef CLUSTER_API_TELLTALE_H
+#define CLUSTER_API_TELLTALE_H
+
+// Signal flags
+#define IC_HMI_TT_TURN_R 0x0000000000000001ULL
+#define IC_HMI_TT_TURN_L 0x0000000000000002ULL
+#define IC_HMI_TT_BRAKE 0x0000000000000004ULL
+#define IC_HMI_TT_SEATBELT 0x0000000000000008ULL
+#define IC_HMI_TT_HIGHBEAM 0x0000000000000010ULL
+#define IC_HMI_TT_DOOR 0x0000000000000020ULL
+#define IC_HMI_TT_EPS 0x0000000000000040ULL
+#define IC_HMI_TT_SRS_AIRBAG 0x0000000000000080ULL
+#define IC_HMI_TT_ABS 0x0000000000000100ULL
+#define IC_HMI_TT_LOW_BATTERY 0x0000000000000200ULL
+#define IC_HMI_TT_OIL_PRESS 0x0000000000000400ULL
+#define IC_HMI_TT_ENGINE 0x0000000000000800ULL
+#define IC_HMI_TT_FUEL 0x0000000000001000ULL
+#define IC_HMI_TT_IMMOBI 0x0000000000002000ULL
+#define IC_HMI_TT_TM_FAIL 0x0000000000004000ULL
+#define IC_HMI_TT_ESP_ACT 0x0000000000008000ULL
+#define IC_HMI_TT_ESP_OFF 0x0000000000010000ULL
+#define IC_HMI_TT_ADAPTING_LIGHTING 0x0000000000020000ULL
+#define IC_HMI_TT_AUTO_STOP 0x0000000000040000ULL
+#define IC_HMI_TT_AUTO_STOP_FAIL 0x0000000000080000ULL
+#define IC_HMI_TT_PARKING_LIGHTS 0x0000000000100000ULL
+#define IC_HMI_TT_FRONT_FOG 0x0000000000200000ULL
+#define IC_HMI_TT_EXTERIOR_LIGHT_FAULT 0x0000000000400000ULL
+#define IC_HMI_TT_ACC_FAIL 0x0000000000800000ULL
+#define IC_HMI_TT_LDW_OFF 0x0000000001000000ULL
+#define IC_HMI_TT_HILL_DESCENT 0x0000000002000000ULL
+#define IC_HMI_TT_AUTO_HI_BEAM_GREEN 0x0000000004000000ULL
+#define IC_HMI_TT_AUTO_HI_BEAM_AMBER 0x0000000008000000ULL
+#define IC_HMI_TT_LDW_OPERATE 0x0000000010000000ULL
+#define IC_HMI_TT_GENERAL_WARN 0x0000000020000000ULL
+#define IC_HMI_TT_SPORTS_MODE 0x0000000040000000ULL
+#define IC_HMI_TT_DRIVING_POWER_MODE 0x0000000080000000ULL
+#define IC_HMI_TT_HOT_TEMP 0x0000000100000000ULL
+#define IC_HMI_TT_LOW_TEMP 0x0000000200000000ULL
+#define IC_HMI_TT_ALL 0xFFFFFFFFFFFFFFFFULL
+
+IC_HMI_ON_OFF getTurnR(void);
+IC_HMI_ON_OFF getTurnL(void);
+IC_HMI_ON_OFF getBrake(void);
+IC_HMI_ON_OFF getSeatbelt(void);
+IC_HMI_ON_OFF getFrontRightSeatbelt(void);
+IC_HMI_ON_OFF getFrontCenterSeatbelt(void);
+IC_HMI_ON_OFF getFrontLeftSeatbelt(void);
+IC_HMI_ON_OFF getMid1RightSeatbelt(void);
+IC_HMI_ON_OFF getMid1CenterSeatbelt(void);
+IC_HMI_ON_OFF getMid1LeftSeatbelt(void);
+IC_HMI_ON_OFF getMid2RightSeatbelt(void);
+IC_HMI_ON_OFF getMid2CenterSeatbelt(void);
+IC_HMI_ON_OFF getMid2LeftSeatbelt(void);
+IC_HMI_ON_OFF getRearRightSeatbelt(void);
+IC_HMI_ON_OFF getRearCenterSeatbelt(void);
+IC_HMI_ON_OFF getRearLeftSeatbelt(void);
+IC_HMI_ON_OFF getHighbeam(void);
+IC_HMI_ON_OFF getDoor(void);
+IC_HMI_ON_OFF getFrontRightDoor(void);
+IC_HMI_ON_OFF getFrontLeftDoor(void);
+IC_HMI_ON_OFF getRearRightDoor(void);
+IC_HMI_ON_OFF getRearLeftDoor(void);
+IC_HMI_ON_OFF getTrunkDoor(void);
+IC_HMI_ON_OFF getHoodDoor(void);
+IC_HMI_ON_OFF getEps(void);
+IC_HMI_ON_OFF getSrsAirbag(void);
+IC_HMI_ON_OFF getAbs(void);
+IC_HMI_ON_OFF getLowBattery(void);
+IC_HMI_ON_OFF getOilPress(void);
+IC_HMI_ON_OFF getEngine(void);
+IC_HMI_ON_OFF getFuel(void);
+IC_HMI_ON_OFF getImmobi(void);
+IC_HMI_ON_OFF getTMFail(void);
+IC_HMI_ON_OFF getEspAct(void);
+IC_HMI_ON_OFF getEspOff(void);
+IC_HMI_ON_OFF getAdaptingLighting(void);
+IC_HMI_ON_OFF getAutoStop(void);
+IC_HMI_ON_OFF getAutoStopFail(void);
+IC_HMI_ON_OFF getParkingLights(void);
+IC_HMI_ON_OFF getFrontFog(void);
+IC_HMI_ON_OFF getExteriorLightFault(void);
+IC_HMI_ON_OFF getAccFail(void);
+IC_HMI_ON_OFF getLdwOff(void);
+IC_HMI_ON_OFF getHillDescent(void);
+IC_HMI_ON_OFF getAutoHiBeamGreen(void);
+IC_HMI_ON_OFF getAutoHiBeamAmber(void);
+IC_HMI_ON_OFF getSportsMode(void);
+IC_HMI_ON_OFF getLdwOperate(void);
+IC_HMI_ON_OFF getGeneralWarn(void);
+IC_HMI_ON_OFF getDriverPowerMode(void);
+IC_HMI_ON_OFF getHotTemp(void);
+IC_HMI_ON_OFF getLowTemp(void);
+
+#endif // CLUSTER_API_TELLTALE_H
diff --git a/include/cluster_api_tripcomputer.h b/include/cluster_api_tripcomputer.h
new file mode 100644
index 0000000..d723646
--- /dev/null
+++ b/include/cluster_api_tripcomputer.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef CLUSTER_API_TRIPCOMPUTER_H
+#define CLUSTER_API_TRIPCOMPUTER_H
+
+typedef enum
+{
+ IC_HMI_TRCOM_KM = 0,
+ IC_HMI_TRCOM_MILE = 1,
+} IC_HMI_TRCOM_UNIT_VAL;
+
+typedef enum
+{
+ IC_HMI_FUEL_KM_L = 0,
+ IC_HMI_FUEL_MPG_US,
+ IC_HMI_FUEL_MPG_IG,
+ IC_HMI_FUEL_L_100KM,
+ IC_HMI_FUEL_MILE_KWH,
+ IC_HMI_FUEL_KM_KWH,
+ IC_HMI_FUEL_MILE_KG,
+ IC_HMI_FUEL_KM_KG,
+ IC_HMI_FUEL_KWH_100KM,
+} IC_HMI_FUEL_ECONOMY_UNIT_VAL;
+
+typedef enum
+{
+ IC_HMI_OTEMP_UNIT_C = 0,
+ IC_HMI_OTEMP_UNIT_K = 1,
+} IC_HMI_OTEMP_UNIT_VAL;
+
+unsigned long getTrcomTripAVal(void);
+unsigned long getTrcomTripBVal(void);
+unsigned long getTrcomOdoVal(void);
+IC_HMI_TRCOM_UNIT_VAL getTrcomUnitVal(void);
+unsigned short getAvgSpeedAVal(void);
+unsigned short getAvgSpeedBVal(void);
+unsigned short getHourAVal(void);
+unsigned short getHourBVal(void);
+unsigned char getMinuteAVal(void);
+unsigned char getMinuteBVal(void);
+unsigned char getSecondAVal(void);
+unsigned char getSecondBVal(void);
+signed short getOTempVal(void);
+IC_HMI_OTEMP_UNIT_VAL getOTempUnitVal(void);
+unsigned short getCruRangeVal(void);
+unsigned short getAvgFuelAVal(void);
+unsigned short getAvgFuelBVal(void);
+unsigned short getInsFuelAVal(void);
+unsigned short getInsFuelBVal(void);
+IC_HMI_FUEL_ECONOMY_UNIT_VAL getFuelEconomyUnitVal(void);
+
+#endif // CLUSTER_API_TRIPCOMPUTER_H
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..ecb9aea
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,48 @@
+# Copyright (c) 2021, Nippon Seiki Co., Ltd.
+# SPDX-License-Identifier: Apache-2.0
+
+# Define project Targets
+add_library(${TARGET_NAME} SHARED
+ cluster_api.c
+)
+
+pkg_check_modules(IPC REQUIRED cluster_ipc)
+
+# Include directories
+target_include_directories(${TARGET_NAME} PRIVATE
+ ./
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+ $<BUILD_INTERFACE:${IPC_INCLUDE_DIRS}>
+ $<INSTALL_INTERFACE:/include>
+)
+
+# find thread library
+find_package(Threads REQUIRED)
+target_link_libraries(${TARGET_NAME} INTERFACE
+ Threads::Threads
+ ${IPC_LIBRARIES})
+
+set_target_properties(${TARGET_NAME}
+ PROPERTIES
+ VERSION ${CLUSTER_API_LIBRARY_VERSION}
+ SOVERSION 1
+)
+
+set(CLUSTER_API_HEADERS
+ ../include/cluster_api.h ../include/cluster_api_registernotify.h
+ ../include/cluster_api_shiftposition.h
+ ../include/cluster_api_speed.h
+ ../include/cluster_api_tacho.h
+ ../include/cluster_api_telltale.h
+ ../include/cluster_api_tripcomputer.h
+ )
+
+# make install
+install(
+ TARGETS ${TARGET_NAME}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
+)
+
+install (
+ FILES ${CLUSTER_API_HEADERS} DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}
+)
diff --git a/src/cluster_api.c b/src/cluster_api.c
new file mode 100644
index 0000000..e47a9ba
--- /dev/null
+++ b/src/cluster_api.c
@@ -0,0 +1,622 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdbool.h>
+
+#include <cluster_ipc.h>
+
+#include <cluster_api.h>
+#include <cluster_api_internal.h>
+
+static IPC_DATA_IC_SERVICE_S gAllSigData;
+static unsigned long long gRegisteredSignals = 0x0000000000000000ULL;
+static IC_HMI_FUNC_NOTIFY_IC_HMI gNotifyIcHmiCB;
+
+static IPC_RET_E clusterClientStart(void);
+static IPC_RET_E clusterReadDataPool(void);
+static IPC_RET_E clusterRegisterCallback(void);
+static IPC_RET_E clusterClientStop(void);
+static void notifyCheck(void* pData, signed int size, int kind);
+
+// == Internal functions ==
+static IPC_RET_E clusterClientStart(void)
+{
+ IPC_RET_E ret;
+
+ ret = ipcClientStart(IPC_USAGE_TYPE_IC_SERVICE);
+ E_CHECK(ret == IPC_RET_OK, ret, end);
+
+end:
+ return ret;
+}
+
+static IPC_RET_E clusterRegisterCallback(void)
+{
+ IPC_RET_E ret;
+
+ ret = ipcRegisterCallback(IPC_USAGE_TYPE_IC_SERVICE, &notifyCheck);
+ E_CHECK(ret == IPC_RET_OK, ret, end);
+
+end:
+ return ret;
+}
+
+static void notifyCheck(void* pData, signed int size, int kind)
+{
+ IC_HMI_ON_OFF data = 0;
+
+ if (gNotifyIcHmiCB == NULL) {
+ return;
+ }
+
+ // If signal is registered, notify IC HMI
+ if (gSigTable[kind] == (gSigTable[kind] & gRegisteredSignals))
+ {
+ memcpy(&data, pData, size);
+ gNotifyIcHmiCB(gSigTable[kind], data);
+ }
+}
+
+static IPC_RET_E clusterClientStop(void)
+{
+ IPC_RET_E ret;
+
+ ret = ipcClientStop(IPC_USAGE_TYPE_IC_SERVICE);
+ E_CHECK(ret == IPC_RET_OK, ret, end);
+
+ end:
+ return ret;
+}
+
+static IPC_RET_E clusterReadDataPool()
+{
+ IPC_RET_E ret;
+ int sigDataSize = sizeof(gAllSigData);
+
+ ret = ipcReadDataPool(IPC_USAGE_TYPE_IC_SERVICE, &gAllSigData, &sigDataSize);
+ E_CHECK(ret == IPC_RET_OK, ret, end);
+ E_CHECK(sigDataSize == sizeof(gAllSigData), sigDataSize, end);
+
+ ret = IPC_RET_OK;
+
+end:
+ return ret;
+}
+
+// == API functions for apps ==
+// === Initialize/Terminate ===
+bool clusterInit(void)
+{
+ bool ret = false;
+ IPC_RET_E rc;
+
+ memset(&gAllSigData, 0x00, sizeof(gAllSigData));
+ gRegisteredSignals = 0x0000000000000000ULL;
+ gNotifyIcHmiCB = NULL;
+
+ rc = clusterClientStart();
+ E_CHECK(rc == IPC_RET_OK, rc, end);
+
+ rc = clusterRegisterCallback();
+ E_CHECK(rc == IPC_RET_OK, rc, end);
+
+ ret = true;
+end:
+ return ret;
+}
+
+bool clusterTerm(void)
+{
+ bool ret = false;
+ IPC_RET_E rc;
+
+ rc = clusterClientStop();
+ E_CHECK(rc == IPC_RET_OK, rc, end);
+
+ memset(&gAllSigData, 0x00, sizeof(gAllSigData));
+ gRegisteredSignals = 0x0000000000000000ULL;
+ gNotifyIcHmiCB = NULL;
+
+ ret = true;
+end:
+ return ret;
+}
+
+// === Register/Notify ===
+bool registerIcHmi(unsigned long long arg_1, IC_HMI_FUNC_NOTIFY_IC_HMI addr)
+{
+ if (addr == NULL) {
+ return false;
+ }
+
+ gNotifyIcHmiCB = addr;
+ gRegisteredSignals = (gRegisteredSignals | arg_1);
+
+ return true;
+}
+
+
+// === Telltale ===
+IC_HMI_ON_OFF getTurnR(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.turnR;
+}
+
+IC_HMI_ON_OFF getTurnL(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.turnL;
+}
+
+IC_HMI_ON_OFF getBrake(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.brake;
+}
+
+IC_HMI_ON_OFF getSeatbelt(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.seatbelt;
+}
+
+IC_HMI_ON_OFF getFrontRightSeatbelt(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.frontRightSeatbelt;
+}
+
+IC_HMI_ON_OFF getFrontCenterSeatbelt(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.frontCenterSeatbelt;
+}
+
+IC_HMI_ON_OFF getFrontLeftSeatbelt(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.frontLeftSeatbelt;
+}
+
+IC_HMI_ON_OFF getMid1RightSeatbelt(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.mid1RightSeatbelt;
+}
+
+IC_HMI_ON_OFF getMid1CenterSeatbelt(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.mid1CenterSeatbelt;
+}
+
+IC_HMI_ON_OFF getMid1LeftSeatbelt(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.mid1LeftSeatbelt;
+}
+
+IC_HMI_ON_OFF getMid2RightSeatbelt(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.mid2RightSeatbelt;
+}
+
+IC_HMI_ON_OFF getMid2CenterSeatbelt(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.mid2CenterSeatbelt;
+}
+
+IC_HMI_ON_OFF getMid2LeftSeatbelt(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.mid2LeftSeatbelt;
+}
+
+IC_HMI_ON_OFF getRearRightSeatbelt(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.rearRightSeatbelt;
+}
+
+IC_HMI_ON_OFF getRearCenterSeatbelt(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.rearCenterSeatbelt;
+}
+
+IC_HMI_ON_OFF getRearLeftSeatbelt(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.rearLeftSeatbelt;
+}
+
+IC_HMI_ON_OFF getHighbeam(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.highbeam;
+}
+
+IC_HMI_ON_OFF getDoor(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.door;
+}
+
+IC_HMI_ON_OFF getFrontRightDoor(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.frontRightDoor;
+}
+
+IC_HMI_ON_OFF getFrontLeftDoor(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.frontLeftDoor;
+}
+
+IC_HMI_ON_OFF getRearRightDoor(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.rearRightDoor;
+}
+
+IC_HMI_ON_OFF getRearLeftDoor(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.rearLeftDoor;
+}
+
+IC_HMI_ON_OFF getTrunkDoor(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.trunkDoor;
+}
+
+IC_HMI_ON_OFF getHoodDoor(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.hoodDoor;
+}
+
+IC_HMI_ON_OFF getEps(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.eps;
+}
+
+IC_HMI_ON_OFF getSrsAirbag(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.srsAirbag;
+}
+
+IC_HMI_ON_OFF getAbs(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.abs;
+}
+
+IC_HMI_ON_OFF getLowBattery(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.lowBattery;
+}
+
+IC_HMI_ON_OFF getOilPress(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.oilPress;
+}
+
+IC_HMI_ON_OFF getEngine(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.engine;
+}
+
+IC_HMI_ON_OFF getFuel(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.fuel;
+}
+
+IC_HMI_ON_OFF getImmobi(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.immobi;
+}
+
+IC_HMI_ON_OFF getTMFail(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.tmFail;
+}
+
+IC_HMI_ON_OFF getEspAct(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.espAct;
+}
+
+IC_HMI_ON_OFF getEspOff(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.espOff;
+}
+
+IC_HMI_ON_OFF getAdaptingLighting(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.adaptingLighting;
+}
+
+IC_HMI_ON_OFF getAutoStop(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.autoStop;
+}
+
+IC_HMI_ON_OFF getAutoStopFail(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.autoStopFail;
+}
+
+IC_HMI_ON_OFF getParkingLights(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.parkingLights;
+}
+
+IC_HMI_ON_OFF getFrontFog(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.frontFog;
+}
+
+IC_HMI_ON_OFF getExteriorLightFault(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.exteriorLightFault;
+}
+
+IC_HMI_ON_OFF getAccFail(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.accFail;
+}
+
+IC_HMI_ON_OFF getLdwOff(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.ldwOff;
+}
+
+IC_HMI_ON_OFF getHillDescent(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.hillDescent;
+}
+
+IC_HMI_ON_OFF getAutoHiBeamGreen(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.autoHiBeamGreen;
+}
+
+IC_HMI_ON_OFF getAutoHiBeamAmber(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.autoHiBeamAmber;
+}
+
+IC_HMI_ON_OFF getSportsMode(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.sportsMode;
+}
+
+IC_HMI_ON_OFF getLdwOperate(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.ldwOperate;
+}
+
+IC_HMI_ON_OFF getGeneralWarn(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.generalWarn;
+}
+
+IC_HMI_ON_OFF getDriverPowerMode(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.drivingPowerMode;
+}
+
+IC_HMI_ON_OFF getHotTemp(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.hotTemp;
+}
+
+IC_HMI_ON_OFF getLowTemp(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.lowTemp;
+}
+
+// === TripComputer ===
+unsigned long getTrcomTripAVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.trcomTripAVal;
+}
+
+unsigned long getTrcomTripBVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.trcomTripBVal;
+}
+
+unsigned long getTrcomOdoVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.trcomOdoVal;
+}
+
+IC_HMI_TRCOM_UNIT_VAL getTrcomUnitVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.trcomUnitVal;
+}
+
+unsigned short getAvgSpeedAVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.avgSpeedAVal;
+}
+
+unsigned short getAvgSpeedBVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.avgSpeedBVal;
+}
+
+unsigned short getHourAVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.hourAVal;
+}
+
+unsigned short getHourBVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.hourBVal;
+}
+
+unsigned char getMinuteAVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.minuteAVal;
+}
+
+unsigned char getMinuteBVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.minuteBVal;
+}
+
+unsigned char getSecondAVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.secondAVal;
+}
+
+unsigned char getSecondBVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.secondBVal;
+}
+
+signed short getOTempVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.oTempVal;
+}
+
+IC_HMI_OTEMP_UNIT_VAL getOTempUnitVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.oTempUnitVal;
+}
+
+unsigned short getCruRangeVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.cruRangeVal;
+}
+
+unsigned short getAvgFuelAVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.avgFuelAVal;
+}
+
+unsigned short getAvgFuelBVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.avgFuelBVal;
+}
+
+unsigned short getInsFuelAVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.insFuelAVal;
+}
+
+unsigned short getInsFuelBVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.insFuelBVal;
+}
+
+IC_HMI_FUEL_ECONOMY_UNIT_VAL getFuelEconomyUnitVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.fuelEconomyUnitVal;
+}
+
+// === ShiftPosition ===
+IC_HMI_GEAR_AT_VAL getGearAtVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.gearAtVal;
+}
+
+IC_HMI_GEAR_MT_VAL getGearMtVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.gearMtVal;
+}
+
+// === Speed ===
+unsigned long getSpAnalogVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.spAnalogVal;
+}
+
+IC_HMI_SP_UNIT_VAL getSpAnaDigUnitVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.spAnaDigUnitVal;
+}
+
+// === Tacho ===
+unsigned long getTaAnalogVal(void)
+{
+ clusterReadDataPool();
+ return gAllSigData.taAnalogVal;
+}
+
diff --git a/src/cluster_api_internal.h b/src/cluster_api_internal.h
new file mode 100644
index 0000000..c9174ae
--- /dev/null
+++ b/src/cluster_api_internal.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef CLUSTER_API_INTERNAL_H
+#define CLUSTER_API_INTERNAL_H
+
+#define E_CHECK(condition, value, label) \
+ do { \
+ if (!(condition)) { \
+ printf("%s:%d ERROR:%s %s:%d\n", __func__, __LINE__, #condition, #value, (int)value); \
+ goto label; \
+ } \
+ } while(0)
+
+// Table with signal bits (defined to fit IPC_KIND_IC_SERVICE_E from ipc_protocol.h)
+const unsigned long long gSigTable[] = {
+ IC_HMI_TT_TURN_R,
+ IC_HMI_TT_TURN_L,
+ IC_HMI_TT_BRAKE,
+ IC_HMI_TT_SEATBELT,
+ IC_HMI_TT_HIGHBEAM,
+ IC_HMI_TT_DOOR,
+ IC_HMI_TT_EPS,
+ IC_HMI_TT_SRS_AIRBAG,
+ IC_HMI_TT_ABS,
+ IC_HMI_TT_LOW_BATTERY,
+ IC_HMI_TT_OIL_PRESS,
+ IC_HMI_TT_ENGINE,
+ IC_HMI_TT_FUEL,
+ IC_HMI_TT_IMMOBI,
+ IC_HMI_TT_TM_FAIL,
+ IC_HMI_TT_ESP_ACT,
+ IC_HMI_TT_ESP_OFF,
+ IC_HMI_TT_ADAPTING_LIGHTING,
+ IC_HMI_TT_AUTO_STOP,
+ IC_HMI_TT_AUTO_STOP_FAIL,
+ IC_HMI_TT_PARKING_LIGHTS,
+ IC_HMI_TT_FRONT_FOG,
+ IC_HMI_TT_EXTERIOR_LIGHT_FAULT,
+ IC_HMI_TT_ACC_FAIL,
+ IC_HMI_TT_LDW_OFF,
+ IC_HMI_TT_HILL_DESCENT,
+ IC_HMI_TT_AUTO_HI_BEAM_GREEN,
+ IC_HMI_TT_AUTO_HI_BEAM_AMBER,
+ IC_HMI_TT_LDW_OPERATE,
+ IC_HMI_TT_GENERAL_WARN,
+ IC_HMI_TT_SPORTS_MODE,
+ IC_HMI_TT_DRIVING_POWER_MODE,
+ IC_HMI_TT_HOT_TEMP,
+ IC_HMI_TT_LOW_TEMP
+};
+
+#endif // CLUSTER_API_INTERNAL_H
diff --git a/test/client_test/CMakeLists.txt b/test/client_test/CMakeLists.txt
new file mode 100644
index 0000000..49b1224
--- /dev/null
+++ b/test/client_test/CMakeLists.txt
@@ -0,0 +1,44 @@
+# Copyright (c) 2021, Nippon Seiki Co., Ltd.
+# SPDX-License-Identifier: Apache-2.0
+
+cmake_minimum_required(VERSION 2.8)
+
+pkg_check_modules(IPC REQUIRED cluster_ipc)
+
+# use the variable <RESULTNAME>_INCLUDE_DIRS to get include paths
+include_directories(
+ ${IPC_INCLUDE_DIRS}
+ ../../include
+ )
+
+# Define project Targets
+set(CLIENT_TEST_BINARY_NAME client_test)
+add_executable(${CLIENT_TEST_BINARY_NAME}
+ client_main.c
+ client_test_common.c
+ client_test_init_term.c
+ client_test_telltale.c
+ client_test_shiftposition.c
+ client_test_speed.c
+ client_test_tacho.c
+ client_test_tripcomputer.c
+ client_test_register_notify.c
+ )
+
+# use the variable <RESULTNAME>_LIBRARIES to get library paths
+target_link_libraries(${CLIENT_TEST_BINARY_NAME}
+ ${IPC_LIBRARIES}
+ ${TARGET_NAME}
+ pthread
+ cunit
+ )
+
+# Define project Targets
+set(DUMMY_SERVER_BINARY_NAME dummy_server)
+add_executable(${DUMMY_SERVER_BINARY_NAME} dummy_server.c)
+
+target_link_libraries(${DUMMY_SERVER_BINARY_NAME}
+ ${IPC_LIBRARIES}
+ pthread
+ )
+
diff --git a/test/client_test/client_main.c b/test/client_test/client_main.c
new file mode 100644
index 0000000..b4736c0
--- /dev/null
+++ b/test/client_test/client_main.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Test program for IC-service IPC inplementation
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <CUnit/CUnit.h>
+#include <CUnit/Console.h>
+
+#include <cluster_ipc.h>
+#include <cluster_api.h>
+
+#include "client_test_common.h"
+#include "client_test_suites.h"
+
+int main(int argc, char *argv[])
+{
+ pid_t child;
+
+ setenv(IPC_ENV_DOMAIN_SOCKET_PATH, IPC_TEST_DOMAIN_PATH, 1);
+
+ setExeFilePath(argv[0]);
+ if ((child = fork()) < 0) {
+ fprintf(stderr, "client_main:%d Failed to fork() : %d\n", __LINE__, child);
+ exit(EXIT_FAILURE);
+ }
+
+ startDummyServer(child);
+ connectToDummyServer();
+
+ CU_initialize_registry();
+
+ SetTestSuiteInitAndTerm();
+ SetTestSuiteTelltale();
+ SetTestSuiteShiftPosition();
+ SetTestSuiteSpeed();
+ SetTestSuiteTacho();
+ SetTestSuiteTripComputer();
+ SetTestSuiteRegisterAndNotify();
+
+ CU_console_run_tests();
+
+ CU_cleanup_registry();
+
+ stopDummyServer();
+
+ return 0;
+}
diff --git a/test/client_test/client_test_common.c b/test/client_test/client_test_common.c
new file mode 100644
index 0000000..3b1418a
--- /dev/null
+++ b/test/client_test/client_test_common.c
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#include <cluster_api.h>
+
+#include "client_test_common.h"
+
+#define CLUSTER_TEST_WAIT_TIME (10000)
+
+static int g_dummyServerFd = -1;
+static char g_dummyServerExeFilePath[256];
+
+void setExeFilePath(const char *exeFilePath)
+{
+ char *pCh;
+
+ // dummy_server in the same path as client_test.
+ strcpy(g_dummyServerExeFilePath, exeFilePath);
+ pCh = strrchr(g_dummyServerExeFilePath, '/');
+ pCh = pCh != NULL ? pCh + 1: g_dummyServerExeFilePath;
+ strcpy(pCh, "dummy_server");
+}
+
+void startDummyServer(pid_t child)
+{
+ if (child == 0) {
+ int rc;
+ char *argv[2] = {NULL, NULL};
+
+ argv[0] = g_dummyServerExeFilePath;
+
+ rc = execv(argv[0], argv);
+ if (rc < 0) {
+ ERRNO_LOG(execv);
+ }
+ }
+ else {
+ usleep(CLUSTER_TEST_WAIT_TIME);
+ }
+}
+
+void stopDummyServer(void)
+{
+ if (g_dummyServerFd >= 0) {
+ shutdown(g_dummyServerFd, SHUT_RDWR);
+ close(g_dummyServerFd);
+ }
+ unlink(CLUSTER_TEST_SENDDATA_FILE);
+ sleep(1);
+}
+
+void connectToDummyServer(void)
+{
+ int rc;
+ int fd;
+ struct sockaddr_un unixAddr;
+ int len;
+
+ fd = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (fd < 0) {
+ ERRNO_LOG(socket);
+ return;
+ }
+ unixAddr.sun_family = AF_UNIX;
+ strcpy(unixAddr.sun_path, CLUSTER_TEST_DOMAIN_PATH);
+ len = sizeof(unixAddr.sun_family)+strlen(unixAddr.sun_path);
+ rc = connect(fd, (struct sockaddr *)&unixAddr, len);
+ if (rc != 0) {
+ ERRNO_LOG(connect);
+ shutdown(fd, SHUT_RDWR);
+ close(fd);
+ return;
+ }
+
+ g_dummyServerFd = fd;
+}
+
+void requestSendData(IPC_DATA_IC_SERVICE_S *pSendData)
+{
+ FILE *fp = NULL;
+ int dummy = 1;
+ int size;
+
+ fp = fopen(CLUSTER_TEST_SENDDATA_FILE, "wb");
+ if (fp != NULL) {
+ size = fwrite(pSendData, 1, sizeof(IPC_DATA_IC_SERVICE_S), fp);
+ if (size < sizeof(IPC_DATA_IC_SERVICE_S)) {
+ ERRNO_LOG(fwrite);
+ }
+ fclose(fp);
+
+ size = write(g_dummyServerFd, &dummy, sizeof(dummy));
+ if (size < 0) {
+ ERRNO_LOG(write);
+ }
+ usleep(CLUSTER_TEST_WAIT_TIME);
+ }
+}
+
diff --git a/test/client_test/client_test_common.h b/test/client_test/client_test_common.h
new file mode 100644
index 0000000..89c164f
--- /dev/null
+++ b/test/client_test/client_test_common.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef CLIENT_TEST_COMMON_H
+#define CLIENT_TEST_COMMON_H
+
+#include <unistd.h>
+#include <cluster_ipc.h>
+
+#define IPC_TEST_DOMAIN_PATH "./"
+
+#define CLUSTER_TEST_DOMAIN_PATH "cluster_test_domain"
+#define CLUSTER_TEST_SENDDATA_FILE "cluster_test.dat"
+
+#define ERRNO_LOG(func) \
+ do { \
+ perror(#func "()"); \
+ fprintf(stderr, "%s:%d Failed to %s()\n", __FILE__, __LINE__, #func); \
+ }while(0)
+
+void setExeFilePath(const char *exeFilePath);
+void startDummyServer(pid_t child);
+void stopDummyServer(void);
+void connectToDummyServer(void);
+void requestSendData(IPC_DATA_IC_SERVICE_S *pSendData);
+
+#endif // CLIENT_TEST_COMMON_H
diff --git a/test/client_test/client_test_init_term.c b/test/client_test/client_test_init_term.c
new file mode 100644
index 0000000..e698ef5
--- /dev/null
+++ b/test/client_test/client_test_init_term.c
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <CUnit/CUnit.h>
+
+#include <cluster_api.h>
+
+#include "client_test_common.h"
+
+// OK case. Calling the APIs of Init and Term while the server is already started.
+static void TestInitAndTermOK(void)
+{
+ CU_ASSERT(clusterInit() == true);
+ CU_ASSERT(clusterTerm() == true);
+}
+
+// NG case. Call the API of Init function twice.
+static void TestInitAndTermNG1(void)
+{
+ CU_ASSERT(clusterInit() == true);
+ CU_ASSERT(clusterInit() == false);
+ CU_ASSERT(clusterTerm() == true);
+}
+
+// NG case. Call the API of Term function twice.
+static void TestInitAndTermNG2(void)
+{
+ CU_ASSERT(clusterInit() == true);
+ CU_ASSERT(clusterTerm() == true);
+ CU_ASSERT(clusterTerm() == false);
+}
+
+// NG case. Call the API of Term only.
+static void TestInitAndTermNG3(void)
+{
+ CU_ASSERT(clusterTerm() == false);
+}
+
+// NG case. Server is not ready.
+static void TestInitAndTermNG4(void)
+{
+ pid_t child;
+
+ stopDummyServer();
+ CU_ASSERT(clusterInit() == false);
+ CU_ASSERT(clusterTerm() == false);
+
+ if ((child = fork()) < 0) {
+ fprintf(stderr, "%s:%d Failed to fork() : %d\n", __FILE__, __LINE__, child);
+ exit(EXIT_FAILURE);
+ }
+
+ startDummyServer(child);
+ connectToDummyServer();
+}
+
+void SetTestSuiteInitAndTerm(void)
+{
+ CU_pSuite testSuite;
+
+ testSuite = CU_add_suite("InitAndTerm", NULL, NULL);
+ CU_add_test(testSuite, "InitAndTerm_OK", TestInitAndTermOK);
+ CU_add_test(testSuite, "InitAndTerm_NG_1", TestInitAndTermNG1);
+ CU_add_test(testSuite, "InitAndTerm_NG_2", TestInitAndTermNG2);
+ CU_add_test(testSuite, "InitAndTerm_NG_3", TestInitAndTermNG3);
+ CU_add_test(testSuite, "InitAndTerm_NG_4", TestInitAndTermNG4);
+}
+
diff --git a/test/client_test/client_test_register_notify.c b/test/client_test/client_test_register_notify.c
new file mode 100644
index 0000000..7b2f280
--- /dev/null
+++ b/test/client_test/client_test_register_notify.c
@@ -0,0 +1,497 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string.h>
+#include <stdbool.h>
+
+#include <CUnit/CUnit.h>
+
+#include <cluster_api.h>
+
+#include "client_test_common.h"
+
+typedef struct {
+ IC_HMI_ON_OFF value;
+ bool isCallbacked;
+ const unsigned long long flag;
+ const char *name;
+} CLUSTER_TEST_CB_STORE_TABLE_S;
+
+#define CLUSTER_TEST_DECLARE_STORE_UNIT(flag) \
+ {IC_HMI_OFF, false, flag, #flag}
+
+static CLUSTER_TEST_CB_STORE_TABLE_S g_cbStoreTable[] = {
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_TURN_R),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_TURN_L),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_BRAKE),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_SEATBELT),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_HIGHBEAM),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_DOOR),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_EPS),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_SRS_AIRBAG),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_ABS),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_LOW_BATTERY),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_OIL_PRESS),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_ENGINE),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_FUEL),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_IMMOBI),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_TM_FAIL),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_ESP_ACT),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_ESP_OFF),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_ADAPTING_LIGHTING),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_AUTO_STOP),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_AUTO_STOP_FAIL),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_PARKING_LIGHTS),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_FRONT_FOG),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_EXTERIOR_LIGHT_FAULT),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_ACC_FAIL),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_LDW_OFF),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_HILL_DESCENT),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_AUTO_HI_BEAM_GREEN),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_AUTO_HI_BEAM_AMBER),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_LDW_OPERATE),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_GENERAL_WARN),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_SPORTS_MODE),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_DRIVING_POWER_MODE),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_HOT_TEMP),
+ CLUSTER_TEST_DECLARE_STORE_UNIT(IC_HMI_TT_LOW_TEMP)
+};
+
+static bool g_isCalledCallback = false;
+
+#define CLUSTER_TEST_STORE_TABLE_SIZE (sizeof(g_cbStoreTable)/sizeof(g_cbStoreTable[0]))
+
+static void cleanStoreTable(void)
+{
+ int i;
+
+ for (i = 0; i < CLUSTER_TEST_STORE_TABLE_SIZE; i++) {
+ g_cbStoreTable[i].value = 0;
+ g_cbStoreTable[i].isCallbacked = false;
+ }
+}
+
+static bool checkValueFromStoreTable(const unsigned long long flag,
+ const bool expectedIsCallbacked,
+ const IC_HMI_ON_OFF expectedOnOff)
+{
+ bool ret = true;
+ int i;
+
+ for (i = 0; i < CLUSTER_TEST_STORE_TABLE_SIZE; i++) {
+ if (flag == g_cbStoreTable[i].flag) {
+ if (g_cbStoreTable[i].isCallbacked != expectedIsCallbacked) {
+ ret = false;
+ fprintf(stderr, "%s:%d [%s] isCallbacked == %d is false\n", __FILE__, __LINE__, g_cbStoreTable[i].name, expectedIsCallbacked);
+ }
+
+ if (expectedIsCallbacked == true && g_cbStoreTable[i].value != expectedOnOff) {
+ ret = false;
+ fprintf(stderr, "%s:%d [%s] value == %d is false\n", __FILE__, __LINE__, g_cbStoreTable[i].name, expectedOnOff);
+ }
+ return ret;
+ }
+ }
+
+ return false;
+}
+
+static void sendDataAllSet(IPC_DATA_IC_SERVICE_S *pSendData, IC_HMI_ON_OFF onOff)
+{
+ pSendData->turnR = onOff;
+ pSendData->turnL = onOff;
+ pSendData->brake = onOff;
+ pSendData->seatbelt = onOff;
+ pSendData->highbeam = onOff;
+ pSendData->door = onOff;
+ pSendData->eps = onOff;
+ pSendData->srsAirbag = onOff;
+ pSendData->abs = onOff;
+ pSendData->lowBattery = onOff;
+ pSendData->oilPress = onOff;
+ pSendData->engine = onOff;
+ pSendData->fuel = onOff;
+ pSendData->immobi = onOff;
+ pSendData->tmFail = onOff;
+ pSendData->espAct = onOff;
+ pSendData->espOff = onOff;
+ pSendData->adaptingLighting = onOff;
+ pSendData->autoStop = onOff;
+ pSendData->autoStopFail = onOff;
+ pSendData->parkingLights = onOff;
+ pSendData->frontFog = onOff;
+ pSendData->exteriorLightFault = onOff;
+ pSendData->accFail = onOff;
+ pSendData->ldwOff = onOff;
+ pSendData->hillDescent = onOff;
+ pSendData->autoHiBeamGreen = onOff;
+ pSendData->autoHiBeamAmber = onOff;
+ pSendData->ldwOperate = onOff;
+ pSendData->generalWarn = onOff;
+ pSendData->sportsMode = onOff;
+ pSendData->drivingPowerMode = onOff;
+ pSendData->hotTemp = onOff;
+ pSendData->lowTemp = onOff;
+}
+
+static void notifyIcHmi(unsigned long long arg_1, IC_HMI_ON_OFF arg_2)
+{
+ int i;
+
+ g_isCalledCallback = true;
+
+ for (i = 0; i < sizeof(g_cbStoreTable) / sizeof(g_cbStoreTable[0]); i++) {
+ if ((arg_1 & g_cbStoreTable[i].flag) == g_cbStoreTable[i].flag) {
+ g_cbStoreTable[i].value = arg_2;
+ g_cbStoreTable[i].isCallbacked = true;
+ }
+ }
+}
+
+static void TestregisterIcHmi_ALL_DifferentData() {
+ unsigned long long arg_1;
+ IPC_DATA_IC_SERVICE_S sendData;
+ int i;
+
+ CU_ASSERT(clusterInit() == true);
+
+ cleanStoreTable();
+ g_isCalledCallback = false;
+
+ arg_1 = IC_HMI_TT_ALL;
+ CU_ASSERT(registerIcHmi(arg_1, notifyIcHmi) == true);
+
+ CU_ASSERT(g_isCalledCallback == false);
+
+ memset(&sendData, 0x00, sizeof(sendData));
+ sendDataAllSet(&sendData, IC_HMI_ON);
+ requestSendData(&sendData);
+
+ CU_ASSERT(g_isCalledCallback == true);
+ for (i = 0; i < CLUSTER_TEST_STORE_TABLE_SIZE; i++) {
+ CU_ASSERT(checkValueFromStoreTable(g_cbStoreTable[i].flag, true, IC_HMI_ON) == true);
+ }
+
+ g_isCalledCallback = false;
+ sendDataAllSet(&sendData, IC_HMI_OFF);
+ requestSendData(&sendData);
+
+ CU_ASSERT(g_isCalledCallback == true);
+ for (i = 0; i < CLUSTER_TEST_STORE_TABLE_SIZE; i++) {
+ CU_ASSERT(checkValueFromStoreTable(g_cbStoreTable[i].flag, true, IC_HMI_OFF) == true);
+ }
+
+ CU_ASSERT(clusterTerm() == true);
+}
+
+static void TestregisterIcHmi_ALL_SameData() {
+ unsigned long long arg_1;
+ IPC_DATA_IC_SERVICE_S sendData;
+
+ CU_ASSERT(clusterInit() == true);
+
+ cleanStoreTable();
+ g_isCalledCallback = false;
+
+ arg_1 = IC_HMI_TT_ALL;
+ CU_ASSERT(registerIcHmi(arg_1, notifyIcHmi) == true);
+
+ CU_ASSERT(g_isCalledCallback == false);
+
+ // Send the data "different" from initial value.
+ memset(&sendData, 0x00, sizeof(sendData));
+ sendDataAllSet(&sendData, IC_HMI_OFF);
+ requestSendData(&sendData);
+
+ CU_ASSERT(g_isCalledCallback == false);
+
+ g_isCalledCallback = false;
+ sendDataAllSet(&sendData, IC_HMI_OFF);
+ requestSendData(&sendData);
+
+ CU_ASSERT(g_isCalledCallback == false);
+
+ CU_ASSERT(clusterTerm() == true);
+}
+
+static void TestregisterIcHmi_NullFunc() {
+ unsigned long long arg_1;
+
+ CU_ASSERT(clusterInit() == true);
+
+ arg_1 = IC_HMI_TT_ALL;
+ CU_ASSERT(registerIcHmi(arg_1, NULL) == false);
+
+ CU_ASSERT(clusterTerm() == true);
+}
+
+static void TestregisterIcHmi_ALL_OFF() {
+ unsigned long long arg_1;
+ IPC_DATA_IC_SERVICE_S sendData;
+
+ CU_ASSERT(clusterInit() == true);
+
+ cleanStoreTable();
+ g_isCalledCallback = false;
+
+ arg_1 = 0ULL;
+ CU_ASSERT(registerIcHmi(arg_1, notifyIcHmi) == true);
+
+ CU_ASSERT(g_isCalledCallback == false);
+
+ memset(&sendData, 0x00, sizeof(sendData));
+ sendDataAllSet(&sendData, IC_HMI_ON);
+ requestSendData(&sendData);
+
+ CU_ASSERT(g_isCalledCallback == false);
+
+ g_isCalledCallback = false;
+ sendDataAllSet(&sendData, IC_HMI_OFF);
+ requestSendData(&sendData);
+
+ CU_ASSERT(g_isCalledCallback == false);
+
+ CU_ASSERT(clusterTerm() == true);
+}
+
+static void TestregisterIcHmi_ALL_UnrelatedParams(void)
+{
+ unsigned long long arg_1;
+ IPC_DATA_IC_SERVICE_S sendData;
+
+ CU_ASSERT(clusterInit() == true);
+
+ cleanStoreTable();
+ g_isCalledCallback = false;
+
+ arg_1 = IC_HMI_TT_ALL;
+ CU_ASSERT(registerIcHmi(arg_1, notifyIcHmi) == true);
+
+ CU_ASSERT(g_isCalledCallback == false);
+
+ memset(&sendData, 0x01, sizeof(sendData));
+ sendDataAllSet(&sendData, IC_HMI_OFF);
+ requestSendData(&sendData);
+
+ CU_ASSERT(g_isCalledCallback == false);
+
+ g_isCalledCallback = false;
+ memset(&sendData, 0x00, sizeof(sendData));
+ sendDataAllSet(&sendData, IC_HMI_OFF);
+ requestSendData(&sendData);
+
+ CU_ASSERT(g_isCalledCallback == false);
+
+ CU_ASSERT(clusterTerm() == true);
+}
+
+static void TestregisterIcHmi_Set_UnusedFlag(void)
+{
+ unsigned long long arg_1;
+ IPC_DATA_IC_SERVICE_S sendData;
+ int i;
+
+ CU_ASSERT(clusterInit() == true);
+
+ cleanStoreTable();
+ g_isCalledCallback = false;
+
+ arg_1 = IC_HMI_TT_ALL;
+ for (i = 0; i < CLUSTER_TEST_STORE_TABLE_SIZE; i++) {
+ arg_1 &= ~(g_cbStoreTable[i].flag);
+ }
+ CU_ASSERT(registerIcHmi(arg_1, notifyIcHmi) == true);
+
+ CU_ASSERT(g_isCalledCallback == false);
+
+ memset(&sendData, 0x00, sizeof(sendData));
+ sendDataAllSet(&sendData, IC_HMI_ON);
+ requestSendData(&sendData);
+
+ CU_ASSERT(g_isCalledCallback == false);
+
+ g_isCalledCallback = false;
+ sendDataAllSet(&sendData, IC_HMI_OFF);
+ requestSendData(&sendData);
+
+ CU_ASSERT(g_isCalledCallback == false);
+
+ CU_ASSERT(clusterTerm() == true);
+}
+
+#define REGISTER_NOTIFY_TEST_FUNC(flag, param) \
+ static void TestregisterIcHmi_ON_ ##flag(void) \
+ { \
+ unsigned long long arg_1; \
+ IPC_DATA_IC_SERVICE_S sendData; \
+ \
+ CU_ASSERT(clusterInit() == true); \
+ \
+ cleanStoreTable(); \
+ g_isCalledCallback = false; \
+ \
+ arg_1 = IC_HMI_ ##flag; \
+ CU_ASSERT(registerIcHmi(arg_1, notifyIcHmi) == true); \
+ \
+ CU_ASSERT(g_isCalledCallback == false); \
+ \
+ memset(&sendData, 0x00, sizeof(sendData)); \
+ sendDataAllSet(&sendData, IC_HMI_ON); \
+ sendData.param = IC_HMI_OFF; \
+ requestSendData(&sendData); \
+ \
+ CU_ASSERT(g_isCalledCallback == false); \
+ \
+ g_isCalledCallback = false; \
+ sendData.param = IC_HMI_ON; \
+ requestSendData(&sendData); \
+ \
+ CU_ASSERT(g_isCalledCallback == true); \
+ CU_ASSERT(checkValueFromStoreTable(IC_HMI_ ##flag, true, IC_HMI_ON) == true); \
+ \
+ g_isCalledCallback = false; \
+ sendData.param = IC_HMI_OFF; \
+ requestSendData(&sendData); \
+ \
+ CU_ASSERT(g_isCalledCallback == true); \
+ CU_ASSERT(checkValueFromStoreTable(IC_HMI_ ##flag, true, IC_HMI_OFF) == true); \
+ \
+ CU_ASSERT(clusterTerm() == true); \
+ } \
+ static void TestregisterIcHmi_OFF_ ##flag(void) \
+ { \
+ unsigned long long arg_1; \
+ IPC_DATA_IC_SERVICE_S sendData; \
+ \
+ CU_ASSERT(clusterInit() == true); \
+ \
+ cleanStoreTable(); \
+ g_isCalledCallback = false; \
+ \
+ arg_1 = IC_HMI_TT_ALL & ~IC_HMI_ ##flag; \
+ CU_ASSERT(registerIcHmi(arg_1, notifyIcHmi) == true); \
+ \
+ CU_ASSERT(g_isCalledCallback == false); \
+ \
+ memset(&sendData, 0x00, sizeof(sendData)); \
+ sendDataAllSet(&sendData, IC_HMI_OFF); \
+ sendData.param = IC_HMI_ON; \
+ requestSendData(&sendData); \
+ \
+ CU_ASSERT(g_isCalledCallback == false); \
+ \
+ g_isCalledCallback = false; \
+ sendData.param = IC_HMI_OFF; \
+ requestSendData(&sendData); \
+ \
+ CU_ASSERT(g_isCalledCallback == false); \
+ \
+ g_isCalledCallback = false; \
+ sendDataAllSet(&sendData, IC_HMI_ON); \
+ requestSendData(&sendData); \
+ \
+ CU_ASSERT(g_isCalledCallback == true); \
+ CU_ASSERT(checkValueFromStoreTable(IC_HMI_ ##flag, false, IC_HMI_OFF) == true); \
+ \
+ CU_ASSERT(clusterTerm() == true); \
+ }
+
+#define REGISTER_NOTIFY_ADD_TEST(testSuite, flag) \
+ CU_add_test(testSuite, "registerIcHmi_ON_" #flag, TestregisterIcHmi_ON_ ##flag); \
+ CU_add_test(testSuite, "registerIcHmi_OFF_" #flag, TestregisterIcHmi_OFF_ ##flag)
+
+REGISTER_NOTIFY_TEST_FUNC(TT_TURN_R, turnR)
+REGISTER_NOTIFY_TEST_FUNC(TT_TURN_L, turnL)
+REGISTER_NOTIFY_TEST_FUNC(TT_BRAKE, brake)
+REGISTER_NOTIFY_TEST_FUNC(TT_SEATBELT, seatbelt)
+REGISTER_NOTIFY_TEST_FUNC(TT_HIGHBEAM, highbeam)
+REGISTER_NOTIFY_TEST_FUNC(TT_DOOR, door)
+REGISTER_NOTIFY_TEST_FUNC(TT_EPS, eps)
+REGISTER_NOTIFY_TEST_FUNC(TT_SRS_AIRBAG, srsAirbag)
+REGISTER_NOTIFY_TEST_FUNC(TT_ABS, abs)
+REGISTER_NOTIFY_TEST_FUNC(TT_LOW_BATTERY, lowBattery)
+REGISTER_NOTIFY_TEST_FUNC(TT_OIL_PRESS, oilPress)
+REGISTER_NOTIFY_TEST_FUNC(TT_ENGINE, engine)
+REGISTER_NOTIFY_TEST_FUNC(TT_FUEL, fuel)
+REGISTER_NOTIFY_TEST_FUNC(TT_IMMOBI, immobi)
+REGISTER_NOTIFY_TEST_FUNC(TT_TM_FAIL, tmFail)
+REGISTER_NOTIFY_TEST_FUNC(TT_ESP_ACT, espAct)
+REGISTER_NOTIFY_TEST_FUNC(TT_ESP_OFF, espOff)
+REGISTER_NOTIFY_TEST_FUNC(TT_ADAPTING_LIGHTING, adaptingLighting)
+REGISTER_NOTIFY_TEST_FUNC(TT_AUTO_STOP, autoStop)
+REGISTER_NOTIFY_TEST_FUNC(TT_AUTO_STOP_FAIL, autoStopFail)
+REGISTER_NOTIFY_TEST_FUNC(TT_PARKING_LIGHTS, parkingLights)
+REGISTER_NOTIFY_TEST_FUNC(TT_FRONT_FOG, frontFog)
+REGISTER_NOTIFY_TEST_FUNC(TT_EXTERIOR_LIGHT_FAULT, exteriorLightFault)
+REGISTER_NOTIFY_TEST_FUNC(TT_ACC_FAIL, accFail)
+REGISTER_NOTIFY_TEST_FUNC(TT_LDW_OFF, ldwOff)
+REGISTER_NOTIFY_TEST_FUNC(TT_HILL_DESCENT, hillDescent)
+REGISTER_NOTIFY_TEST_FUNC(TT_AUTO_HI_BEAM_GREEN, autoHiBeamGreen)
+REGISTER_NOTIFY_TEST_FUNC(TT_AUTO_HI_BEAM_AMBER, autoHiBeamAmber)
+REGISTER_NOTIFY_TEST_FUNC(TT_LDW_OPERATE, ldwOperate)
+REGISTER_NOTIFY_TEST_FUNC(TT_GENERAL_WARN, generalWarn)
+REGISTER_NOTIFY_TEST_FUNC(TT_SPORTS_MODE, sportsMode)
+REGISTER_NOTIFY_TEST_FUNC(TT_DRIVING_POWER_MODE, drivingPowerMode)
+REGISTER_NOTIFY_TEST_FUNC(TT_HOT_TEMP, hotTemp)
+REGISTER_NOTIFY_TEST_FUNC(TT_LOW_TEMP, lowTemp)
+
+void SetTestSuiteRegisterAndNotify(void)
+{
+ CU_pSuite testSuite;
+
+ testSuite = CU_add_suite("RegisterAndNotify", NULL, NULL);
+ CU_add_test(testSuite, "registerIcHmi_ALL_DifferentData", TestregisterIcHmi_ALL_DifferentData);
+ CU_add_test(testSuite, "registerIcHmi_ALL_SameData", TestregisterIcHmi_ALL_SameData);
+ CU_add_test(testSuite, "registerIcHmi_ALL_UnrelatedParams", TestregisterIcHmi_ALL_UnrelatedParams);
+ CU_add_test(testSuite, "registerIcHmi_ALL_OFF", TestregisterIcHmi_ALL_OFF);
+ CU_add_test(testSuite, "registerIcHmi_Set_UnusedFlag", TestregisterIcHmi_Set_UnusedFlag);
+ CU_add_test(testSuite, "registerIcHmi_NullFunc", TestregisterIcHmi_NullFunc);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_TURN_R);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_TURN_L);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_BRAKE);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_SEATBELT);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_HIGHBEAM);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_DOOR);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_EPS);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_SRS_AIRBAG);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_ABS);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_LOW_BATTERY);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_OIL_PRESS);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_ENGINE);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_FUEL);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_IMMOBI);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_TM_FAIL);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_ESP_ACT);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_ESP_OFF);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_ADAPTING_LIGHTING);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_AUTO_STOP);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_AUTO_STOP_FAIL);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_PARKING_LIGHTS);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_FRONT_FOG);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_EXTERIOR_LIGHT_FAULT);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_ACC_FAIL);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_LDW_OFF);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_HILL_DESCENT);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_AUTO_HI_BEAM_GREEN);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_AUTO_HI_BEAM_AMBER);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_LDW_OPERATE);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_GENERAL_WARN);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_SPORTS_MODE);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_DRIVING_POWER_MODE);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_HOT_TEMP);
+ REGISTER_NOTIFY_ADD_TEST(testSuite, TT_LOW_TEMP);
+}
diff --git a/test/client_test/client_test_shiftposition.c b/test/client_test/client_test_shiftposition.c
new file mode 100644
index 0000000..c1bf23b
--- /dev/null
+++ b/test/client_test/client_test_shiftposition.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <CUnit/CUnit.h>
+
+#include <cluster_api.h>
+
+#include "client_test_common.h"
+
+#define SHIFTPOSITION_TEST_FUNC(func, param, value) \
+ static void Test ##func() { \
+ IPC_DATA_IC_SERVICE_S sendData; \
+ CU_ASSERT(clusterInit() == true); \
+ memset(&sendData, 0x00, sizeof(sendData)); \
+ sendData.param = value; \
+ requestSendData(&sendData); \
+ CU_ASSERT(func() == value); \
+ CU_ASSERT(clusterTerm() == true); \
+ }
+
+#define SHIFTPOSITION_ADD_TEST(testSuite, func) \
+ CU_add_test(testSuite, #func, Test ##func)
+
+SHIFTPOSITION_TEST_FUNC(getGearAtVal, gearAtVal, IC_HMI_AT_UNUSED)
+SHIFTPOSITION_TEST_FUNC(getGearMtVal, gearMtVal, IC_HMI_MT_EIGHTTH)
+
+void SetTestSuiteShiftPosition(void)
+{
+ CU_pSuite testSuite;
+
+ testSuite = CU_add_suite("ShiftPosition", NULL, NULL);
+ SHIFTPOSITION_ADD_TEST(testSuite, getGearAtVal);
+ SHIFTPOSITION_ADD_TEST(testSuite, getGearMtVal);
+}
diff --git a/test/client_test/client_test_speed.c b/test/client_test/client_test_speed.c
new file mode 100644
index 0000000..e0805ee
--- /dev/null
+++ b/test/client_test/client_test_speed.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <CUnit/CUnit.h>
+
+#include <cluster_api.h>
+
+#include "client_test_common.h"
+
+#define SPEED_TEST_FUNC(func, param, value) \
+ static void Test ##func() { \
+ IPC_DATA_IC_SERVICE_S sendData; \
+ CU_ASSERT(clusterInit() == true); \
+ memset(&sendData, 0x00, sizeof(sendData)); \
+ sendData.param = value; \
+ requestSendData(&sendData); \
+ CU_ASSERT(func() == value); \
+ CU_ASSERT(clusterTerm() == true); \
+ }
+
+#define SPEED_ADD_TEST(testSuite, func) \
+ CU_add_test(testSuite, #func, Test ##func)
+
+SPEED_TEST_FUNC(getSpAnalogVal, spAnalogVal, 0x00007530)
+SPEED_TEST_FUNC(getSpAnaDigUnitVal, spAnaDigUnitVal, IC_HMI_SP_MPH)
+
+void SetTestSuiteSpeed(void)
+{
+ CU_pSuite testSuite;
+
+ testSuite = CU_add_suite("Speed", NULL, NULL);
+ SPEED_ADD_TEST(testSuite, getSpAnalogVal);
+ SPEED_ADD_TEST(testSuite, getSpAnaDigUnitVal);
+}
+
diff --git a/test/client_test/client_test_suites.h b/test/client_test/client_test_suites.h
new file mode 100644
index 0000000..ebac8cd
--- /dev/null
+++ b/test/client_test/client_test_suites.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef CLIENT_TEST_SUITES_H
+#define CLIENT_TEST_SUITES_H
+
+void SetTestSuiteInitAndTerm(void);
+void SetTestSuiteTelltale(void);
+void SetTestSuiteShiftPosition(void);
+void SetTestSuiteSpeed(void);
+void SetTestSuiteTacho(void);
+void SetTestSuiteTripComputer(void);
+void SetTestSuiteRegisterAndNotify(void);
+
+#endif // CLIENT_TEST_SUITES_H
+
diff --git a/test/client_test/client_test_tacho.c b/test/client_test/client_test_tacho.c
new file mode 100644
index 0000000..574c2f8
--- /dev/null
+++ b/test/client_test/client_test_tacho.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <CUnit/CUnit.h>
+
+#include <cluster_api.h>
+
+#include "client_test_common.h"
+
+#define TACHO_TEST_FUNC(func, param, value) \
+ static void Test ##func() { \
+ IPC_DATA_IC_SERVICE_S sendData; \
+ CU_ASSERT(clusterInit() == true); \
+ memset(&sendData, 0x00, sizeof(sendData)); \
+ sendData.param = value; \
+ requestSendData(&sendData); \
+ CU_ASSERT(func() == value); \
+ CU_ASSERT(clusterTerm() == true); \
+ }
+
+#define TACHO_ADD_TEST(testSuite, func) \
+ CU_add_test(testSuite, #func, Test ##func)
+
+TACHO_TEST_FUNC(getTaAnalogVal, taAnalogVal, 0x00004E20)
+
+void SetTestSuiteTacho(void)
+{
+ CU_pSuite testSuite;
+
+ testSuite = CU_add_suite("Tacho", NULL, NULL);
+ TACHO_ADD_TEST(testSuite, getTaAnalogVal);
+}
+
diff --git a/test/client_test/client_test_telltale.c b/test/client_test/client_test_telltale.c
new file mode 100644
index 0000000..d5c7daf
--- /dev/null
+++ b/test/client_test/client_test_telltale.c
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <CUnit/CUnit.h>
+
+#include <cluster_api.h>
+
+#include "client_test_common.h"
+
+#define TELLTALE_TEST_FUNC(func, param) \
+ static void Test ##func() { \
+ IPC_DATA_IC_SERVICE_S sendData; \
+ CU_ASSERT(clusterInit() == true); \
+ memset(&sendData, 0x00, sizeof(sendData)); \
+ sendData.param = IC_HMI_ON; \
+ requestSendData(&sendData); \
+ CU_ASSERT(func() == IC_HMI_ON); \
+ CU_ASSERT(clusterTerm() == true); \
+ }
+
+#define TELLTALE_ADD_TEST(testSuite, func) \
+ CU_add_test(testSuite, #func, Test ##func)
+
+TELLTALE_TEST_FUNC(getTurnR, turnR)
+TELLTALE_TEST_FUNC(getTurnL, turnL)
+TELLTALE_TEST_FUNC(getBrake, brake)
+TELLTALE_TEST_FUNC(getSeatbelt, seatbelt)
+TELLTALE_TEST_FUNC(getFrontRightSeatbelt, frontRightSeatbelt)
+TELLTALE_TEST_FUNC(getFrontCenterSeatbelt, frontCenterSeatbelt)
+TELLTALE_TEST_FUNC(getFrontLeftSeatbelt, frontLeftSeatbelt)
+TELLTALE_TEST_FUNC(getMid1RightSeatbelt, mid1RightSeatbelt)
+TELLTALE_TEST_FUNC(getMid1CenterSeatbelt, mid1CenterSeatbelt)
+TELLTALE_TEST_FUNC(getMid1LeftSeatbelt, mid1LeftSeatbelt)
+TELLTALE_TEST_FUNC(getMid2RightSeatbelt, mid2RightSeatbelt)
+TELLTALE_TEST_FUNC(getMid2CenterSeatbelt, mid2CenterSeatbelt)
+TELLTALE_TEST_FUNC(getMid2LeftSeatbelt, mid2LeftSeatbelt)
+TELLTALE_TEST_FUNC(getRearRightSeatbelt, rearRightSeatbelt)
+TELLTALE_TEST_FUNC(getRearCenterSeatbelt, rearCenterSeatbelt)
+TELLTALE_TEST_FUNC(getRearLeftSeatbelt, rearLeftSeatbelt)
+TELLTALE_TEST_FUNC(getHighbeam, highbeam)
+TELLTALE_TEST_FUNC(getDoor, door)
+TELLTALE_TEST_FUNC(getFrontRightDoor, frontRightDoor)
+TELLTALE_TEST_FUNC(getFrontLeftDoor, frontLeftDoor)
+TELLTALE_TEST_FUNC(getRearRightDoor, rearRightDoor)
+TELLTALE_TEST_FUNC(getRearLeftDoor, rearLeftDoor)
+TELLTALE_TEST_FUNC(getTrunkDoor, trunkDoor)
+TELLTALE_TEST_FUNC(getHoodDoor, hoodDoor)
+TELLTALE_TEST_FUNC(getEps, eps)
+TELLTALE_TEST_FUNC(getSrsAirbag, srsAirbag)
+TELLTALE_TEST_FUNC(getAbs, abs)
+TELLTALE_TEST_FUNC(getLowBattery, lowBattery)
+TELLTALE_TEST_FUNC(getOilPress, oilPress)
+TELLTALE_TEST_FUNC(getEngine, engine)
+TELLTALE_TEST_FUNC(getFuel, fuel)
+TELLTALE_TEST_FUNC(getImmobi, immobi)
+TELLTALE_TEST_FUNC(getTMFail, tmFail)
+TELLTALE_TEST_FUNC(getEspAct, espAct)
+TELLTALE_TEST_FUNC(getEspOff, espOff)
+TELLTALE_TEST_FUNC(getAdaptingLighting, adaptingLighting)
+TELLTALE_TEST_FUNC(getAutoStop, autoStop)
+TELLTALE_TEST_FUNC(getAutoStopFail, autoStopFail)
+TELLTALE_TEST_FUNC(getParkingLights, parkingLights)
+TELLTALE_TEST_FUNC(getFrontFog, frontFog)
+TELLTALE_TEST_FUNC(getExteriorLightFault, exteriorLightFault)
+TELLTALE_TEST_FUNC(getAccFail, accFail)
+TELLTALE_TEST_FUNC(getLdwOff, ldwOff)
+TELLTALE_TEST_FUNC(getHillDescent, hillDescent)
+TELLTALE_TEST_FUNC(getAutoHiBeamGreen, autoHiBeamGreen)
+TELLTALE_TEST_FUNC(getAutoHiBeamAmber, autoHiBeamAmber)
+TELLTALE_TEST_FUNC(getSportsMode, sportsMode)
+TELLTALE_TEST_FUNC(getLdwOperate, ldwOperate)
+TELLTALE_TEST_FUNC(getGeneralWarn, generalWarn)
+TELLTALE_TEST_FUNC(getDriverPowerMode, drivingPowerMode)
+TELLTALE_TEST_FUNC(getHotTemp, hotTemp)
+TELLTALE_TEST_FUNC(getLowTemp, lowTemp)
+
+void SetTestSuiteTelltale(void)
+{
+ CU_pSuite testSuite;
+
+ testSuite = CU_add_suite("Telltale", NULL, NULL);
+ TELLTALE_ADD_TEST(testSuite, getTurnR);
+ TELLTALE_ADD_TEST(testSuite, getTurnL);
+ TELLTALE_ADD_TEST(testSuite, getBrake);
+ TELLTALE_ADD_TEST(testSuite, getSeatbelt);
+ TELLTALE_ADD_TEST(testSuite, getFrontRightSeatbelt);
+ TELLTALE_ADD_TEST(testSuite, getFrontCenterSeatbelt);
+ TELLTALE_ADD_TEST(testSuite, getFrontLeftSeatbelt);
+ TELLTALE_ADD_TEST(testSuite, getMid1RightSeatbelt);
+ TELLTALE_ADD_TEST(testSuite, getMid1CenterSeatbelt);
+ TELLTALE_ADD_TEST(testSuite, getMid1LeftSeatbelt);
+ TELLTALE_ADD_TEST(testSuite, getMid2RightSeatbelt);
+ TELLTALE_ADD_TEST(testSuite, getMid2CenterSeatbelt);
+ TELLTALE_ADD_TEST(testSuite, getMid2LeftSeatbelt);
+ TELLTALE_ADD_TEST(testSuite, getRearRightSeatbelt);
+ TELLTALE_ADD_TEST(testSuite, getRearCenterSeatbelt);
+ TELLTALE_ADD_TEST(testSuite, getRearLeftSeatbelt);
+ TELLTALE_ADD_TEST(testSuite, getHighbeam);
+ TELLTALE_ADD_TEST(testSuite, getDoor);
+ TELLTALE_ADD_TEST(testSuite, getFrontRightDoor);
+ TELLTALE_ADD_TEST(testSuite, getFrontLeftDoor);
+ TELLTALE_ADD_TEST(testSuite, getRearRightDoor);
+ TELLTALE_ADD_TEST(testSuite, getRearLeftDoor);
+ TELLTALE_ADD_TEST(testSuite, getTrunkDoor);
+ TELLTALE_ADD_TEST(testSuite, getHoodDoor);
+ TELLTALE_ADD_TEST(testSuite, getEps);
+ TELLTALE_ADD_TEST(testSuite, getSrsAirbag);
+ TELLTALE_ADD_TEST(testSuite, getAbs);
+ TELLTALE_ADD_TEST(testSuite, getLowBattery);
+ TELLTALE_ADD_TEST(testSuite, getOilPress);
+ TELLTALE_ADD_TEST(testSuite, getEngine);
+ TELLTALE_ADD_TEST(testSuite, getFuel);
+ TELLTALE_ADD_TEST(testSuite, getImmobi);
+ TELLTALE_ADD_TEST(testSuite, getTMFail);
+ TELLTALE_ADD_TEST(testSuite, getEspAct);
+ TELLTALE_ADD_TEST(testSuite, getEspOff);
+ TELLTALE_ADD_TEST(testSuite, getAdaptingLighting);
+ TELLTALE_ADD_TEST(testSuite, getAutoStop);
+ TELLTALE_ADD_TEST(testSuite, getAutoStopFail);
+ TELLTALE_ADD_TEST(testSuite, getParkingLights);
+ TELLTALE_ADD_TEST(testSuite, getFrontFog);
+ TELLTALE_ADD_TEST(testSuite, getExteriorLightFault);
+ TELLTALE_ADD_TEST(testSuite, getAccFail);
+ TELLTALE_ADD_TEST(testSuite, getLdwOff);
+ TELLTALE_ADD_TEST(testSuite, getHillDescent);
+ TELLTALE_ADD_TEST(testSuite, getAutoHiBeamGreen);
+ TELLTALE_ADD_TEST(testSuite, getAutoHiBeamAmber);
+ TELLTALE_ADD_TEST(testSuite, getSportsMode);
+ TELLTALE_ADD_TEST(testSuite, getLdwOperate);
+ TELLTALE_ADD_TEST(testSuite, getGeneralWarn);
+ TELLTALE_ADD_TEST(testSuite, getDriverPowerMode);
+ TELLTALE_ADD_TEST(testSuite, getHotTemp);
+ TELLTALE_ADD_TEST(testSuite, getLowTemp);
+}
+
diff --git a/test/client_test/client_test_tripcomputer.c b/test/client_test/client_test_tripcomputer.c
new file mode 100644
index 0000000..1e082db
--- /dev/null
+++ b/test/client_test/client_test_tripcomputer.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <CUnit/CUnit.h>
+
+#include <cluster_api.h>
+
+#include "client_test_common.h"
+
+#define TRIPCOMPUTER_TEST_FUNC(func, param, value) \
+ static void Test ##func() { \
+ IPC_DATA_IC_SERVICE_S sendData; \
+ CU_ASSERT(clusterInit() == true); \
+ memset(&sendData, 0x00, sizeof(sendData)); \
+ sendData.param = value; \
+ requestSendData(&sendData); \
+ CU_ASSERT(func() == value); \
+ CU_ASSERT(clusterTerm() == true); \
+ }
+
+#define TRIPCOMPUTER_ADD_TEST(testSuite, func) \
+ CU_add_test(testSuite, #func, Test ##func)
+
+TRIPCOMPUTER_TEST_FUNC(getTrcomTripAVal, trcomTripAVal, 0x0001869F)
+TRIPCOMPUTER_TEST_FUNC(getTrcomTripBVal, trcomTripBVal, 0x0001869F)
+TRIPCOMPUTER_TEST_FUNC(getTrcomOdoVal, trcomOdoVal, 0x000F423F)
+TRIPCOMPUTER_TEST_FUNC(getTrcomUnitVal, trcomUnitVal, IC_HMI_TRCOM_MILE)
+TRIPCOMPUTER_TEST_FUNC(getAvgSpeedAVal, avgSpeedAVal, 0x012C)
+TRIPCOMPUTER_TEST_FUNC(getAvgSpeedBVal, avgSpeedBVal, 0x012C)
+TRIPCOMPUTER_TEST_FUNC(getHourAVal, hourAVal, 0x03E7)
+TRIPCOMPUTER_TEST_FUNC(getHourBVal, hourBVal, 0x03E7)
+TRIPCOMPUTER_TEST_FUNC(getMinuteAVal, minuteAVal, 0x3B)
+TRIPCOMPUTER_TEST_FUNC(getMinuteBVal, minuteBVal, 0x3B)
+TRIPCOMPUTER_TEST_FUNC(getSecondAVal, secondAVal, 0x3B)
+TRIPCOMPUTER_TEST_FUNC(getSecondBVal, secondBVal, 0x3B)
+TRIPCOMPUTER_TEST_FUNC(getOTempVal, oTempVal, (signed short)0xFFD8)
+TRIPCOMPUTER_TEST_FUNC(getOTempUnitVal, oTempUnitVal, IC_HMI_OTEMP_UNIT_K)
+TRIPCOMPUTER_TEST_FUNC(getCruRangeVal, cruRangeVal, 0x064A)
+TRIPCOMPUTER_TEST_FUNC(getAvgFuelAVal, avgFuelAVal, 0x07CF)
+TRIPCOMPUTER_TEST_FUNC(getAvgFuelBVal, avgFuelBVal, 0x07CF)
+TRIPCOMPUTER_TEST_FUNC(getInsFuelAVal, insFuelAVal, 0x07CF)
+TRIPCOMPUTER_TEST_FUNC(getInsFuelBVal, insFuelBVal, 0x07CF)
+TRIPCOMPUTER_TEST_FUNC(getFuelEconomyUnitVal, fuelEconomyUnitVal, IC_HMI_FUEL_KWH_100KM)
+
+void SetTestSuiteTripComputer(void)
+{
+ CU_pSuite testSuite;
+
+ testSuite = CU_add_suite("TripComputer", NULL, NULL);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getTrcomTripAVal);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getTrcomTripBVal);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getTrcomOdoVal);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getTrcomUnitVal);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getAvgSpeedAVal);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getAvgSpeedBVal);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getHourAVal);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getHourBVal);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getMinuteAVal);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getMinuteBVal);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getSecondAVal);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getSecondBVal);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getOTempVal);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getOTempUnitVal);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getCruRangeVal);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getAvgFuelAVal);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getAvgFuelBVal);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getInsFuelAVal);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getInsFuelBVal);
+ TRIPCOMPUTER_ADD_TEST(testSuite, getFuelEconomyUnitVal);
+}
+
diff --git a/test/client_test/dummy_server.c b/test/client_test/dummy_server.c
new file mode 100644
index 0000000..d30bfec
--- /dev/null
+++ b/test/client_test/dummy_server.c
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2021, Nippon Seiki Co., Ltd.
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "client_test_common.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdbool.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/epoll.h>
+
+#include <cluster_ipc.h>
+
+#define CLUSTER_TEST_EPOLL_WAIT_NUM (2)
+
+int createEpoll(int waitNum)
+{
+ int fd = -1;
+
+ fd = epoll_create(waitNum);
+ if (fd < 0) {
+ ERRNO_LOG(epoll_create);
+ return -1;
+ }
+
+ return fd;
+}
+
+int createSocket(int epollFd, int *pOutTestFd)
+{
+ int rc;
+ int fd = -1;
+ int testFd = -1;
+ struct sockaddr_un unixAddr;
+ int len;
+ struct epoll_event epollEv;
+
+ fd = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (fd < 0) {
+ ERRNO_LOG(socket);
+ return -1;
+ }
+
+ unixAddr.sun_family = AF_UNIX;
+ strcpy(unixAddr.sun_path, CLUSTER_TEST_DOMAIN_PATH);
+ len = sizeof(unixAddr.sun_family)+strlen(unixAddr.sun_path);
+ rc = bind(fd, (struct sockaddr *)&unixAddr, len);
+ if (rc < 0) {
+ ERRNO_LOG(bind);
+ goto err;
+ }
+
+ rc = listen(fd, 1);
+ if (rc < 0) {
+ ERRNO_LOG(listen);
+ goto err;
+ }
+
+ testFd = accept(fd, (struct sockaddr*)&unixAddr, (socklen_t *)&len);
+ if (testFd < 0) {
+ ERRNO_LOG(accept);
+ goto err;
+ }
+
+ memset(&epollEv, 0, sizeof(epollEv));
+ epollEv.events = EPOLLIN;
+ epollEv.data.fd = fd;
+ epoll_ctl(epollFd, EPOLL_CTL_ADD, epollEv.data.fd, &epollEv);
+
+ epollEv.events = EPOLLIN | EPOLLRDHUP;
+ epollEv.data.fd = testFd;
+ epoll_ctl(epollFd, EPOLL_CTL_ADD, epollEv.data.fd, &epollEv);
+
+ *pOutTestFd = testFd;
+
+ return fd;
+err:
+ shutdown(fd, SHUT_RDWR);
+ close(fd);
+ unlink(CLUSTER_TEST_DOMAIN_PATH);
+ return -1;
+}
+
+void sendMessageLoop(void)
+{
+ int epollFd = -1;
+ int socketFd = -1;
+ int testFd = -1;
+ int fdNum;
+ int i;
+ struct epoll_event epEvents[CLUSTER_TEST_EPOLL_WAIT_NUM];
+ bool isRunning = true;
+ int dummyData;
+ FILE *fp;
+ IPC_DATA_IC_SERVICE_S sendData;
+ IPC_RET_E rc;
+ int size;
+
+ epollFd = createEpoll(CLUSTER_TEST_EPOLL_WAIT_NUM);
+ if (epollFd < 0) {
+ goto end;
+ }
+
+ socketFd = createSocket(epollFd, &testFd);
+ if (socketFd < 0) {
+ goto end;
+ }
+
+ while(isRunning == true) {
+ fdNum = epoll_wait(epollFd, epEvents, CLUSTER_TEST_EPOLL_WAIT_NUM, -1);
+
+ for (i = 0; i < fdNum; i++) {
+ if (epEvents[i].events & EPOLLRDHUP) {
+ isRunning = false;
+ break;
+ }
+ else if (epEvents[i].events & EPOLLIN) {
+ size = read(epEvents[i].data.fd, &dummyData, sizeof(dummyData));
+ if (size < 0) {
+ ERRNO_LOG(read);
+ }
+ fp = fopen(CLUSTER_TEST_SENDDATA_FILE, "rb");
+ if (fp != NULL) {
+ size = fread(&sendData, 1, sizeof(sendData), fp);
+ if (size < sizeof(sendData) && ferror(fp)) {
+ ERRNO_LOG(fread);
+ }
+ fclose(fp);
+ rc = ipcSendMessage(IPC_USAGE_TYPE_IC_SERVICE, &sendData, sizeof(sendData));
+ if (rc != IPC_RET_OK) {
+ fprintf(stderr, "dummy_server:%d Failed to ipcSendMessage() : %d\n", __LINE__, rc);
+ }
+ }
+ }
+ }
+ }
+
+end:
+ if (testFd >= 0) {
+ shutdown(testFd, SHUT_RDWR);
+ close(testFd);
+ }
+
+ if (socketFd >= 0) {
+ shutdown(socketFd, SHUT_RDWR);
+ close(socketFd);
+ unlink(CLUSTER_TEST_DOMAIN_PATH);
+ }
+
+ if (epollFd >= 0) {
+ close(epollFd);
+ }
+}
+
+int main(void)
+{
+ IPC_RET_E ret;
+
+ setenv(IPC_ENV_DOMAIN_SOCKET_PATH, IPC_TEST_DOMAIN_PATH, 1);
+
+ ret = ipcServerStart(IPC_USAGE_TYPE_IC_SERVICE);
+ if (ret != IPC_RET_OK) {
+ fprintf(stderr, "dummy_server:%d Failed to ipcServerStart() : %d\n", __LINE__, ret);
+ exit(EXIT_FAILURE);
+ }
+
+ sendMessageLoop();
+
+ ret = ipcServerStop(IPC_USAGE_TYPE_IC_SERVICE);
+ if (ret != IPC_RET_OK) {
+ fprintf(stderr, "dummy_server:%d Failed to ipcServerStop() : %d\n", __LINE__, ret);
+ exit(EXIT_FAILURE);
+ }
+
+ return 0;
+}
+