e5a94e557869146f1639e45404bfbc05932e6221
[staging/basesystem.git] / video_in_hal / systemservice / interface_unified / library / include / system_service / ss_heartbeat_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_heartbeat_if.h
19  * @brief \~english This file supports the System Manager Heartbeat Service.
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_HEARTBEAT_IF_H_  // NOLINT (build/header_guard)
33 #define SS_HEARTBEAT_IF_H_
34
35 #include <string>
36
37 typedef struct {
38   BOOL       fAvailable;
39   HANDLE     hService;
40   std::string szServiceName;
41 }THeartBeatSession;
42
43
44 class CHeartBeatServiceIf {
45  public:
46   /////////////////////////////////////////////////////////////////////////////////////
47   /// \ingroup SS_SystemManager
48   /// \~english @par Summary
49   ///       Constructor of CHeartBeatServiceIf class.
50   /// \~english @param [in] avail
51   ///        BOOL avail  - default value of HBSession available
52   /// \~english @param [in] service
53   ///        HANDLE service - set default value of Service handle
54   /// \~english @param [in] name
55   ///        PSTR name      - set application name used by client
56   /// \~english @retval None
57   /// \~english @par Preconditions
58   ///       - None.
59   /// \~english @par Change of the internal state
60   ///       - Change of internal state according to the API does not occur.
61   /// \~english @par Causes of failures
62   ///       None
63   /// \~english @par Classification
64   ///       Public
65   /// \~english @par Type
66   ///       None
67   /// \~english @par Detail
68   ///       Constructor of CHeartBeatServiceIf class. \n
69   ///       variables (g_tHeartBeatSession) to be initialization.
70   /// \~english @see  ~CHeartBeatServiceIf
71   ////////////////////////////////////////////////////////////////////////////////////
72     CHeartBeatServiceIf(BOOL avail, HANDLE service, PCSTR name);
73   /////////////////////////////////////////////////////////////////////////////////////
74   /// \ingroup SS_SystemManager
75   /// \~english @par Summary
76   ///       Destructor of CHeartBeatServiceIf class.
77   /// \~english @param None
78   /// \~english @retval None
79   /// \~english @par Preconditions
80   ///       - None.
81   /// \~english @par Change of the internal state
82   ///       - Change of internal state according to the API does not occur.
83   /// \~english @par Causes of failures
84   ///       None
85   /// \~english @par Classification
86   ///       Public
87   /// \~english @par Type
88   ///       None
89   /// \~english @par Detail
90   ///       To delete a CHeartBeatServiceIf class. \n
91   ///       pHeartBeatServiceIf is not NULL, to delete it.\n
92   /// \~english @see  CHeartBeatServiceIf
93   ////////////////////////////////////////////////////////////////////////////////////
94     virtual ~CHeartBeatServiceIf();
95   /////////////////////////////////////////////////////////////////////////////////////
96   /// \ingroup SS_SystemManager
97   /// \~english @par Summary
98   ///       Subscribe hApp to message queue of the HeartBeat client application.
99   /// \~english @param [in] f_hApp
100   ///         HANDLE - Handle to message queue of the HeartBeat client application.
101   /// \~english @retval eFrameworkunifiedStatusOK Success
102   /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
103   /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
104   /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
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 @retval eFrameworkunifiedStatusFail Some sort of error occurred
110   /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
111   /// \~english @par Preconditions
112   /// \~english @par Change of the internal state
113   ///       - Change of internal state according to the API does not occur.
114   /// \~english @par Conditions of processing failure
115   ///       - Pointer (pNtfyHandler) is NULL to the structure of the Notification Handler specified in the argument.
116   ///       [eFrameworkunifiedStatusInvldParam]
117   ///       - Notification Handler number specified in the argument (uiHandlerCount) 0. [eFrameworkunifiedStatusInvldParam]
118   ///       - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
119   ///       - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
120   ///       - Notification Handler number specified in the argument (uiHandlerCount) has exceeded the maximum number of
121   ///       Notification. [eFrameworkunifiedStatusFail]
122   ///       - The acquisition of the buffer for storing a plurality of information of Notification Handler specified by
123   ///       the argument has failed. [eFrameworkunifiedStatusInvldParam]
124   ///       - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
125   ///       [eFrameworkunifiedStatusFail]
126   ///       - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
127   ///       - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
128   ///       [eFrameworkunifiedStatusInvldParam]
129   ///       - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more
130   ///       than 20byte) [eFrameworkunifiedStatusInvldHandle]
131   ///       - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
132   ///       [eFrameworkunifiedStatusInvldHndlType]
133   ///       - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
134   ///       - It is invalid transmission file descriptor of the session message to the NPP Service.
135   ///       [eFrameworkunifiedStatusErrNoEBADF]
136   ///       - Interruption by the system call (signal) has occurred during the transmission of the session message for
137   ///       the NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
138   ///       - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
139   ///       - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
140   ///       - It failed to shared memory access for transmission of the session message for the NPP Service.
141   ///       [eFrameworkunifiedStatusErrOther]
142   /// \~english @par Classification
143   ///          Public
144   /// \~english @par Type
145   ///          None
146   /// \~english @par Detail
147   ///          Subscribe hApp to message queue of the HeartBeat client application. \n
148   ///          if service hApp is NULL and hApp is not be Subscribed,return eFrameworkunifiedStatusNullPointer.\n
149   ///          if service hApp is Subscribe to Heartbeat Serivceand hApp is not NULL,then subscribe hApp to message
150   ///          queue of the HeartBeat client application.
151   /// \~english @see FrameworkunifiedGetAppName  FrameworkunifiedSubscribeNotificationsWithCallback
152   ////////////////////////////////////////////////////////////////////////////////////
153     EFrameworkunifiedStatus OnHeartBeatRequest(HANDLE hApp);
154
155  private:
156     THeartBeatSession g_tHeartBeatSession;
157
158
159     friend EFrameworkunifiedStatus DBG_CloseHeatBeat(HANDLE hApp);
160 };
161
162 #endif /* SS_HEARTBEAT_IF_H_ */  // NOLINT (build/header_guard)
163 /** @}*/
164 /** @}*/
165 /** @}*/