summaryrefslogtreecommitdiff
path: root/NodeStateAccess/NodeStateAccess.h
diff options
context:
space:
mode:
Diffstat (limited to 'NodeStateAccess/NodeStateAccess.h')
-rw-r--r--NodeStateAccess/NodeStateAccess.h177
1 files changed, 126 insertions, 51 deletions
diff --git a/NodeStateAccess/NodeStateAccess.h b/NodeStateAccess/NodeStateAccess.h
index f66861f..a7ccec2 100644
--- a/NodeStateAccess/NodeStateAccess.h
+++ b/NodeStateAccess/NodeStateAccess.h
@@ -1,28 +1,25 @@
-#ifndef NODESTATEACCESS_H_
-#define NODESTATEACCESS_H_
-
/**********************************************************************************************************************
-*
-* Copyright (C) 2012 Continental Automotive Systems, Inc.
-*
-* Author: Jean-Pierre.Bogler@continental-corporation.com
-*
-* Interface between NodeStateManager and IPC
-*
-* This header file is a part of the NodeStateAccess library (NSMA).
-* The architecture requires that the NodeStateManager (NSM) is independent from the D-Bus binding and code generated by
-* "gdbus-codegen". Therefore, the D-Bus communication and generated D-Bus objects are handled inside of this library.
-* The library offers the NSM an interface to use objects generated via gdbus-codgen.
-*
-* This Source Code Form is subject to the terms of the Mozilla Public
-* License, v. 2.0. If a copy of the MPL was not distributed with this
-* file, You can obtain one at http://mozilla.org/MPL/2.0/.
-*
-* Date Author Reason
-* 24.10.2012 Jean-Pierre Bogler CSP_WZ#1322: Initial creation
-*
-**********************************************************************************************************************/
+ *
+ * Copyright (C) 2013 Continental Automotive Systems, Inc.
+ * 2017 BMW AG
+ *
+ * Author: Jean-Pierre.Bogler@continental-corporation.com
+ *
+ * Interface between NodeStateManager and IPC
+
+ * This source file is a part of the NodeStateAccess library (NSMA).
+ * The architecture requires that the NodeStateManager (NSM) is independent from the CommonAPI binding.
+ * Therefore, the CommonAPI communication is handled inside of this library.
+ * The library offers the NSM an interface to use objects generated via CommonAPI.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ **********************************************************************************************************************/
+#ifndef NODESTATEACCESS_H_
+#define NODESTATEACCESS_H_
/**********************************************************************************************************************
*
@@ -30,15 +27,27 @@
*
**********************************************************************************************************************/
-#include "NodeStateTypes.h" /* NodeStateTypes to communicate with NSM */
-#include "gio/gio.h" /* glib types for easier ICP connection */
-
+#include "NodeStateTypes.h" /* NodeStateManagerTypes to communicate with NSM */
+#include <gio/gio.h> /* glib types for easier ICP connection */
+#ifdef __cplusplus
+extern "C" {
+#endif
/**********************************************************************************************************************
*
* TYPE
*
**********************************************************************************************************************/
+/* The type defines the structure for a lifecycle consumer client */
+typedef struct
+{
+ size_t clientHash; /* Identifier of the client base on capi client id */
+ guint32 u32RegisteredMode; /* Bit array of shutdown modes */
+ guint32 timeout; /* Timeout in ms of the client */
+ gboolean boShutdown; /* Only "run up" clients which are shut down */
+ gboolean boPendingCall; /* Client has a pending lifecycle call */
+} NSM__tstLifecycleClient;
+
/* Type definitions of callbacks that the NSM registers for the object interfaces */
typedef NsmErrorStatus_e (*NSMA_tpfSetBootModeCb) (const gint i32BootMode);
@@ -56,12 +65,10 @@ typedef NsmErrorStatus_e (*NSMA_tpfRegisterSessionCb) (const gchar
typedef NsmErrorStatus_e (*NSMA_tpfUnRegisterSessionCb) (const gchar *sSessionName,
const gchar *sSessionOwner,
const NsmSeat_e enSeatId);
-typedef NsmErrorStatus_e (*NSMA_tpfRegisterLifecycleClientCb) (const gchar *sBusName,
- const gchar *sObjName,
+typedef NsmErrorStatus_e (*NSMA_tpfRegisterLifecycleClientCb) (const size_t clientHash,
const guint u32ShutdownMode,
const guint u32TimeoutMs);
-typedef NsmErrorStatus_e (*NSMA_tpfUnRegisterLifecycleClientCb)(const gchar *sBusName,
- const gchar *sObjName,
+typedef NsmErrorStatus_e (*NSMA_tpfUnRegisterLifecycleClientCb)(const size_t clientHash,
const guint u32ShutdownMode);
typedef NsmErrorStatus_e (*NSMA_tpfGetAppModeCb) (NsmApplicationMode_e *penAppMode);
typedef NsmErrorStatus_e (*NSMA_tpfGetSessionStateCb) (const gchar *sSessionName,
@@ -77,15 +84,13 @@ typedef guint (*NSMA_tpfGetInterfaceVersionCb) (void);
/* Type definition for the management of Lifecycle clients */
-typedef gpointer NSMA_tLcConsumerHandle;
-typedef void (*NSMA_tpfLifecycleReqFinish)(const NsmErrorStatus_e enErrorStatus);
+typedef void (*NSMA_tpfLifecycleReqFinish)(size_t clientID, gboolean timeout, gboolean late);
/* Type definition to wrap all callbacks in a structure */
typedef struct
{
NSMA_tpfSetBootModeCb pfSetBootModeCb;
NSMA_tpfSetNodeStateCb pfSetNodeStateCb;
- NSMA_tpfSetAppModeCb pfSetAppModeCb;
NSMA_tpfRequestNodeRestartCb pfRequestNodeRestartCb;
NSMA_tpfSetAppHealthStatusCb pfSetAppHealthStatusCb;
NSMA_tpfCheckLucRequiredCb pfCheckLucRequiredCb;
@@ -93,7 +98,6 @@ typedef struct
NSMA_tpfUnRegisterSessionCb pfUnRegisterSessionCb;
NSMA_tpfRegisterLifecycleClientCb pfRegisterLifecycleClientCb;
NSMA_tpfUnRegisterLifecycleClientCb pfUnRegisterLifecycleClientCb;
- NSMA_tpfGetAppModeCb pfGetAppModeCb;
NSMA_tpfGetSessionStateCb pfGetSessionStateCb;
NSMA_tpfGetNodeStateCb pfGetNodeStateCb;
NSMA_tpfSetSessionStateCb pfSetSessionStateCb;
@@ -275,30 +279,70 @@ gboolean NSMA_boGetShutdownReason(NsmShutdownReason_e *penShutdownReason);
/**********************************************************************************************************************
*
-* The function is used to create a LifecycleConsumer client.
+* The function is used to inform a LifecycleConsumer about a shutdown or runup request
+*
+* @param hLcClient: Handle of the client (created with "NSMA_hCreateLcConsumer").
+* @param u32ShutdownType: Shutdown type.
+*
+* @return TRUE: Successfully called client
+* FALSE: Error calling the client.
+*
+**********************************************************************************************************************/
+gboolean NSMA_boCallLcClientRequest(NSM__tstLifecycleClient *client, guint u32ShutdownType);
+
+/**********************************************************************************************************************
+*
+* The function is used to inform a LifecycleConsumer about a shutdown or runup request without timeout
+* This is used when a late LifecycleConsumer has returned to inform him about the current state when it
+* has been changed since the last call to this LifecycleConsumer
*
-* @param sBusName: Bus name of the client object.
-* @param sObjName: Object name of the client object.
-* @param u32TimeoutMs: Timeout for client calls in ms.
+* @param hLcClient: Handle of the client (created with "NSMA_hCreateLcConsumer").
+* @param u32ShutdownType: Shutdown type.
*
-* @return Handle to the new life cycle consumer or NULL, if there was an error.
+* @return TRUE: Successfully called client
+* FALSE: Error calling the client.
*
**********************************************************************************************************************/
-NSMA_tLcConsumerHandle NSMA_hCreateLcConsumer(const gchar* sBusName, const gchar* sObjName, const guint u32TimeoutMs);
+gboolean NSMA_boCallLcClientRequestWithoutTimeout(NSM__tstLifecycleClient *client, guint u32ShutdownType);
/**********************************************************************************************************************
*
-* The function is used to call the "LifecycleRequest" method of a client.
+* Returns true if a sequential client has a pending call that has not timed out
*
-* @param hLcClient: Handle of the client (created with "NSMA_hCreateLcConsumer").
+* @return TRUE: Pending call active
+* FALSE: No pending call active
+*
+**********************************************************************************************************************/
+gboolean NSMA__SequentialClientHasPendingActiveCall();
+
+/**********************************************************************************************************************
+*
+* Returns true if parallel client has a pending call that has not timed out
+*
+* @param clientID: ClientID to check for
+* If clientID is 0 check if any parallel client has a pending call
+*
+* @return TRUE: Pending call active
+* FALSE: No pending call active
+*
+**********************************************************************************************************************/
+gboolean NSMA__ParallelClientHasPendingActiveCall(size_t clientID);
+
+/**********************************************************************************************************************
+*
+* The function is used to inform multiple LifecycleConsumers about a shutdown or runup request.
+* This is used for parallel shutdown.
+*
+* @param client: List of Handle of the client (created with "NSMA_hCreateLcConsumer").
+* @param numClients: Number of clients in client list.
* @param u32ShutdownType: Shutdown type.
*
* @return TRUE: Successfully called client
* FALSE: Error calling the client.
*
**********************************************************************************************************************/
-gboolean NSMA_boCallLcClientRequest(NSMA_tLcConsumerHandle hLcClient, guint u32ShutdownType);
+gboolean NSMA_boCallParallelLcClientsRequest(NSM__tstLifecycleClient *client, guint numClients, guint u32ShutdownType);
/**********************************************************************************************************************
@@ -312,8 +356,21 @@ gboolean NSMA_boCallLcClientRequest(NSMA_tLcConsumerHandle hLcClient, guint u32S
* FALSE: Error setting the clients timeout time.
*
**********************************************************************************************************************/
-gboolean NSMA_boSetLcClientTimeout(NSMA_tLcConsumerHandle hClient, guint u32TimeoutMs);
+gboolean NSMA_boSetLcClientTimeout(NSM__tstLifecycleClient *client, guint u32TimeoutMs);
+
+/**********************************************************************************************************************
+*
+* The function is called to get the default timeout for calls to the life cycle client.
+*
+* @param hLcClient: Handle of the life cycle client.
+* @param pu32TimeoutMs: Pointer where to store the timeout value in ms.
+*
+* @return TRUE: Successfully got timeout time for client.
+* FALSE: Error getting the clients timeout time.
+*
+**********************************************************************************************************************/
+gboolean NSMA_boGetLcClientTimeout(NSM__tstLifecycleClient *client, guint *pu32TimeoutMs);
/**********************************************************************************************************************
*
@@ -326,20 +383,36 @@ gboolean NSMA_boSetLcClientTimeout(NSMA_tLcConsumerHandle hClient, guint u32Time
* FALSE: Error getting the clients timeout time.
*
**********************************************************************************************************************/
-gboolean NSMA_boGetLcClientTimeout(NSMA_tLcConsumerHandle hClient, guint *pu32TimeoutMs);
+gboolean NSMA_boDeleteLifecycleClient(NSM__tstLifecycleClient *client);
+
+
+/**********************************************************************************************************************
+*
+* The function is called to cancel the current LcCient Timeout.
+*
+**********************************************************************************************************************/
+void NSMA_cancelLcClientTimeout();
+/**********************************************************************************************************************
+*
+* The function is called to stop the current LcCient Timeout.
+*
+**********************************************************************************************************************/
+void NSMA_stopLcClientTimeout();
/**********************************************************************************************************************
*
-* The function is used to delete a "LifecycleRequest".
+* The function is called to stop the current Parallel LcCient Timeout.
*
-* @param hLcClient: Handle of the client (created with "NSMA_hCreateLcConsumer").
+**********************************************************************************************************************/
+void NSMA_stopParallelLcClientTimeout();
+
+/**********************************************************************************************************************
*
-* @return TRUE: Successfully freed clients memory.
-* FALSE: Error freeing the clients memory.
+* The function is called to cancel the current shutdown due to collective timeout.
*
**********************************************************************************************************************/
-gboolean NSMA_boFreeLcConsumerProxy(NSMA_tLcConsumerHandle hLcConsumer);
+void NSMA_setLcCollectiveTimeout();
/**********************************************************************************************************************
@@ -373,6 +446,8 @@ gboolean NSMA_boQuitEventLoop(void);
*
**********************************************************************************************************************/
gboolean NSMA_boDeInit(void);
-
+#ifdef __cplusplus
+}
+#endif
#endif /* NODESTATEACCESS_H_ */