Re-organized sub-directory by category
[staging/basesystem.git] / service / system / interface_unified / library / include / system_service / ss_system_if.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  * @file ss_system_if.h
19  * @brief \~english This file contains api build the session of heartbeat observation system manager
20  */
21 /** @addtogroup BaseSystem
22  *  @{
23  */
24 /** @addtogroup system_service
25  *  @ingroup BaseSystem
26  *  @{
27  */
28 /** @addtogroup interface_unified
29  *  @ingroup system_service
30  *  @{
31  */
32 #ifndef SS_SYSTEM_IF_H_  // NOLINT (build/header_guard)
33 #define SS_SYSTEM_IF_H_
34
35 #include <native_service/frameworkunified_types.h>
36 #include <native_service/frameworkunified_application.h>
37 #include <native_service/frameworkunified_framework_types.h>
38 #include <native_service/frameworkunified_sm_framework_if.h>
39
40 ////////////////////////////////////////////////////////////////////////////////////////////
41 /// \ingroup system_manager
42 /// \~english @par Summary:
43 ///       Establish SystemManger and HeartBeat monitoring session
44 /// \~english @param [in] hApp
45 ///                   HANDLE - Handle for application
46 /// \~english @retval eFrameworkunifiedStatusOK Success
47 /// \~english @retval eFrameworkunifiedStatusNullPointer Handle error
48 /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue error
49 /// \~english @retval eFrameworkunifiedStatusErrNoEBADF File descriptor error
50 /// \~english @retval eFrameworkunifiedStatusErrNoEINTR System call error
51 /// \~english @retval eFrameworkunifiedStatusInvldBufSize Message buffer error
52 /// \~english @retval eFrameworkunifiedStatusErrOther Session establishment failure
53 /// \~english @retval eFrameworkunifiedStatusFail Message sharing memory error
54
55 /// \~english @par Preconditions:
56 ///       - Dispather for application is created / initialized(FrameworkunifiedCreateDispatcherWithoutLoop etc.)
57 /// \~english @par Change of the internal state:
58 ///       - No change of internal state by this API occurs
59 /// \~english @par Causes of failures:
60 ///       - Handle(hApp) specified in the argument is not appropriate(invalid) [eFrameworkunifiedStatusNullPointer]
61 ///       - Management information area acquisition(malloc) failed [eFrameworkunifiedStatusNullPointer]
62 ///       - Message queue for session for service is full [eFrameworkunifiedStatusMsgQFull]
63 ///       - Invalid file descriptor for sending session messages for service [eFrameworkunifiedStatusErrNoEBADF]
64 ///       - System call(signal) interrupt occurs
65 ///         while sending a session message for a service [eFrameworkunifiedStatusErrNoEINTR]
66 ///       - The size of the message transmission buffer for service is incorrect [eFrameworkunifiedStatusInvldBufSize]
67 ///       - Some error occurred when sending session message for service [eFrameworkunifiedStatusFail]
68 ///       - Failed to access shared memory for sending session messages for service [eFrameworkunifiedStatusErrOther]
69 /// \~english @par Detail:
70 ///       Establish HeartBeat monitoring and SystemManager session.\n
71 ///
72 /// \~english @par Classification:
73 ///          Public
74 /// \~english @see   FrameworkunifiedMcOpenSender, FrameworkunifiedAttachCallbacksToDispatcher, FrameworkunifiedSendMsg
75 ///
76 ////////////////////////////////////////////////////////////////////////////////////////////
77 EFrameworkunifiedStatus FrameworkunifiedSSFrameworkInterface(HANDLE hApp);
78
79 #ifdef __cplusplus
80 extern "C" {
81 #endif
82
83 #if !defined(IMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND)
84 #define FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(x) \
85   x.onInitilization = FrameworkunifiedOnInitialization; \
86   x.onDestroy = FrameworkunifiedOnDestroy; \
87   x.onStart = FrameworkunifiedOnStart; \
88   x.onStop  = FrameworkunifiedOnStop; \
89   x.onDebugDump = FrameworkunifiedOnDebugDump; \
90   x.createStateMachine = FrameworkunifiedCreateStateMachine; \
91   x.ssFrameworkInterface = FrameworkunifiedSSFrameworkInterface; \
92   x.onPreStart = FrameworkunifiedOnDummy; \
93   x.onPreStop = FrameworkunifiedOnDummy; \
94   x.onBackgroundStart = FrameworkunifiedOnDummy; \
95   x.onBackgroundStop = FrameworkunifiedOnDummy; 
96 #else
97 #define FRAMEWORKUNIFIED_MAKE_DEFAULT_CALLBACK(x) \
98   x.onInitilization = FrameworkunifiedOnInitialization; \
99   x.onDestroy = FrameworkunifiedOnDestroy; \
100   x.onStart = FrameworkunifiedOnStart; \
101   x.onStop  = FrameworkunifiedOnStop; \
102   x.onDebugDump = FrameworkunifiedOnDebugDump; \
103   x.createStateMachine = FrameworkunifiedCreateStateMachine; \
104   x.ssFrameworkInterface = FrameworkunifiedSSFrameworkInterface; \
105   x.onPreStart = FrameworkunifiedOnPreStart; \
106   x.onPreStop = FrameworkunifiedOnPreStop; \
107   x.onBackgroundStart = FrameworkunifiedOnBackgroundStart; \
108   x.onBackgroundStop = FrameworkunifiedOnBackgroundStop; 
109 #endif
110
111 #ifdef __cplusplus
112 }
113 #endif
114
115
116 #endif /* SS_SYSTEM_IF_H_ */  // NOLINT (build/header_guard)
117 /** @}*/    // end of interface_unified
118 /** @}*/    // end of system_service
119 /** @}*/    // end of BaseSystem