static int gShutdownMode = 0;
-/// loical function declaration
-void invalidateCustomPlugin(int idx);
-
int pclInitLibrary(const char* appName, int shutdownMode)
{
// initialize custom library structure
for(i = 0; i < PersCustomLib_LastEntry; i++)
{
- invalidateCustomPlugin(i);
+ invalidate_custom_plugin(i);
}
if(pOnDemandLoad == NULL) // load all available libraries now
// close library handle
dlclose(gPersCustomFuncs[i].handle);
- invalidateCustomPlugin(i);
+ invalidate_custom_plugin(i);
}
}
-void invalidateCustomPlugin(int idx)
-{
- gPersCustomFuncs[idx].handle = NULL;
- gPersCustomFuncs[idx].custom_plugin_init = NULL;
- gPersCustomFuncs[idx].custom_plugin_deinit = NULL;
- gPersCustomFuncs[idx].custom_plugin_handle_open = NULL;
- gPersCustomFuncs[idx].custom_plugin_handle_close = NULL;
- gPersCustomFuncs[idx].custom_plugin_handle_get_data = NULL;
- gPersCustomFuncs[idx].custom_plugin_handle_set_data = NULL;
- gPersCustomFuncs[idx].custom_plugin_get_data = NULL;
- gPersCustomFuncs[idx].custom_plugin_set_data = NULL;
- gPersCustomFuncs[idx].custom_plugin_delete_data = NULL;
- gPersCustomFuncs[idx].custom_plugin_get_status_notification_clbk = NULL;
- gPersCustomFuncs[idx].custom_plugin_handle_get_size = NULL;
- gPersCustomFuncs[idx].custom_plugin_get_size = NULL;
- gPersCustomFuncs[idx].custom_plugin_create_backup = NULL;
- gPersCustomFuncs[idx].custom_plugin_get_backup = NULL;
- gPersCustomFuncs[idx].custom_plugin_restore_backup = NULL;
-}
-
-
return rval;
}
+
+
+
+void invalidate_custom_plugin(int idx)
+{
+ gPersCustomFuncs[idx].handle = NULL;
+ gPersCustomFuncs[idx].custom_plugin_init = NULL;
+ gPersCustomFuncs[idx].custom_plugin_deinit = NULL;
+ gPersCustomFuncs[idx].custom_plugin_handle_open = NULL;
+ gPersCustomFuncs[idx].custom_plugin_handle_close = NULL;
+ gPersCustomFuncs[idx].custom_plugin_handle_get_data = NULL;
+ gPersCustomFuncs[idx].custom_plugin_handle_set_data = NULL;
+ gPersCustomFuncs[idx].custom_plugin_get_data = NULL;
+ gPersCustomFuncs[idx].custom_plugin_set_data = NULL;
+ gPersCustomFuncs[idx].custom_plugin_delete_data = NULL;
+ gPersCustomFuncs[idx].custom_plugin_get_status_notification_clbk = NULL;
+ gPersCustomFuncs[idx].custom_plugin_handle_get_size = NULL;
+ gPersCustomFuncs[idx].custom_plugin_get_size = NULL;
+ gPersCustomFuncs[idx].custom_plugin_create_backup = NULL;
+ gPersCustomFuncs[idx].custom_plugin_get_backup = NULL;
+ gPersCustomFuncs[idx].custom_plugin_restore_backup = NULL;
+}
char* get_custom_client_lib_name(int idx);
+/**
+ * @brief invalidate customer plugin function
+ */
+void invalidate_custom_plugin(int idx);
+
+
#endif /* PERSISTENCE_CLIENT_LIBRARY_CUSTOM_LOADER_H */
// sync data back to memory device
pers_data_sync();
// send complete notification
- pers_admin_service_data_sync_complete(requestID, status);
+ //pers_admin_service_data_sync_complete(requestID, status);
}
// close library handle
dlclose(gPersCustomFuncs[i].handle);
- gPersCustomFuncs[i].custom_plugin_deinit = NULL;
+ invalidate_custom_plugin(i);
}
}
// notify lifecycle shutdown OK
- send_prepare_shutdown_complete((int)requestId, (int)status);
+ //send_prepare_shutdown_complete((int)requestId, (int)status);
}
pthread_mutex_t gMainLoopMtx = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t gMainLoopCond = PTHREAD_COND_INITIALIZER;
-int gEfds;
+int gEfds; // communication channel int dbus mainloop
typedef enum EDBusObjectType
{
case CMD_PAS_BLOCK_AND_WRITE_BACK:
process_block_and_write_data_back((buf[2]), buf[1]);
+ process_send_pas_request(conn, (buf[2]), buf[1]);
+ pthread_mutex_lock(&gDbusPendingRegMtx); // block until pending received
break;
case CMD_LC_PREPARE_SHUTDOWN:
process_prepare_shutdown((buf[2]), buf[1]);
- break;
- case CMD_SEND_LC_REQUEST:
process_send_lifecycle_request(conn, (buf[2]), buf[1]);
break;
case CMD_SEND_NOTIFY_SIGNAL:
case CMD_REG_NOTIFY_SIGNAL:
process_reg_notification_signal(conn);
break;
- case CMD_SEND_PAS_REQUEST:
- process_send_pas_request(conn, (buf[2]), buf[1]);
- break;
case CMD_SEND_PAS_REGISTER:
process_send_pas_register(conn, (buf[1]), buf[2]);
break;
case CMD_QUIT:
bContinue = FALSE;
break;
+
+ // ******************************************************
+ /*
+ case CMD_SEND_LC_REQUEST: // remove
+ process_send_lifecycle_request(conn, (buf[2]), buf[1]);
+ break;
+ case CMD_SEND_PAS_REQUEST: /// remove
+ process_send_pas_request(conn, (buf[2]), buf[1]);
+ break;
+ */
+ // ******************************************************
default:
DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("mainLoop => command not handled"), DLT_INT(buf[0]) );
break;
CMD_LC_PREPARE_SHUTDOWN, /// command to prepare shutdown
CMD_SEND_NOTIFY_SIGNAL, /// command send changed notification signal
CMD_REG_NOTIFY_SIGNAL, /// command send register/unregister command
- CMD_SEND_PAS_REQUEST, /// command send admin request
+ //CMD_SEND_PAS_REQUEST, /// command send admin request
CMD_SEND_PAS_REGISTER, /// command send admin register/unregister
- CMD_SEND_LC_REQUEST, /// command send lifecycle request
+ //CMD_SEND_LC_REQUEST, /// command send lifecycle request
CMD_SEND_LC_REGISTER, /// command send lifecycle register/unregister
CMD_QUIT /// quit command
} tCmd;
int deliverToMainloop_NM(tCmd mainloopCmd, unsigned int param1, unsigned int param2);
+
#endif /* PERSISTENCE_CLIENT_LIBRARY_DBUS_SERVICE_H_ */
return deliverToMainloop(CMD_SEND_LC_REGISTER, 0, shutdownMode);
}
-
-
+/*
int send_prepare_shutdown_complete(int requestId, int status)
{
return deliverToMainloop_NM(CMD_SEND_LC_REQUEST, status, requestId);
}
-
+*/
DLT_LOG(gDLTContext, DLT_LOG_ERROR, DLT_STRING("signal_persModeChange => DBus No memory"));
}
- dbus_message_unref (reply);
+ dbus_message_unref(reply);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
}
-
+/*
int pers_admin_service_data_sync_complete(unsigned int requestID, unsigned int status)
{
int rval = 0;
}
return rval;
}
-
+*/
#include <pthread.h>
#include <sys/eventfd.h>
+/*
+ * N O T E
+ *
+ * To test the PAS notifications the "./persistence_client_library_dbus_test" can be used.
+ * Use the dbus-send command to send shutdown notification to registered client if the lifecycle mockup will be used.
+ * To get the correct destionation (example is :1.11) see console when this application has been started.
+ * You sould find something like:
+ * " checkAdminMsg ==> busName: :1.79 | objName: /org/genivi/persistence/adminconsumer | notificationFlag: 19 | gTimeoutMs: 5000"
+ * when a client registeres itself to the lifecycle mockup.
+ * Now use the the destination ":1.79" to communicate with the client library for dest in dbus-send command.
+ *
+
+ dbus-send --system --dest=:1.11 --type=method_call --print-reply /org/genivi/persistence/adminconsumer org.genivi.persistence.adminconsumer.PersistenceAdminRequest int32:17 int32:22
+
+ parameter 1:
+ int32:17 => PAS message block and write back
+ int32:2 => PAS message unblock
+
+ dbus-send return message value 32768 ==> invalid message:
+ method return sender=:1.72 -> dest=:1.74 reply_serial=2
+ int32 32768
+
+ dbus-send return message value 1 ==> OK:
+ method return sender=:1.72 -> dest=:1.76 reply_serial=2
+ int32 1
+
+*/
+
+
/// command definitions for main loop
typedef enum ECmd
result = checkAdminMsg(connection, message);
}
+ else if((0==strcmp("PersistenceAdminRequestCompleted", dbus_message_get_member(message))))
+ {
+ printf(" ==> org.genivi.persistence.admin - received - ==> PersistenceAdminRequestCompleted \n");
+ }
else
{
printf(" ==> org.genivi.persistence.admin - received U N KN O W N-'%s'\n", dbus_message_get_interface(message));
* @see
*/
+
+/*
+ * N O T E
+ *
+ * To test the shutdown sequence the "./persistence_client_library_dbus_test" can be used.
+ * Use the dbus-send command to send shutdown notification to registered client if the lifecycle mockup will be used.
+ * To get the correct destionation (example is :1.11) see console when this application has been started.
+ * You sould find something like:
+ * "handleObjectPathMessageFallback Object: ':1.69' -> Interface: 'org.genivi.NodeStateManager.Consumer' -> Message: 'RegisterShutdownClient'"
+ * when a client registeres itself to the lifecycle mockup.
+ * Now use the the destination ":1.69" to communicate with the client library for dest in dbus-send command.
+ *
+
+ dbus-send --system --dest=:1.11 --type=method_call --print-reply /org/genivi/NodeStateManager/LifeCycleConsumer org.genivi.NodeStateManager.LifeCycleConsumer.LifecycleRequest uint32:1 uint32:22
+
+*/
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>