Precommit (#1)

* first commit

* cleanup
This commit is contained in:
tompzf
2025-11-04 13:28:06 +01:00
committed by GitHub
parent dba45dc636
commit 6ed4b1534e
898 changed files with 256340 additions and 0 deletions

181
export/interfaces/app.idl Normal file
View File

@@ -0,0 +1,181 @@
/**
* @file app.idl
* @brief This file provides the core interface definitions SDV framework administration.
* @version 0.1
* @date 2024.04.11
* @author erik.verhoeven@zf.com
* @copyright Copyright ZF Friedrichshaven AG (c) 2023-2025
*/
#include "core.idl"
#include "toml.idl"
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
* @brief Core features.
*/
module app
{
/**
* @brief The application operation state.
*/
enum EAppOperationState
{
not_started = 0, ///< The application hasn't been started yet.
starting = 1, ///< The application is starting.
started = 2, ///< The application has started.
initializing = 10, ///< The application is initializing.
initialized = 12, ///< The application has initialized.
configuring = 20, ///< The application switched to configuration mode.
running = 30, ///< The application is running/switched to running mode.
shutting_down = 90, ///< The application is shutting down.
};
/**
* @brief Event structure. Dependable on the event, can be derived to provide additional information.
*/
struct SAppEvent
{
uint32 uiEventID; ///< The event ID of the event
uint32 uiInfo; ///< Additional information that can be used during a call to the event and as answer from
///< the implemented event handler. The information depends on the event that is triggered.
};
const uint32 EVENT_OPERATION_STATE_CHANGED = 1; ///< Information about the application operation state. The information
///< section of the event structure contains the current operation mode
///< represented by the EAppOperationMode enum. This event is
///< informational only and will be called by the core library to
///< inform the application.
const uint32 EVENT_RUNNING_LOOP = 8; ///< Triggered every 2ms to do idle operations during the running loop.
/**
* @brief Application event system. To be implemented by the application.
*/
local interface IAppEvent
{
/**
* @brief Process the event.
* @param[inout] sEvent Event structure containing the information to process.
*/
void ProcessEvent(inout SAppEvent sEvent);
};
/**
* @brief Application context types.
*/
enum EAppContext : uint32
{
no_context = 0, ///< The core hasn't started yet. No context available.
standalone = 10, ///< Running as standalone application. No component isolation instantiated. Additional
///< configurations can be loaded.
external = 20, ///< External application. Component isolation in client mode.
isolated = 30, ///< Isolated application. Component isolation in client mode.
main = 100, ///< Main application. Component isolation in server mode.
essential = 5, ///< Bare minunum configuration. Local services loaded only. Additional configurations can be
///< loaded.
maintenance = 80, ///< Maintenance application. Component isolation in client mode. Access to maintenance interfaces
///< only.
};
/**
* @brief Application context interface.
*/
local interface IAppContext
{
/**
* @brief Return the application context.
* @return The context mode.
*/
EAppContext GetContextType() const;
/**
* @brief Return the core instance ID.
* @return The instance ID.
*/
uint32 GetInstanceID() const;
/**
* @brief Return the number of retries to establish a connection.
* @return Number of retries.
*/
uint32 GetRetries() const;
};
/**
* @brief Local application control.
*/
local interface IAppControl
{
/**
* @brief Start the application.
* @details The core will prepare for an application start based on the provided configuration. Per default, the
* application will be in running mode after successful startup.
* @param[in] ssConfig String containing the configuration to be used by the core during startup. This configuration
* is optional. If not provided the application runs as standalone application without any RPC support.
* @param[in] pEventHandler Pointer to the event handler receiving application events. For the handler to receive
* events, the handler needs to expose the IAppEvent interface. This pointer is optionally and can be NULL.
* @return Returns 'true' on successful start-up and 'false' on failed startup.
*/
boolean Startup(in u8string ssConfig, in IInterfaceAccess pEventHandler)
raises(XAccessDenied, toml::XTOMLParseException);
/**
* @brief Running loop until shutdown request is triggered.
*/
void RunLoop() raises(XAccessDenied, XInvalidState);
/**
* @brief Initiate a shutdown of the application.
* @details The objects will be called to shutdown allowing them to clean up and gracefully shutdown. If, for some
* reason, the object cannot shut down (e.g. pointers are still in use or threads are not finalized), the object will
* be kept alive and the application state will stay in shutting-down-state. In that case the exception is called. A
* new call to the shutdown function using the force-flag might force a shutdown. Alternatively the application can
* wait until the application state changes to not-started.
* @remarks Application shutdown is only possible when all components are released.
* @param[in] bForce When set, forces an application shutdown. This might result in loss of data and should only be
* used as a last resort.
*/
void Shutdown(in boolean bForce) raises(XAccessDenied, XInvalidState, XTimeout);
};
/**
* @brief Application operation control.
*/
interface IAppOperation
{
/**
* @brief Get the current operation state. This information is also supplied through the event handler function.
* @return Returns the operation state of the application.
*/
EAppOperationState GetOperationState() const;
/**
* @brief Switch from running mode to the configuration mode.
*/
void SetConfigMode() raises(XAccessDenied, XInvalidState);
/**
* @brief Switch from the configuration mode to the running mode.
*/
void SetRunningMode() raises(XAccessDenied, XInvalidState);
};
/**
* @brief Request a shutdown (only for server).
*/
interface IAppShutdownRequest
{
/**
* @brief Request a shutdown. The function will only place the request to shut down.
*/
void RequestShutdown() raises(XAccessDenied, XInvalidState);
};
}; // module app
}; // module sdv

120
export/interfaces/can.idl Normal file
View File

@@ -0,0 +1,120 @@
/**
* @file can.idl
* @author Erik Verhoeven FRD DISS2 (mailto:erik.verhoeven@zf.com)
* @brief This file provides the CAN abstraction interfaces
* @version 1.0
* @date 2024-02-07
*
* @copyright Copyright ZF Friedrichshafen AG (c) 2024
*
*/
#include "core.idl"
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
* @brief CAN abstraction interface.
*/
module can
{
/**
* @brief CAN message structure
*/
struct SMessage
{
uint32 uiID; ///< CAN ID
boolean bExtended; ///< When set, the message ID is extended.
boolean bCanFd; ///< When set, the message is of CAN-FD.
sequence<uint8> seqData; ///< The data for this message (max. 8 bytes for standard CAN and 64 bytes for CAN-FD).
};
/**
* @brief Error enum
*/
enum EError : uint32
{
no_error = 0, ///< No error
bit_error = 1, ///< When the bit received is not the same as the bit transmitted.
stuff_error = 2, ///< If more than five consecutive bits of the same level occur on the bus.
form_error = 3, ///< Violation of fixed bit format.
crc_error = 4, ///< If the received CRC does not match with the calculated code.
ack_error = 5, ///< The transmitter does not receive a dominant acknowledgement bit in reply.
};
/**
* @brief CAN error frame structure
*/
struct SErrorFrame
{
uint32 uiID; ///< CAN ID; could be 0 when the error is not referring to a specific ID.
EError eError; ///< The error.
};
/**
* @brief Interface to receive CAN messages; callback interface.
*/
local interface IReceive
{
/**
* @brief Process a receive a CAN message.
* @param[in] sMsg Message that was received.
* @param[in] uiIfcIndex Interface index of the received message.
*/
void Receive(in SMessage sMsg, in uint32 uiIfcIndex);
/**
* @brief Process an error frame.
* @param[in] sError Error frame that was received.
* @param[in] uiIfcIndex Interface index of the received message.
*/
void Error(in SErrorFrame sError, in uint32 uiIfcIndex);
};
/**
* @brief Interface to register the CAN receiver.
*/
local interface IRegisterReceiver
{
/**
* @brief Register a CAN message receiver.
* @param[in] pReceiver Pointer to the receiver interface.
*/
void RegisterReceiver(in IReceive pReceiver);
/**
* @brief Unregister a previously registered CAN message receiver.
* @param[in] pReceiver Pointer to the receiver interface.
*/
void UnregisterReceiver(in IReceive pReceiver);
};
/**
* @brief Interface to send CAN messagee.
*/
local interface ISend
{
/**
* @brief Send a CAN message.
* @param[in] sMsg Message that is to be sent.
* @param[in] uiIfcIndex Interface index to use for sending.
*/
void Send(in SMessage sMsg, in uint32 uiIfcIndex);
};
/**
* @brief Interface to request the available interfaces and nodes.
*/
local interface IInformation
{
/**
* @brief Get a list of interface names.
* @return Sequence containing the names of the interfaces.
*/
sequence<u8string> GetInterfaces() const;
};
};
};

172
export/interfaces/com.idl Normal file
View File

@@ -0,0 +1,172 @@
/**
* @file com.idl
* @author Erik Verhoeven FRD DISDS1 (mailto:erik.verhoeven@zf.com) & Steffen Altmeier FRD DISS21 (mailto:steffen.altmeier@zf.com)
* @brief This file includes all the interfaces used by the communication control service
* @version 1.0
* @date 2024-08-12
*
* @copyright Copyright ZF Friedrichshafen AG (c) 2024
*/
#include "core.idl"
#include "core_ps.idl"
#include "process.idl"
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
* @brief Core features.
*/
module com
{
/**
* @brief Connection ID used for connection identification
*/
struct SConnectionID
{
uint32 uiIdent; ///< Identification value.
uint32 uiControl; ///< Control value for 2nd pass identification.
};
/**
* @brief Channel connection ID.
*/
typedef SConnectionID TConnectionID;
/**
* @brief Request a channel to connect to the core application.
*/
interface IRequestChannel
{
/**
* @brief Request a channel.
* @param[in] ssConfig Configuration; currently not used.
* @return The channel string needed to initialize the channel.
*/
u8string RequestChannel(in u8string ssConfig);
};
/**
* @brief Connect to a remote system. Provided by the ConnectClient utility.
*/
interface IClientConnect
{
/**
* @brief Connect to a remote system using the connection string to contact the system.
* @remarks After a successful connection, the ConnectClient utility is not needed any more.
* @param[in] ssConnectString Optional connection string to use for connection. If not provided, the connection will
* automatically get the connection ID from the app-control service (default). The connection string for a local
* connection can be of the form:
* @code
* [Client]
* Type = "local"
* Instance = 1234 # Optional: only use when connecting to a system with a different instance ID.
* @endcode
* And the following can be used for a remote connection:
* @code
* [Client]
* Type = "remote"
* Interface = "127.0.0.1"
* Port = 2000
* @endcode
* @return Returns an interface to the repository of the remote system or a NULL pointer if not found.
*/
IInterfaceAccess Connect(in u8string ssConnectString) raises(XAccessDenied, XNotFound, XInvalidState, XTimeout);
};
/**
* @brief Channel type
*/
enum EChannelType : uint32
{
local_channel = 0, ///< Local channel
remote_channel = 1, ///< Remote channel
custom_channel = 2, ///< Custom channel (not specifically defined as standard local or remote).
};
/**
* @brief Interface for creating a channel connection used for SDV communication.
* @details The channel control interface is used to create a connection between two processes and start the initial
* communication. The provided object will be accessible as initial object through the channel.
* Using these interfaces the following connections can be made:
* 1. The main application provides an endpoint with a channel to its repository and the isolated or external application
* links its own repository to the repository of the main application.
* 2. The main application provides a listener endpoint (IPC channel is configured as listener and assigned to the
* channel control) with an object to create a new private connection. Connecting applications can then connect to the
* main applications and after the initial connection create a private communication.
* 3. The isolated application provides an object to create a private communication to another isolated or external
* application
*/
local interface IConnectionControl
{
/**
* @brief Create an IPC channel endpoint and use it for SDV communication.
* @remarks The channel will be destroyed automatically when a timeout occurs (no initial connection took place within
* the specified time).
* @remarks The function doesn't wait until a connection has been made, but returns straight after the channel creation.
* @param[in] eChannelType Type of channel to create. Must be local or remote.
* @param[in] pObject Initial object to start the communication with.
* @param[in] uiTimeoutMs Timeout for waiting for a connection.
* @param[out] ssConnectionString String describing the connection details to connect to this channel.
* @return Channel connection ID if successful or 0 if not.
*/
TConnectionID CreateServerConnection(in EChannelType eChannelType, in IInterfaceAccess pObject, in uint32 uiTimeoutMs,
out u8string ssConnectionString);
/**
* @brief Connect to an IPC channel managed by the channel control.
* @remarks The connection will be destroyed automatically when a timeout occurs (no initial connection took place
* within the specified time).
* @param[in] ssConnectionString The string describing the connection details.
* @param[in] uiTimeoutMs Timeout for waiting for a connection.
* @param[out] pProxy Pointer to the object representing the remote object (a proxy to the remote object). Or nullptr
* when a timeout occurred.
* @return Channel connection ID if successful or 0 if not.
*/
TConnectionID CreateClientConnection(in u8string ssConnectionString, in uint32 uiTimeoutMs, out IInterfaceAccess pProxy);
/**
* @brief Assign and take over an already initialized IPC channel server endpoint for use with SDV communication.
* @remarks The channel will be destroyed automatically when a timeout occurs (no initial connection took place within
* the specified time) unless the flag bAllowReconnect has been set.
* @remarks The channel uses the interface sdv::IObjectLifetime to control the lifetime of the channel. If
* IObjectLifetime is not available, IObjectDestroy will be used.
* @remarks The function doesn't wait until a connection has been made, but returns straight after the assignment.
* @param[in] pChannelEndpoint Pointer to the channel endpoint to be assigned.
* @param[in] pObject Initial object to start the communication with.
* @param[in] uiTimeoutMs Timeout for waiting for an initial connection. Not used when the bAllowReconnect flag has
* been set.
* @param[in] bAllowReconnect When set, the channel is allowed to be disconnected and reconnected again.
* @return Channel connection ID if successful or 0 if not.
*/
TConnectionID AssignServerEndpoint(in IInterfaceAccess pChannelEndpoint, in IInterfaceAccess pObject,
in uint32 uiTimeoutMs, in boolean bAllowReconnect);
/**
* @brief Assign and take over an already initialized IPC channel client endpoint for use with SDV communication.
* @remarks The connection will be destroyed automatically when a timeout occurs (no initial connection took place
* within the specified time).
* @remarks The channel uses the interface sdv::IObjectLifetime to control the lifetime of the channel. If
* IObjectLifetime is not available, IObjectDestroy will be used.
* @param[in] pChannelEndpoint Pointer to the channel endpoint to be assigned.
* @param[in] uiTimeoutMs Timeout for waiting for an initial connection. Not used when the bAllowReconnect flag has
* been set.
* @param[out] pProxy Pointer to the object representing the remote object (a proxy to the remote object). Or nullptr
* when a timeout occurred.
* @return Channel connection ID if successful or 0 if not.
*/
TConnectionID AssignClientEndpoint(in IInterfaceAccess pChannelEndpoint, in uint32 uiTimeoutMs,
out IInterfaceAccess pProxy);
/**
* @brief Remove a connection with the provided connection ID.
* @param[in] tConnectionID The connection ID of the connection to remove.
*/
void RemoveConnection(in TConnectionID tConnectionID);
};
}; // module com
}; // module sdv

