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 ///////////////////////////////////////////////////////////////////////////////
19 /// \brief Application framework's core structures and data types.
23 ///////////////////////////////////////////////////////////////////////////////
26 * @file frameworkunified_framework_types.h
27 * @brief \~english Application framework's core structures and data types.
30 /** @addtogroup BaseSystem
32 /** @addtogroup native_service
36 /** @addtogroup framework_unified
37 * @ingroup native_service
40 /** @addtogroup framework
41 * @ingroup native_service
44 #ifndef __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_TYPES_H__ // NOLINT (build/header_guard)
45 #define __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_TYPES_H__
47 #include <native_service/frameworkunified_types.h>
48 #include <boost/function.hpp>
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
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"
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);
68 typedef enum _EFrameworkunifiedServiceAvailableStatus {
69 eFrameworkunifiedServiceAvailable = 0,
70 eFrameworkunifiedServiceNotAvailable,
71 } EFrameworkunifiedServiceAvailableStatus;
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
80 * \~english Callbacks structure of Application Life cycle
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;
96 // LCOV_EXCL_BR_START 11:Occurred in the above test
97 typedef struct _FrameworkunifiedProtocolCallbackHandler {
100 } FrameworkunifiedProtocolCallbackHandler;
103 typedef struct _FrameworkunifiedFdProtocolCallbackHandler {
106 } FrameworkunifiedFdProtocolCallbackHandler;
108 // LCOV_EXCL_BR_START 11:Occurred in the above test
109 typedef struct _FrameworkunifiedNotificationCallbackHandler {
110 CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION];
112 } FrameworkunifiedNotificationCallbackHandler;
115 typedef struct _FrameworkunifiedNotificationsList {
116 CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION];
118 EFrameworkunifiedNotificationType persType;
119 } FrameworkunifiedNotificationsList;
121 typedef struct _FrameworkunifiedProtocolEvent {
124 } FrameworkunifiedProtocolEvent;
126 typedef struct _FrameworkunifiedNotificationEvent {
127 CHAR cNotification[MAX_STRING_SIZE_NOTIFICATION];
129 } FrameworkunifiedNotificationEvent;
131 typedef struct _ServiceAvailability {
132 CHAR cServiceName[MAX_NAME_SIZE_APP];
133 EFrameworkunifiedServiceAvailableStatus eServiceAvailability;
134 } ServiceAvailability;
136 typedef enum _EFrameworkunifiedShutdowntatus {
137 eFrameworkunifiedShutdownOk = 0,
138 eFrameworkunifiedShutdownTimeout,
139 eFrameworkunifiedShutdownFail,
140 } EFrameworkunifiedShutdownStatus;
142 typedef struct _ShutdownComplete {
143 CHAR cServiceName[MAX_NAME_SIZE_APP];
144 EFrameworkunifiedShutdownStatus eShutdownCompleteStatus;
147 typedef struct _CustomCommandLineOptions {
149 PCHAR cLongOptions; // reserved for long options.
150 CbArgumentParser callback;
151 } CustomCommandLineOptions;
153 /// Scheduling Policy
154 typedef enum _EFrameworkunifiedSchedPolicy {
155 eFrameworkunifiedSchedPolicyInherit = 0,
156 eFrameworkunifiedSchedPolicyTSS,
157 eFrameworkunifiedSchedPolicyFIFO,
158 eFrameworkunifiedSchedPolicyRR,
159 eFrameworkunifiedSchedPolicyMAX
160 } EFrameworkunifiedSchedPolicy;
162 /// Child Thread Attribute
163 typedef struct _FrameworkunifiedChildThreadAttr {
164 EFrameworkunifiedSchedPolicy schedPolicy;
166 } FrameworkunifiedChildThreadAttr;
168 #endif /* __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_FRAMEWORK_TYPES_H__ */ // NOLINT (build/header_guard)