Re-organized sub-directory by category
[staging/basesystem.git] / service / system / interface_unified / library / include / system_service / ss_heartbeat_if.h
diff --git a/service/system/interface_unified/library/include/system_service/ss_heartbeat_if.h b/service/system/interface_unified/library/include/system_service/ss_heartbeat_if.h
new file mode 100755 (executable)
index 0000000..e5a94e5
--- /dev/null
@@ -0,0 +1,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)
+/** @}*/
+/** @}*/
+/** @}*/