View File

@@ -0,0 +1,550 @@
/**
* @file app.idl
* @brief This file provides the core interface definitions SDV framework administration.
* @version 0.1
* @date 2024.04.11
* @author erik.verhoeven@zf.com
* @copyright Copyright ZF Friedrichshaven AG (c) 2023-2025
*/
#include "core.idl"
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
#verbatim_begin
#include "../support/string.h"
#verbatim_end
/**
* @brief Failed to open a file.
*/
exception XCannotOpenFile : XSysExcept
{
/** Description */
const char _description[] = "Cannot open a file.";
u8string ssPath; ///< Path to the file that cannot be opened.
};
/**
* @brief File corruption detected.
*/
exception XFileCorrupt : XSysExcept
{
/** Description */
const char _description[] = "The inetrnal structure of the file is not as expected.";
u8string ssPath; ///< Path to the file that is corrupted.
};
/**
* @brief Failed to read file times or attributes.
*/
exception XCannotReadFileTimesOrAttributes : XSysExcept
{
/** Description */
const char _description[] = "Cannot read file times or attributes.";
u8string ssPath; ///< Path to the file that cannot be changed.
};
/**
* @brief Failed to change file times or attributes.
*/
exception XCannotChangeFileTimesOrAttributes : XSysExcept
{
/** Description */
const char _description[] = "Cannot change file times or attributes.";
u8string ssPath; ///< Path to the file that cannot be changed.
};
/**
* @brief Cannot create a directory.
*/
exception XCannotCreateDir : XSysExcept
{
/** Description */
const char _description[] = "Cannot create a directory.";
u8string ssPath; ///< Path to the directory that cannot be created.
};
/**
* @brief Cannot remove a directory.
*/
exception XCannotRemoveDir : XSysExcept
{
/** Description */
const char _description[] = "Cannot remove a directory.";
u8string ssPath; ///< Path to the directory that cannot be removed.
};
/**
* @brief An invalid path was supplied.
*/
exception XInvalidPath : XSysExcept
{
/** Description */
const char _description[] = "An invalid path was supplied.";
u8string ssPath; ///< Path.
};
/**
* @brief A file with the same path already exists.
*/
exception XDuplicateFile : XSysExcept
{
/** Description */
const char _description[] = "A file with the same path already exists.";
u8string ssFilePath; ///< Path to the file.
};
/**
* @brief Core features.
*/
module core
{
/**
* Configuration loading/processing result enumeration.
*/
enum EConfigProcessResult : int32
{
failed = 0, ///< Loading or processing the configuration failed.
successful = 1, ///< Loading or processing the configuration was successful.
partially_successful = -1, ///< Loading or processing the configuration was successful for some modules and/or
///< components and not successful for other module and/or components.
};
/**
* @brief Application configuration.
* @attention This interface is available for the standalone and essential application. The main, isolated and maintenance
* applications cannot use this interface.
*/
local interface IConfig
{
/**
* @brief Process the provided configuration by loading modules and creating objects/stubs/proxies defined in the
* configuration string. Processing a configuration resets the baseline before processing.
* @attention Configuration changes can only occur when the system is in configuration mode.
* @param[in] ssContent The contents of the configuration file (TOML).
* @return Returns a config process result enum value.
*/
EConfigProcessResult ProcessConfig(in u8string ssContent);
/**
* @brief Read file pointed to by the provided file path and load modules and create components as defined in the
* configuration file. Loading a configuration resets the baseline before processing.
* @attention Configuration changes can only occur when the system is in configuration mode.
* @param[in] ssConfigPath Path to the file containing the configuration (TOML). The path can be an absolute as well as a
* relative path. In case a relative path is provided, the executable directory is searched as well as all directories
* supplied through the AddConfigSearchDir function.
* @return Returns a config process result enum value.
*/
EConfigProcessResult LoadConfig(in u8string ssConfigPath);
/**
* @brief Save a configuration file pointed to by the provided file path. All components are saved that were added after
* the last baseline with the configuration specific settings.
* @attention Configuration changes can only occur when the system is in configuration mode.
* @param[in] ssConfigPath Path to the file containing the configuration (TOML). The path can be an absolute as well as a
* relative path. In case a relative path is provided, the configuration is stored relative to the executable directory.
* @return Returns 'true' on success; 'false' otherwise.
*/
boolean SaveConfig(in u8string ssConfigPath) const;
/**
* @brief Add a search path to a folder where a config file can be found.
* @param[in] ssDir Relative or absolute path to an existing folder.
* @return Returns 'true' on success; 'false' otherwise.
*/
boolean AddConfigSearchDir(in u8string ssDir);
/**
* @brief Reset the configuration baseline.
* @details The configuration baseline determines what belongs to the current configuration. Any object being added
* after this baseline will be stored in a configuration file.
*/
void ResetConfigBaseline();
};
}; // module core
/**
* @brief Installation module.
*/
module installation
{
/**
* @brief Package version struct.
*/
struct SPackageVersion
{
uint32 uiMajor; ///< Major version number
uint32 uiMinor; ///< Minor version number
uint32 uiPatch; ///< Patch level
};
/**
* @brief Installation package header V1.0.
* @todo Add signature information to prevent change after creation.
* @details The installation package is composed as follows:
* @code
* +--------------------------------------------------+
* | package header structure |
* | optional info |
* | checksum |
* +--------------------------------------------------+
* | 1st BLOB header |
* | BLOB content (e.g. file content) |
* | BLOB checksum |
* +--------------------------------------------------+
* | 2nd BLOB header |
* | BLOB content (e.g. file content) |
* | BLOB checksum |
* +--------------------------------------------------+
* | ... |
* +--------------------------------------------------+
* | nth BLOB header |
* | BLOB content (e.g. installation manifest) |
* | BLOB checksum |
* +--------------------------------------------------+
* | package footer - checksum of package |
* +--------------------------------------------------+
* @endcode
*/
struct SPackageHeader
{
EEndian eEndian; ///< Describes whether the data is in big or in little endian.
uint8 uiReserved; ///< Reserved for alignment measures. Mus be 0.
uint16 uiVersion; ///< Structure version (major * 100 + minor).
uint32 uiOffset; ///< Offset to the 1st package BLOB.
uint8 rguiSignature[8]; ///< Signature 'SDV_IPCK'
uint64 uiCreationDate; ///< Creation date (micro-seconds since 1st January 1970).
u8string ssManifest; ///< Installation manifest
};
/**
* @brief Checksum over header following the header content
*/
struct SPackageHeaderChecksum
{
uint32 uiChecksum; ///< Checksum over header (CRC32c)
};
/**
* @brief Footer at the end of the package.
*/
struct SPackageFooter
{
uint32 uiChecksum; ///< Checksum over complete package (CRC32c)
};
/**
* @brief File description structure.
* @details The file description structure contaions all the information to create the file, including the content. The
* file is stored in the installation package in a BLOB by using the serialization functions created by the IDL compiler.
*/
struct SFileDesc
{
u8string ssFileName; ///< File name.
uint64 uiCreationDate; ///< Creation date (micro-seconds since 1st January 1970).
uint64 uiChangeDate; ///< Last change date (micro-seconds since 1st January 1970).
boolean bAttrReadonly; ///< Read only file flag when set.
boolean bAttrExecutable; ///< Executable file flag when set.
pointer<uint8> ptrContent; ///< The binary content of the file.
};
/**
* @brief Installation package BLOB type.
*/
enum EPackageBLOBType : uint32
{
binary_file = 1, ///< The BLOB is a binary file using the serialized SFileDesc structure.
final_entry = 0xffffffff, ///< Last BLOB entry; no more BLOBs available.
};
/**
* @brief Installation package directory entry. Each BLOB is serialized using the serialization functions generated by IDL
* compiler.
*/
struct SPackageBLOB
{
EPackageBLOBType eBLOBType; ///< The BLOB type, used for interpretation.
uint32 uiChecksumInit; ///< Initial value of the checksum calculation (CRC32c)
uint32 uiBLOBSize; ///< Size of the BLOB including header and checksum.
/// Anonymous union containing the BLOB content.
union switch (eBLOBType)
{
case EPackageBLOBType::binary_file:
SFileDesc sFileDesc; ///< File description
case final_entry:
};
};
/**
* @brief Checksum over BLOB following the content
*/
struct SPackageBLOBChecksum
{
uint32 uiChecksum; ///< Checksum over BLOB (CRC32c)
};
/**
* @brief The composure of an installation package failed.
*/
exception XFailedToCompose : XSysExcept
{
/** Description */
const char _description[] = "Faled to compose an installation package.";
u8string ssInstallName; ///< Name of the installation to compose.
};
/**
* @brief The installation manifest is missing.
*/
exception XNoManifest : XSysExcept
{
/** Description */
const char _description[] = "The installation manifest could not be found or created.";
};
/**
* @brief The installation manifest is not readable.
*/
exception XInvalidManifest : XSysExcept
{
/** Description */
const char _description[] = "The installation manifest could not be loaded.";
};
/**
* @brief The installation manifest could not be saved.
*/
exception XFailedSaveManifest : XSysExcept
{
/** Description */
const char _description[] = "The installation manifest could not be saved.";
u8string ssInstallName; ///< Name of the installation.
u8string ssPath; ///< Path to the target directory.
};
/**
* @brief Creating the installation manifest is not readable.
*/
exception XFailedManifestCreation : XSysExcept
{
/** Description */
const char _description[] = "The installation manifest could not be created.";
u8string ssInstallName; ///< Name of the installation.
};
/**
* @brief Multiple installation manifests found.
*/
exception XDuplicateManifest : XSysExcept
{
/** Description */
const char _description[] = "A duplicate installation manifest was found.";
u8string ssInstallName1; ///< Name of the 1st installation.
u8string ssInstallName2; ///< Name of the 2nd installation.
};
/**
* @brief An installation with the same name exists already.
*/
exception XDuplicateInstall : XSysExcept
{
/** Description */
const char _description[] = "An installation exists already.";
u8string ssInstallName; ///< Name of the installation.
};
/**
* @brief The installation doesn't contain a module.
*/
exception XModuleNotFound : XSysExcept
{
/** Description */
const char _description[] = "A module with the supplied name could not be found.";
u8string ssPath; ///< Path to the component.
};
/**
* @brief One or more components within the installation cannot be loaded. It might be that companion files are missing.
*/
exception XComponentNotLoadable : XSysExcept
{
/** Description */
const char _description[] = "One or more components cannot be loaded.";
sequence<u8string> seqComponents; ///< List of components that cannot be loaded.
};
/**
* @brief One or more files have an incorrect CRC.
*/
exception XIncorrectCRC : XSysExcept
{
/** Description */
const char _description[] = "The installation package has an invalid CRC.";
};
/**
* @brief The package is not compatible.
*/
exception XIncompatiblePackage : XSysExcept
{
/** Description */
const char _description[] = "The installation package is incompatible.";
};
/**
* @brief One or more files have an incorrect relative path to store the files.
*/
exception XIncorrectPath : XSysExcept
{
/** Description */
const char _description[] = "Invalid module target path.";
u8string ssPath; ///< The module target path is invalid.
};
/**
* @brief Missing base path.
*/
exception XMissingBasePath : XSysExcept
{
/** Description */
const char _description[] = "A base path is required for processing.";
};
/**
* @brief The requested installation was not found.
*/
exception XInstallationNotFound : XSysExcept
{
/** Description */
const char _description[] = "THe installation was not found.";
u8string ssInstallName; ///< Name of the installation.
};
/**
* @brief The installed components cannot be unloaded and therefore the installation cannot be uninstalled.
*/
exception XUninstallCouldNotUnload : XSysExcept
{
/** Description */
const char _description[] = "Unable to unload the installation.";
u8string ssInstallName; ///< Name of the installation.
};
/*
TODO EVE
Installation needs to be more flexible...
- Components can have calibration values. They content is stored in the config.
- A configuration can be made using the components and the names of the components (VSS???)
- Installing and configuring devices and system and basic services is possible when sdv_core is started in update mode.
- Installing and configuring complex services is possible at any time dynamically.
- Installation and configuring only in config mode
- extend the functionality of the sdv_packager utility to create more detailed config.
*/
/**
* @brief Application installation interface.
* @attention This function is only available for the main application and part of the application config service.
*/
interface IAppInstall
{
/**
* @brief Make an installation onto the system.
* @details Make an installation with from component modules and supporting files. At least one component module must
* be provided for this installation to be successful (component attribute flag must be set). Components are only
* installed, not activated.
* @remarks The system needs to run in configuration mode.
* @param[in] ssInstallName Name of the installation. Must be unique to the system.
* @param[in] seqFiles Files belonging to the installation. This could be component modules as well as supporting files.
* @return Returns whether the installation was successful - installation name was unique and at least one loadable
* component was provided.
*/
boolean Install(in u8string ssInstallName, in sequence<SFileDesc> seqFiles)
raises(XDuplicateInstall, XModuleNotFound, XComponentNotLoadable, XIncorrectCRC,
XIncorrectPath);
/**
* @brief Update an installation.
* @details Stops a component if the component is running, makes an update and if the component was running, starts
* the component again.
* @todo: Currently limited to complex services only.
* @remarks The system needs to run in configuration mode.
* @param[in] ssInstallName Name of the installation. Must be unique to the system.
* @param[in] seqFiles Files belonging to the installation. This could be component modules as well as supporting files.
* @return Returns whether the installation was successful - installation name was unique and at least one loadable
* component was provided.
*/
boolean Update(in u8string ssInstallName, in sequence<SFileDesc> seqFiles)
raises(XInstallationNotFound, XModuleNotFound, XComponentNotLoadable, XIncorrectCRC,
XIncorrectPath);
/**
* @brief Uninstall of a previous installation.
* @details Stops a component if the component is running and removes the files and modules.
* @todo: Currently limited to complex services only.
* @remarks The system needs to run in configuration mode.
* @param[in] ssInstallName Installation name.
* @return Returns whether the uninstallation was successful.
*/
boolean Uninstall(in u8string ssInstallName) raises(XInstallationNotFound, XUninstallCouldNotUnload);
/**
* @brief Get a sequence of installations.
* @return The sequence with installations.
*/
sequence<u8string> GetInstallations() const;
/**
* @brief Get the installed files from the installation.
* @param[in] ssInstallName The installation to get the files for.
* @return Sequence containing the file structures without the binary file content.
*/
sequence<SFileDesc> GetInstallationFiles(in u8string ssInstallName) const raises(XInstallationNotFound);
};
}; // module installation
/**
* @brief Helper features
*/
module helper
{
/**
* @brief Read the module manifest.
* @brief Interface for reading the module manifest. This interface is implemented by the manifest_util component to read
* the manifest while being isolated from the system, thus protecting the system for unwanted behavior in case of
* malfunction.
*/
interface IModuleManifestHelper
{
/**
* @brief Read the module manifest.
* @param[in] ssModule Path to the module file.
* @return The module manifest if available. Otherwise an empty string.
*/
u8string ReadModuleManifest(in u8string ssModule);
};
}; // module helper
}; // module sdv

