Init basesystem source codes.
[staging/basesystem.git] / video_in_hal / nsframework / framework_unified / client / include / native_service / frameworkunified_dispatcher.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  tag_NSFramework
19 /// \brief    Application dispatch interface functions
20 ///////////////////////////////////////////////////////////////////////////////
21 //@{
22 /**
23  * @file frameworkunified_dispatcher.h
24  * @brief \~english This file contains the base class of application.
25  *
26  */
27 /** @addtogroup BaseSystem
28  *  @{
29  */
30 /** @addtogroup native_service
31  *  @ingroup BaseSystem
32  *  @{
33  */
34 /** @addtogroup framework_unified
35  *  @ingroup native_service
36  *  @{
37  */
38 /** @addtogroup framework
39  *  @ingroup native_service
40  *  @{
41  */
42 #ifndef __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_DISPATCHER_H__  // NOLINT  (build/header_guard)
43 #define __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_DISPATCHER_H__
44
45 #include <native_service/frameworkunified_framework_types.h>
46 // #include <native_service/frameworkunified_sm_hsmframework.h>
47
48 ////////////////////////////////////////////////////////////////////////////////////////////
49 /// \ingroup FrameworkunifiedDispatcher
50 /// \~english @par Brief
51 ///        This API creates, initializes the dispatcher and runs mainloop for event handling.
52 /// \~english @param [in] cAppName
53 ///        PCSTR - Pointer to application thread name
54 /// \~english @param [in] CbHandler
55 ///        const FrameworkunifiedDefaultCallbackHandler* - Pointer to default callback functions.
56 /// \~english @par
57 ///        FrameworkunifiedDefaultCallbackHandler Structure
58 /// \~english @code
59 ///                 typedef struct _FrameworkunifiedDefaultCallbackHandler
60 ///                 {
61 ///                       CbFuncPtr onInitilization;               /* Function is called when a Dispatcher is created.
62 ///                                   */
63 ///                       CbFuncPtr onDestroy;                     /* Function is called when the Dispatcher is
64 ///                       released.            */
65 ///                       CbFuncPtr onStart;                       /* Function is called when the Dispatcher is started.
66 ///                                   */
67 ///                       CbFuncPtr onStop;                        /* Function is called when the Dispatcher is stopped.
68 ///                                   */
69 ///                       CbFuncPtr onPreStart;                    /* Function is called when the Dispatcher is pre started. */
70 ///                       CbFuncPtr onPreStop;                     /* Function is called when the Dispatcher is pre stoped. */
71 ///                       CbFuncPtr onBackgroundStart;             /* Function is called when the Dispatcher is Background started. */
72 ///                       CbFuncPtr onBackgroundStop;              /* Function is called when the Dispatcher is Background stopped. */
73 ///                       CbFuncPtr onDebugDump;                   /* Function is called when the Dispatcher detects
74 ///                       abnormal state. */
75 ///                       CbFuncPtr createStateMachine;            /* Set dummy function that does nothing.
76 ///                                   */
77 ///                       CbFuncPtr ssFrameworkInterface;          /* Function to connect to SystemManager
78 ///                                   */
79 ///                 } FrameworkunifiedDefaultCallbackHandler;
80 ///            @endcode
81 /// \~english @par
82 ///        About setting of default callback functions(FrameworkunifiedDefaultCallbackHandler)
83 ///        - Use FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK when initialize of FrameworkunifiedDefaultCallbackHandler structure as argument CbHandler.
84 ///        - Application that run this API need to define functions below.(allow to dummy function that does nothing.)
85 ///            - EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp)
86 ///            - EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
87 ///            - EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
88 ///            - EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp)
89 ///            - EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp)
90 ///            - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp)
91 ///            - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp)
92 ///            - EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp)
93 ///            - EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp)
94 ///            - EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
95 ///        - If application is resident service, link library libSS_SystemIfUnified
96 ///          (This library provides the function FrameworkunifiedSSFrameworkInterface to connect to SystemManager.).
97 ///        - If application is nonresident service, define function that does nothing below.
98 ///            - EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp)
99 /// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
100 /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
101 /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
102 /// \~english @retval eFrameworkunifiedStatusDuplicate Duplication error of entry
103 /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
104 /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
105 /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
106 /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
107 /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
108 /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
109 /// \~english @par Prerequisite
110 ///        - Prerequisites are nothing.
111 /// \~english @par Change of internal state
112 ///        - Change of internal state according to the API does not occur.
113 /// \~english @par Conditions of processing failure
114 ///        - Application thread name specified in the argument (cAppName) is NULL. [eFrameworkunifiedStatusNullPointer]
115 ///        - Pointer to default callback functions specified in the argument (CbHandler) is NULL.
116 ///        [eFrameworkunifiedStatusNullPointer]
117 ///        - One of members in default callback functions specified in the argument (CbHandler) is NULL.
118 ///        [eFrameworkunifiedStatusInvldParam]
119 ///        - Application thread name specified in the argument (cAppName) is not appropriate(The name is more than
120 ///        15byte). [eFrameworkunifiedStatusNullPointer]
121 ///        - Failed to open message queue (mq_open). [eFrameworkunifiedStatusNullPointer]
122 ///        - Failed to get memory (malloc) of message queue info area. [eFrameworkunifiedStatusNullPointer]
123 ///        - Failed to initialize socket for monitoring abnormal state (socket, bind, listen). [eFrameworkunifiedStatusFail]
124 ///        - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
125 ///        - It is invalid transmission file descriptor of the session message to the NPP Service.
126 ///        [eFrameworkunifiedStatusErrNoEBADF]
127 ///        - Interruption by the system call (signal) has occurred during the transmission of the session message for
128 ///        the NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
129 ///        - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
130 ///        - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
131 ///        - Failed to create of epoll instance (epoll_create1). [eFrameworkunifiedStatusInvldHandle]
132 ///        - Failed to register of a descriptor of the message queue to the epoll instance (epoll_ctl).
133 ///        [eFrameworkunifiedStatusInvldHandle]
134 ///        - Failed to create file descriptor for receive event (eventfd). [eFrameworkunifiedStatusFail]
135 ///        - Failed to register of a descriptor for receive event to the epoll instance (epoll_ctl). [eFrameworkunifiedStatusFail]
136 ///        - Failed to register of a socket for detect abnormal state to the epoll instance (epoll_ctl).
137 ///        [eFrameworkunifiedStatusFail]
138 ///        - The result of FrameworkunifiedOnInitialization is not eFrameworkunifiedStatusOK. [eFrameworkunifiedStatusNullPointer]
139 /// \~english @par Detail
140 ///        This API creates and initializes the dispatcher.\n
141 ///        It starts to mainloop that receives request or notification, and runs registered callback to dispatcher.
142 ///        When success starting mainloop, never return.
143 /// \~english @par Classification
144 ///        Public
145 /// \~english @par Type
146 ///        No match
147 /// \~english @see
148 ///        FrameworkunifiedDispatcherWithArguments
149 ////////////////////////////////////////////////////////////////////////////////////////////
150 EFrameworkunifiedStatus FrameworkunifiedDispatcher(PCSTR cAppName, const FrameworkunifiedDefaultCallbackHandler *CbHandler);
151
152 ////////////////////////////////////////////////////////////////////////////////////////////
153 /// \ingroup FrameworkunifiedDispatcherWithArguments
154 /// \~english @par Brief
155 ///        This API creates, initializes the dispatcher and runs loop with command-line options.
156 /// \~english @param [in] cAppName
157 ///        PCSTR   - Pointer to application thread name
158 /// \~english @param [in] argc
159 ///        int   - Number of command-line options
160 /// \~english @param [in] argv
161 ///        char *[]   - Array of pointer to command-line options
162 /// \~english @param [in] CbHandler
163 ///        const FrameworkunifiedDefaultCallbackHandler*   - Pointer to default callback functions.
164 /// \~english @param [in] cmdLineOptions
165 ///        CustomCommandLineOptions*   - Parser setting of command-line options(Optional. When don't use, set NULL.)
166 /// \~english @par
167 ///        FrameworkunifiedDefaultCallbackHandler Structure
168 /// \~english @code
169 ///                 typedef struct _FrameworkunifiedDefaultCallbackHandler
170 ///                 {
171 ///                       CbFuncPtr onInitilization;               /* Function is called when a Dispatcher is created.
172 ///                                   */
173 ///                       CbFuncPtr onDestroy;                     /* Function is called when the Dispatcher is
174 ///                       released.            */
175 ///                       CbFuncPtr onStart;                       /* Function is called when the Dispatcher is started.
176 ///                                   */
177 ///                       CbFuncPtr onStop;                        /* Function is called when the Dispatcher is stopped.
178 ///                                   */
179 ///                       CbFuncPtr onPreStart;                    /* Function is called when the Dispatcher is pre started. */
180 ///                       CbFuncPtr onPreStop;                     /* Function is called when the Dispatcher is pre stoped. */
181 ///                       CbFuncPtr onBackgroundStart;             /* Function is called when the Dispatcher is Background started. */
182 ///                       CbFuncPtr onBackgroundStop;              /* Function is called when the Dispatcher is Background stopped. */
183 ///                       CbFuncPtr onDebugDump;                   /* Function is called when the Dispatcher detects
184 ///                       abnormal state. */
185 ///                       CbFuncPtr createStateMachine;            /* Set dummy function that does nothing.
186 ///                                   */
187 ///                       CbFuncPtr ssFrameworkInterface;          /* Function to connect to SystemManager
188 ///                                   */
189 ///                 } FrameworkunifiedDefaultCallbackHandler;
190 ///            @endcode
191 /// \~english @par
192 ///        CustomCommandLineOptions Structure
193 /// \~english @code
194 ///                 typedef struct _CustomCommandLineOptions
195 ///                 {
196 ///                       PCSTR            cShortOptions;          /* Short options list. */
197 ///                       PCHAR            cLongOptions;           /* Reserved. Set to NULL. */
198 ///                       CbArgumentParser callback;               /* Pointer to callback function to parse command-line
199 ///                       options. */
200 ///                 } CustomCommandLineOptions;
201 ///            @endcode
202 /// \~english @par
203 ///        About setting of default callback functions(FrameworkunifiedDefaultCallbackHandler)
204 ///        - Use FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK when initialize of FrameworkunifiedDefaultCallbackHandler structure as argument CbHandler.
205 ///        - Application that run this API need to define functions below.(allow to dummy function that does nothing.)
206 ///            - EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp)
207 ///            - EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
208 ///            - EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
209 ///            - EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp)
210 ///            - EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp)
211 ///            - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp)
212 ///            - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp)
213 ///            - EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp)
214 ///            - EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp)
215 ///            - EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
216 ///        - If application is resident service, link library libSS_SystemIfUnified
217 ///          (This library provides the function FrameworkunifiedSSFrameworkInterface to connect to SystemManager.).
218 ///        - If application is nonresident service, define function that does nothing below.
219 ///            - EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp)
220 /// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
221 /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
222 /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
223 /// \~english @retval eFrameworkunifiedStatusDuplicate Duplication error of entry
224 /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
225 /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
226 /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
227 /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
228 /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
229 /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
230 /// \~english @par Prerequisite
231 ///       - Prerequisites are nothing.
232 /// \~english @par Change of internal state
233 ///       - Change of internal state according to the API does not occur.
234 /// \~english @par Conditions of processing failure
235 ///       - Application thread name specified in the argument (cAppName) is NULL. [eFrameworkunifiedStatusNullPointer]
236 ///       - Pointer to default callback functions specified in the argument (CbHandler) is NULL. [eFrameworkunifiedStatusNullPointer]
237 ///       - One of members in default callback functions specified in the argument (CbHandler) is NULL.
238 ///       [eFrameworkunifiedStatusInvldParam]
239 ///       - Application thread name specified in the argument (cAppName) is not appropriate(The name is more than
240 ///       15byte). [eFrameworkunifiedStatusNullPointer]
241 ///       - Failed to open message queue (mq_open). [eFrameworkunifiedStatusNullPointer]
242 ///       - Failed to get memory (malloc) of message queue info area. [eFrameworkunifiedStatusNullPointer]
243 ///       - Failed to initialize socket for monitoring abnormal state (socket, bind, listen). [eFrameworkunifiedStatusFail]
244 ///       - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
245 ///       - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
246 ///       - Interruption by the system call (signal) has occurred during the transmission of the session message for the
247 ///       NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
248 ///       - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
249 ///       - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
250 ///       - Failed to create of epoll instance (epoll_create1). [eFrameworkunifiedStatusInvldHandle]
251 ///       - Failed to register of a descriptor of the message queue to the epoll instance (epoll_ctl).
252 ///       [eFrameworkunifiedStatusInvldHandle]
253 ///       - Failed to create file descriptor for receive event (eventfd). [eFrameworkunifiedStatusFail]
254 ///       - Failed to register of a descriptor for receive event to the epoll instance (epoll_ctl). [eFrameworkunifiedStatusFail]
255 ///       - Failed to register of a socket for detect abnormal state to the epoll instance (epoll_ctl). [eFrameworkunifiedStatusFail]
256 ///       - The result of FrameworkunifiedOnInitialization is not eFrameworkunifiedStatusOK. [eFrameworkunifiedStatusNullPointer]
257 /// \~english @par Detail
258 ///        This API creates and initializes the dispatcher with command-line options.\n
259 ///        It starts to mainloop that receives request or notification, and runs registered callback to dispatcher.
260 ///        When success starting mainloop, never return.
261 ///        Use this API to take over a command-line options to the dispatcher.
262 /// \~english @par Classification
263 ///          Public
264 /// \~english @par Type
265 ///        No match
266 /// \~english @see
267 ///        FrameworkunifiedDispatcher, FrameworkunifiedCreateDispatcher, FrameworkunifiedDispatchBlock,
268 ///        FrameworkunifiedDispatchProcess, FrameworkunifiedCloseDispatcher,
269 ////////////////////////////////////////////////////////////////////////////////////////////
270 EFrameworkunifiedStatus FrameworkunifiedDispatcherWithArguments(PCSTR cAppName, int argc, char *argv[],
271                                       const FrameworkunifiedDefaultCallbackHandler *CbHandler,
272                                       CustomCommandLineOptions *cmdLineOptions = NULL);
273
274 ////////////////////////////////////////////////////////////////////////////////////////////
275 /// \ingroup FrameworkunifiedSimpleDispatcher
276 /// \~english @par none
277 ///        Generatings/intializes a Dispatcher and executs main loops for handling events.
278 /// \~english @param [in] cAppName
279 ///        PCSTR   - Pointer to the application thread name
280 /// \~english @param [in] CbHandler
281 ///        const FrameworkunifiedDefaultCallbackHandler*   - Pointer to a default-defined callback function
282 /// \~english @param [in] CbShutdown
283 ///        CbFuncPtr   - Pointer to the callack function o be called when the main loop is exited
284 /// \~english @param [in] isChildThread
285 ///        BOOL   - Whether the child thread is a dispatcher (Default:TRUE)
286 /// \~english @par
287 ///        FrameworkunifiedDefaultCallbackHandler Structure
288 /// \~english @code
289 ///                 typedef struct _FrameworkunifiedDefaultCallbackHandler
290 ///                 {
291 ///                   CbFuncPtr onInitilization;       /* Callback function to run when creating dispatcher instance */
292 ///                   CbFuncPtr onDestroy;             /* Callback function to run when releasing dispatcher instance */
293 ///                   CbFuncPtr onStart;               /* Callback function executed when dispatcher starts processing */
294 ///                   CbFuncPtr onStop;                /* Callback function to be executed when dispatcher termination is requested */
295 ///                   CbFuncPtr onPreStart;            /* Callback function executed when dispatcher requestes activation */
296 ///                   CbFuncPtr onPreStop;             /* Callback function to be executed when an-request is made to the dispatcher on board status */
297 ///                   CbFuncPtr onBackgroundStart;     /* Callback function executed when dispatcher parking is requested */
298 ///                   CbFuncPtr onBackgroundStop;      /* Callback function executed when requesting termination of a dispatcher's parking status */
299 ///                   CbFuncPtr onDebugDump;           /* Callback function to be executed when an error is detected */
300 ///                   CbFuncPtr createStateMachine;    /* Specify an empty function */
301 ///                   CbFuncPtr ssFrameworkInterface;  /* Callback function for connecting to the systemManager */
302 ///                 } FrameworkunifiedDefaultCallbackHandler;
303 ///            @endcode
304 /// \~english @par
305 ///        About setting the default definition callback function (FrameworkunifiedDefaultCallbackHandler)
306 ///          The FrameworkunifiedDefaultCallbackHandler structure passed as argument CbHandler must be initialized using the FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK macro.
307 ///        - The application that executes this API must define a function with the following name. (Can also be an functio)
308 ///          - EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp)
309 ///          - EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
310 ///          - EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
311 ///          - EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp)
312 ///          - EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp)
313 ///          - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp)
314 ///          - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp)
315 ///          - EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp)
316 ///          - EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp)
317 ///          - EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
318 ///          If the applicatio is a resident service, link the library libSS_SystemIfUnified
319 ///          (which provides the function FrameworkunifiedSSFrameworkInterface that performs connection processin with SystemManager).
320 ///        - If the applicatio is a nonresident service, define the following names with empy function.
321 ///          - EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp)
322 /// \~english @retval eFrameworkunifiedStatusNullPointer Specifiying NULL pointers
323 /// \~english @retval eFrameworkunifiedStatusFail User-specific continuation.
324 /// \~english @retval eFrameworkunifiedStatusDuplicate Duplicate entry error
325 /// \~english @retval eFrameworkunifiedStatusInvldHandle Category Type
326 /// \~english @retval eFrameworkunifiedStatusErrOther Shared-memory accesses for sending message for NPP Service fail.
327 /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue full
328 /// \~english @retval eFrameworkunifiedStatusErrNoEBADF If the timers fail,...
329 /// \~english @retval eFrameworkunifiedStatusErrNoEINTR Generating an interrupt by a system call (signal)
330 /// \~english @retval eFrameworkunifiedStatusInvldBufSize Service does not exist
331 /// \~english @par Failed to acquire
332 ///        - 
333 /// \~english @par Log output string
334 ///        - The internal state is not changed.
335 /// \~english @par You do not use.
336 ///        - When the pointer (CbHandler) to the default-definition callback function specified by the arguments is NULL [eFrameworkunifiedStatusNullPointer]
337 ///        - If any of the member of the default-defined callback-function sruct specified in he arguments is NULL [eFrameworkunifiedStatusInvldParam]
338 ///        - When the pointer (CbShutdown) to the callback fuction to be called when the main loop specified by the arguments exits is NULL [eFrameworkunifiedStatusFail]
339 ///        - When the pointer (cAppName) to the threade name of the application specified by the arguments is NULL [eFrameworkunifiedStatusNullPointer]
340 ///        - When the application name (cAppName) specified in the parameter exceeds 15 byte [eFrameworkunifiedStatusNullPointer]
341 ///        - Failed to open a message queue (mq_open) [eFrameworkunifiedStatusNullPointer]
342 ///        - When acquisition (malloc) of the message queue management information area fails, [eFrameworkunifiedStatusNullPointer]
343 ///        - If the creation (socket, bind, listen) of sockets for error monitoring fails,... [eFrameworkunifiedStatusFail]
344 ///        - Application handles and callback function cannot be added to Notification lists [eFrameworkunifiedStatusDuplicate]
345 ///        - When the Notification name specified in the arguments has already been registred i the Dispatcher [eFrameworkunifiedStatusDuplicate]
346 ///        - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
347 ///        - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
348 ///        - When an interrupt by a system call (signal) occurs while sending session-specific messages for NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
349 ///        - Incorrectly sized send buffers for sessions destined for the NPP Service.... [eFrameworkunifiedStatusInvldBufSize]
350 ///        - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
351 ///        - Failed to access shared memory for sending messages for sessions for NPP Service [eFrameworkunifiedStatusErrOther]
352 ///        - Failed to create epoll instances (epoll_create1) [eFrameworkunifiedStatusInvldHandle]
353 ///        - Failed to register Dispatcher message queue descriptor for epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
354 ///        - Failed to create file descriptor for receiving events to Dispatcher (eventfd) [eFrameworkunifiedStatusFail]
355 ///        - Failed to register file descriptor for receiving Dispatcher events to epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
356 ///        - Failed to register socket for monitoring Dispatcher error in epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
357 ///        - If FrameworkunifiedOnInitialization of result is not eFrameworkunifiedStatusOK [eFrameworkunifiedStatusNullPointer]
358 /// \~english @par Type
359 ///        Creats or initializes a Dispatcher, receives requests and notifications to the Dispatcher, and starts a main loop that executes the registred callback functions.\n
360 ///        When the main loop is started normally, this API does not retur until the hread terminates.\n
361 ///        At thread termination, the callback function specified by the third argument is called, and the processing result is returned.\n
362 ///        \n
363 ///        This API can be used for both main and child threads.\n
364 ///        However, since this API is an API for chid threads created without going through the API of NS framework such as \ref FrameworkunifiedCreateChildThread,
365 ///        it is recommended to use \ref FrameworkunifiedDispatcherWithArguments or other API to create Dispatcher in the main thread.\n
366 /// \~english @par Immediate
367 ///          Brief
368 /// \~english @par Classification
369 ///        Public
370 /// \~english @par Type
371 ///        Not applicable
372 /// \~english @see
373 ///        FrameworkunifiedDispatcherWithArguments
374 ///
375 /// \~english @par Brief
376 ///        Generatings/intializes a Dispatcher and executs main loops for handling events
377 /// \~english @param [in] cAppName
378 ///        PCSTR - Application/ thread name
379 /// \~english @param [in] CbHandler
380 ///        const FrameworkunifiedDefaultCallbackHandler*   - Function that primes the dispatch pump. i.e. start function
381 /// \~english @param [in] CbShutdown
382 ///        CbFuncPtr * - Shutdown function. Functions gets called if the dispatcher loop exits.
383 /// \~English @param[in] isChildThread
384 ///        BOOL - Default value is TRUE. TRUE - child thread dispatcher else main thread dispatcher
385 /// \~english @retval Never does. Unless any callback function returns eFrameworkunifiedStatusExit
386 /// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer
387 /// \~english @retval eFrameworkunifiedStatusFail  Invalid Parameter
388 /// \~english @retval eFrameworkunifiedStatusErrOther Unknown Error
389 /// \~english @par Prerequisite
390 ///       - Prerequisites are nothing.
391 /// \~english @par Change of internal state
392 ///       - Change of internal state according to the API does not occur.
393 /// \~english @par Conditions of processing failure
394 ///        - cAppName is NULL[eFrameworkunifiedStatusNullPointer]
395 ///        - Length of cAppName is longer than MAX_NAME_SIZE_APP[eFrameworkunifiedStatusNullPointer]
396 ///        - NativeService has some issues [eFrameworkunifiedStatusNullPointer]
397 ///        - When the pointer (CbHandler) to the default-definition callback function specified by the arguments is NULL [eFrameworkunifiedStatusNullPointer]
398 ///        - If any of the member of the default-defined callback-function sruct specified in he arguments is NULL [eFrameworkunifiedStatusInvldParam]
399 ///        - When the pointer (CbShutdown) to the callback fuction to be called when the main loop specified by the arguments exits is NULL [eFrameworkunifiedStatusFail]
400 ///        - Failed to open a message queue (mq_open) [eFrameworkunifiedStatusNullPointer]
401 ///        - When acquisition (malloc) of the message queue management information area fails, [eFrameworkunifiedStatusNullPointer]
402 ///        - If the creation (socket, bind, listen) of sockets for error monitoring fails,... [eFrameworkunifiedStatusFail]
403 ///        - Application handles and callback function cannot be added to Notification lists [eFrameworkunifiedStatusDuplicate]
404 ///        - When the Notification name specified in the arguments has already been registred i the Dispatcher [eFrameworkunifiedStatusDuplicate]
405 ///        - Full Message Queue for Sessions for NPP Service [eFrameworkunifiedStatusMsgQFull]
406 ///        - Incorrect file descriptors for sending messages for NPP Service sessions [eFrameworkunifiedStatusErrNoEBADF]
407 ///        - When an interrupt by a system call (signal) occurs while sending NPP Service session-specific messages [eFrameworkunifiedStatusErrNoEINTR]
408 ///        - Incorrectly sized send buffers for sessions destined for the NPP Service.... [eFrameworkunifiedStatusInvldBufSize]
409 ///        - If there are any errors sending messages for sessions intended for NPP Service [eFrameworkunifiedStatusFail]
410 ///        - When an interrupt by a system call (signal) occurs while sending Service session-specific messages. [eFrameworkunifiedStatusErrOther]
411 ///        - Failed to create epoll instances (epoll_create1) [eFrameworkunifiedStatusInvldHandle]
412 ///        - Failed to register Dispatcher message queue descriptor for epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
413 ///        - Failed to create file descriptor for receiving events to Dispatcher (eventfd) [eFrameworkunifiedStatusFail]
414 ///        - Failed to register file descriptor for receiving Dispatcher events to epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
415 ///        - Failed to register socket for monitoring Dispatcher error in epoll instances (epoll_ctl) [eFrameworkunifiedStatusFail]
416 ///        - If FrameworkunifiedOnInitialization of result is not eFrameworkunifiedStatusOK [eFrameworkunifiedStatusNullPointer]
417 /// \~english @par Detail
418 ///        Creates, initializes and runs the dispatcher. This dispatcher function can be used with child thread or main
419 ///        thread. <BR>
420 ///        But, recommended to use for child thread. For main thread use \ref FrameworkunifiedDispatcherWithArguments<BR>
421 ///        Intention to provide this API is for child threads created from dynamically loaded plugin, where thread wants
422 ///        to <BR>
423 ///        subscribe to PASA notification, attach callbacks. This can be done in the start function specified with this
424 ///        API.
425 /// \~english @par Classification
426 ///        Public
427 /// \~english @par Type
428 ///        No match
429 /// \~english @see
430 ///        FrameworkunifiedDispatcherWithArguments
431 /// \~english @todo not enough inforamtion need readon why this API is for child thread.
432 ////////////////////////////////////////////////////////////////////////////////////////////
433 EFrameworkunifiedStatus FrameworkunifiedSimpleDispatcher(PCSTR cAppName, const FrameworkunifiedDefaultCallbackHandler *CbHandler, CbFuncPtr CbShutdown,
434                                BOOL isChildThread = TRUE);
435
436 ////////////////////////////////////////////////////////////////////////////////////////////
437 /// \ingroup FrameworkunifiedCreateDispatcherWithoutLoop
438 /// \~english @par Brief
439 ///        This API creates and initializes the dispatcher with command-line options.
440 /// \~english @param [in] cAppName
441 ///        PCSTR   - Pointer to application thread name
442 /// \~english @param [out] hApp
443 ///        HANDLE   - Handle for Application
444 /// \~english @param [in] argc
445 ///        int   - Number of command-line options
446 /// \~english @param [in] argv
447 ///        char *[]   - Array of pointer to command-line options
448 /// \~english @param [in] CbHandler
449 ///        const FrameworkunifiedDefaultCallbackHandler*   - Pointer to default callback functions.
450 /// \~english @param [in] bIsConnectSM
451 ///        BOOL   - whether or not connect with System Manager(TRUE/FALSE)
452 /// \~english @param [in] cmdLineOptions
453 ///        CustomCommandLineOptions*   - Parser setting of command-line options(Optional. When don't use, set NULL.)
454 /// \~english @par
455 ///        FrameworkunifiedDefaultCallbackHandler Structure
456 /// \~english @code
457 ///                 typedef struct _FrameworkunifiedDefaultCallbackHandler
458 ///                 {
459 ///                       CbFuncPtr onInitilization;               /* Function is called when a Dispatcher is created.
460 ///                                   */
461 ///                       CbFuncPtr onDestroy;                     /* Function is called when the Dispatcher is
462 ///                       released.            */
463 ///                       CbFuncPtr onStart;                       /* Function is called when the Dispatcher is started.
464 ///                                   */
465 ///                       CbFuncPtr onStop;                        /* Function is called when the Dispatcher is stopped.
466 ///                                   */
467 ///                       CbFuncPtr onPreStart;                    /* Function is called when the Dispatcher is pre started. */
468 ///                       CbFuncPtr onPreStop;                     /* Function is called when the Dispatcher is pre stoped. */
469 ///                       CbFuncPtr onBackgroundStart;             /* Function is called when the Dispatcher is Background started. */
470 ///                       CbFuncPtr onBackgroundStop;              /* Function is called when the Dispatcher is Background stopped. */
471 ///                       CbFuncPtr onDebugDump;                   /* Function is called when the Dispatcher detects
472 ///                       abnormal state. */
473 ///                       CbFuncPtr createStateMachine;            /* Set dummy function that does nothing.
474 ///                                   */
475 ///                       CbFuncPtr ssFrameworkInterface;          /* Function to connect to SystemManager
476 ///                                   */
477 ///                 } FrameworkunifiedDefaultCallbackHandler;
478 ///            @endcode
479 /// \~english @par
480 ///        CustomCommandLineOptions Structure
481 /// \~english @code
482 ///                 typedef struct _CustomCommandLineOptions
483 ///                 {
484 ///                       PCSTR            cShortOptions;          /* Short options list. */
485 ///                       PCHAR            cLongOptions;           /* Reserved. Set to NULL. */
486 ///                       CbArgumentParser callback;               /* Pointer to callback function to parse command-line
487 ///                       options. */
488 ///                 } CustomCommandLineOptions;
489 ///            @endcode
490 /// \~english @par
491 ///        About setting of default callback functions(FrameworkunifiedDefaultCallbackHandler)
492 ///        - Use FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK when initialize of FrameworkunifiedDefaultCallbackHandler structure as argument CbHandler.
493 ///        - Application that run this API need to define functions below.(allow to dummy function that does nothing.)
494 ///            - EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp)
495 ///            - EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
496 ///            - EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
497 ///            - EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp)
498 ///            - EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp)
499 ///            - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp)
500 ///            - EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp)
501 ///            - EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp)
502 ///            - EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp)
503 ///            - EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
504 ///        - If application is resident service, link library libSS_SystemIfUnified
505 ///          (This library provides the function FrameworkunifiedSSFrameworkInterface to connect to SystemManager.).
506 ///        - If application is nonresident service, define function that does nothing below.
507 ///            - EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp)
508 /// \~english @retval eFrameworkunifiedStatusOK Success
509 /// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
510 /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
511 /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
512 /// \~english @retval eFrameworkunifiedStatusDuplicate Duplication error of entry
513 /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
514 /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
515 /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
516 /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
517 /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
518 /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
519 /// \~english @par Prerequisite
520 ///       - Prerequisites are nothing.
521 /// \~english @par Change of internal state
522 ///       - Change of internal state according to the API does not occur.
523 /// \~english @par Conditions of processing failure
524 ///       - Application thread name specified in the argument (cAppName) is NULL. [eFrameworkunifiedStatusNullPointer]
525 ///       - Pointer to default callback functions specified in the argument (CbHandler) is NULL. [eFrameworkunifiedStatusNullPointer]
526 ///       - One of members in default callback functions specified in the argument (CbHandler) is NULL.
527 ///       [eFrameworkunifiedStatusInvldParam]
528 ///       - Application thread name specified in the argument (cAppName) is not appropriate(The name is more than
529 ///       15byte). [eFrameworkunifiedStatusNullPointer]
530 ///       - Failed to open message queue (mq_open). [eFrameworkunifiedStatusNullPointer]
531 ///       - Failed to get memory (malloc) of message queue info area. [eFrameworkunifiedStatusNullPointer]
532 ///       - Failed to initialize socket for monitoring abnormal state (socket, bind, listen). [eFrameworkunifiedStatusFail]
533 ///       - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
534 ///       - It is invalid transmission file descriptor of the session message to the NPP Service. [eFrameworkunifiedStatusErrNoEBADF]
535 ///       - Interruption by the system call (signal) has occurred during the transmission of the session message for the
536 ///       NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
537 ///       - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
538 ///       - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
539 ///       - Failed to create of epoll instance (epoll_create1). [eFrameworkunifiedStatusInvldHandle]
540 ///       - Failed to register of a descriptor of the message queue to the epoll instance (epoll_ctl).
541 ///       [eFrameworkunifiedStatusInvldHandle]
542 ///       - Failed to create file descriptor for receive event (eventfd). [eFrameworkunifiedStatusFail]
543 ///       - Failed to register of a descriptor for receive event to the epoll instance (epoll_ctl). [eFrameworkunifiedStatusFail]
544 ///       - Failed to register of a socket for detect abnormal state to the epoll instance (epoll_ctl). [eFrameworkunifiedStatusFail]
545 /// \~english @par Detail
546 ///        This API creates and initializes the dispatcher with command-line options without running main loop.\n
547 ///        Use this, if application control some contexts(include NS framework).\n
548 ///        when the dispatcher generated by this API, Application need to handle event.\n
549 ///        Use FrameworkunifiedGetDispatcherFD and FrameworkunifiedDispatchProcessWithoutLoop for event handling.
550 /// \~english @par Classification
551 ///          Public
552 /// \~english @par Type
553 ///        Open Close
554 /// \~english @see
555 ///        FrameworkunifiedCreateDispatcherWithoutLoop, FrameworkunifiedDestroyDispatcherWithoutLoop, FrameworkunifiedGetDispatcherFD
556 ////////////////////////////////////////////////////////////////////////////////////////////
557 EFrameworkunifiedStatus FrameworkunifiedCreateDispatcherWithoutLoop(PCSTR cAppName, HANDLE &hApp, int argc, char *argv[],  // NOLINT  (readability/nolint)
558                                           const FrameworkunifiedDefaultCallbackHandler *CbHandler,
559                                           BOOL bIsConnectSM, CustomCommandLineOptions *cmdLineOptions = NULL);
560
561 ////////////////////////////////////////////////////////////////////////////////////////////
562 /// \ingroup FrameworkunifiedDispatchProcessWithoutLoop
563 /// \~english @par Brief
564 ///        Receive request or notification, and run registered callback to dispatcher.
565 /// \~english @param [in] hApp
566 ///        HANDLE   - Handle for Application
567 /// \~english @retval eFrameworkunifiedStatusOK Success
568 /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
569 /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
570 /// \~english @par Prerequisite
571 ///       - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedCreateDispatcherWithoutLoop has been done.
572 /// \~english @par Change of internal state
573 ///       - Change of internal state according to the API does not occur.
574 /// \~english @par Conditions of processing failure
575 ///       - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
576 ///       - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldHandle]
577 ///       - If the waiting message (epoll_wait) , was terminated with an error other than interrupt (EINTR)
578 ///       [eFrameworkunifiedStatusFail]
579 ///       - Service name that has been set in the received message exceeds the 20byte. [eFrameworkunifiedStatusFail]
580 ///       - Message queue in the HANDLE specified in the argument (hApp) is not for receive. [eFrameworkunifiedStatusFail]
581 ///       - Message queue for receive is empty. [eFrameworkunifiedStatusFail]
582 ///       - File descriptor of message queue for receive is invalid. [eFrameworkunifiedStatusFail]
583 ///       - Interruption by the system call (signal) has occurred during the message receiving. [eFrameworkunifiedStatusFail]
584 ///       - Size of the receive buffer of the message is illegal. [eFrameworkunifiedStatusFail]
585 ///       - Any errors occur during the message receiving. [eFrameworkunifiedStatusFail]
586 ///       - Service name in the received message is not appropriate(The name is NULL, Length is 0byte) [eFrameworkunifiedStatusFail]
587 ///       - The received message data length is more than data length in the received message header. [eFrameworkunifiedStatusFail]
588 ///       - The received message is not appropriate. [eFrameworkunifiedStatusFail]
589 ///       - Shared memory ID for receiving message is invalid. [eFrameworkunifiedStatusFail]
590 ///       - Failed to access to shared memory for receive message. [eFrameworkunifiedStatusFail]
591 ///       - Data size of shared memory for receiving message is more than destination buffer size. [eFrameworkunifiedStatusFail]
592 ///       - Message queue of the processing result destination is invalid. [eFrameworkunifiedStatusFail]
593 ///       - The transmission data that is the received request processing result is NULL. [eFrameworkunifiedStatusFail]
594 ///       - Service name of the processing result destination is not appropriate(The name is NULL, more than 20byte).
595 ///       [eFrameworkunifiedStatusFail]
596 ///       - Failed to access to shared memory for send message. [eFrameworkunifiedStatusFail]
597 ///       - Message queue type is not for sending. [eFrameworkunifiedStatusFail]
598 ///       - Message queue for sending is full. [eFrameworkunifiedStatusFail]
599 ///       - File descriptor of message queue for sending is invalid. [eFrameworkunifiedStatusFail]
600 ///       - Interruption by the system call (signal) has occurred during the message sending. [eFrameworkunifiedStatusFail]
601 ///       - Size of the send buffer of the message is illegal. [eFrameworkunifiedStatusFail]
602 ///       - Any errors occur during the message sending. [eFrameworkunifiedStatusFail]
603 ///       - Failed to access to shared memory for sending message. [eFrameworkunifiedStatusFail]
604 ///       - Failed to get memory buffer for message receiving. [eFrameworkunifiedStatusFail]
605 ///       - Failed to read data from file descriptor that is set from application. [eFrameworkunifiedStatusFail]
606 ///       - Failed to run callback that is set from application. [eFrameworkunifiedStatusFail]
607 ///       - The callback that is set from application returned error. [eFrameworkunifiedStatusFail]
608 ///       - I could not found callback function associated with file descriptor that is set from application.
609 ///       [eFrameworkunifiedStatusFail]
610 /// \~english @par Detail
611 ///        If the Dispatcher was created by FrameworkunifiedCreateDispatcherWithoutLoop, \n
612 ///        you use this API to receive request or notification, and run registered callback to dispatcher.
613 /// \~english @par Classification
614 ///          Public
615 /// \~english @par Type
616 ///        No match
617 /// \~english @see
618 ///        FrameworkunifiedCreateDispatcherWithoutLoop, FrameworkunifiedDestroyDispatcherWithoutLoop, FrameworkunifiedGetDispatcherFD
619 ////////////////////////////////////////////////////////////////////////////////////////////
620 EFrameworkunifiedStatus FrameworkunifiedDispatchProcessWithoutLoop(HANDLE hApp);
621
622 ////////////////////////////////////////////////////////////////////////////////////////////
623 /// \ingroup FrameworkunifiedDestroyDispatcherWithoutLoop
624 /// \~english @par Brief
625 ///        This API destroy the dispatcher created by FrameworkunifiedCreateDispatcherWithoutLoop.
626 /// \~english @param [in] hApp
627 ///        HANDLE   - Handle for Application
628 /// \~english @retval eFrameworkunifiedStatusOK Success
629 /// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
630 /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
631 /// \~english @par Prerequisite
632 ///        - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedCreateDispatcherWithoutLoop has been
633 ///        done.
634 /// \~english @par Change of internal state
635 ///        - Change of internal state according to the API does not occur.
636 /// \~english @par Conditions of processing failure
637 ///        - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
638 ///        - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldHandle]
639 ///        - Failed to release memory referenced by HANDLE specified in the argument (hApp). [eFrameworkunifiedStatusNullPointer]
640 /// \~english @par Detail
641 ///        This API destroy the dispatcher created by FrameworkunifiedCreateDispatcherWithoutLoop.
642 /// \~english @par Classification
643 ///        Public
644 /// \~english @par Type
645 ///        Sync
646 /// \~english @see
647 ///        FrameworkunifiedCreateDispatcherWithoutLoop
648 ////////////////////////////////////////////////////////////////////////////////////////////
649 EFrameworkunifiedStatus FrameworkunifiedDestroyDispatcherWithoutLoop(HANDLE hApp);
650
651 ////////////////////////////////////////////////////////////////////////////////////////////
652 /// \ingroup FrameworkunifiedGetDispatcherFD
653 /// \~english @par Brief
654 ///        Get the Dispatcher file descriptor corresponding to the given application handle.
655 /// \~english @param [in] hApp
656 ///        HANDLE   - Handle for Application
657 /// \~english @param [out] efd
658 ///        int*   - Dispatcher file descriptor
659 /// \~english @retval eFrameworkunifiedStatusOK Success
660 /// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
661 /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
662 /// \~english @par Prerequisite
663 ///        - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedCreateDispatcherWithoutLoop has been
664 ///        done.
665 /// \~english @par Change of internal state
666 ///        - Change of internal state according to the API does not occur.
667 /// \~english @par Conditions of processing failure
668 ///        - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldHandle]
669 ///        - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldHandle]
670 ///        - The argument efd is NULL. [eFrameworkunifiedStatusNullPointer]
671 /// \~english @par Detail
672 ///        This API gets the Dispatcher file descriptor corresponding to the given application handle.\n
673 ///        The application can use  file descriptor to detect event of NS Framework.\n
674 ///        When events detected, run FrameworkunifiedDispatchProcessWithoutLoop to handling events.
675 /// \~english @par Classification
676 ///        Public
677 /// \~english @par Type
678 ///        No match
679 /// \~english @see FrameworkunifiedDispatchProcessWithoutLoop
680 ////////////////////////////////////////////////////////////////////////////////////////////
681 EFrameworkunifiedStatus FrameworkunifiedGetDispatcherFD(HANDLE hApp, SI_32 *efd);  // Replace int with SI_32
682
683 ////////////////////////////////////////////////////////////////////////////////////////////
684 /// \ingroup FrameworkunifiedGetDefaultCbHandler
685 /// \~english @par Brief
686 ///        Get default callback handler table
687 /// \~english @param [out] CbHandler
688 ///        FrameworkunifiedGetDefaultCbHandler * - Default callback handler table pointer
689 /// \~english @par
690 ///        FrameworkunifiedDefaultCallbackHandler Structure
691 /// \~english @code
692 ///                 typedef struct _FrameworkunifiedDefaultCallbackHandler
693 ///                 {
694 ///                       CbFuncPtr onInitilization;               /* Function is called when a Dispatcher is created.
695 ///                                   */
696 ///                       CbFuncPtr onDestroy;                     /* Function is called when the Dispatcher is
697 ///                       released.            */
698 ///                       CbFuncPtr onStart;                       /* Function is called when the Dispatcher is started.
699 ///                                   */
700 ///                       CbFuncPtr onStop;                        /* Function is called when the Dispatcher is stopped.
701 ///                                   */
702 ///                       CbFuncPtr onPreStart;                    /* Function is called when the Dispatcher is pre started. */
703 ///                       CbFuncPtr onPreStop;                     /* Function is called when the Dispatcher is pre stoped. */
704 ///                       CbFuncPtr onBackgroundStart;             /* Function is called when the Dispatcher is Background started. */
705 ///                       CbFuncPtr onBackgroundStop;              /* Function is called when the Dispatcher is Background stopped. */
706 ///                       CbFuncPtr onDebugDump;                   /* Function is called when the Dispatcher detects
707 ///                       abnormal state. */
708 ///                       CbFuncPtr createStateMachine;            /* Set dummy function that does nothing.
709 ///                                   */
710 ///                       CbFuncPtr ssFrameworkInterface;          /* Function to connect to SystemManager
711 ///                                   */
712 ///                 } FrameworkunifiedDefaultCallbackHandler;
713 ///            @endcode
714 /// \~english @retval eFrameworkunifiedStatusOK Success
715 /// \~english @retval eFrameworkunifiedStatusNullPointer NULL pointer specified
716 /// \~english @par Prerequisite
717 ///        - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedCreateDispatcherWithoutLoop has been
718 ///        done.
719 /// \~english @par Change of internal state
720 ///        - Change of internal state according to the API does not occur.
721 /// \~english @par Conditions of processing failure
722 ///        - Pointer to default callback functions specified in the argument (CbHandler) is NULL.
723 ///        [eFrameworkunifiedStatusNullPointer]
724 /// \~english @par Detail
725 ///        Gets the default defined callback fuction set by FrameworkunifiedDispatcherWithArguments, FrameworkunifiedSimpleDispatcher, and FrameworkunifiedCreateDispatcherWithoutLoop.
726 /// \~english @par Classification
727 ///        Public
728 /// \~english @par Type
729 ///        No match
730 /// \~english @see FrameworkunifiedDispatchProcessWithoutLoop
731 ////////////////////////////////////////////////////////////////////////////////////////////
732 EFrameworkunifiedStatus FrameworkunifiedGetDefaultCbHandler(FrameworkunifiedDefaultCallbackHandler *CbHandler);
733
734 ////////////////////////////////////////////////////////////////////////////////////////////
735 /// \ingroup FrameworkunifiedAttachLostSessionCallbackToDispatcher
736 /// \~english Register
737 ///        abnormal session disconnect callback
738 /// \~english @param[in] hApp
739 ///        HANDLE - Application framework handle
740 /// \~english @param[in] fpLostSession
741 ///        - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedCreateDispatcherWithoutLoop has been
742 ///        done.
743 /// \~english @retval eFrameworkunifiedStatusOK Success
744 /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid Parameter
745 /// \~english @par Preconditions
746 ///        - Generation/Initialization of Dispatcher for the Application by FrameworkunifiedCreateDispatcherWithoutLoop has been
747 ///        done.
748 /// \~english @par Change of internal status
749 ///        - Change of internal state according to the API does not occur.
750 /// \~english @par Conditions of processing failure
751 ///        - hApp is NULL [eFrameworkunifiedStatusInvldParam]
752 ///        - hApp is invalid [eFrameworkunifiedStatusInvldParam]
753 ///        - fpLostSession is NULL [eFrameworkunifiedStatusInvldParam]
754 /// \~english @par Detail
755 ///        Registers a callback fuction to be called when a session disconnection occurs in the specified application handle.
756 /// \~english @par Classification
757 ///        Public
758 /// \~english @par Type
759 ///        No match
760 /// \~english @see FrameworkunifiedCreateDispatcherWithoutLoop, FrameworkunifiedDispatcherWithArguments, FrameworkunifiedSimpleDispatcher
761 ////////////////////////////////////////////////////////////////////////////////////////////
762 EFrameworkunifiedStatus FrameworkunifiedAttachLostSessionCallbackToDispatcher(HANDLE hApp, CbFuncPtr fpLostSession);
763
764 ////////////////////////////////////////////////////////////////////////////////////////////
765 /// \ingroup FrameworkunifiedGetLostSessionData
766 /// \~english @par Brief
767 ///        Get last lost session data
768 /// \~english @param [in] hApp
769 ///        HANDLE - Application framework handle
770 /// \~english @param [out] pServiceName
771 ///        PSTR - Disconnect service name
772 /// \~english @param [out] puiSessionId
773 ///        PUI_32 - Disconnect session ID
774 /// \~english @retval eFrameworkunifiedStatusOK Success
775 /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid Parameter
776 /// \~english @retval eFrameworkunifiedStatusAccessError Error when accessing resource
777 /// \~english @par Preconditions
778 ///        - Generation/Initialization of Dispatcher for the Application
779 ///          by FrameworkunifiedCreateDispatcherWithoutLoop has been done.
780 /// \~english @par Change of internal status
781 ///        - Change of internal state according to the API does not occur.
782 /// \~english @par Conditions of processing failure
783 ///        - hApp is invalid [eFrameworkunifiedStatusInvldParam]
784 ///        - pServiceName is NULL [eFrameworkunifiedStatusInvldParam]
785 ///        - puiSessionId is NULL [eFrameworkunifiedStatusInvldParam]
786 ///        - Lost session queue is empty [eFrameworkunifiedStatusAccessError]
787 /// \~english @par Detail
788 ///        Gets the service name and session ID disconnected from the hadle for the specified application.
789 /// \~english @par Classification
790 ///        Public
791 /// \~english @par Type
792 ///        No match
793 /// \~english @see
794 ///        FrameworkunifiedCreateDispatcherWithoutLoop, FrameworkunifiedDispatcherWithArguments, FrameworkunifiedSimpleDispatcher
795 ////////////////////////////////////////////////////////////////////////////////////////////
796 EFrameworkunifiedStatus FrameworkunifiedGetLostSessionData(HANDLE hApp, PSTR pServiceName, PUI_32 puiSessionId);
797
798 #endif /* __NATIVESERVICES_FRAMEWORK_FRAMEWORKUNIFIED_DISPATCHER_H__ */  // NOLINT  (build/header_guard)
799 /** @}*/
800 /** @}*/
801 /** @}*/
802 /** @}*/
803 //@}