summaryrefslogtreecommitdiffstats
path: root/task_manager/server/include/tskm_main.h
blob: 24ba5f1f156a81547a75af8bc85d2345066413f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
 *
 * 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 TASK_MANAGER_SERVER_INCLUDE_TSKM_MAIN_H_
#define TASK_MANAGER_SERVER_INCLUDE_TSKM_MAIN_H_

#include <system_service/ss_boot_map.h>

#include "system_service/tskm_svc.h"
#include "system_service/tskm_local_type.h"
#include "tskm_comm.h"
#include "tskm_type_local.h"

typedef struct {
  // State
  TSKM_BOOL_t isExec;                  // Executing flag
  TSKM_STATE_t state;                  // TSKM state

  // API
  TSKM_BOOL_t inApi;                   // API running
  TSKM_ERR_t apiRet;                   // API return
  TSKM_BOOL_t isReboot;                // REBOOT request

  TSKM_BOOL_t isOnStartDone;           // System start process completion flag
  TSKM_BOOL_t isOnStopDone;            // System stop process completion flag

  // Communication
  TSKM_SRV_SOCK_CTX_t sock;            // priLib socket
  int sigFd;                           // signalFd(process-termination-detection)
  HANDLE hApp;                         // DispatcherHandle
  int nsFd;                            // For receiving from the NSFW
  int iFd;                             // inotify FDs
  int resmFd;                          // EV FDs of RESM

  // Non-volatile info
  TSKM_NV_INFO_t nvInfo;               // Non-volatile information

  // Startup info
  T_SS_SM_START_DataStructType bootInfo;          // for Pri notification
  T_SS_SM_START_ExtDataStructType extBootInfo;    // for Pri notification

  // Analysis support
  STATEMGR__CWORD69_LOG* p__CWORD69_Log;         // BUGBUG: Required or not

  // Services management
  TSKM_SVCS_CTX_t svcs;

  // Gradual starting state management
  TSKM_GSTEP_CTX_t wakeup;

  // Gradual terminating state management
  TSKM_GSTEP_CTX_t down;
} TSKM_MAIN_CTX_t;

EFrameworkunifiedStatus OnStart(const HANDLE hApp);  // System start process
TSKM_MAIN_CTX_t* tskm_getMainCtx(void);

#endif  // TASK_MANAGER_SERVER_INCLUDE_TSKM_MAIN_H_