291
export/interfaces/core.idl Normal file
View File

@@ -0,0 +1,291 @@
/**
* @file core.idl
* @brief This file provides the core interface definitions of the core SDV framework.
* @version 0.1
* @date 2023.04.26
* @author erik.verhoeven@zf.com
* @copyright Copyright ZF Friedrichshaven AG (c) 2023
*/
#include "core_types.idl"
#verbatim #include "../support/pointer.h"
#verbatim #include "../support/iterator.h"
#verbatim #include "../support/string.h"
#verbatim #include "../support/sequence.h"
#verbatim #include "../support/any.h"
#verbatim_begin
#if defined(_WIN32) && defined(GetClassInfo)
#undef GetClassinfo
#endif
#ifdef _MSC_VER
#pragma warning(disable: 4190) // Disable C-linkage warning when using C++ objects.
#endif
#verbatim_end
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
* @brief Access interface
*/
interface IInterfaceAccess
{
/**
* @brief Get access to another interface.
*
* @param[in] idInterface The interface id to get access to.
* @return Returns a pointer to the interface or NULL when the interface is not supported.
*/
interface_t GetInterface(in interface_id idInterface);
#verbatim_begin
/**
* @brief Templated version of GetInterface.
* @tparam TInterface The interface type.
* @return Returns a pointer to the interface or NULL when the interface is not supported.
*/
template <typename TInterface>
TInterface* GetInterface()
{
return GetInterface(sdv::GetInterfaceId<TInterface>()).template get<TInterface>();
}
#verbatim_end
};
/**
* @brief Object type enumeration.
*/
enum EObjectType : uint32
{
SystemObject = 0, ///< System object
Device = 10, ///< Abstract device
BasicService = 20, ///< Basic service
ComplexService = 21, ///< Complex service
Application = 30, ///< Application
Proxy = 100, ///< Proxy object
Stub = 101, ///< Stub object
Utility = 1000, ///< Utility object
};
/**
* @brief Object flags.
*/
enum EObjectFlags : uint32
{
singleton = 256, ///< The object is a singleton object.
};
/**
* @brief Class information structure.
*/
struct SClassInfo
{
u8string ssModulePath; ///< Path to the module that contains the class.
u8string ssClassName; ///< String representing the class name.
sequence<u8string> seqClassAliases; ///< Sequence with class name aliases.
u8string ssDefaultObjectName; ///< The default object name.
EObjectType eType; ///< Type of object.
uint32 uiFlags; ///< Zero or more object flags from EObjectFlags.
sequence<u8string> seqDependencies; ///< Sequence with object class names this object is dependent on.
};
/**
* @brief Interface implemented by each module and used for managing the objects.
*/
interface IObjectFactory
{
/**
* @brief Create or get the object using the name from the object class info.
* @attention The objects lifetime is ended by a call to the DestroyObject function or the unloading of the module.
* @param[in] ssClassName The name of the class object to instantiate.
* @return Pointer to IInterfaceAccess interface of the object or NULL when the requested object doesn't exist.
*/
IInterfaceAccess CreateObject(in u8string ssClassName);
/**
* @brief Destroy an instantiated object using the pointer to the object instance.
* @param[in] sdvObject The object to destroy
*/
void DestroyObject(in IInterfaceAccess sdvObject);
/**
* @brief Destroys all currently instantiated objects in reverse order of creation
*/
void DestroyAllObjects();
};
/**
* @brief Object status enumeration
*/
enum EObjectStatus : uint32
{
initialization_pending = 0, ///< constructor called, but no call to initialize yet
initializing = 10, ///< Initialize was called and is being executed.
initialization_failure = 11, ///< Initialization failed
initialized = 12, ///< Initialization succeeded
configuring = 20, ///< In configuration mode (available after initialization).
config_error = 21, ///< While configuring, error encountered
running = 30, ///< In running mode (available after initialization).
runtime_error = 31, ///< While running, error encountered
shutdown_in_progress = 90, ///< Shutdown called, but not finished yet
destruction_pending = 99, ///< All threads stopped + does no longer fire callbacks or events, ready to be destroyed
};
/**
* @brief Component operation mode.
*/
enum EOperationMode : uint32
{
configuring = 20, ///< The component should switch to configuration mode.
running = 30, ///< The component should switch to running mode.
};
/**
* @brief Optional interface allowing for additional control of more complex SDVObjects.
* To be implemented if the object in question calls other SDVobjects via running threads or callbacks,
* requires configuration or performs other complex behavior during creation/shutdown
*/
interface IObjectControl
{
/**
* @brief Initialize the object.
* @param[in] ssObjectConfig Optional configuration string.
*/
void Initialize(in u8string ssObjectConfig);
/**
* @brief Get the current status of the object.
* @return Return the current status of the object.
*/
EObjectStatus GetStatus() const;
/**
* @brief Set the component operation mode.
* @param[in] eMode The operation mode, the component should run in.
*/
void SetOperationMode(in EOperationMode eMode);
/**
* @brief Shutdown called before the object is destroyed.
* @attention Implement calls to other SDV objects here as this is no longer considered safe during the destructor of the object!
* After a call to shutdown any threads/callbacks/etc that could call other SDV objects need to have been stopped.
* The SDV object itself is to remain in a state where it can respond to calls to its interfaces as other objects may still call it during the shutdown sequence!
* Any subsequent call to GetStatus should return EObjectStatus::destruction_pending
*/
void Shutdown();
};
/**
* @brief Interface that might be exposed by objects to allow self-destruction if the owner doesn't need to object any more.
*/
interface IObjectDestroy
{
/**
* @brief Destroy the object.
* @attention After a call of this function, all exposed interfaces render invalid and should not be used any more.
*/
void DestroyObject();
};
/**
* @brief Lifetime management through reference counting.
*/
interface IObjectLifetime
{
/**
* @brief Increment the lifetime. Needs to be balanced by a call to Decrement.
*/
void Increment();
/**
* @brief Decrement the lifetime. If the lifetime reaches zero, the object will be destroyed (through the exposed
* IObjectDestroy interface).
* @return Returns 'true' if the object was destroyed, false if not.
*/
boolean Decrement();
/**
* @brief Get the current lifetime count.
* @remarks The GetCount function returns a momentary value, which can be changed at any moment.
* @return Returns the current counter value.
*/
uint32 GetCount() const;
};
/**
* @brief Attribute flags.
*/
enum EAttributeFlags : uint32
{
read_only = 0x100, ///< When set, the attribute is readonly.
};
/**
* @brief Attribute interface
*/
interface IAttributes
{
/**
* @brief Get a sequence with the available attribute names.
* @return The sequence of attribute names.
*/
sequence<u8string> GetNames() const;
/**
* @brief Get the attribute value.
* @param[in] ssAttribute Name of the attribute.
* @return The attribute value or an empty any-value if the attribute wasn't found or didn't have a value.
*/
any Get(in u8string ssAttribute) const;
/**
* @brief Set the attribute value.
* @param[in] ssAttribute Name of the attribute.
* @param[in] anyAttribute Attribute value to set.
* @return Returns 'true' when setting the attribute was successful or 'false' when the attribute was not found or the
* attribute is read-only or another error occurred.
*/
boolean Set(in u8string ssAttribute, in any anyAttribute);
/**
* @brief Get the attribute flags belonging to a certain attribute.
* @param[in] ssAttribute Name of the attribute.
* @return Returns the attribute flags (zero or more EAttributeFlags flags) or 0 when the attribute could not be found.
*/
uint32 GetFlags(in u8string ssAttribute) const;
};
}; // module sdv
#verbatim_begin
/**
* @brief Returns whether or not instances of objects implemented by this module are running. If none, the module can be unloaded.
* @remarks Unloading the module with running instances could cause a crash and should be prevented at all costs. Unloading the
* module removes the code of the objects still running.
* @return Returns true when object instances are running; otherwise returns 'false'.
*/
extern "C" SDV_SYMBOL_PUBLIC bool HasActiveObjects();
/**
* @brief Get the module factory interface with a specific version.
* @details This function provides access to the objects being implemented in this module.
* @param[in] interfaceVersion Request the module factory for a specific interface version.
* Using another interface version than the one returned from the GetInterfaceVersion, might cause the function to fail.
* @return Returns pointer to the IInterfaceAccess interface of the module factory object.
*/
extern "C" SDV_SYMBOL_PUBLIC sdv::IInterfaceAccess* GetModuleFactory(uint32_t interfaceVersion);
/**
* @brief Get the the module manifest.
* @details Each module contains a manifest containing general information as well as information about the component classes. This
* allows installing the component without having to instantiate the classes.
* @return Returns the pointer to a zero terminated string containing the module manifest or NULL when there is no string.
*/
extern "C" SDV_SYMBOL_PUBLIC const char* GetManifest();
#verbatim_end
#include "mem.idl"

View File

