This repository has been archived by the owner on Oct 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
12.12.2013 * add missing licenses information / update after review feedback 20131212 - J.Kowalski 03.12.2013 * Persistence Common Object - OIP BL 0.9.130 08.08.2013 * Add instrumentation for debug purposes (low level db access) 18.06.2013 * persistence-common version 1.0.1 - Add makefile to allow creation of auto-generated code - Default error handler causes the termination of the calling process - de-central build of the common part 02.05.2013 * initial version of the common persistence libraries Change-Id: I6ac6b7f1fe453537835ac32f664c04d537d732db Signed-off-by: Guy Sagnes <[email protected]>
- Loading branch information
Showing
28 changed files
with
6,654 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Ionut Ieremie <[email protected]> | ||
Guy Sagnes <[email protected]> | ||
Petrica Manoila <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
####################################################################################################################### | ||
# | ||
# Copyright (C) 2012 Continental Automotive Systems, Inc. | ||
# | ||
# Author: [email protected] | ||
# | ||
# Makefile template for the persistence common library | ||
# | ||
# Process this file with automake to produce a Makefile.in. | ||
# | ||
# 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/. | ||
# | ||
####################################################################################################################### | ||
|
||
# Build trough subfolders. Make sure "generated" is called before "src". | ||
ACLOCAL_AMFLAGS=-I m4 | ||
SUBDIRS = generated src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
1.0.1 | ||
===== | ||
* Initial release of the persistence common interface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh -e | ||
# | ||
# | ||
# Copyright (C) 2012 Continental Automotive Systems, Inc. | ||
# | ||
# Author: [email protected] | ||
# | ||
# Script to create necessary files/folders from a fresh git check out. | ||
# | ||
# 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/. | ||
# | ||
############################################################################### | ||
|
||
mkdir -p m4 | ||
|
||
autoreconf --verbose --install --force | ||
./configure $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
####################################################################################################################### | ||
# | ||
# Copyright (C) 2012 Continental Automotive Systems, Inc. | ||
# | ||
# Author: [email protected] | ||
# | ||
# Configure template for the persistence-common library | ||
# | ||
# Process this file with autoconf to produce a configure script. | ||
# | ||
# 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/. | ||
# | ||
####################################################################################################################### | ||
|
||
dnl ************************************************************************** | ||
dnl *** First, define all of the version numbers up front *** | ||
dnl *** In particular, this allows the version macro to be used in AC_INIT *** | ||
dnl ************************************************************************** | ||
m4_define([LIBPERSOCOMMON_VERSION_S],[1.0.1]) | ||
m4_define([LIBPERSOCOMMON_VERSION_N],[1000001]) | ||
|
||
dnl *************************** | ||
dnl *** Initialize autoconf *** | ||
dnl *************************** | ||
AC_INIT([persistence-common],[LIBPERSOCOMMON_VERSION_S()]) | ||
AC_COPYRIGHT([Copyright (c) 2012 Continental Automotive GmbH]) | ||
AC_PREREQ([2.50]) | ||
|
||
dnl *************************** | ||
dnl *** Initialize automake *** | ||
dnl *************************** | ||
AM_INIT_AUTOMAKE() | ||
AC_USE_SYSTEM_EXTENSIONS() | ||
AC_CONFIG_MACRO_DIR([m4]) | ||
AC_SUBST([ACLOCAL_AMFLAGS], ["$ACLOCAL_FLAGS -I m4"]) | ||
|
||
dnl ********************************* | ||
dnl *** Shared library versioning *** | ||
dnl ********************************* | ||
PERSCOMMON_MAJOR=$((((LIBPERSOCOMMON_VERSION_N() / 1000) / 1000) % 1000 )) | ||
PERSCOMMON_MINOR=$(( (LIBPERSOCOMMON_VERSION_N() / 1000) % 1000 )) | ||
PERSCOMMON_MICRO=$(( LIBPERSOCOMMON_VERSION_N() % 1000 )) | ||
GENERIC_LIBRARY_VERSION=$PERSCOMMON_MAJOR:$PERSCOMMON_MINOR:$PERSCOMMON_MICRO | ||
AC_SUBST(GENERIC_LIBRARY_VERSION) | ||
|
||
dnl ******************************** | ||
dnl *** Check for basic programs *** | ||
dnl ******************************** | ||
AC_PROG_CC() | ||
AM_PROG_CC_C_O() | ||
AC_PROG_CXX() | ||
AC_PROG_INSTALL() | ||
|
||
dnl *************************** | ||
dnl *** Initialize lib tool *** | ||
dnl *************************** | ||
AC_DISABLE_STATIC() | ||
AC_PROG_LIBTOOL() | ||
|
||
dnl *************************************** | ||
dnl *** Check for standard header files *** | ||
dnl *************************************** | ||
AC_CHECK_HEADERS([string.h]) | ||
|
||
dnl *********************************** | ||
dnl *** Check for library functions *** | ||
dnl *********************************** | ||
AC_FUNC_STRNLEN | ||
AC_FUNC_MALLOC | ||
AC_CHECK_FUNCS([memcpy]) | ||
AC_CHECK_FUNCS([memset]) | ||
|
||
dnl ******************************************************************** | ||
dnl *** Check for typedefs, structures, and compiler characteristics *** | ||
dnl ******************************************************************** | ||
AC_HEADER_STDBOOL | ||
AC_TYPE_SIZE_T | ||
AC_TYPE_UINT8_T | ||
AC_TYPE_UINT16_T | ||
AC_TYPE_UINT32_T | ||
AC_TYPE_UINT64_T | ||
|
||
dnl *********************************** | ||
dnl *** Check for required packages *** | ||
dnl *********************************** | ||
PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.30.0]) | ||
PKG_CHECK_MODULES([GIO_UNIX], [gio-unix-2.0 >= 2.30.0]) | ||
PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.30.0]) | ||
PKG_CHECK_MODULES([DLT], [automotive-dlt >= 2.2.0]) | ||
PKG_CHECK_MODULES([ITZAM], [libitzam >= 6.0.4]) | ||
ITZAM_LIBS="-litzam" | ||
|
||
dnl ************************************* | ||
dnl *** Define extra paths *** | ||
dnl ************************************* | ||
AC_ARG_WITH([dbuspolicydir], | ||
AS_HELP_STRING([--with-dbuspolicydirdir=DIR], [Directory for D-Bus system policy files]), | ||
[], | ||
[with_dbuspolicydir=$(pkg-config --silence-errors --variable=sysconfdir dbus-1)/dbus-1/system.d]) | ||
AC_SUBST([dbuspolicydir], [$with_dbuspolicydir]) | ||
|
||
# Derive path for storing 'dbus' interface files (e. g. /usr/share/dbus-1/interfaces) | ||
AC_ARG_WITH([dbusinterfacesdir], | ||
AS_HELP_STRING([--with-dbusinterfacesdir=DIR], [Directory for D-Bus interface files]), | ||
[], | ||
[with_dbusinterfacesdir=$(pkg-config --silence-errors --variable=interfaces_dir dbus-1)]) | ||
AC_SUBST([dbusinterfacesdir], [$with_dbusinterfacesdir]) | ||
|
||
dnl ******************************* | ||
dnl *** Define configure output *** | ||
dnl ******************************* | ||
AC_CONFIG_FILES(Makefile src/Makefile generated/Makefile pkgconfig/libperscommon.pc) | ||
|
||
AC_OUTPUT | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE busconfig PUBLIC | ||
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" | ||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> | ||
<busconfig> | ||
|
||
<!-- Only root can own the service --> | ||
<policy user="root"> | ||
<allow own="org.genivi.persistence.admin"/> | ||
<allow send_destination="org.genivi.persistence.admin"/> | ||
<allow send_interface="org.genivi.persistence.admin"/> | ||
</policy> | ||
<policy context="default"> | ||
<allow send_destination="org.genivi.persistence.admin"/> | ||
<allow send_interface="org.genivi.persistence.admin"/> | ||
</policy> | ||
</busconfig> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<!-- | ||
* | ||
* Copyright (C) 2012-2013 Continental Automotive GmbH. | ||
* | ||
* Author: [email protected] | ||
* | ||
* XML model of the dbus interfaces for the test NodeStateMachine | ||
* | ||
* 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 | ||
* 2012.11.27 uidu0250 Initial version | ||
* | ||
--> | ||
<node> | ||
<interface name="org.genivi.persistence.admin"> | ||
<method name="RegisterPersAdminNotification"> | ||
<arg name="BusName" type="s" direction="in"/> | ||
<arg name="ObjName" type="s" direction="in"/> | ||
<arg name="NotificationFlag" type="i" direction="in"/> | ||
<arg name="TimeoutMs" type="u" direction="in"/> | ||
<arg name="ErrorCode" type="i" direction="out"/> | ||
</method> | ||
<method name="UnRegisterPersAdminNotification"> | ||
<arg name="BusName" type="s" direction="in"/> | ||
<arg name="ObjName" type="s" direction="in"/> | ||
<arg name="NotificationFlag" type="i" direction="in"/> | ||
<arg name="TimeoutMs" type="u" direction="in"/> | ||
<arg name="ErrorCode" type="i" direction="out"/> | ||
</method> | ||
<method name="PersistenceAdminRequestCompleted"> | ||
<arg name="RequestId" type="u" direction="in"/> | ||
<arg name="Status" type="i" direction="in"/> | ||
<arg name="ErrorCode" type="i" direction="out"/> | ||
</method> | ||
</interface> | ||
<interface name="org.genivi.persistence.adminconsumer"> | ||
<method name="PersistenceAdminRequest"> | ||
<arg name="Request" type="i" direction="in"/> | ||
<arg name="RequestId" type="i" direction="in"/> | ||
<arg name="ErrorCode" type="i" direction="out"/> | ||
</method> | ||
</interface> | ||
</node> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
gdbus-codegen --interface-prefix="org.genivi.persistence." --c-namespace="OipPersistence" --generate-c-code="PasClientNotificationGen" org.genivi.persistence.admin.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
####################################################################################################################### | ||
# | ||
# Copyright (C) 2012 Continental Automotive Systems, Inc. | ||
# | ||
# Author: [email protected] | ||
# | ||
# Makefile template for the Persistence Administration Service generated sources | ||
# | ||
# Process this file with automake to produce a Makefile.in. | ||
# | ||
# 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/. | ||
# | ||
####################################################################################################################### | ||
|
||
# List generated sources here to assert that they are available at build start | ||
BUILT_SOURCES = PasClientNotificationGen.c \ | ||
PasClientNotificationGen.h | ||
|
||
# Delete all generated files on 'make clean' | ||
CLEANFILES = PasClientNotificationGen.c \ | ||
PasClientNotificationGen.h | ||
|
||
|
||
# Targets to create generated sources during the build | ||
|
||
PasClientNotificationGen.c PasClientNotificationGen.h: $(top_srcdir)/dbus_specifications/org.genivi.persistence.admin.xml | ||
gdbus-codegen --interface org.genivi.persistence. --c-namespace OipPersistence --generate-c-code PasClientNotificationGen $(top_srcdir)/dbus_specifications/org.genivi.persistence.admin.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
#ifndef OSS_PERSISTENCE_COMMON_IPC_DBUS_H | ||
#define OSS_PERSISTENCE_COMMON_IPC_DBUS_H | ||
|
||
/********************************************************************************************************************** | ||
* | ||
* Copyright (C) 2012 Continental Automotive Systems, Inc. | ||
* | ||
* Author: [email protected] | ||
* | ||
* Interface: private - specifies the DBus interface for PersCommonIPC | ||
* | ||
* The file defines contains the defines according to | ||
* https://collab.genivi.org/wiki/display/genivi/SysInfraEGPersistenceConceptInterface | ||
* | ||
* 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 Version Reason | ||
* 2013.04.03 uidu0250 1.0.0.0 CSP_WZ#2739 : Initial version of the interface | ||
* | ||
**********************************************************************************************************************/ | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif /* #ifdef __cplusplus */ | ||
|
||
#include "persComTypes.h" | ||
|
||
#define PERSIST_IPC_DBUS_INTERFACE_VERSION (0x01000000U) | ||
|
||
|
||
#define PERSISTENCE_ADMIN_BUS_TYPE G_BUS_TYPE_SYSTEM | ||
#define PERSISTENCE_ADMIN_BUS_NAME "org.genivi.persistence.admin" | ||
#define PERSISTENCE_ADMIN_OBJ_PATH "/org/genivi/persistence/admin" | ||
#define PERSISTENCE_ADMIN_IFACE "org.genivi.persistence.admin" | ||
#define PERSISTENCE_ADMIN_CONSUMER_OBJ_PATH "/org/genivi/persistence/adminconsumer" | ||
|
||
/* TO DO: remove when PCL implementation is adapted to PersCommonIPC */ | ||
#define PERSISTENCE_ADMIN_CONSUMER_IFACE "org.genivi.persistence.adminconsumer" | ||
#define PERSISTENCE_ADMIN_CONSUMER_METHOD_PERS_ADMIN_REQ "PersistenceAdminRequest" | ||
|
||
/** | ||
* \brief Initialize PAS IPC DBus component | ||
* | ||
* \note : The function creates the DBus connection and tries to obtain the DBus name | ||
* and exports the org.genivi.persistence.admin interface. | ||
* It runs the DBus main loop on a second thread. | ||
* | ||
* \param pInitInfo [in] pointer to a \ref PersAdminPASInitInfo_s structure containing | ||
* the supported callbacks | ||
* | ||
* \return 0 for success, negative value for error (\ref PERS_COM_ERROR_CODES_DEFINES) | ||
*/ | ||
sint_t persIpcInitPAS_DBus_high(PersAdminPASInitInfo_s *pInitInfo); | ||
|
||
|
||
/** | ||
* \brief Sends over DBus a request to the PCL client specified by clientId. | ||
* | ||
* \note : Each requestId should be unique. | ||
* | ||
* \param clientID [in] the client ID returned by the supplied pRegCB callback | ||
* \param requestID [in] a unique identifier generated for every request | ||
* \param request [in] the request to be sent (bitfield using a valid | ||
* combination of any of the following flags : | ||
* ::PERSISTENCE_MODE_LOCK, ::PERSISTENCE_MODE_SYNC and ::PERSISTENCE_MODE_UNLOCK) | ||
* | ||
* \return 0 for success, negative value for error (see \ref PERS_COM_ERROR_CODES_DEFINES) | ||
*/ | ||
sint_t persIpcSendRequestToPCL_DBus_high( sint_t clientID, | ||
sint_t requestID, | ||
uint_t request); | ||
|
||
|
||
/** | ||
* \brief Register PCL client to PAS over DBus | ||
* | ||
* \note : An additional thread is created for communication purposes. | ||
* Initialize members of the supplied PersAdminPCLInitInfo_s structure before calling this function. | ||
* | ||
* \param pInitInfo [in] pointer to a \ref PersAdminPCLInitInfo_s structure containing | ||
* the supported callbacks | ||
* \param flags [in] supported notification flags | ||
* \param timeout [in] maximum time needed to process any supported request | ||
* | ||
* \return 0 for success, negative value for error (see \ref PERS_COM_ERROR_CODES_DEFINES) | ||
*/ | ||
sint_t persIpcRegisterToPAS_DBus_high( PersAdminPCLInitInfo_s * pInitInfo, | ||
uint_t flags, | ||
uint_t timeout); | ||
|
||
|
||
/** | ||
* \brief Un-Register PCL client application from PAS over DBus | ||
* | ||
* \note : The additional thread created for communication purposes is stopped. | ||
* | ||
* \param flags [in] supported notification flags | ||
* | ||
* \return 0 for success, negative value for error (\ref PERS_COM_ERROR_CODES_DEFINES) | ||
*/ | ||
sint_t persIpcUnRegisterFromPAS_DBus_high( uint_t flags); | ||
|
||
|
||
/** | ||
* \brief Send 'request processed' confirmation to PAS over DBus | ||
* \note : Send confirmation to PAS that the request specified by requestId has been processed. | ||
* The status parameter should reflect this request and could also return an error. | ||
* | ||
* \param requestID [in] the ID of the processed request | ||
* \param status [in] the status of the request processed by PCL | ||
* - In case of success: bitfield using any of the following flags, depending on the request : ::PERSISTENCE_STATUS_LOCKED. | ||
* - In case of error: the sum of ::PERSISTENCE_STATUS_ERROR and an error code \ref PERS_COM_IPC_DEFINES_ERROR is returned. | ||
* | ||
* \return 0 for success, negative value for error (see \ref PERS_COM_ERROR_CODES_DEFINES) | ||
*/ | ||
sint_t persIpcSendConfirmationToPAS_DBus_high( sint_t requestID, | ||
uint_t status); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif /* extern "C" { */ | ||
|
||
#endif /* OSS_PERSISTENCE_COMMON_IPC_DBUS_H */ | ||
|
Oops, something went wrong.