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.
18 * @brief \~english define of tskm
20 /** @addtogroup BaseSystem
23 /** @addtogroup system_service
27 /** @addtogroup task_manager
28 * @ingroup system_service
31 #ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_SVC_H_
32 #define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_SVC_H_
36 #include <sys/types.h>
37 #include "system_service/tskm_local_type.h"
40 #define TSKM_SVC_WAIT_REQ_MAX (8) // Number of queued requests
44 TSKM_SVC_TYPE_NATIVE, //
45 TSKM_SVC_TYPE_UNKNONW, //
50 TSKM_SVC_POLICY_TSS, //
51 TSKM_SVC_POLICY_RR, //
52 TSKM_SVC_POLICY_FIFO, //
57 TSKM_SVC_LC_ALWAYS, // Resident
58 TSKM_SVC_LC_ALWAYS_RECOVERABLE, // Resident(Recoverable)
59 TSKM_SVC_LC_DYNAMIC // Non-resident
62 // CPU allocation: This defined value should match the specification of the second argument of CL_ProcessCreateAttrSetCpuAssign
65 TSKM_SVC_ASSIGN_CPU_AUTO = 0, // Automatic allocation
66 TSKM_SVC_ASSIGN_CPU_0 = 1, // Fixed to CPU0
67 TSKM_SVC_ASSIGN_CPU_1 = 2, // Fixed to CPU1
68 } TSKM_SVC_ASSIGN_CPU_t;
70 // Service attributes (given by XML)
72 TSKM_SVCID_t svcId; //
76 TSKM_SVC_TYPE_t type; //
78 TSKM_SVC_POLICY_t policy; //
79 TSKM_SVC_LC_t lifeCycle; //
81 TSKM_SVC_ASSIGN_CPU_t cpuAssign; //
83 uint32_t runtimeLimit; //
86 TSKM_BOOL_t shotdownWait; //
87 uint32_t subgidNum; //
93 TSKM_SVC_DORMANT, // During dormant (Not exec)
94 TSKM_SVC_WAITCONNECT, // Wait for connection
95 TSKM_SVC_WAKEUP, // Start in progress
96 TSKM_SVC_RUNNING, // Running (Startup completed)
97 TSKM_SVC_DOWN, // Termination in progress
98 TSKM_SVC_FINDOWN, // Termination completed
99 TSKM_SVC_DISABLE, // Prohibitting startup (exec prohibited)
103 typedef struct { // Life cycle
104 TSKM_SVC_ATTR_t *attr; // Service Attributes ALL
105 TSKM_SVC_STATE_t state; // Service State ALL
106 int iFd; // inotifyFd for touch ALL
107 pid_t pid; // PID of service REQ_WAKEUP - FIN_DOWN
108 int connFd; // service communication socket DO_WAKEUP - FIN_DOWN
109 T_SS_SM_START_DataStructType bootInfo; // Boot info REQ_WAKEUP - FIN_DOWN
110 T_SS_SM_START_ExtDataStructType extBootInfo; // Extended boot info REQ_WAKEUP - FIN_DOWN
112 TSKM_BOOL_t isShmDone; // Shared memory initialization completed
113 TSKM_BOOL_t isStepDone; // Gradual startup completed
114 TSKM_BOOL_t isAvailable; // Availability reception completed
116 uint32_t watchCnt; // Service monitoring counter
117 uint32_t waitResCnt; // Wait for response to request DO_WAKEUP - WAIT_WAKEUP
118 uint32_t waitReqCnt; // Wait for request issuance REQ_WAKEUP - DO_WAKEUP
119 TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX]; // REQ_WAKEUP - DO_WAKEUP
121 uint32_t errTermCnt; // Number of abnormal terminations ALL
127 TSKM_SVC_CTX_t *svcList;
130 // State of waiting for service termination
132 TSKM_SVC_WAIT_NONE, // No wait
133 TSKM_SVC_WAIT_TRANSIENT, // Waiting for termination of nonresident service
134 TSKM_SVC_WAIT_BOTH, // Waiting for termination of resident/nonresident service
135 } TSKM_SVC_WAIT_STATE_t;
138 /////////////////////////////////////////////////////////////////////////////////////
139 /// \ingroup tskm_svcsEventHandle
140 /// \~english @par Summary
143 /// \~english @param [in] p_svcs
144 /// p_svcs - pointer of services
146 /// p_svcs TSKM_SVCS_CTX_t*
149 /// uint32_t svcNum; // service num
150 /// TSKM_SVC_CTX_t *svcList; // services list pointer
151 /// } TSKM_SVCS_CTX_t;
153 /// \~english @param [in] p_inEv
154 /// p_inEv - pointer of input event info
156 /// p_inEv TSKM_EVENT_INFO_t*
158 /// typedef struct _TSKM_EVENT_INFO_t {
159 /// TSKM_EVENT_t event;
160 /// TSKM_ERR_t errCode;
162 /// TSKM_BOOL_t hasExtend;
163 /// uint32_t extendSize;
167 /// TSKM_EV_PRI_REQ_WAKEUP_PRM_t reqWakeup;
168 /// TSKM_EV_PRI_REQ_DOWN_PRM_t reqDown;
170 /// TSKM_EV_PRI_REP_WAKEUP_COMP_PRM_t repWakeupComp;
171 /// TSKM_EV_PRI_REP_DOWN_COMP_PRM_t repDownComp;
172 /// TSKM_EV_PRI_REP_CONNECT_PRM_t repConnect;
173 /// TSKM_EV_PRI_RES_WAKEUP_PRM_t resWakeup;
174 /// TSKM_EV_PRI_RES_DOWN_PRM_t resDown;
175 /// TSKM_EV_LCL_CHG_SVC_STATE_PRM_t chgSvc;
177 /// } TSKM_EVENT_INFO_t;
179 /// \~english @param [out] p_outEv
180 /// p_outEv - pointer of output event info
182 /// p_outEv TSKM_EVENT_INFO_t*
183 /// \~english @retval
184 /// \~english @par Preconditions
186 /// \~english @par Change of the internal state
187 /// - The internal state is not changed.
188 /// \~english @par Causes of failures
190 /// \~english @par Classification
192 /// \~english @par Type
194 /// \~english @par Detail
196 /// \~english @see None
197 ////////////////////////////////////////////////////////////////////////////////////
198 TSKM_ERR_t tskm_svcsEventHandle(TSKM_SVCS_CTX_t* p_svcs,
199 const TSKM_EVENT_INFO_t* p_inEv,
200 TSKM_EVENT_INFO_t* p_outEv);
202 /////////////////////////////////////////////////////////////////////////////////////
203 /// \ingroup tskm_svcsGetSvcBySvcId
204 /// \~english @par Summary
205 /// find service in inputed service list by service id.
206 /// \~english @param [in] p_svcs
207 /// p_svcs - pointer of services object
209 /// p_svcs TSKM_SVCS_CTX_t*
212 /// uint32_t svcNum; // service num
213 /// TSKM_SVC_CTX_t *svcList; // services list pointer
214 /// } TSKM_SVCS_CTX_t;
216 /// \~english @param [in] svcId
217 /// svcId - service Id
220 /// \~english @retval TSKM_SVC_CTX_t* service pointer
221 /// \~english @retval TSKM_SVC_CTX_t* NULL
222 /// \~english @par Preconditions
224 /// \~english @par Change of the internal state
225 /// - The internal state is not changed.
226 /// \~english @par Causes of failures
227 /// - If not find svcId in services list. [NULL]
228 /// \~english @par Classification
230 /// \~english @par Type
232 /// \~english @par Detail
233 /// find service in inputed service list by service id.. If do not find then return NULL pointer.
234 /// \~english @see getSvcCtxBySvcId
235 ////////////////////////////////////////////////////////////////////////////////////
236 TSKM_SVC_CTX_t* tskm_svcsGetSvcBySvcId(TSKM_SVCS_CTX_t* p_svcs,
239 /////////////////////////////////////////////////////////////////////////////////////
240 /// \ingroup tskm_svcsGetSvcByPid
241 /// \~english @par Summary
242 /// find service in inputed service list by process id.
243 /// \~english @param [in] p_svcs
244 /// p_svcs - pointer of services
246 /// p_svcs TSKM_SVCS_CTX_t*
249 /// uint32_t svcNum; // service num
250 /// TSKM_SVC_CTX_t *svcList; // services list pointer
251 /// } TSKM_SVCS_CTX_t;
253 /// \~english @param [in] pid
257 /// \~english @retval TSKM_SVC_CTX_t* service pointer
258 /// \~english @retval TSKM_SVC_CTX_t* NULL
259 /// \~english @par Preconditions
261 /// \~english @par Change of the internal state
262 /// - The internal state is not changed.
263 /// \~english @par Causes of failures
264 /// - If not find process id in services list. [NULL]
265 /// \~english @par Classification
267 /// \~english @par Type
269 /// \~english @par Detail
270 /// find service in inputed service list by process id. If do not find then return NULL pointer.
271 /// \~english @see getSvcCtxByPid
272 ////////////////////////////////////////////////////////////////////////////////////
273 TSKM_SVC_CTX_t* tskm_svcsGetSvcByPid(TSKM_SVCS_CTX_t* p_svcs, pid_t pid);
276 /////////////////////////////////////////////////////////////////////////////////////
277 /// \ingroup tskm_svcsIsWaiting
278 /// \~english @par Summary
279 /// Is the service state waiting.
280 /// \~english @param [in] p_svcs
281 /// p_svcs - pointer of services
283 /// p_svcs TSKM_SVCS_CTX_t*
286 /// uint32_t svcNum; // service num
287 /// TSKM_SVC_CTX_t *svcList; // services list pointer
288 /// } TSKM_SVCS_CTX_t;
290 /// \~english @retval TSKM_BOOL_t
291 /// \~english @par Preconditions
293 /// \~english @par Change of the internal state
294 /// - The internal state is not changed.
295 /// \~english @par Causes of failures
296 /// - If service state is TSKM_SVC_WAITCONNECT and wait response num is 0. [TSKM_FALSE]
297 /// \~english @par Classification
299 /// \~english @par Type
301 /// \~english @par Detail
302 /// Is the service state waiting. \n
303 /// There are not service's state equal TSKM_SVC_WAITCONNECT or wait respose number > 0 return TSKM_TRUE.
304 /// \~english @see None
305 ////////////////////////////////////////////////////////////////////////////////////
306 TSKM_BOOL_t tskm_svcsIsWaiting(TSKM_SVCS_CTX_t* p_svcs);
308 /////////////////////////////////////////////////////////////////////////////////////
309 /// \ingroup tskm_svcsGetSvcTermWaitState
310 /// \~english @par Summary
311 /// Get the service which state equanl not equal terminal.
314 /// uint32_t svcNum; // service num
315 /// TSKM_SVC_CTX_t *svcList; // services list pointer
316 /// } TSKM_SVCS_CTX_t;
318 /// \~english @retval TSKM_SVC_WAIT_STATE_t
320 /// TSKM_SVC_WAIT_STATE_t enum
323 /// TSKM_SVC_WAIT_NONE, // not waiting state
324 /// TSKM_SVC_WAIT_TRANSIENT, // dynamic service terminal waiting state
325 /// TSKM_SVC_WAIT_BOTH, // no dynamic/ dyanmic service terminal waiting state
326 /// } TSKM_SVC_WAIT_STATE_t;
328 /// \~english @par Preconditions
330 /// \~english @par Change of the internal state
331 /// - The internal state is not changed.
332 /// \~english @par Causes of failures
333 /// If all services state equal TSKM_SVC_DORMANT. [TSKM_SVC_WAIT_NONE]
334 /// If dynamic service. [TSKM_SVC_WAIT_TRANSIENT]
335 /// If not dynamic service and state not TSKM_SVC_FINDOWN. [TSKM_SVC_WAIT_BOTH]
336 /// \~english @par Classification
338 /// \~english @par Type
340 /// \~english @par Detail
341 /// Get the service which state equanl not equal terminal. \n
342 /// \~english @see None
343 ////////////////////////////////////////////////////////////////////////////////////
344 TSKM_SVC_WAIT_STATE_t tskm_svcsGetSvcTermWaitState(TSKM_SVCS_CTX_t* p_svcs);
346 /////////////////////////////////////////////////////////////////////////////////////
347 /// \ingroup tskm_svcsSetBootInfo
348 /// \~english @par Summary
349 /// initialize all services boot info.
350 /// \~english @param [in] p_svcs
351 /// p_svcs - pointer of services
353 /// p_svcs TSKM_SVCS_CTX_t*
356 /// uint32_t svcNum; // service num
357 /// TSKM_SVC_CTX_t *svcList; // services list pointer
358 /// } TSKM_SVCS_CTX_t;
360 /// \~english @param [in] p_info
361 /// p_info - SS_SM_START 'FrameworkunifiedOnStart'/'evStart' message pointer
363 /// p_info T_SS_SM_START_DataStructType*
365 /// Data passed as part of SS_SM_START 'FrameworkunifiedOnStart'/'evStart' message
366 /// typedef struct T_SS_SM_START_DataStruct {
367 /// EPWR_WAKEUP_FACTOR_TYPE startupReason;
368 /// BOOL isUserModeOn;
369 /// ESMDataResetModeInfo dataResetMode;
370 /// EPWR_SC_SECURITY_STATUS securityStatus;
371 /// EPWR_SC_WAKEUP_TYPE wakeupType;
372 /// ESMDramBackupStatus dramBackupStatus;
373 /// ESMResetStatus resetStatus;
374 /// UI_32 errResetCount;
375 /// T_SS_SM_START_DataStruct
376 /// } T_SS_SM_START_DataStructType;
378 /// \~english @param [in] p_exInfo
379 /// p_exInfo - FrameworkunifiedOnStart extend info pointer
381 /// p_exInfo T_SS_SM_START_ExtDataStructType*
383 /// /// Extended Parameter for FrameworkunifiedOnStart
385 /// BOOL isProgUpdated;
386 /// EMRelaunchStatus relaunchStatus;
387 /// BOOL isMapUpdated;
388 /// BOOL isMapDiffUpdated;
389 /// uint8_t reserved[SS_SM_START_EXT_RSV_SIZE];
390 /// } T_SS_SM_START_ExtDataStructType;
392 /// \~english @retval TSKM_E_OK
394 /// TSKM_SVC_WAIT_STATE_t enum
395 /// \~english @par Preconditions
396 /// - call tskm_dataInitAll() to get boot info
397 /// \~english @par Change of the internal state
398 /// - The internal state is not changed.
399 /// \~english @par Causes of failures
401 /// \~english @par Classification
403 /// \~english @par Type
405 /// \~english @par Detail
406 /// - initialize all services boot info.
407 /// \~english @see None
408 ////////////////////////////////////////////////////////////////////////////////////
409 TSKM_ERR_t tskm_svcsSetBootInfo(TSKM_SVCS_CTX_t* p_svcs,
410 T_SS_SM_START_DataStructType* p_info,
411 T_SS_SM_START_ExtDataStructType *p_exInfo);
413 /////////////////////////////////////////////////////////////////////////////////////
414 /// \ingroup tskm_svcsAvtiveSvcTerm
415 /// \~english @par Summary
416 /// Terminal the dynamic services.
417 /// \~english @param [in] p_svcs
418 /// p_svcs - pointer of services
420 /// p_svcs TSKM_SVCS_CTX_t*
423 /// uint32_t svcNum; // service num
424 /// TSKM_SVC_CTX_t *svcList; // services list pointer
425 /// } TSKM_SVCS_CTX_t;
427 /// \~english @retval TSKM_ERR_t
431 /// \~english @par Preconditions
433 /// \~english @par Change of the internal state
434 /// - The internal state is not changed.
435 /// \~english @par Causes of failures
436 /// - tskm_svcDownRequest return failed [TSKM_E_NG]
437 /// \~english @par Classification
439 /// \~english @par Type
441 /// \~english @par Detail
442 /// Terminal all the dynamic services which state equal TSKM_SVC_RUNNING and response num equal 0. \n
443 /// \~english @see tskm_svcDownRequest
444 ////////////////////////////////////////////////////////////////////////////////////
445 TSKM_ERR_t tskm_svcsAvtiveSvcTerm(TSKM_SVCS_CTX_t* p_svcs);
447 /////////////////////////////////////////////////////////////////////////////////////
448 /// \ingroup tskm_svcsCallDebugDump
449 /// \~english @par Summary
450 /// Send DebugDump message to services.
451 /// \~english @param [in] p_svcs
452 /// p_svcs - pointer of services
454 /// p_svcs TSKM_SVCS_CTX_t*
457 /// uint32_t svcNum; // service num
458 /// TSKM_SVC_CTX_t *svcList; // services list pointer
459 /// } TSKM_SVCS_CTX_t;
461 /// \~english @retval TSKM_ERR_t
465 /// \~english @par Preconditions
467 /// \~english @par Change of the internal state
468 /// - The internal state is not changed.
469 /// \~english @par Causes of failures
470 /// - tskm_sockSend send DebugDump message failed [TSKM_E_NG]
471 /// \~english @par Classification
473 /// \~english @par Type
475 /// \~english @par Detail
476 /// Send DebugDump message to services which state equal TSKM_SVC_RUNNING. \n
477 /// \~english @see tskm_sockSend
478 ////////////////////////////////////////////////////////////////////////////////////
479 TSKM_ERR_t tskm_svcsCallDebugDump(TSKM_SVCS_CTX_t* p_svcs);
481 /////////////////////////////////////////////////////////////////////////////////////
482 /// \ingroup tskm_svcsCallLowMem
483 /// \~english @par Summary
484 /// Send checking low memory message to services.
485 /// \~english @param [in] p_svcs
486 /// p_svcs - pointer of services
488 /// p_svcs TSKM_SVCS_CTX_t*
491 /// uint32_t svcNum; // service num
492 /// TSKM_SVC_CTX_t *svcList; // services list pointer
493 /// } TSKM_SVCS_CTX_t;
495 /// \~english @retval TSKM_ERR_t
499 /// \~english @par Preconditions
501 /// \~english @par Change of the internal state
502 /// - The internal state is not changed.
503 /// \~english @par Causes of failures
504 /// - tskm_sockSend send LowMemory message failed [TSKM_E_NG]
505 /// \~english @par Classification
507 /// \~english @par Type
509 /// \~english @par Detail
510 /// Send checking LowMemory message to services which state equal TSKM_SVC_RUNNING. \n
511 /// \~english @see tskm_sockSend
512 ////////////////////////////////////////////////////////////////////////////////////
513 TSKM_ERR_t tskm_svcsCallLowMem(TSKM_SVCS_CTX_t* p_svcs);
516 /////////////////////////////////////////////////////////////////////////////////////
517 /// \ingroup tskm_svcEventHandle
518 /// \~english @par Summary
520 /// \~english @param [in] p_svcs
521 /// p_svcs - pointer of services
523 /// p_svcs TSKM_SVCS_CTX_t*
526 /// uint32_t svcNum; // service num
527 /// TSKM_SVC_CTX_t *svcList; // services list pointer
528 /// } TSKM_SVCS_CTX_t;
530 /// \~english @param [in][out] p_ev
531 /// p_ev - event info pointer
533 /// p_ev TSKM_EVENT_INFO_t*
535 /// typedef struct _TSKM_EVENT_INFO_t {
536 /// TSKM_EVENT_t event;
537 /// TSKM_ERR_t errCode;
539 /// TSKM_BOOL_t hasExtend;
540 /// uint32_t extendSize;
544 /// TSKM_EV_PRI_REQ_WAKEUP_PRM_t reqWakeup;
545 /// TSKM_EV_PRI_REQ_DOWN_PRM_t reqDown;
548 /// TSKM_EV_PRI_REP_WAKEUP_COMP_PRM_t repWakeupComp;
549 /// TSKM_EV_PRI_REP_DOWN_COMP_PRM_t repDownComp;
550 /// TSKM_EV_PRI_REP_CONNECT_PRM_t repConnect;
551 /// TSKM_EV_PRI_RES_WAKEUP_PRM_t resWakeup;
552 /// TSKM_EV_PRI_RES_DOWN_PRM_t resDown;
553 /// TSKM_EV_LCL_CHG_SVC_STATE_PRM_t chgSvc;
555 /// } TSKM_EVENT_INFO_t;
557 /// \~english @retval TSKM_ERR_t
560 /// \~english @par Preconditions
562 /// \~english @par Change of the internal state
563 /// - The internal state is not changed.
564 /// \~english @par Causes of failures
566 /// \~english @par Classification
568 /// \~english @par Type
570 /// \~english @par Detail
572 /// process connect response.\n
573 /// process disconnect response. \n
574 /// process service wakeup request. \n
575 /// process service down request. \n
576 /// process service debugdump request. \n
577 /// process service exit request. \n
578 /// process service terminal response. \n
579 /// \~english @see isSvcEvent,connectHandle,disConnectHandle,resWakeupHandle, \n
580 /// resDownHandle,resDebugDumpHandle,reqExit,repTermHandle \n
581 ////////////////////////////////////////////////////////////////////////////////////
582 TSKM_ERR_t tskm_svcEventHandle(TSKM_SVC_CTX_t* p_svc, TSKM_EVENT_INFO_t* p_ev); // p_ev: [IN/OUT]
584 /////////////////////////////////////////////////////////////////////////////////////
585 /// \ingroup tskm_svcExec
586 /// \~english @par Summary
588 /// \~english @param [in][out] p_svc
589 /// p_svc - pointer of services
591 /// p_svc TSKM_SVC_CTX_t*
594 /// TSKM_SVC_ATTR_t *attr; // attribute of service
595 /// TSKM_SVC_STATE_t state; // state of service
596 /// int iFd; // inotifyFd used by touch
597 /// pid_t pid; // PID of service
598 /// int connFd; // service communicate fd
599 /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
600 /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
601 /// TSKM_BOOL_t isShmDone; // shared memory init done
602 /// TSKM_BOOL_t isStepDone; // step done
603 /// TSKM_BOOL_t isAvailable; // Availability flag
604 /// uint32_t watchCnt; // service monitor count
605 /// uint32_t waitResCnt; // wait response num
606 /// uint32_t waitReqCnt; // wait request num
607 /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
608 /// uint32_t errTermCnt; // exception terminal count
609 /// } TSKM_SVC_CTX_t;
611 /// \~english @retval TSKM_ERR_t
616 /// \~english @par Preconditions
618 /// \~english @par Change of the internal state
619 /// - The internal state is not changed.
620 /// \~english @par Causes of failures
621 /// - input parameter p_svc is NULL. [TSKM_E_NG]
622 /// - service state is TSKM_SVC_DISABLE [TSKM_E_STATE]
623 /// - reqTouch return failed [TSKM_E_NG]
624 /// - tskm_pf_createProc return failed [TSKM_E_NG]
625 /// \~english @par Classification
627 /// \~english @par Type
629 /// \~english @par Detail
630 /// start service which state is TSKM_SVC_DORMANT.\n
631 /// \~english @see svcExec, reqTouch, tskm_pf_createProc
632 ////////////////////////////////////////////////////////////////////////////////////
633 TSKM_ERR_t tskm_svcExec(TSKM_SVC_CTX_t* p_svc);
635 /////////////////////////////////////////////////////////////////////////////////////
636 /// \ingroup tskm_svcWakeupRequest
637 /// \~english @par Summary
638 /// Send started request to service.
639 /// \~english @param [in][out] p_svc
640 /// p_svc - pointer of service
642 /// p_svc TSKM_SVC_CTX_t*
645 /// TSKM_SVC_ATTR_t *attr; // attribute of service
646 /// TSKM_SVC_STATE_t state; // state of service
647 /// int iFd; // inotifyFd used by touch
648 /// pid_t pid; // PID of service
649 /// int connFd; // service communicate fd
650 /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
651 /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
652 /// TSKM_BOOL_t isShmDone; // shared memory init done
653 /// TSKM_BOOL_t isStepDone; // step done
654 /// TSKM_BOOL_t isAvailable; // Availability flag
655 /// uint32_t watchCnt; // service monitor count
656 /// uint32_t waitResCnt; // wait response num
657 /// uint32_t waitReqCnt; // wait request num
658 /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
659 /// uint32_t errTermCnt; // exception terminal count
660 /// } TSKM_SVC_CTX_t;
662 /// \~english @param [in] p_req
663 /// p_req - pointer of request
665 /// p_req TSKM_GSTEP_REQ_INFO_t*
668 /// TSKM_SVCID_t svcId; // service ID
669 /// TSKM_LOCAL_STEP_t localStep; // local step id
670 /// } TSKM_GSTEP_REQ_INFO_t;
672 /// \~english @retval TSKM_ERR_t
677 /// \~english @par Preconditions
679 /// \~english @par Change of the internal state
680 /// - The internal state is not changed.
681 /// \~english @par Causes of failures
682 /// - Input parameter p_svc is NULL. [TSKM_E_STATE]
683 /// - Service state is TSKM_SVC_DISABLE [TSKM_E_STATE]
684 /// - wakeupRequest return failed [TSKM_E_NG]
685 /// \~english @par Classification
687 /// \~english @par Type
689 /// \~english @par Detail
690 /// Send started request to service. If service do not connect, save the request.\n
691 /// Send request again when service connect. \n
692 /// \~english @see svcWakeupRequest
693 ////////////////////////////////////////////////////////////////////////////////////
694 TSKM_ERR_t tskm_svcWakeupRequest(TSKM_SVC_CTX_t* p_svc,
695 TSKM_GSTEP_REQ_INFO_t* p_req);
698 /////////////////////////////////////////////////////////////////////////////////////
699 /// \ingroup tskm_svcDownRequest
700 /// \~english @par Summary
701 /// Send service down request to service.
702 /// \~english @param [in][out] p_svc
703 /// p_svc - pointer service
705 /// p_svc TSKM_SVC_CTX_t*
708 /// TSKM_SVC_ATTR_t *attr; // attribute of service
709 /// TSKM_SVC_STATE_t state; // state of service
710 /// int iFd; // inotifyFd used by touch
711 /// pid_t pid; // PID of service
712 /// int connFd; // service communicate fd
713 /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
714 /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
715 /// TSKM_BOOL_t isShmDone; // shared memory init done
716 /// TSKM_BOOL_t isStepDone; // step done
717 /// TSKM_BOOL_t isAvailable; // Availability flag
718 /// uint32_t watchCnt; // service monitor count
719 /// uint32_t waitResCnt; // wait response num
720 /// uint32_t waitReqCnt; // wait request num
721 /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
722 /// uint32_t errTermCnt; // exception terminal count
723 /// } TSKM_SVC_CTX_t;
725 /// \~english @param [in] p_req
726 /// p_req - request pointer
728 /// p_req TSKM_GSTEP_REQ_INFO_t*
731 /// TSKM_SVCID_t svcId; // service ID
732 /// TSKM_LOCAL_STEP_t localStep; // local step id
733 /// } TSKM_GSTEP_REQ_INFO_t;
735 /// \~english @retval TSKM_ERR_t
739 /// \~english @par Preconditions
741 /// \~english @par Change of the internal state
742 /// - The internal state is not changed.
743 /// \~english @par Causes of failures
744 /// - Send service down request failed [TSKM_E_NG]
745 /// \~english @par Classification
747 /// \~english @par Type
749 /// \~english @par Detail
750 /// If service state is commounicated(TSKM_SVC_WAKEUP, TSKM_SVC_RUNNING), \n
751 /// send service down request and set state as TSKM_SVC_DOWN.\n
752 /// \~english @see tskm_svcIsCommunicatable,tskm_sockSend
753 ////////////////////////////////////////////////////////////////////////////////////
754 TSKM_ERR_t tskm_svcDownRequest(TSKM_SVC_CTX_t* p_svc,
755 TSKM_GSTEP_REQ_INFO_t* p_req);
757 /////////////////////////////////////////////////////////////////////////////////////
758 /// \ingroup tskm_svcDisableRequest
759 /// \~english @par Summary
761 /// \~english @param [in][out] p_svc
762 /// p_svc - pointer of service
764 /// p_svc TSKM_SVC_CTX_t*
767 /// TSKM_SVC_ATTR_t *attr; // attribute of service
768 /// TSKM_SVC_STATE_t state; // state of service
769 /// int iFd; // inotifyFd used by touch
770 /// pid_t pid; // PID of service
771 /// int connFd; // service communicate fd
772 /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
773 /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
774 /// TSKM_BOOL_t isShmDone; // shared memory init done
775 /// TSKM_BOOL_t isStepDone; // step done
776 /// TSKM_BOOL_t isAvailable; // Availability flag
777 /// uint32_t watchCnt; // service monitor count
778 /// uint32_t waitResCnt; // wait response num
779 /// uint32_t waitReqCnt; // wait request num
780 /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
781 /// uint32_t errTermCnt; // exception terminal count
782 /// } TSKM_SVC_CTX_t;
784 /// \~english @retval TSKM_ERR_t
788 /// \~english @par Preconditions
790 /// \~english @par Change of the internal state
791 /// - The internal state is not changed.
792 /// \~english @par Causes of failures
793 /// - If service state is not TSKM_SVC_DORMANT and TSKM_SVC_DISABLE. [TSKM_E_STATE]
794 /// \~english @par Classification
796 /// \~english @par Type
798 /// \~english @par Detail
799 /// Set service state as TSKM_SVC_DISABLE if state is TSKM_SVC_DORMANT.
800 /// \~english @see None
801 ////////////////////////////////////////////////////////////////////////////////////
802 TSKM_ERR_t tskm_svcDisableRequest(TSKM_SVC_CTX_t* p_svc);
804 /////////////////////////////////////////////////////////////////////////////////////
805 /// \ingroup tskm_svcDisableRequest
806 /// \~english @par Summary
807 /// Set service state as start available.
808 /// \~english @param [in][out] p_svc
809 /// p_svc - Pointer to service
811 /// p_svc TSKM_SVC_CTX_t*
814 /// TSKM_SVC_ATTR_t *attr; // attribute of service
815 /// TSKM_SVC_STATE_t state; // state of service
816 /// int iFd; // inotifyFd used by touch
817 /// pid_t pid; // PID of service
818 /// int connFd; // service communicate fd
819 /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
820 /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
821 /// TSKM_BOOL_t isShmDone; // shared memory init done
822 /// TSKM_BOOL_t isStepDone; // step done
823 /// TSKM_BOOL_t isAvailable; // Availability flag
824 /// uint32_t watchCnt; // service monitor count
825 /// uint32_t waitResCnt; // wait response num
826 /// uint32_t waitReqCnt; // wait request num
827 /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
828 /// uint32_t errTermCnt; // exception terminal count
829 /// } TSKM_SVC_CTX_t;
831 /// \~english @retval TSKM_ERR_t
834 /// \~english @par Preconditions
836 /// \~english @par Change of the internal state
837 /// - The internal state is not changed.
838 /// \~english @par Causes of failures
840 /// \~english @par Classification
842 /// \~english @par Type
844 /// \~english @par Detail
845 /// Set service state as start available which state is disable(TSKM_SVC_DISABLE).
846 /// \~english @see None
847 ////////////////////////////////////////////////////////////////////////////////////
848 TSKM_ERR_t tskm_svcEnableRequest(TSKM_SVC_CTX_t* p_svc);
850 /////////////////////////////////////////////////////////////////////////////////////
851 /// \ingroup tskm_svcIsCommunicatable
852 /// \~english @par Summary
853 /// Whether service is Communicatable.
854 /// \~english @param [in] p_svc
855 /// p_svc - pointer of service
857 /// p_svc TSKM_SVC_CTX_t*
860 /// TSKM_SVC_ATTR_t *attr; // attribute of service
861 /// TSKM_SVC_STATE_t state; // state of service
862 /// int iFd; // inotifyFd used by touch
863 /// pid_t pid; // PID of service
864 /// int connFd; // service communicate fd
865 /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
866 /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
867 /// TSKM_BOOL_t isShmDone; // shared memory init done
868 /// TSKM_BOOL_t isStepDone; // step done
869 /// TSKM_BOOL_t isAvailable; // Availability flag
870 /// uint32_t watchCnt; // service monitor count
871 /// uint32_t waitResCnt; // wait response num
872 /// uint32_t waitReqCnt; // wait request num
873 /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
874 /// uint32_t errTermCnt; // exception terminal count
875 /// } TSKM_SVC_CTX_t;
877 /// \~english @retval TSKM_BOOL_t
881 /// \~english @par Preconditions
883 /// \~english @par Change of the internal state
884 /// - The internal state is not changed.
885 /// \~english @par Causes of failures
886 /// - If input parameter p_svc is NULL. [TSKM_FALSE]
887 /// - If input parameter p_svc->attr->type is TSKM_SVC_TYPE_UNKNONW. [TSKM_FALSE]
888 /// - If service state is TSKM_SVC_DORMANT or TSKM_SVC_WAITCONNECT or
889 /// TSKM_SVC_FINDOWN orTSKM_SVC_DISABLE. [TSKM_FALSE]
890 /// \~english @par Classification
892 /// \~english @par Type
894 /// \~english @par Detail
895 /// Whether service is Communicatable. \n
896 /// If service state is TSKM_SVC_WAKEUP or TSKM_SVC_RUNNING or TSKM_SVC_DOWN, return TSKM_TRUE. \n
897 /// \~english @see None
898 ////////////////////////////////////////////////////////////////////////////////////
899 TSKM_BOOL_t tskm_svcIsCommunicatable(TSKM_SVC_CTX_t* p_svc);
901 #endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_SVC_H_