@@ -0,0 +1,650 @@
/**
* @file core_idl.idl
* @brief This file provides all interface definitions for generator of the IDL compiler as part of the core SDV framework.
* @version 0.1
* @date 2023.06.29
* @author erik.verhoeven@zf.com
* @copyright Copyright ZF Friedrichshaven AG (c) 2022-2025
*/
#include "core.idl"
#include "mem.idl"
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
* @brief IDL features.
*/
module idl
{
/**
* @brief Compilation error.
*/
exception XCompileError
{
u8string ssReason; ///< Explanation of the compilation error.
u8string ssFile; ///< Path to the file causing the compilation error.
uint32 uiLine; ///< Line in the source file that contains the error (starts at 1).
uint32 uiCol; ///< Column in the source file that contains the error (starts at 1).
u8string ssToken; ///< Token that caused the error.
u8string ssLine; ///< Source code line that contains the error.
};
const u8string ssOptionDevEnvDir = u8"DevEnvDir"; ///< The installation directory of the compiler.
const u8string ssOptionOutDir = u8"OutDir"; ///< Path to the output file directory. Default "." - relative to the file path.
const u8string ssOptionFilename = u8"Filename"; ///< Name of the input file.
const u8string ssOptionFilePath = u8"FilePath"; ///< Path to the input file.
const u8string ssOptionCodeGen = u8"CodeGen"; ///< List of code generators
/**
* @brief Compiler option access.
*/
interface ICompilerOption
{
/**
* @brief Get the compiler option.
* @param[in] rssOption Reference to the string containing the name of the option to retrieve.
* @return The requested compiler option (if available).
*/
u8string GetOption(in u8string rssOption) const;
/**
* @brief Get the amount of option values.
* @param[in] rssOption Reference to the string containing the name of the option to retrieve.
* @return The amount of option values.
*/
uint32 GetOptionCnt(in u8string rssOption) const;
/**
* @brief Get the compiler option.
* @param[in] rssOption Reference to the string containing the name of the option to retrieve.
* @param[in] uiIndex The index of the option value.
* @return The requested compiler option value.
*/
u8string GetOptionN(in u8string rssOption, in uint32 uiIndex) const;
};
/**
* @brief Compiler information access.
*/
interface ICompilerInfo
{
/**
* @brief Get the path of the processed file.
* @return The path string.
*/
u8string GetFilePath() const;
/**
* @brief Return the path to the output directory.
* @return The directory string.
*/
u8string GetOutputDir() const;
};
/**
* @brief The entity type.
* @remarks Const entities, declaration entities and typedef entities return the base type of the entity they declare/define.
*/
enum EEntityType : uint32
{
type_unknown, ///< Unknown entity type
type_variable, ///< Variable entity type
type_enum, ///< Enum entity type
type_struct, ///< Struct entity type
type_union, ///< Union entity type
type_module, ///< Module entity type
type_interface, ///< Interface entity type
type_exception, ///< Interface entity type
type_attribute, ///< Attribute entity type
type_operation, ///< Operation entity type
type_parameter, ///< Parameter entity type
type_enum_entry, ///< Enum entry entity type
type_case_entry, ///< Case entry entity type
type_switch_variable, ///< Switch variable entity type (used by unions)
type_typedef, ///< Typedef entity type
type_meta, ///< Meta data entity type
};
/**
* @brief The entity declaration type.
*/
enum EDeclType : uint32
{
decltype_unknown, ///< Unknown type
decltype_short, ///< Integer type (int16_t)
decltype_long, ///< Integer type (int32_t)
decltype_long_long, ///< Integer type (int64_t)
decltype_octet, ///< Octet type (uint8_t)
decltype_unsigned_short, ///< Integer type (uint16_t)
decltype_unsigned_long, ///< Integer type (uint32)
decltype_unsigned_long_long, ///< Integer type (uint64_t)
decltype_float, ///< Floating point type
decltype_double, ///< Floating point type
decltype_long_double, ///< Floating point type
decltype_fixed, ///< Fixed point templated type
decltype_char, ///< Character type (int8_t)
decltype_char16, ///< UTF-16 character
decltype_char32, ///< UTF-32 character
decltype_wchar, ///< Character type
decltype_boolean, ///< Boolean type
decltype_native, ///< Native type
decltype_string, ///< ASCII templated string type
decltype_u8string, ///< UTF-8 templated string type
decltype_u16string, ///< UTF-16 templated string type
decltype_u32string, ///< UTF-32 templated string type
decltype_wstring, ///< Wide templated string type
decltype_enum, ///< Enum type
decltype_struct, ///< Struct type
decltype_union, ///< Union type
decltype_module, ///< Module type
decltype_interface, ///< Interface type (not used in declarations)
decltype_exception, ///< Interface type (not used in declarations)
decltype_attribute, ///< Attribute type (not used in declarations)
decltype_operation, ///< Operation type (not used in declarations)
decltype_parameter, ///< Parameter type (only for operations)
decltype_enum_entry, ///< Enum entry type (only for enums)
decltype_case_entry, ///< Case entry type (only for unions)
decltype_typedef, ///< Typedef type
decltype_void, ///< Void type (only for operations)
decltype_meta, ///< Meta data type
decltype_pointer, ///< Pointer templated data type
decltype_sequence, ///< Sequence templated data type
decltype_map, ///< Map templated data type
decltype_bitset, ///< Bitset data type
decltype_bitfield, ///< Bitfield templated data type
decltype_bitmask, ///< Bitmask data type
decltype_any, ///< Any composite data type
decltype_interface_id, ///< Interface ID data type
decltype_interface_type, ///< Interface data type
decltype_exception_id, ///< Exception ID data type
};
/**
* @brief Entity base information interface.
*/
interface IEntityInfo
{
/**
* @brief Get the type of the entity. Default type is EEntityType::type_unknown.
* @return Returns the type of the entity.
*/
EEntityType GetType() const;
/**
* @brief Get the name of the entity.
* @return Returns the name string.
*/
u8string GetName() const;
/**
* @brief Get the scoped name of the entity (including the modules separated by the scope separator).
* @details The scoped name is composed of the entities of the parents separated by the scope operator '::'. For
* members of a compound entity (struct, union), the separation is done through the member operator '.'.
* @return The scoped name build from the entities of the parents separated by '::'. An empty name means global
* scope.
*/
u8string GetScopedName() const;
/**
* @brief Is the entity defined as (forward) declaration only?
* @return Returns 'true' when the entity is defined as forward declaration; otherwise returns 'false'.
*/
boolean ForwardDeclaration() const;
/**
* @brief Get the entity ID. This ID is a hash value composed from its definition and all declarative members not
* including const values. The ID can be used to uniquely identify the entity (e.g. as interface ID or exception ID).
* @return The ID of the entity.
*/
uint64 GetId() const;
/**
* @brief Get the parent entity of this entity.
* @return Returns an interface to the parent entity or NULL when this is the root parent (when there is no parent).
*/
IInterfaceAccess GetParent() const;
};
/**
* @brief Iterate through a vector of entities.
*/
interface IEntityIterator
{
/**
* @brief Get amount of entities.
* @return Returns the amount of entities available to this iterator.
*/
uint32 GetCount() const;
/**
* @brief Get entity at supplied index.
* @param[in] uiIndex The index to get the entity for.
* @return The entity at the index or NULL when there is no entity at this index.
*/
IInterfaceAccess GetEntityByIndex(in uint32 uiIndex);
};
/**
* @brief Context information interface.
*/
interface IEntityContext
{
/**
* @brief The location of the parsed file.
*/
enum ELocation : uint32
{
source, ///< Source code or source file.
local_include, ///< Local include file.
global_include ///< Global include file.
};
/**
* @brief Get the location.
* @return Returns context location.
*/
ELocation GetLocation() const;
/**
* @brief Get the path to the file.
* @return Returns the source path string.
*/
u8string GetSourcePath() const;
/**
* @brief Get the position in the file.
* @remarks Not all entities have a position. If no position is available, the position return value has the
* value 0.
* @param[out] ruiLineBegin Reference to the variable receiving the line number of the entity beginning.
* @param[out] ruiColBegin Reference to the variable receiving the column number of the entity beginning.
* @param[out] ruiLineEnd Reference to the variable receiving the line number of the entity ending.
* @param[out] ruiColEnd Reference to the variable receiving the column number of the entity ending.
*/
void GetPosition(out uint32 ruiLineBegin, out uint32 ruiColBegin, out uint32 ruiLineEnd, out uint32 ruiColEnd);
};
/**
* @brief Meta information interface. Exposed by the meta entity.
*/
interface IMetaEntity
{
/**
* @brief Token meta type (valid when token is a meta token).
*/
enum EType : uint32
{
include_local = 10, ///< Local include file
include_global = 11, ///< Global include file
define = 20, ///< Definition
undef = 21, ///< Remove definition
verbatim = 100, ///< Verbatim text to be inserted in the generated code
};
/**
* @brief Get the meta data type.
* @return Returns the meta type.
*/
EType GetMetaType() const;
/**
* @brief Get the meta data content.
* @return Returns a string object.
*/
u8string GetContent() const;
};
/**
* @brief Comment interface.
*/
interface IEntityComments
{
/**
* \brief Comment mask
*/
enum ECommentMask : uint32
{
c_style_javadoc = 0x40001000, ///< Comment of the form "/** ... */"
c_style_javadoc_post = 0x40201000, ///< Comment of the form "/**< ... */"
c_style_qt = 0x40002000, ///< Comment of the form "/*! ... */"
c_style_qt_post = 0x40202000, ///< Comment of the form "/*!< ... */"
c_style = 0x40000000, ///< Comment of the form "/* ... */"
cpp_style_javadoc = 0x80001000, ///< Comment of the form "/// ..."
cpp_style_javadoc_post = 0x80201000, ///< Comment of the form "///< ..."
cpp_style_qt = 0x80002000, ///< Comment of the form "//! ..."
cpp_style_qt_post = 0x80202000, ///< Comment of the form "///< ..."
cpp_style = 0x80000000, ///< Comment of the form "// ..."
loc_succeeding = 0x00200000, ///< Comment location is succeeding statement
format_javadoc = 0x00001000, ///< Comment using javadoc form
format_qt = 0x00002000, ///< Comment using QT form
format_mask = 0x0000f000, ///< Comment formatting mask
};
/**
* @brief Get the comment lines for this entity as one string.
* @remarks For c-style multi-line comments, the indentation and additional asterisk character at the beginning of
* each line is removed.
* @param[out] ruiFlags Reference to the variable receiving the comment flags (a bitmask combination of
* sdv::idl::IEntityComments::ECommentMask).
* @return Returns the comment string. If the comment contains multiple lines, each line is ending with a newline.
*/
u8string GetComments(out uint32 ruiFlags) const;
};
/**
* @brief Entity definition information interface.
*/
interface IDefinitionEntity
{
/**
* \brief Does the entity have an unnamed definition.
* @return Returns 'true' when the entity has an unnamed definition; otherwise returns 'false'.
*/
boolean IsUnnamed() const;
/**
* @brief Get child entity iterator if children are available and supported by the definition.
* @return Returns a pointer to the child entity iterator or NULL when not available.
*/
IEntityIterator GetChildren();
/**
* @brief Get inheritance entity iterator if the definition was inheriting from other entities.
* @return Returns a pointer to the inheritance entity iterator or NULL when not available.
*/
IEntityIterator GetInheritance();
};
/**
* @brief Entities declared in a forward declaration expose this interface.
*/
interface IForwardDeclarationEntity
{
/**
* @brief Get access to the actual declaration (if there is one).
* @return Pointer to the interface of the entity definition or NULL when there is no definition.
*/
IInterfaceAccess GetEntity();
};
/**
* @brief Declaration type interface containing the base type, type string as defined in the code as well as the
* definition object interface and template parameters.
*/
interface IDeclarationType
{
/**
* @brief Return the base type.
* @details The bse type might be a templated type (string, sequence, map, etc.) which means that additional
* information is needed. Furthermore, the type might be a complex type (struct, union, enum) or a typedef. In these
* cases the type definition interface is available.
* @return The base type of this type.
*/
EDeclType GetBaseType() const;
/**
* @brief Return the string that described the type in the code.
* @return The type string.
*/
u8string GetTypeString() const;
/**
* @brief Return the type definition for complex types or typedefs.
* @return Pointer to the interface representing the type definition. Will be NULL for all other types.
*/
IInterfaceAccess GetTypeDefinition() const;
/**
* @brief Fixed length parameter for some templated types.
* @details Fixed length template parameter for "fixed", "string", "sequence", "pointer", "map" and "bitfields".
* When not compulsory (for "fixed", "string", "sequence", "pointer" and "map") could be 0 to indicate a dynamic
* length (or defined over assignment with "fixed"). Bitfields allow a length between 1 and 64 bits.
* @return Returns the fixed length for some templated types or 0 for all other other types.
*/
uint32 GetFixedLength() const;
/**
* @brief The amount of decimals of the "fixed" data type. Must be equal or smaller than the fixed length.
* @return The amount of decimals for the "fixed" data type or 0 for all other data types.
*/
uint32 GetDecimals() const;
/**
* @brief The value type template parameter for the "sequence", "pointer", "map" and "bitfield" data types.
* @return Interface to the value data type for some templated types of NULL for all other types.
*/
IInterfaceAccess GetValueType() const;
/**
* @brief The key type template parameter for the "map" data type.
* @return Interface to the key data type for the "map" type of NULL for all other types.
*/
IInterfaceAccess GetKeyType() const;
};
/**
* @brief Array dimension definition.
* @details Multi-dimensional arrays are possible. Each dimension is defined between square-brackets
* (eg. var[a][b][]). An unbound dimension can only occur as the last dimension. Fixed-bound dimensions can be
* specified using a constant expression. If variables are used in the constant expression, they need to be in
* scope of the array variable.
*/
struct SArrayDimension
{
/**
* @brief Dimension type.
*/
enum EDimensionType : uint32
{
bound = 0, ///< Bound array
unbound = 2, ///< Unbound array
} eType; ///< The dimension type
u8string ssExpression; ///< Expression defining the dimension size either as constant- or as runtime-expression.
};
/**
* @brief Declaration entity information interface.
*/
interface IDeclarationEntity
{
/**
* @brief Get declaration type.
* @return Interface to the declaration type object.
*/
IInterfaceAccess GetDeclarationType() const;
/**
* @brief Is the entity readonly?
* @return Returns 'true' when the declaration is defined as readonly declaration; otherwise returns 'false'.
*/
boolean IsReadOnly() const;
/**
* @brief Is the entity anonymous when used in a struct/union (unnamed and not declared)?
* @details Returns whether the entity is anonymous when used in a struct/union. This allows its members to appear
* directly as members within the struct.
* @return Returns 'true' when the declaration is defined as anonymous declaration; otherwise returns 'false'.
*/
boolean IsAnonymous() const;
/**
* @brief Has array?
* @return Returns 'true' when the declaration is part of an array; otherwise returns 'false'.
*/
boolean HasArray() const;
/**
* @brief Get the array dimensions (if there are any).
* @return Smart pointer to the sequence of array dimensions.
*/
sequence<SArrayDimension> GetArrayDimensions() const;
/**
* @brief Has assignment?
* @return Returns 'true' when the declaration is followed by an assignment; otherwise returns 'false'.
*/
boolean HasAssignment() const;
/**
* @brief Get assignment string.
* @details The assignment can be an algebraic expression composed from constants and variables. If the assignment is an
* array, the expression is composed like this: {{expr1},{expr2},{expr...}}
* @return Returns the assignment string when available.
*/
u8string GetAssignment() const;
};
/**
* @brief Interface entity
*/
interface IInterfaceEntity
{
/**
* @brief Is this interface local?
* @details When set, the interface is defined as local and not intended to be marshalled.
* @return Returns 'true' when the interface is defined as local interface; otherwise returns 'false'.
*/
boolean IsLocal() const;
};
/**
* @brief Operation entity
*/
interface IOperationEntity
{
/**
* @brief Get parameter entity iterator if the definition has any parameters.
* @return Returns a pointer to the parameter entity iterator or NULL when not available.
*/
IEntityIterator GetParameters();
/**
* @brief Get the list of possible exceptions that might be fired for this operation.
* @return Returns a pointer to the exception entity iterator or NULL when not available.
*/
IEntityIterator GetExceptions();
};
/**
* @brief Attribute entity
*/
interface IAttributeEntity
{
/**
* @brief Get the list of possible exceptions that might be fired during a read operation.
* @return Returns a pointer to the exception entity iterator or NULL when not available.
*/
IEntityIterator GetReadExceptions();
/**
* @brief Get the list of possible exceptions that might be fired during a write operation.
* @return Returns a pointer to the exception entity iterator or NULL when not available.
*/
IEntityIterator GetWriteExceptions();
};
/**
* @brief Parameter entity information interface.
*/
interface IParameterEntity
{
/**
* @brief Parameter direction enumeration
*/
enum EParameterDirection : uint32
{
unknown, ///< The parameter direction is not known.
input, ///< The parameter is defined as input parameter.
output, ///< The parameter is defined as output parameter.
in_out, ///< The parameter is defined as input and output parameter.
};
/**
* @brief Get the parameter direction.
* @return Returns the parameter direction.
*/
EParameterDirection GetDirection() const;
};
/**
* @brief Enum entity information interface.
*/
interface IEnumEntity
{
/**
* @brief Get the enumerator base type.
* @param[out] reType Reference to the declaration type. The type if EEntityType::type_unknown if not available.
* @param[out] rpType Reference to the interface pointer if the type is a complex type. Otherwise is NULL.
*/
void GetBaseType(out EDeclType reType, out IInterfaceAccess rpType) const;
};
/**
* @brief Union entity information interface.
*/
interface IUnionEntity
{
/**
* @brief The interpretation of the switch case.
*/
enum ESwitchInterpret : uint32
{
switch_variable, ///< The switch case is determined by a variable of the parent struct.
switch_type, ///< The switch case is determined by the value of a type.
};
/**
* @brief Return the switch interpretation.
* @return The interpretation of the switch case of this union.
*/
ESwitchInterpret GetSwitchInterpretation() const;
/**
* @brief Return type information for the switch case. If the switch case is type base, this is the type information
* that is used to select. If the switch case is variable based, this is the type of the variable.
* @param[out] reType Reference to the declaration type (either enum or an integral type).
* @param[out] rpType Reference to the type entity if existing.
*/
void GetSwitchType(out EDeclType reType, out IInterfaceAccess rpType) const;
/**
* @brief Get the switch variable information if the switch case is variable based. Will be empty/NULL when the switch
* case is type based.
* @param[out] rssVarStr Reference to the string receiving the exact scoped declaration name of the switch variable if
* the interpretation is variable based. The variable name uses the scope separator '::' to define the common parent
* definition and the member separator '.' to define the variable declaration as member from the common parent.
* @param[out] rpVarEntity Reference to the variable entity if the interpretation is variable based.
* @param[out] rpVarContainer Reference to the variable entity of the container of both the switch variable and the
* union.
*/
void GetSwitchVar(out u8string rssVarStr, out IInterfaceAccess rpVarEntity,
out IInterfaceAccess rpVarContainer) const;
};
/**
* @brief Case entity information interface.
*/
interface ICaseEntity
{
/**
* @brief Get the case label string. The case label string will be empty for the default case entry.
* @return Returns the label (of not default).
*/
u8string GetLabel() const;
/**
* @brief Is this case entry the default entry.
* @return Return whether the case entry is the default entry.
*/
boolean IsDefault() const;
};
}; // module idl
}; // module sdv

View File

@@ -0,0 +1,253 @@
/**
* @file core_ps.idl
* @brief This file provides the marshalling interface definitions of the core SDV framework.
* @version 0.1
* @date 2023.05.10
* @author erik.verhoeven@zf.com
* @copyright Copyright ZF Friedrichshaven AG (c) 2023
*/
#include "core.idl"
#include "process.idl"
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
* @brief Proxy/stub features
*/
module ps
{
/**
* @brief Marshall exception.
*/
exception XMarshallExcept
{};
/**
* @brief Marshalling was not initialized.
*/
exception XMarshallNotInitialized : XMarshallExcept
{
/** Description */
const char _description[] = "Marshalling data between proxy and stub was not initialized or is in an invalid state.";
};
/**
* @brief Marshalling timeout exception.
*/
exception XMarshallTimeout : XMarshallExcept
{
/** Description */
const char _description[] = "The marshalling call was timed out.";
};
/**
* @brief Marshalling missing data.
*/
exception XMarshallMissingData : XMarshallExcept
{
/** Description */
const char _description[] = "Part of the marshalling data was lost during the marshalling call.";
};
/**
* @brief Incompatible interface version.
*/
exception XMarshallVersion : XMarshallExcept
{
/** Description */
const char _description[] = "The marshalling interfaces of objects have different versions and therefore cannot be connected.";
};
/**
* @brief Marshall data integrity violation.
*/
exception XMarshallIntegrity : XMarshallExcept
{
/** Description */
const char _description[] = "An integrity violation has occurred during marshalling.";
};
/**
* @brief No interface marshalling object found.
*/
exception XMarshallNoObject : XMarshallExcept
{
/** Description */
const char _description[] = "No marshalling object for the interface found.";
};
/**
* @brief Marshalling flags.
*/
enum EMarshallFlags : uint32
{
direction_output = 0x10, ///< When set, direction is output. Otherwise direction is input. If an exception
///< occurred, this flag might indicate if the exception occurred on input or on output
///< of the call.
exception_triggered = 0x80, ///< When set, a exception was triggered and is provided instead of any parameters
///< or return value.
};
/**
* @brief Marshall ID used for proxy and stub identification
*/
struct SMarshallID
{
uint32 uiHostID; ///< Reserved
process::TProcessID tProcessID; ///< ProcessID
uint32 uiIdent; ///< Identification value.
uint32 uiControl; ///< Control value for 2nd pass identification.
};
/**
* @brief Marshall object ID.
*/
typedef SMarshallID TMarshallID;
/**
* @brief Marshalling header structure.
* @details A marshall packet contains the information about the data being broadcasted. It must be the first packet
* in a marshalled call.
*/
struct SMarshall
{
EEndian eEndian; ///< Describes whether the data is in big or in little endian.
uint16 uiVersion; ///< Structure version (major * 100 + minor).
interface_id tIfcId; ///< Interface id.
uint32 uiFuncIndex; ///< Operation/attribute index.
sequence<uint16> seqChecksums; ///< CRC-16 CCITT-FALSE checksums for each additional stream.
uint32 uiFlags; ///< Bitmask with zero or more flags from EMarshallFlags.
uint16 uiHdrChecksum; ///< CRC-16 CCITT-FALSE checksum over all data members above (not including
///< uiChkSum itself).
};
/**
* @brief Marshalling data interpretation.
*/
enum EMarshallDataInterpret : uint32
{
input_data = 0, ///< The data is input data.
output_data = 1, ///< The data is output data..
};
/**
* @brief Identical marshalling header containing only the address portion of the marshall structure.
*/
struct SMarshallAddress
{
EEndian eEndian; ///< Describes whether the data is in big or in little endian.
uint16 uiVersion; ///< Structure version (major * 100 + minor).
EMarshallDataInterpret eInterpret; ///< Defines the data interpretation.
TMarshallID tProxyID; ///< Proxy id to identify the proxy this packet is sending from or destined to.
TMarshallID tStubID; ///< Stub id to identify the stub this packet is destined to or receiving from.
uint64 uiCallIndex; ///< Call index to uniquely identify the call.
};
/**
* @brief Set the marshall object identification. The identification will be used to verify the proper sender/receiver.
*/
interface IMarshallObjectIdent
{
/**
* @brief Set the identification.
* @param[in] tMarshallID Reference to the marshall object ID. For a proxy object, this is the proxy ID. For a stub object
* this is a stub ID.
*/
void SetIdentification(in TMarshallID tMarshallID);
};
/**
* @brief Communication interface to broadcast a marshall packet to the receiver.
*/
local interface IMarshall
{
/**
* @brief Marshall a function call.
* @remarks This function call is synchronous and does not return until the call has been finalized or a timeout
* exception has occurred.
* @remarks The sequence contains all data to make the call. It is important that the data in the sequence is
* complete and in the correct order.
* @param[inout] seqInputData Reference to sequence of input data pointers. The first data pointer contains the
* marshalling header. The second contains the parameters (if available) and the others contain raw data pointers
* (if available). The call is allowed to change the sequence to be able to add additional information during the
* communication without having to copy the existing data.
* @return Sequence of output data pointers. The first data pointer contains the marshalling header. The second
* contains the return value and parameters (if available) and the others contain raw data pointers (if available).
*/
sequence<pointer<uint8>> Call(inout sequence<pointer<uint8>> seqInputData);
};
/**
* @brief Link/unlink a communication interface to/from the object.
*/
interface IMarshallLink
{
/**
* @brief Link the communication interface to the object.
* @remarks Only one link can exists at the time.
* @param[in] pMarshall Interface to be linked.
*/
void Link(in IMarshall pMarshall);
/**
* @brief Unlink the linked interface.
*/
void Unlink();
};
/**
* @brief Get the target interface from the proxy object.
*/
interface IProxyControl
{
/**
* @brief Get the target interface from the proxy object.
* @return The target interface.
*/
interface_t GetTargetInterface();
};
/**
* @brief Link/unlink the object target interface to the stub object.
*/
interface IStubLink
{
/**
* @brief Link the object target interface to the stub-object.
* @remarks Only one link can exists at the time.
* @param[in] ifc Interface to be linked.
*/
void Link(in interface_t ifc);
/**
* @brief Unlink the linked interface.
*/
void Unlink();
};
/**
* @brief Marshall access interface.
*/
interface IMarshallAccess
{
/**
* @brief Get a proxy for the interface connection to the stub.
* @param[in] tStubID Reference to the ID of the stub to connect to.
* @param[in] id The interface ID to get the proxy for.
* @return Returns the interface to the proxy object.
*/
interface_t GetProxy(in TMarshallID tStubID, in interface_id id) raises(XMarshallNoObject);
/**
* @brief Get a stub for the interface with the supplied ID.
* @param[in] ifc The interface to get the stub for..
* @return Returns the Stub ID that is assigned to the interface. Or an empty ID when no stub could be found.
*/
TMarshallID GetStub(in interface_t ifc) raises(XMarshallNoObject);
};
}; // module ps
}; // module sdv

View File

@@ -0,0 +1,245 @@
/**
* @file core_types.idl
* @brief This file provides all data types for the core SDV framework.
* @version 0.1
* @date 2023.05.08
* @author erik.verhoeven@zf.com
* @copyright Copyright ZF Friedrichshaven AG (c) 2023
*/
/**
* @brief Current interface version.
*/
const uint32 SDVFrameworkInterfaceVersion = 100;
/**
* @brief Current framework build version.
*/
const uint32 SDVFrameworkBuildVersion = 100;
/**
* @brief Current framework sub-build version.
*/
const uint32 SDVFrameworkSubbuildVersion = 100;
#verbatim_begin
/* Define SDV_SYMBOL_PUBLIC attribute for exported functions. */
#if !defined(SDV_SYMBOL_PUBLIC) || !defined(SDV_SYMBOL_HIDDEN)
#if defined _WIN32 || defined __CYGWIN__
#ifdef __GNUC__
#define SDV_SYMBOL_PUBLIC __attribute__((dllexport))
#else \
#define SDV_SYMBOL_PUBLIC __declspec(dllexport)
#endif
#define SDV_SYMBOL_HIDDEN
#else
#if __GNUC__ >= 4
#define SDV_SYMBOL_PUBLIC __attribute__((visibility("default"))) __attribute__((used))
#define SDV_SYMBOL_HIDDEN __attribute__((visibility("hidden")))
#else
#define SDV_SYMBOL_PUBLIC /**< SDV_SYMBOL_PUBLIC: exportable function attribute */
#define SDV_SYMBOL_HIDDEN /**< SDV_SYMBOL_HIDDEN: private function attribute */
#endif
#endif
#endif /* !defined(SDV_SYMBOL_PUBLIC) || !defined(SDV_SYMBOL_HIDDEN) */
#ifdef __unix__
#if _POSIX_C_SOURCE < 200809L
#error POSIX version POSIX.1-2008 or higher needed
#endif
#endif
#verbatim_end
#verbatim_begin
#include "../support/interface.h"
#include "../support/except.h"
#verbatim_end
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
* @brief Endian enum
*/
enum EEndian : uint8
{
big_endian = 0,
little_endian = 1,
};
/**
* @brief System exception.
*/
exception XSysExcept
{};
/**
* @brief Access to the function is denied exception.
*/
exception XAccessDenied : XSysExcept
{
/** Description */
const char _description[] = "Access denied.";
};
/**
* @brief The requested resource hasn't been found.
*/
exception XNotFound : XSysExcept
{
/** Description */
const char _description[] = "Resource not found.";
};
/**
* @brief The system is in an invalid state exception.
*/
exception XInvalidState : XSysExcept
{
/** Description */
const char _description[] = "The system is in an invalid state.";
};
/**
* @brief A timeout occurred exception.
*/
exception XTimeout : XSysExcept
{
/** Description */
const char _description[] = "A timeout occurred.";
};
/**
* @brief No interface found exception.
*/
exception XNoInterface : XSysExcept
{
/** Description */
const char _description[] = "The interface could not be found.";
};
/**
* @brief Invalid index (index >= size or index < 0).
*/
exception XIndexOutOfRange : XSysExcept
{
/** Description */
const char _description[] = "The supplied index was out of range.";
uint32 uiIndex; ///< Index
uint32 uiSize; ///< Size
};
/**
* @brief Invalid iterator.
*/
exception XInvalidIterator : XSysExcept
{
/** Description */
const char _description[] = "The supplied iterator was invalid.";
};
/**
* @brief Null pointer.
*/
exception XNullPointer : XSysExcept
{
/** Description */
const char _description[] = "A NULL-pointer was supplied.";
};
/**
* @brief Invalid value for the reference counter.
*/
exception XInvalidRefCount : XSysExcept
{
/** Description */
const char _description[] = "The reference counter has an invalid/unexpected value.";
uint32 uiCount; ///< Reference counter value.
};
/**
* @brief Buffer is too small.
*/
exception XBufferTooSmall : XSysExcept
{
/** Description */
const char _description[] = "The buffer was too small to store the data.";
uint64 uiSize; ///< Requested size.
uint64 uiCapacity; ///< Size of the buffer.
};
/**
* @brief Hash value doesn't match.
*/
exception XHashNotMatching : XSysExcept
{
/** Description */
const char _description[] = "The provided hash value doesn't match to the calculated hash value.";
uint64 uiCalculated; ///< Calculated hash value.
uint64 uiProvided; ///< Provided hash value.
};
/**
* @brief Offset out of range.
*/
exception XOffsetPastBufferSize : XSysExcept
{
/** Description */
const char _description[] = "The provided offset doesn't is not pointing to a location within the buffer.";
uint64 uiOffset; ///< Offset value.
uint64 uiSize; ///< Buffer size.
};
/**
* @brief Unknown exception.
*/
exception XUnknownException : XSysExcept
{
/** Description */
const char _description[] = "An exception was fired, but no handler found for it.";
exception_id unknown_id; ///< The ID of the unknown exception.
};
/**
* @brief Unhandled exception.
*/
exception XUnhandledException : XSysExcept
{
/** Description */
const char _description[] = "An unhandled exception was caught.";
};
/**
* @brief Core features.
*/
module core
{
/**
* @brief No memory manager available exception.
*/
exception XNoMemMgr : XSysExcept
{
/** Description */
const char _description[] = "The memory manager could not be accessed.";
};
/**
* @brief Allocation failed exception
*/
exception XAllocFailed : XSysExcept
{
/** Description */
const char _description[] = "The allocation of memory failed.";
uint32 uiSize; ///< Size of the allocation.
};
};
};

