2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "tskm_watch.h"
18 #include <agl_thread.h>
20 #include "tskm_debug.h"
21 #include "tskm_port_pf.h"
22 #include "tskm_comm.h"
27 #define TIMER_THREAD_NAME "SS_TskmTimer"
29 /*******************************************************************
30 * Periodic Timer-Thread MAIN Function
31 *******************************************************************/
33 watchMain(void *arg) {
36 connFd = tskm_cliSockConnect(TSKM_SOCKET_NAME);
37 if (connFd < 0) { // LCOV_EXCL_BR_LINE 5: system function(uinx) "socket" fail process
38 // LCOV_EXCL_START 5: system function(uinx) "socket" fail process
39 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
51 ev.event = TSKM_EV_LCL_REP_POLLING;
52 ev.errCode = TSKM_E_OK;
53 ret = tskm_sockSend(connFd, &ev);
54 if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: system function(uinx) "send" fail process
55 // LCOV_EXCL_START 5: system function(uinx) "send" fail process
56 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
63 // LCOV_EXCL_START 6: system function(uinx) call fail process
65 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
67 tskm_sockDestory(connFd);
74 /*******************************************************************
75 * Periodic Timer thread start
76 *******************************************************************/
77 int tskm_watch_startTimer() {
79 pthread_t thId = { 0 };
81 ret = tskm_pf_createThread(watchMain, NULL, PR_SS_TSKMTIMER,
82 TIMER_THREAD_NAME, &thId);
83 if (ret != 0) { // LCOV_EXCL_BR_LINE 5: system function(uinx) "pthread_*" fail process
84 // LCOV_EXCL_START 5: system function(uinx) "pthread_*" fail process
85 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
90 TSKM_PRINTF(TSKM_LOG_STATE, "watch thread created.");
95 // LCOV_EXCL_LINE 6: system function(uinx) "pthread_*" fail process
97 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert