Init basesystem source codes.
[staging/basesystem.git] / nsframework / framework_unified / client / include / native_service / frameworkunified_framework_types.h
1 /*
2  * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 ///////////////////////////////////////////////////////////////////////////////
18 /// \ingroup
19 /// \brief    Application framework's core structures and data types.
20 ///
21 ///
22 ///
23 ///////////////////////////////////////////////////////////////////////////////
24 //@{
25 /**
26  * @file frameworkunified_framework_types.h
27  * @brief \~english Application framework's core structures and data types.
28  *
29  */
30 /** @addtogroup BaseSystem
31  */
32 /** @addtogroup native_service
33  *  @ingroup BaseSystem
34  *  @{
35  */
36 /** @addtogroup framework_unified
37  *  @ingroup native_service
38  *  @{
39  */
40 /** @addtogroup framework
41  *  @ingroup native_service
42  *  @{
43  */
44 #ifndef __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_TYPES_H__  // NOLINT  (build/header_guard)
45 #define __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_TYPES_H__
46
47 #include <native_service/frameworkunified_types.h>
48 #include <boost/function.hpp>
49
50 #define MAX_LEN      MAX_QUEUE_NAME_SIZE
51 #define MAX_MSGQ_BUFFER  MAX_QUEUE_MSG_SIZE
52 #define MAX_SESSION_ID_VAL 0xFFFF
53 #define MAX_FD_MULTIWAITING 8
54
55 #define FRAMEWORKUNIFIED_ANY_SOURCE   "NS_ANY_SRC"
56 #define FRAMEWORKUNIFIED_ANY_COMMAND  0xFFFFFFFF
57 #define FRAMEWORKUNIFIED_NS_NPSERVICE "NS_NPPService"
58 #define FRAMEWORKUNIFIED_NS_VERSIONUTIL "nsverutil"
59 #define FRAMEWORKUNIFIED_NS_MSGPROFILERUTIL "NSDisMsgProfile"
60 #define FRAMEWORKUNIFIED_NS_REMOTECONTROLSERVICE "NS_RemoteControlService"
61
62 // call back function definition
63 typedef boost::function< EFrameworkunifiedStatus(HANDLE) > TCbFunction;
64 typedef TCbFunction CallbackFunctionPtr;
65 typedef TCbFunction CbFuncPtr;
66 typedef EFrameworkunifiedStatus(*CbArgumentParser)(SI_32 argument, PCHAR argumentValue);
67
68 typedef enum _EFrameworkunifiedServiceAvailableStatus {
69   eFrameworkunifiedServiceAvailable = 0,
70   eFrameworkunifiedServiceNotAvailable,
71 } EFrameworkunifiedServiceAvailableStatus;
72
73 // Share Memory Retrieve Types
74 typedef enum _ESMRetrieveTypes {
75   eSMRRelease = 0,  ///< data will be released on a read
76   eSMRRetain = 1,  ///< data will be retained in the shared memory
77 } ESMRetrieveTypes;
78
79 /**
80  * \~english Callbacks structure of Application Life cycle
81  */
82 typedef struct _FrameworkunifiedDefaultCallbackHandler {
83   CbFuncPtr onInitilization;  //!< \~english Callback of initialization
84   CbFuncPtr onDestroy;  //!< \~english Callback of destroy
85   CbFuncPtr onStart;  //!< \~english Callback of startup
86   CbFuncPtr onStop;  //!< \~english Callback of stop
87   CbFuncPtr onPreStart;  //!< \~english Callback of pre start
88   CbFuncPtr onPreStop;  //!< \~english Callback of pre stop
89   CbFuncPtr onBackgroundStart;  //!< \~english Callback of Background start
90   CbFuncPtr onBackgroundStop;  //!< \~english Callback of Background stop
91   CbFuncPtr onDebugDump;  //!< \~english Callback of debug dump
92   CbFuncPtr createStateMachine;  //!< \~english Callback of created state machine
93   CbFuncPtr ssFrameworkInterface;  //!< \~english Callback to Establish a session with the system_manager
94 } FrameworkunifiedDefaultCallbackHandler;
95
96 // LCOV_EXCL_BR_START 11:Occurred in the above test
97 typedef struct _FrameworkunifiedProtocolCallbackHandler {
98   UI_32 iCmd;
99   CbFuncPtr callBack;
100 } FrameworkunifiedProtocolCallbackHandler;
101 // LCOV_EXCL_BR_STOP
102
103 typedef struct _FrameworkunifiedFdProtocolCallbackHandler {
104   int fd;
105   CbFuncPtr callBack;
106 } FrameworkunifiedFdProtocolCallbackHandler;
107
108 // LCOV_EXCL_BR_START 11:Occurred in the above test
109 typedef struct _FrameworkunifiedNotificationCallbackHandler {
110   CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION];
111   CbFuncPtr callBack;
112 } FrameworkunifiedNotificationCallbackHandler;
113 // LCOV_EXCL_BR_STOP
114
115 typedef struct _FrameworkunifiedNotificationsList {
116   CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION];
117   UI_32 uiLengthData;
118   EFrameworkunifiedNotificationType  persType;
119 } FrameworkunifiedNotificationsList;
120
121 typedef struct _FrameworkunifiedProtocolEvent {
122   UI_32 iCmd;
123   UI_32 iEventId;
124 } FrameworkunifiedProtocolEvent;
125
126 typedef struct _FrameworkunifiedNotificationEvent {
127   CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION];
128   UI_32 iEventId;
129 } FrameworkunifiedNotificationEvent;
130
131 typedef struct _ServiceAvailability {
132   CHAR cServiceName[MAX_NAME_SIZE_APP];
133   EFrameworkunifiedServiceAvailableStatus eServiceAvailability;
134 } ServiceAvailability;
135
136 typedef enum _EFrameworkunifiedShutdowntatus {
137   eFrameworkunifiedShutdownOk = 0,
138   eFrameworkunifiedShutdownTimeout,
139   eFrameworkunifiedShutdownFail,
140 } EFrameworkunifiedShutdownStatus;
141
142 typedef struct _ShutdownComplete {
143   CHAR cServiceName[MAX_NAME_SIZE_APP];
144   EFrameworkunifiedShutdownStatus eShutdownCompleteStatus;
145 } ShutdownComplete;
146
147 typedef struct _CustomCommandLineOptions {
148   PCSTR cShortOptions;
149   PCHAR cLongOptions;  // reserved for long options.
150   CbArgumentParser callback;
151 } CustomCommandLineOptions;
152
153 /// Scheduling Policy
154 typedef enum _EFrameworkunifiedSchedPolicy {
155   eFrameworkunifiedSchedPolicyInherit = 0,
156   eFrameworkunifiedSchedPolicyTSS,
157   eFrameworkunifiedSchedPolicyFIFO,
158   eFrameworkunifiedSchedPolicyRR,
159   eFrameworkunifiedSchedPolicyMAX
160 } EFrameworkunifiedSchedPolicy;
161
162 /// Child Thread Attribute
163 typedef struct _FrameworkunifiedChildThreadAttr {
164   EFrameworkunifiedSchedPolicy schedPolicy;
165   SI_32 schedPriority;
166 } FrameworkunifiedChildThreadAttr;
167
168 #endif /* __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_TYPES_H__ */  // NOLINT  (build/header_guard)
169 /** @}*/
170 /** @}*/
171 /** @}*/
172 /** @}*/
173 //@}