View File

@@ -0,0 +1,215 @@
/**
*
* @file dispatch.idl
* @brief This file provides interfaces related to the data dispatch service.
* @version 1.0
* @date 2024.01.12
* @author Erik Verhoeven
* @copyright Copyright ZF Friedrichshaven AG (c) 2024
*
*/
#include "core.idl"
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
* @brief Core features.
*/
module core
{
/**
* @brief This interface is called by the data link component transmitting and receiving signals.
* @remarks This interface is for local use only.
*/
local interface ISignalTransmission
{
/**
* @brief Trigger behavior enumeration.
*/
enum ETxTriggerBehavior : uint32
{
none = 0, ///< No specific behavior
spontaneous = 1, ///< Trigger when signal value change occurs
periodic_if_active = 2, ///< Trigger periodically, but only when signal differs from default value.
};
/**
* @brief Create a TX trigger object that defines how to trigger the signal transmission.
* @param[in] uiCycleTime When set to any value other than 0, provides a cyclic trigger (ms). Could be 0 if cyclic
* triggering is not required.
* @param[in] uiDelayTime When set to any value other than 0, ensures a minimum time between two triggers. Could be 0
* if minimum time should not be enforced.
* @param[in] uiBehaviorFlags Zero or more flags from ETxTriggerBehavior.
* @param[in] pTriggerCallback Pointer to the trigger callback object. This object needs to expose the
* ITxTriggerCallback interface. This interface must stay valid during the lifetime of the generated trigger object.
* @returns On success, returns an interface to the trigger object. Use the ITxTrigger interface to assign signals to
* the trigger. Returns null when a trigger was requested without cycletime and without trigger behavior (which would
* mean it would never trigger). Use IObjectDestroy to destroy the trigger object.
*/
IInterfaceAccess CreateTxTrigger(in uint32 uiCycleTime, in uint32 uiDelayTime, in uint32 uiBehaviorFlags,
in IInterfaceAccess pTriggerCallback);
/**
* @brief Register a signal for sending over the network; reading from the dispatch service. Data is provided by the
* signal publisher and dependable on the requested behavior stored until it is sent.
* @remarks Multiple registrations of the same signal are allowed.
* @param[in] ssSignalName Name of the signal. To guarantee uniqueness, it is preferred to add the group hierarchy to
* the signal name separated by a dot. E.g. with CAN: MAB.BcmChas1Fr03.SteerReCtrlReqAgReq
* @param[in] anyDefVal The default value of the signal.
* @return Returns the IInterfaceAccess interface that allows access to the ISignalRead interface for reading the
* signal value. Use IObjectDestroy to destroy the signal object.
*/
IInterfaceAccess RegisterTxSignal(in u8string ssSignalName, in any anyDefVal);
/**
* @brief Register a signal for reception over the network; providing to the dispatch service.
* @remarks Multiple registrations of the same signal are allowed.
* @param[in] ssSignalName Name of the signal. To guarantee uniqueness, it is preferred to add the group hierarchy to
* the signal name separated by a dot. E.g. with CAN: MAB.BcmChas1Fr03.SteerReCtrlReqAgReq
* @return Returns the IInterfaceAccess interface that allows access to the ISignalWrite interface for writing the
* signal value. Use IObjectDestroy to destroy the signal object.
*/
IInterfaceAccess RegisterRxSignal(in u8string ssSignalName);
};
/**
* @brief Interface to add and remove signals to the trigger object.
*/
interface ITxTrigger
{
/**
* @brief Add a signal to the trigger object. The signal must be registered as TX signal before.
* @param[in] ssSignalName Name of the signal.
* @return Returns whether adding the signal was successful.
*/
boolean AddSignal(in u8string ssSignalName);
/**
* @brief Remove a signal from the trigger object.
* @param[in] ssSignalName Name of the signal.
*/
void RemoveSignal(in u8string ssSignalName);
};
/**
* @brief Trigger interface to be implemented by the caller to the trigger creation function.
*/
interface ITxTriggerCallback
{
/**
* @brief Execute the trigger.
*/
void Execute();
};
/**
* @brief Signal type enumeration.
*/
enum ESignalDirection
{
sigdir_tx, ///< Signal is a transmission-signal. Use a publisher to transmit data.
sigdir_rx, ///< Signal is a reception-signal. Use a subscriber to receive data.
};
/**
* @brief Signal registration entry function to be used in the GetRegisteredSignals function.
*/
struct SSignalRegistration
{
u8string ssName; ///< Name of the signal.
ESignalDirection eType; ///< Registration type.
};
/**
* @brief Access a previously registered signal. This interface is called by the devices providing and receiving the
* signals.
*/
local interface ISignalAccess
{
/**
* @brief Requested a registered signal for publication (send signal).
* @param[in] ssSignalName Name of the signal. To guarantee uniqueness, it is preferred to add the group hierarchy to
* the signal name separated by a dot. E.g. with CAN: MAB.BcmChas1Fr03.SteerReCtrlReqAgReq
* @return Returns the IInterfaceAccess interface that allows access to the ISignalWrite interface for writing the
* signal value.
*/
IInterfaceAccess RequestSignalPublisher(in u8string ssSignalName);
/**
* @brief Add a registered signal for subscription (receive signal).
* @param[in] ssSignalName Name of the signal. To guarantee uniqueness, it is preferred to add the group hierarchy to
* the signal name separated by a dot. E.g. with CAN: MAB.BcmChas1Fr03.SteerReCtrlReqAgReq
* @param[in] pSubscriber Pointer to the IInterfaceAccess of the subscriber. The subscriber should implement the
* ISignalReceiveEvent interface.
* @return Returns an interface that can be used to manage the subscription. Use IObjectDestroy to destroy the signal
* object.
*/
IInterfaceAccess AddSignalSubscription(in u8string ssSignalName, in IInterfaceAccess pSubscriber);
/**
* @brief Get a list of registered signals.
* @return List of registration functions.
*/
sequence<SSignalRegistration> GetRegisteredSignals() const;
};
/**
* @brief Interface to allow transacted updates as well as transacted readings without the interference of another update.
*/
local interface IDispatchTransaction
{
/**
* @brief Create a transaction.
* @details When starting a group transaction, any writing to a signal will not be reflected yet until the transaction
* is finalized. For the data link layer, this also allows freezing the reading values until all values have been read.
* @return Returns the transaction interface or NULL when the transaction could not be started. Use IObjectDestroy to
* destroy the transaction object.
*/
IInterfaceAccess CreateTransaction();
};
/**
* @brief Interface to update a signal value.
*/
local interface ISignalWrite
{
/**
* @brief Update the signal value.
* @param[in] anyVal The value to update the signal with.
* @param[in] pTransaction The transaction interface. Could be NULL in case the update should occur immediately.
*/
void Write(in any anyVal, in IInterfaceAccess pTransaction);
};
/**
* @brief Interface to read a signal value.
* @remarks This interface is only accessible by the link layer.
*/
local interface ISignalRead
{
/**
* @brief Get the signal value.
* @param[in] pTransaction The transaction interface. Could be NULL in case the most up-to-date value is requested.
* @return Returns the value.
*/
any Read(in IInterfaceAccess pTransaction) const;
};
/**
* @brief Inform, that a signal value has been received.
* @remarks This interface is to be implemented by the device to receive signal values.
*/
local interface ISignalReceiveEvent
{
/**
* @brief A signal value was received.
* @param[in] anyVal The signal value.
*/
void Receive(in any anyVal);
};
}; // core module
}; // sdv module

View File

@@ -0,0 +1,36 @@
/**
* @file hw_ident.idl
* @author Erik Verhoeven DISDS1 (mailto:erik.verhoeven@zf.com)
* @brief This file includes all the interfaces used for hardware identification.
* @version 1.0
* @date 2024-05-09
*
* @copyright Copyright ZF Friedrichshafen AG (c) 2023-2025
*/
#include "core.idl"
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
* @brief Hardware specific features.
*/
module hardware
{
/**
* @brief Interface to obtain Hardware ID
*/
interface IHardwareID
{
/**
* @brief Gets the hardware ID of the current hardware.
* It's same for the all processes running in the same hardware and different for the processes of each different hardwares.
* @return Returns the hardware ID or 0 in case of failure.
*/
uint64 GetHardwareID();
};
};
};

184
export/interfaces/ipc.idl Normal file
View File

@@ -0,0 +1,184 @@
/**
* @file ipc.idl
* @author Erik Verhoeven DISDS1 (mailto:erik.verhoeven@zf.com)
* @brief This file includes all the interfaces used for interpprocess communication.
* @version 1.0
* @date 2024-05-09
*
* @copyright Copyright ZF Friedrichshafen AG (c) 2023-2025
*/
#include "core.idl"
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
* @brief Interprocess communication features.
*/
module ipc
{
/**
* @brief structure of IPC Connection to which a client can attach.
*/
struct SChannelEndpoint
{
IInterfaceAccess pConnection; ///< Connection object
u8string ssConnectString; ///< Parameter string used by other participant to establish a connection. The
///< parameter string is a TOMl description containing the identification of the
///< provider among with provider specific connection details. The provider
///< identification must be similar to the following example:
///< @code
///< [Provider]
///< Name = "DefaultSharedMemoryChannelControl"
///< @endcode
};
/**
* @brief Interface for creating an IPC connection, which other participants can connect to via IChannelAccess
*/
interface ICreateEndpoint
{
/**
* @brief Create IPC connection object and return the endpoint information.
* @post Use AsyncConnect on SChannelEndpoint::pConnection to initiate the connection.
* @param[in] ssChannelConfig Optional channel type specific endpoint configuration. The configuration is a TOML base
* description specific to the provider.
* @return IPC connection object
*/
SChannelEndpoint CreateEndpoint(in u8string ssChannelConfig);
};
/**
* @brief Interface local IPC access.
*/
interface IChannelAccess
{
/**
* @brief Create a connection object from the channel connection parameters string.
* @post Use AsyncConnect to initiate the connection.
* @param[in] ssConnectString Reference to the string containing the channel connection parameters returned by the
* ICreateEndpoint::CreateEndpoint function or a TOML configuration that is provider specific and describes clearly the
* access to a running channel. This configuriration is identical (or similar) to the configuration supplied to the
* ICreateEndpoint::CreateEndpoint function.
* @return Pointer to IInterfaceAccess interface of the connection object or NULL when the object cannot be created.
*/
IInterfaceAccess Access(in u8string ssConnectString);
};
/**
* @brief Connection status enumeration
*/
enum EConnectStatus : uint32
{
uninitialized = 0, ///< Initialization via IConnect pending/required
initializing = 1, ///< Initiation channel access.
initialized = 2, ///< Channel access initialized.
connecting = 10, ///< Both participants are available, connecting started
negotiating = 20, ///< Negotiating the connection
connection_error = 990, ///< Connection error; negotiation failed
connected = 11, ///< Connection successful
communication_error = 991, ///< Communication error
disconnected = 30, ///< Connection terminated due to disconnection of other participant
disconnected_forced = 32, ///< Connection terminated due to unplanned disconnection of other participant
terminating = 90, ///< Termination of channel access (through IObjectDestroy::DestroyObject)
};
/**
* \brief Interface for managing IPC connection.
*/
interface IConnect
{
/**
* @brief Establish a connection and start sending/receiving messages.
* @param[in] pReceiver Callback interface for receiving data and connect status.
* @return Returns 'true' when a channel connection could be initiated. Use GetStatus or IConnectEventCallback to
* check the connection state.
*/
boolean AsyncConnect(in IInterfaceAccess pReceiver);
/**
* @brief Wait for a connection to take place.
* @param[in] uiWaitMs Wait for a connection to take place. A value of 0 doesn't wait at all, a value of 0xffffffff
* waits for infinite time.
* @return Returns 'true' when a connection took place.
*/
boolean WaitForConnection(in uint32 uiWaitMs);
/**
* @brief Cancel a wait for connection.
*/
void CancelWait();
/**
* @brief Disconnect from a connection. This will set the connect status to disconnected and release the interface
* used for the status events.
*/
void Disconnect();
/**
* @brief Register event callback interface.
* @details Register a connection status event callback interface. The exposed interface must be of type
* IConnectEventCallback. The registration will exist until a call to the unregister function with the returned cookie
* or until the connection is terminated.
* @param[in] pEventCallback Pointer to the object exposing the IConnectEventCallback interface.
* @return The cookie assigned to the registration or 0 when the registration wasn't successful.
*/
uint64 RegisterStatusEventCallback(in IInterfaceAccess pEventCallback);
/**
* @brief Unregister the status event callback with the returned cookie from the registration.
* @param[in] uiCookie The cookie returned by a previous call to the registration function.
*/
void UnregisterStatusEventCallback(in uint64 uiCookie);
/**
* @brief Gets the current status of the IPC whether it is initialized/connected/disconnected or having connection
* error.
* @return Returns retrieved status of the IPC.
*/
EConnectStatus GetStatus() const;
};
/**
* @brief Interface implemented by the connecting object to receive channel connection events.
*/
interface IConnectEventCallback
{
/**
* @brief Set the current status.
* @param[in] eConnectStatus The connection status.
*/
void SetStatus(in EConnectStatus eConnectStatus);
};
/**
* @brief Interface implemented by the channel connection object for sending messages through a channel.
*/
interface IDataSend
{
/**
* @brief Sends data consisting of multiple data chunks via the IPC connection.
* @param[inout] seqData Sequence of data buffers to be sent. The sequence might be changed to optimize the
* communication without having to copy the data.
* @return Return 'true' if all data could be sent; 'false' otherwise.
*/
boolean SendData(inout sequence<pointer<uint8>> seqData);
};
/**
* @brief Interface implemented by the connecting object that allows receiving messages.
*/
interface IDataReceiveCallback
{
/**
* @brief Callback to be called by the IPC connection when receiving a data packet.
* @param[inout] seqData Sequence of data buffers to received. The sequence might be changed to optimize the
* communication without having to copy the data.
*/
void ReceiveData(inout sequence<pointer<uint8>> seqData);
};
}; // module ipc
}; // module sdv

