summaryrefslogtreecommitdiffstats
path: root/systemservice/interface_unified/library/include/system_service/ss_heartbeat_if.h
blob: e5a94e557869146f1639e45404bfbc05932e6221 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/**
 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @file ss_heartbeat_if.h
 * @brief \~english This file supports the System Manager Heartbeat Service.
 */
/** @addtogroup BaseSystem
 *  @{
 */
/** @addtogroup system_service
 *  @ingroup BaseSystem
 *  @{
 */
/** @addtogroup interface_unified
 *  @ingroup system_service
 *  @{
 */
#ifndef SS_HEARTBEAT_IF_H_  // NOLINT (build/header_guard)
#define SS_HEARTBEAT_IF_H_

#include <string>

typedef struct {
  BOOL       fAvailable;
  HANDLE     hService;
  std::string szServiceName;
}THeartBeatSession;


class CHeartBeatServiceIf {
 public:
  /////////////////////////////////////////////////////////////////////////////////////
  /// \ingroup SS_SystemManager
  /// \~english @par Summary
  ///       Constructor of CHeartBeatServiceIf class.
  /// \~english @param [in] avail
  ///        BOOL avail  - default value of HBSession available
  /// \~english @param [in] service
  ///        HANDLE service - set default value of Service handle
  /// \~english @param [in] name
  ///        PSTR name      - set application name used by client
  /// \~english @retval None
  /// \~english @par Preconditions
  ///       - None.
  /// \~english @par Change of the internal state
  ///       - Change of internal state according to the API does not occur.
  /// \~english @par Causes of failures
  ///       None
  /// \~english @par Classification
  ///       Public
  /// \~english @par Type
  ///       None
  /// \~english @par Detail
  ///       Constructor of CHeartBeatServiceIf class. \n
  ///       variables (g_tHeartBeatSession) to be initialization.
  /// \~english @see  ~CHeartBeatServiceIf
  ////////////////////////////////////////////////////////////////////////////////////
    CHeartBeatServiceIf(BOOL avail, HANDLE service, PCSTR name);
  /////////////////////////////////////////////////////////////////////////////////////
  /// \ingroup SS_SystemManager
  /// \~english @par Summary
  ///       Destructor of CHeartBeatServiceIf class.
  /// \~english @param None
  /// \~english @retval None
  /// \~english @par Preconditions
  ///       - None.
  /// \~english @par Change of the internal state
  ///       - Change of internal state according to the API does not occur.
  /// \~english @par Causes of failures
  ///       None
  /// \~english @par Classification
  ///       Public
  /// \~english @par Type
  ///       None
  /// \~english @par Detail
  ///       To delete a CHeartBeatServiceIf class. \n
  ///       pHeartBeatServiceIf is not NULL, to delete it.\n
  /// \~english @see  CHeartBeatServiceIf
  ////////////////////////////////////////////////////////////////////////////////////
    virtual ~CHeartBeatServiceIf();
  /////////////////////////////////////////////////////////////////////////////////////
  /// \ingroup SS_SystemManager
  /// \~english @par Summary
  ///       Subscribe hApp to message queue of the HeartBeat client application.
  /// \~english @param [in] f_hApp
  ///         HANDLE - Handle to message queue of the HeartBeat client application.
  /// \~english @retval eFrameworkunifiedStatusOK Success
  /// \~english @retval eFrameworkunifiedStatusInvldParam Invalid parameter
  /// \~english @retval eFrameworkunifiedStatusInvldHandle Invalid handle
  /// \~english @retval eFrameworkunifiedStatusInvldHndlType Invalid type of handle
  /// \~english @retval eFrameworkunifiedStatusMsgQFull Message queue is full
  /// \~english @retval eFrameworkunifiedStatusErrNoEBADF Invalid File-Descriptor
  /// \~english @retval eFrameworkunifiedStatusErrNoEINTR An interrupt is generated by the system call (signal)
  /// \~english @retval eFrameworkunifiedStatusInvldBufSize Invalid buffer-size
  /// \~english @retval eFrameworkunifiedStatusFail Some sort of error occurred
  /// \~english @retval eFrameworkunifiedStatusErrOther Other error has occurred(Cannot access shared memory, etc.)
  /// \~english @par Preconditions
  /// \~english @par Change of the internal state
  ///       - Change of internal state according to the API does not occur.
  /// \~english @par Conditions of processing failure
  ///       - Pointer (pNtfyHandler) is NULL to the structure of the Notification Handler specified in the argument.
  ///       [eFrameworkunifiedStatusInvldParam]
  ///       - Notification Handler number specified in the argument (uiHandlerCount) 0. [eFrameworkunifiedStatusInvldParam]
  ///       - HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
  ///       - HANDLE specified in the argument (hApp) is not appropriate(which is invalid). [eFrameworkunifiedStatusInvldParam]
  ///       - Notification Handler number specified in the argument (uiHandlerCount) has exceeded the maximum number of
  ///       Notification. [eFrameworkunifiedStatusFail]
  ///       - The acquisition of the buffer for storing a plurality of information of Notification Handler specified by
  ///       the argument has failed. [eFrameworkunifiedStatusInvldParam]
  ///       - Can not be acquired memory in the acquisition of the buffer of the message for transmission (malloc).
  ///       [eFrameworkunifiedStatusFail]
  ///       - Message queue HANDLE in HANDLE specified in the argument (hApp) is NULL. [eFrameworkunifiedStatusInvldParam]
  ///       - HANDLE specified in the argument message queue HANDLE in (hApp) is not appropriate (which is invalid).
  ///       [eFrameworkunifiedStatusInvldParam]
  ///       - Message queue name of HANDLE specified in the argument (hApp) is not appropriate(The name is NULL, more
  ///       than 20byte) [eFrameworkunifiedStatusInvldHandle]
  ///       - Message queue type of HANDLE specified in the argument (hApp) is not a transmission.
  ///       [eFrameworkunifiedStatusInvldHndlType]
  ///       - Session message queue is full to the NPP Service. [eFrameworkunifiedStatusMsgQFull]
  ///       - It is invalid transmission file descriptor of the session message to the NPP Service.
  ///       [eFrameworkunifiedStatusErrNoEBADF]
  ///       - Interruption by the system call (signal) has occurred during the transmission of the session message for
  ///       the NPP Service. [eFrameworkunifiedStatusErrNoEINTR]
  ///       - Incorrect size of the transmit buffer of the session message to the NPP Service. [eFrameworkunifiedStatusInvldBufSize]
  ///       - Any errors occur during the transmission of a session message to the NPP Service. [eFrameworkunifiedStatusFail]
  ///       - It failed to shared memory access for transmission of the session message for the NPP Service.
  ///       [eFrameworkunifiedStatusErrOther]
  /// \~english @par Classification
  ///          Public
  /// \~english @par Type
  ///          None
  /// \~english @par Detail
  ///          Subscribe hApp to message queue of the HeartBeat client application. \n
  ///          if service hApp is NULL and hApp is not be Subscribed,return eFrameworkunifiedStatusNullPointer.\n
  ///          if service hApp is Subscribe to Heartbeat Serivceand hApp is not NULL,then subscribe hApp to message
  ///          queue of the HeartBeat client application.
  /// \~english @see FrameworkunifiedGetAppName  FrameworkunifiedSubscribeNotificationsWithCallback
  ////////////////////////////////////////////////////////////////////////////////////
    EFrameworkunifiedStatus OnHeartBeatRequest(HANDLE hApp);

 private:
    THeartBeatSession g_tHeartBeatSession;


    friend EFrameworkunifiedStatus DBG_CloseHeatBeat(HANDLE hApp);
};

#endif /* SS_HEARTBEAT_IF_H_ */  // NOLINT (build/header_guard)
/** @}*/
/** @}*/
/** @}*/