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 ///////////////////////////////////////////////////////////////////////////////
18 /// \ingroup tag_SystemManager
19 /// \brief This file provides support for the application heartbeat system.
21 ///////////////////////////////////////////////////////////////////////////////
23 #ifndef SS_HEARTBEAT_SESSION_H_ // NOLINT
24 #define SS_HEARTBEAT_SESSION_H_
26 #include <native_service/frameworkunified_types.h>
27 #include <system_service/ss_heartbeat_service_protocol.h>
28 #include <system_service/ss_system_manager_if.h>
29 #include <system_service/ss_system_manager_if_local.h>
35 // The name of the module that is trying to open a session with Heart Beat
36 typedef std::string SubscriberName;
41 class CHeartBeatSessionHandler {
43 CHeartBeatSessionHandler();
44 virtual ~CHeartBeatSessionHandler();
46 EFrameworkunifiedStatus HBProcessClientResponse(HANDLE hApp);
48 EFrameworkunifiedStatus HBEntrySubscriber(SubscriberName &f_Subscriber); // NOLINT
49 EFrameworkunifiedStatus HBSendRequest(HANDLE hApp, SI_32 f_HeartBeatIntervalRepeat, SI_32 f_ChkIndex);
50 EFrameworkunifiedStatus HBCheckResponses(THbReportData &f_tReportData, UI_32 f_MaxHeartBeatRetryCount, // NOLINT
51 SI_32 f_HeartBeatIntervalRepeat, SI_32 f_ChkIndex);
53 EFrameworkunifiedStatus HBDeleteRegisteredClientEntry(HANDLE f_hThread, PSTR pQueueName);
54 EFrameworkunifiedStatus HBAvailableCheck(THbAvailCheck &check); // NOLINT
56 VOID HBPrintConnection();
57 VOID HBPrintStack(UI_32 f_MaxHeartBeatRetryCount);
65 BOOL fHeartBeatRequestSent;
66 BOOL fHeartBeatResponseReceived;
67 UI_8 HeartBeatRetryCount;
68 BOOL fHeartBeatTimedOut;
72 HbSessionInfo(const HbSessionInfo &f_SessionInfo) {
73 szName = f_SessionInfo.szName;
74 hSession = f_SessionInfo.hSession;
75 fRunning = f_SessionInfo.fRunning;
76 fHeartBeatRequestSent = f_SessionInfo.fHeartBeatRequestSent;
77 fHeartBeatResponseReceived = f_SessionInfo.fHeartBeatResponseReceived;
78 HeartBeatRetryCount = f_SessionInfo.HeartBeatRetryCount;
79 fHeartBeatTimedOut = f_SessionInfo.fHeartBeatTimedOut;
80 fisAvailability = f_SessionInfo.fisAvailability;
83 explicit HbSessionInfo(SubscriberName f_Subscriber);
86 typedef std::map<SubscriberName, HbSessionInfo> HbSessionMap;
87 typedef HbSessionMap::iterator HbSessionIter;
89 HbSessionMap m_mapHbSessions;
91 #endif // SS_HEARTBEAT_SESSION_H_ // NOLINT