107
export/interfaces/log.idl Normal file
View File

@@ -0,0 +1,107 @@
/**
* @file log.idl
* @author Erik Verhoeven DISDS1 (mailto:erik.verhoeven@zf.com)
* @brief This file includes all the interfaces used for logging information.
* @version 1.0
* @date 2024-05-09
*
* @copyright Copyright ZF Friedrichshafen AG (c) 2023-2025
*/
#include "core.idl"
#include "process.idl"
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
* @brief Core features.
*/
module core
{
/**
* @brief Enumeration for the severity level of the logging from sdv platform abstraction
*/
enum ELogSeverity : uint32
{
trace = 1, ///< level: this is a code smell if used in production. This should be used during development to track
///< bugs, but never committed to your VCS.
debug = 2, ///< level: log at this level about anything that happens in the program. This is mostly used during
///< debugging, and I'd advocate trimming down the number of debug statement before entering the production
///< stage, so that only the most meaningful entries are left, and can be activated during troubleshooting.
info = 3, ///< level: log at this level all actions that are user-driven, or system specific (i.e. regularly scheduled
///< operations...)
///< (not included) NOTICE level: this will certainly be the level at which the program will run when in production.
///< Log at this level all the notable events that are not considered an error.
warning = 4, ///< level: log at this level all events that could potentially become an error. For instance if one
///< database call took more than a predefined time, or if an in-memory cache is near capacity. This
///< will allow proper automated alerting, and during troubleshooting will allow to better understand
///< how the system was behaving before the failure.
error = 5, ///< level: log every error condition at this level. That can be API calls that return errors or internal
///< error conditions.
fatal = 6 ///< level: too bad, it's doomsday. Use this very scarcely, this shouldn't happen a lot in a real program.
///< Usually logging at this level signifies the end of the program. For instance, if a network daemon
///< can't bind a network socket, log at this level and exit is the only sensible thing to do.
};
/**
* @brief Interface to configure the logger.
*/
interface ILoggerConfig
{
/**
* @brief Initialize the logging from sdv platform abstraction.
* @details This function needs to be called before starting to log.
* @param[in] ssTag Provided tag to create log.
*/
void SetProgramTag(in u8string ssTag);
/**
* @brief Get the program tag used for logging.
* @return The string containing the program tag.
*/
u8string GetProgramTag() const;
/**
* @brief Filter the log messages based on severity.
* @param[in] eSeverity The severity level to use as a lowest level for logging. Default is "info" meaning, that
* debug and trace messages will not be logged.
* @param[in] eViewSeverity The severity level to use as a lowest level for viewing. Default is "error" meaning, that
* debug, trace, info, warning and error messages will not be shown in console output.
*/
void SetLogFilter(in ELogSeverity eSeverity, in ELogSeverity eViewSeverity);
/**
* @brief Get the current log severity filter level.
* @return The severity level of the log filter.
*/
ELogSeverity GetLogFilter() const;
/**
* @brief Get the current view severity level.
* @return The severity level of the view filter.
*/
ELogSeverity GetViewFilter() const;
};
/**
* @brief Interface to enable logging information from sdv platform abstraction
*/
interface ILogger
{
/**
* @brief Log a message to the SDV log.
* @param[in] eSeverity Severity level of the log message which will be logged, e.g. info, warning, error etc.
* @param[in] ssSrcFile The source file that caused the log entry.
* @param[in] iSrcLine The line number in the source file that caused the log entry.
* @param[in] tProcessID Process ID of the process reporting this log entry.
* @param[in] ssObjectName Name of the object if the log entry is supplied by a component.
* @param[in] ssMessage The log message that will be logged.
*/
void Log(in ELogSeverity eSeverity, in u8string ssSrcFile, in uint32 iSrcLine, in process::TProcessID tProcessID,
in u8string ssObjectName, in u8string ssMessage);
};
};
};

36
export/interfaces/mem.idl Normal file
View File

@@ -0,0 +1,36 @@
/**
* @file mem.idl
* @brief This file provides the memory management interface definitions of the core SDV framework.
* @version 0.1
* @date 2023.05.22
* @author erik.verhoeven@zf.com
* @copyright Copyright ZF Friedrichshaven AG (c) 2023
*/
#include "core.idl"
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
* @brief Core features.
*/
module core
{
/**
* @brief Memory allocation interface.
* @attention This interface is not intended to be marshalled.
*/
local interface IMemoryAlloc
{
/**
* @brief Allocate a memory block of the provided length.
* @param[in] uiLength The length of the memory block to allocate.
* @return Smart pointer to the memory allocation or NULL when allocating was not possible.
*/
pointer<uint8> Allocate(in uint32 uiLength);
};
};
};

View File

@@ -0,0 +1,125 @@
/**
* @file module.idl
* @author Erik Verhoeven FRD DISDS1 (mailto:erik.verhoeven@zf.com)
* @brief This file includes all the interfaces used for module management
* @version 1.0
* @date 2024-05-02
*
* @copyright Copyright ZF Friedrichshafen AG (c) 2023-2025
*
*/
#include "core.idl"
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
* @brief Core features.
*/
module core
{
/**
* @brief Module ID.
*/
typedef uint64 TModuleID;
/**
* @brief Special module ID for the Core Library module.
*/
const TModuleID tCoreLibModule = 0xffffffffffffffffu;
/**
* @brief Interface for module control.
* @attention This interface is accessible by standalone and essential apps.
*/
interface IModuleControl
{
/**
* @brief Load a module with the provided path containing SDV components. The components are available for creation
* through the repository.
* @attention Only modules with exposed SDV functions and the correct interface version can be loaded.
* @details This method can be used to load a module by providing a path to SDV components. Upon successful loading it
* will return the ID of the module. If the module Path is wrong/invalid or empty, module cannot not be loaded and 0 is
* returned. If the module is successfully loaded once and same module is loaded again the same module ID is returned.
* @param[in] ssModulePath Path to the module to load.
* @return Returns the ID of the module or 0 if the module could not be loaded.
*/
TModuleID Load(in u8string ssModulePath);
/**
* @brief Unload the module by providing module ID. The function will request the repository to shutdown any running
* component. If there are no components running any more, the module will be unloaded.
* @param[in] tModuleID Id representing a module, which has previous been loaded by Load
* @return Returns 'true' when unloading was successful or the module was unloaded before already. Returns 'false' in
* case the module could not be unloaded due to having active objects.
*/
boolean Unload(in TModuleID tModuleID);
/**
* @brief Checks for active objects - if active objects are present in a module, the module (currently) cannot be
* unloaded via Unload.
* @param[in] tModuleID Id representing a module, which has previous been loaded by Load(ModulePath)
* @return Returns true if the module is currently loaded and it contains at least one loaded object and false
* otherwise.
*
* @details The module exposes the symbol HasActiveObjects defined in
* export/support/component_impl.h, which is to be used in order to determine whether or not
* active objects remain within the module
*/
boolean HasActiveObjects(in TModuleID tModuleID) const;
};
/**
* @brief Modukle control configuration interface.
*/
interface IModuleControlConfig
{
/**
* @brief Add a search path to a folder where modules can be found.
* @param[in] ssDir Relative (to the executable) or absolute path to an existing folder.
* @return Returns 'true' if folder exists; otherwise 'false'.
*/
boolean AddModuleSearchDir(in u8string ssDir);
/**
* @brief Get a sequence containing the current module search directories.
* @return The sequence with the module search directories.
*/
sequence<u8string> GetModuleSearchDirs() const;
};
/**
* @brief Loaded component module information.
*/
struct SModuleInfo
{
TModuleID tModuleID; ///< The ID of the module.
u8string ssPath; ///< The full path to the module.
u8string ssFilename; ///< The module file name.
uint32 uiVersion; ///< The module version.
boolean bActive; ///< Boolean indicating whether or not objects are loaded.
};
/**
* @brief Module information access.
*/
interface IModuleInfo
{
/**
* @brief Get a list of loaded modules.
* @return Sequence with the module information structures.
*/
sequence<SModuleInfo> GetModuleList() const;
/**
* @brief Get a list of classes exposed by the provided module.
* @param[in] tModuleID The module ID to request the list of classes for.
* @return Sequence with the class information structures.
*/
sequence<SClassInfo> GetClassList(in TModuleID tModuleID) const;
};
};
};

View File

@@ -0,0 +1,119 @@
/**
* @file process.idl
* @author Erik Verhoeven DISDS1 (mailto:erik.verhoeven@zf.com)
* @brief This file includes all the interfaces used for process creation.
* @version 1.0
* @date 2024-05-09
*
* @copyright Copyright ZF Friedrichshafen AG (c) 2023-2025
*/
#include "core.idl"
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
* @brief Process features.
*/
module process
{
/**
* @brief Process ID.
*/
typedef uint32 TProcessID;
/**
* @brief Process termination callback.
*/
local interface IProcessLifetimeCallback
{
/**
* @brief Called when the process was terminated.
* @remarks The process return value is not always valid. The validity depends on the support of the underlying system.
* @param[in] tProcessID The process ID of the process being terminated.
* @param[in] iRetValue Process return value or 0 when not supported.
*/
void ProcessTerminated(in TProcessID tProcessID, in int64 iRetValue);
};
/**
* @brief Process lifetime monitoring.
*/
local interface IProcessLifetime
{
/**
* @brief Register a process lifetime monitor.
* @param[in] tProcessID Process ID to monitor the lifetime for.
* @param[in] pMonitor Pointer to the monitor interface. The monitor should expose the IProcessLifetimeCallback
* interface.
* @return Returns a non-zero cookie when successful; zero when not.
*/
uint32 RegisterMonitor(in TProcessID tProcessID, in IInterfaceAccess pMonitor);
/**
* @brief Unregistered a previously registered monitor.
* @param[in] uiCookie The cookie from the monitor registration.
*/
void UnregisterMonitor(in uint32 uiCookie);
/**
* @brief Wait for a process to finalize.
* @param[in] tProcessID The process ID to wait for.
* @param[in] uiWaitMs Maximum time to wait in ms. Could be 0xffffffff to wait indefintely.
* @return Returns 'true' when the process was terminated (or isn't running), 'false' when still running and a timeout
* has occurred.
*/
boolean WaitForTerminate(in TProcessID tProcessID, in uint32 uiWaitMs);
};
/**
* @brief Process rights during process creation
*/
enum EProcessRights : uint32
{
default_rights = 0, ///< Default rights - for 'main' application the process is started using reduced rights, for a
///< standalone application the parent rights are used.
parent_rights = 10, ///< Same rights as the parent process
reduced_rights = 20, ///< Reduced rights
};
/**
* @brief Interface for process control. This interface is accessible by 'main' and 'standalone' applications only.
*/
local interface IProcessControl
{
/**
* @brief Execute a process.
* @param[in] ssModule Module name of the process executable.
* @param[in] seqArgs Instantiation arguments to supply to the process.
* @param[in] eRights The process rights during instantiation.
* @return Returns the process ID or 0 when process creation failed.
*/
TProcessID Execute(in u8string ssModule, in sequence<u8string> seqArgs, in EProcessRights eRights);
/**
* @brief Terminate the process.
* @attention Use this function as a last resort only. The process will be killed and anything unsaved will render
* invalid.
* @param[in] tProcessID The process ID of the process to terminate.
* @return Returns 'true' if termination was successful; returns 'false' if termination was not possible or not allowed.
*/
boolean Terminate(in TProcessID tProcessID);
};
/**
* @brief Interface for process information.
*/
local interface IProcessInfo
{
/**
* @brief Gets the process ID of the own process.
* @return Return the process ID.
*/
TProcessID GetProcessID() const;
};
};
};

View File

@@ -0,0 +1,248 @@
/**
*
* @file repository.idl
* @brief This file provides interfaces related to the repository service
* @version 0.1
* @date 2022.11.21
* @author steffen.altmeier@zf.com
* @copyright Copyright ZF Friedrichshaven AG (c) 2022
*
*/
#include "core.idl"
#include "module.idl"
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
* @brief Core features.
*/
module core
{
/**
* @brief Object ID.
*/
typedef uint64 TObjectID;
/**
* @brief Interface used to access objects from other modules via the repository service
*/
interface IObjectAccess
{
/**
* @brief Get the object instance previously created through the repository service.
* @param[in] ssObjectName The name of the requested object.
* @return Returns the IInterfaceAccess interface of the object instance if found and nullptr otherwise.
*/
IInterfaceAccess GetObject(in u8string ssObjectName);
/**
* @brief Get the object instance previously created through the repository service.
* @attention Utilities cannot be returned by this function.
* @param[in] tObjectID The ID of the requested object.
* @return Returns the IInterfaceAccess interface of the object instance if found and nullptr otherwise.
*/
IInterfaceAccess GetObjectByID(in TObjectID tObjectID);
};
/**
* @brief Object information flags.
*/
enum EObjectInfoFlags : uint32
{
object_foreign = 0x00000100, ///< The object is registered as a foreign object.
object_controlled = 0x00008000, ///< The object is controlled by the Repository Service.
object_isolated = 0x00010000, ///< The object is running in an isolated environment.
};
/**
* @brief Object information.
*/
struct SObjectInfo
{
TObjectID tObjectID; ///< The object ID to identify the object.
TModuleID tModuleID; ///< The module ID that contains the object class. Might be zero with foreign
///< objects.
SClassInfo sClassInfo; ///< The class information used during object creation.
u8string ssObjectName; ///< The object name. Might be empty for uncontrolled objects.
u8string ssObjectConfig; ///< The object configuration. Might be empty when no configuration was supplied.
uint32 uiFlags; ///< Information flags - zero or more flags of EObjectInfoFlags.
// TODO... Proxy/Stub objects (tObjectID) and Process (tProcessID) information and host information.
};
/**
* @brief Get object information.
*/
interface IRepositoryInfo
{
/**
* @brief Find the class information of an object with the supplied name.
* @param[in] ssClassName Object class name.
* @return The object class information.
*/
SClassInfo FindClass(in u8string ssClassName) const;
/**
* @brief Get a list of all the instantiated objects.
* @return Sequence containing the object information structures.
*/
sequence<SObjectInfo> GetObjectList() const;
/**
* @brief Get the object info for the requested object.
* @param[in] tObjectID The object ID to return the object information for.
* @return The object information structure if the object is available or an empty structure if not.
*/
SObjectInfo GetObjectInfo(in TObjectID tObjectID) const;
/**
* @brief Find an object with the supplied name. Only object instances that are in the service list can be found with
* this function (devices, basic and complex services, and system objects).
* @param[in] ssObjectName Object name to search for.
* @return The object information structure if the object is available or an empty structure if not.
*/
SObjectInfo FindObject(in u8string ssObjectName) const;
};
/**
* @brief Interface used to control object creation and destruction.
*/
interface IRepositoryControl
{
/**
* @brief Create an object and all its objects it depends on.
* @details For standalone and essential applications, this function allows the creation of system, device and service
* objects if the module was loaded previously. For the main and isolated application, this function allows the
* creation of complex services only and only those that are in the installation. For the isolated application only one
* complex service can be created. External apps, utilities, and proxy and stub objects cannot be created at all using
* this function.
* Objects that the to be create object is depending on will be created as well. For the main application this is
* limited to complex services. Isolated applications cannot load other services; this is taken over by the main
* application.
* @param[in] ssClassName The name of the object class to be created. For the main application, the class string could
* be empty for the main application if the object was defined in the installation.
* @param[in] ssObjectName Name of the object, required to be unique. For standalone and essential applications, the
* name string can be empty, in which case the object might either provide a name proposal or the name is the same as
* the class name. Use the returned object ID to request the name of the object.
* @param[in] ssObjectConfig Optional configuration handed over to the object upon creation via IObjectControl. Only
* valid for standalone, essential and isolated applications.
* @return Returns the object ID when the object creation was successful or 0 when not. On success the object is
* available through the IObjectAccess interface. If the object already exists (class and object names are identical),
* the object ID of the existing object is returned.
*/
TObjectID CreateObject(in u8string ssClassName, in u8string ssObjectName, in u8string ssObjectConfig);
/**
* @brief Create an object from a previously loaded module. Provide the module ID to explicitly define what module to
* use during object creation.
* @attention This function is not available for 'main' and 'isolated' applications.
* @param[in] tModuleID Module ID that contains the object class to create the object with.
* @param[in] ssClassName The name of the object class to be created.
* @param[in] ssObjectName Optional name of the object - required to be unique. If not supplied, the object might
* either provide a name proposal or the name is the same as the class name. Use the returned object ID to request
* the name of the object.
* @param[in] ssObjectConfig Optional configuration handed over to the object upon creation via IObjectControl.
* @return Returns the object ID when the object creation was successful or 0 when not. On success the object is
* available through the IObjectAccess interface. If the object already exists (class and object names are identical),
* the object ID of the existing object is returned.
*/
TObjectID CreateObjectFromModule(in TModuleID tModuleID, in u8string ssClassName, in u8string ssObjectName,
in u8string ssObjectConfig);
/**
* @brief Destroy a previously created object with the supplied name.
* @details For standalone and essential applications previously created system, device and service objects can be
* destroyed. For the main and isolated applications, only the complex service can be destroyed. For isolated
* applications a destruction of the object will end the application.
* @param[in] ssObjectName The name of the object to destroy.
* @return Returns whether the object destruction was successful.
*/
boolean DestroyObject(in u8string ssObjectName);
};
/**
* @brief Interface used to create utilities.
*/
interface IRepositoryUtilityCreate
{
/**
* @brief Creates an utility object.
* @details The behavior of this function depends on the run-as mode the application is running in... For the core
* application running as 'main' the module will be loaded if not already done so (pre-condition, the module containing
* the object is installed) . If the object is
* a complex service, the object is created in an isolated space. For the isolated application, only complex services
* can be created running locally if the module is installed. For all other run-as modes (standalone, essential, etc.),
* the object is created if the module was loaded previously.
* @attention Utilities are standalone objects. Use IObjectDestroy to destroy the utility.
* @param[in] ssClassName The name of the object class to be created.
* @param[in] ssObjectConfig Optional configuration handed over to the object upon creation via IObjectControl.
* @return Returns the IInterfaceAccess interface of newly created utility.
*/
IInterfaceAccess CreateUtility(in u8string ssClassName, in u8string ssObjectConfig);
};
/**
* @brief Interface used to create marshall objects. This interface is operated by the Communication Control service.
*/
local interface IRepositoryMarshallCreate
{
/**
* @brief Create a proxy object for the interface with the supplied ID. If successful, this object is initialized, but
* not linked to any other object within the system.
* @details Create a proxy object with the name "proxy_<ifc id>". "ifc_id" is the decimal value of an interface ID.
* @param[in] id The interface ID to create the object for.
* @return Returns the interface to the proxy object. Destruction of the object can be achieved through IObjectDestroy.
*/
IInterfaceAccess CreateProxyObject(in interface_id id);
/**
* @brief Create a stub object for the interface with the supplied ID. If successful, this object is initialized, but
* not linked to any other object within the system.
* @details Create a stub object with the name "stub_<ifc id>". "ifc_id" is the decimal value of an interface ID.
* @param[in] id The interface ID to create the object for.
* @return Returns the interface to the stub object. Destruction of the object can be achieved through IObjectDestroy.
*/
IInterfaceAccess CreateStubObject(in interface_id id);
};
/**
* @brief Interface used to publish external objects to the SDV system.
* @attention Any objects supplied must not be destroyed before IRepositoryControl::Shutdown has been called
*/
interface IRegisterForeignObject
{
/**
* @brief Register as foreign object and make it public to the system with the given name.
* @param[in] pObjectIfc The object to be registered
* @param[in] ssObjectName The name under which the object - required to be unique.
* @return Returns the object ID when the object creation was successful or 0 when not. On success the object is
* available through the IObjectAccess interface. If the object already exists (class and object names are identical),
* the object ID of the existing object is returned.
*/
TObjectID RegisterObject(in IInterfaceAccess pObjectIfc, in u8string ssObjectName);
};
/**
* @brief Connect the core repository to the local repository to allow object access by the locally running components.
* @remarks This interface is available only for isolated and external applications.
*/
interface ILinkCoreRepository
{
/**
* @brief Register the core repository.
* @param[in] pCoreRepository Pointer to the proxy interface of the core repository.
*/
void LinkCoreRepository(in IInterfaceAccess pCoreRepository);
/**
* @brief Unlink a previously linked core repository.
*/
void UnlinkCoreRepository();
};
}; // module core
}; // module sdv

View File

@@ -0,0 +1,62 @@
/**
* @file timer.idl
* @author Erik Verhoeven DISDS1 (mailto:erik.verhoeven@zf.com)
* @brief This file includes all the interfaces used for timer creation.
* @version 1.0
* @date 2024-05-09
*
* @copyright Copyright ZF Friedrichshafen AG (c) 2023-2025
*/
#include "core.idl"
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
* @brief Core features.
*/
module core
{
/**
* @brief Interface to be implemented by user-defined tasks so that the core::ITaskTimer interface can periodically execute the
* task
*/
interface ITaskExecute
{
/**
* @brief Execute a task. This function is triggered by the task timer service.
*/
void Execute();
};
/**
* @brief Interface to execute tasks periodically
*/
interface ITaskTimer
{
/**
* @brief Method to execute the user-defined task periodically.
* @param[in] uiPeriod The time period in milliseconds in which the task should executed.
* @param[in] pTask Interface to the task object exposing the ITaskExecute interface. The object must be kept alive
* until the timer has been destroyed.
* @return Returns an interface to the task timer object. Use sdv::IObjectDestroy to terminate the timer.
*/
IInterfaceAccess CreateTimer(in uint32 uiPeriod, in IInterfaceAccess pTask);
};
/**
* @brief Interface to set the simulation time between 2 simulation steps.
*/
interface ITimerSimulationStep
{
/**
* @brief Method to set the time which has past from the last simulation step.
* @param[in] uiSimulationStep the time in microseconds which has past from the last simulation step.
*/
void SimulationStep(in uint64 uiSimulationStep);
};
};
};

123
export/interfaces/toml.idl Normal file
View File

@@ -0,0 +1,123 @@
/**
*
* @file dispatch.idl
* @brief This file provides interfaces related to the data dispatch service.
* @version 1.0
* @date 2024.01.12
* @author Erik Verhoeven
* @copyright Copyright ZF Friedrichshaven AG (c) 2024
*
*/
#include "core.idl"
/**
* @brief Software Defined Vehicle framework.
*/
module sdv
{
/**
* @brief TOML interface.
*/
module toml
{
/**
* @brief TOML parse exception.
*/
exception XTOMLParseException : XSysExcept
{
/** Description */
const char _description[] = "TOML parse exception.";
u8string ssMessage; ///< Message indicating the cause of the exception.
};
/**
* @brief Collection of possible data in parse tree node
*/
enum ENodeType : uint8
{
node_table, //!< Table
node_array, //!< Array
node_integer, //!< Integer
node_floating_point, //!< Floating point
node_boolean, //!< Boolean
node_string, //!< String
node_invalid //!< Invalid content
};
/**
* @brief Node information interface
*/
interface INodeInfo
{
/**
* @brief Get the node name.
* @return String containing the name of the node.
*/
u8string GetName() const;
/**
* @brief Get the node type.
* @return Type of the node.
*/
ENodeType GetType() const;
/**
* @brief The node value.
* @return For boolean, integer, floating point and strings, the function returns a value. Otherwise the function
* returns empty.
*/
any GetValue() const;
/**
* @brief Return the TOML string belonging to this node including all potential child nodes.
* @return The TOML string.
*/
u8string GetTOML() const;
};
/**
* @brief Interface allowing access to table and array nodes.
*/
interface INodeCollection
{
/**
* @brief Returns the amount of nodes.
* @return The amount of nodes.
*/
uint32 GetCount() const;
/**
* @brief Get the node.
* @param[in] uiIndex Index of the node to get.
* @return Interface to the node object.
*/
IInterfaceAccess GetNode(in uint32 uiIndex) const;
/**
* @brief Searches a node by its key in the parse tree
* @details Elements of tables can be accessed and traversed by using '.' to separated the parent name from child
* name. E.g. 'parent.child' would access the 'child' element of the 'parent' table. Elements of arrays can be
* accessed and traversed by using the index number in brackets. E.g. 'array[3]' would access the fourth element of
* the array 'array'. These access conventions can also be chained like 'table.array[2][1].subtable.integerElement'.
* @attention Array indexing starts with 0!
* @param[in] ssPath The path of the Node to searched for.
* @return Returns an interface the requested node if available.
*/
IInterfaceAccess GetNodeDirect(in u8string ssPath) const;
};
/**
* @brief TOML parser interface.
*/
interface ITOMLParser
{
/**
* @brief Process the configuration from the supplied content string.
* @param[in] ssContent Configuration string.
* @return Returns 'true' when the configuration could be read successfully, false when not.
*/
boolean Process(in u8string ssContent) raises(XTOMLParseException);
};
};
};