Commit e194aa19 authored by Maxime Perrotin's avatar Maxime Perrotin

Add generation of the GUI runtime

parent 73896ca7
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@@-- @_Is_Type_@ : True if function type
@@-- @_Instance_Of_@ : Name of instance or empty string
queue_manager.c
This diff is collapsed.
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the interface
@@-- @_Direction_@ : "PI" or "RI"
@@-- @_Kind_@ : The RCM Kind
@@-- @_Parent_Function_@ : The name of the function
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- This template must return either TRUE or something else (meaning FALSE)
@@-- It is used to determine if the other templates in this folder will be
@@-- processed or ignored.
@@-- One folder can contain two templates: one for a function, and one for
@@-- a corresponding makefile (or build script)
@@-- The name of the function is read from template "function-filename.tmplt"
@@-- The name of the makefile is read from template "makefile-filename.tmplt"
@@-- These files are optional, if absent no error is raised
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@@-- @_Is_Type_@ : True if function type
@@-- @_Instance_Of_@ : Name of instance or empty string
@@-- @_Language_@ : Implementation language for the function
@@-- @_Filename_Is_Present_@ : True if target function output already exists
@@-- @_Makefile_Is_Present_@ : True if target build script already exists
@@-- @_C_Middleware_@ : True if middleware is in C (e.g. PO-HI-C)
@@IF@@ @_Language_@ = "GUI"
TRUE
@@END_IF@@
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@@-- @_Is_Type_@ : True if function type
@@-- @_Instance_Of_@ : Name of instance or empty string
debug_messages.c
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@@-- @_Language_@ : The implementation language
@@-- @_List_Of_PIs_@ : List of all Provided Interfaces (just names)
@@-- @_List_Of_RIs_@ : List of all Required Interfaces (just names)
@@-- @_List_Of_Sync_PIs@ : List of synchronous Provided Interfaces
@@-- @_List_Of_Sync_RIs@ : List of synchronous Required Interfaces
@@-- @_List_Of_ASync_PIs@ : List of asynchronous Provided Interfaces
@@-- @_List_Of_ASync_RIs@ : List of asynchronous Required Interfaces
@@-- @_ASN1_Modules_@ : List of ASN.1 Modules names
@@-- @_ASN1_Files_@ : List of ASN.1 Files with path
@@-- @_Timers_@ : List of timers (just names)
@@-- @_Has_Context_@ : Flag, True if there are context parameters
@@-- @_CP_Names_@ : List of Context Parameter names
@@-- @_CP_Types_@ : List of Context Parameter types
@@-- @_Provided_Interfaces_@ : From template: Provided interfaces with params
@@-- @_Required_Interfaces_@ : From template: Required interfaces with params
@@-- @_Property_Names_@ : List of User-defined properties (names)
@@-- @_Property_Values_@ : List of User-defined properties (values)
@@-- @_Is_Type_@ : Flag, True if function is a component type
@@-- @_Instance_Of_@ : Optional name of component type
#ifdef __unix__
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include "debug_messages.h"
// debug_printf is used for logging and error reporting
void debug_printf(DebugLevel level, const char *fmt, ...)
{
static int bFirstTime = 1;
static int bPrintsEnabled = 0;
static char message[4096];
if (bFirstTime) {
bFirstTime = 0;
bPrintsEnabled = (NULL != getenv("ASSERT_DEBUG"))?1:0;
}
if (level == LVL_ERROR)
printf("%s\n", "***** ERROR just happened: *****");
if (((level == LVL_INFO || level == LVL_WARN) && bPrintsEnabled) ||
level == LVL_ERROR ||
level == LVL_PANIC)
{
va_list ap;
va_start(ap, fmt);
vsnprintf(message, sizeof message, fmt, ap);
printf("%s", message);
va_end(ap);
}
if (level == LVL_PANIC)
exit(1);
}
#endif
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the interface
@@-- @_Direction_@ : "PI" or "RI"
@@-- @_Kind_@ : The RCM Kind
@@-- @_Parent_Function_@ : The name of the function
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- This template must return either TRUE or something else (meaning FALSE)
@@-- It is used to determine if the other templates in this folder will be
@@-- processed or ignored.
@@-- One folder can contain two templates: one for a function, and one for
@@-- a corresponding makefile (or build script)
@@-- The name of the function is read from template "function-filename.tmplt"
@@-- The name of the makefile is read from template "makefile-filename.tmplt"
@@-- These files are optional, if absent no error is raised
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@@-- @_Is_Type_@ : True if function type
@@-- @_Instance_Of_@ : Name of instance or empty string
@@-- @_Language_@ : Implementation language for the function
@@-- @_Filename_Is_Present_@ : True if target function output already exists
@@-- @_Makefile_Is_Present_@ : True if target build script already exists
@@-- @_C_Middleware_@ : True if middleware is in C (e.g. PO-HI-C)
@@IF@@ @_Language_@ = "GUI"
TRUE
@@END_IF@@
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@@-- @_Is_Type_@ : True if function type
@@-- @_Instance_Of_@ : Name of instance or empty string
debug_messages.h
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@@-- @_Language_@ : The implementation language
@@-- @_List_Of_PIs_@ : List of all Provided Interfaces (just names)
@@-- @_List_Of_RIs_@ : List of all Required Interfaces (just names)
@@-- @_List_Of_Sync_PIs@ : List of synchronous Provided Interfaces
@@-- @_List_Of_Sync_RIs@ : List of synchronous Required Interfaces
@@-- @_List_Of_ASync_PIs@ : List of asynchronous Provided Interfaces
@@-- @_List_Of_ASync_RIs@ : List of asynchronous Required Interfaces
@@-- @_ASN1_Modules_@ : List of ASN.1 Modules names
@@-- @_ASN1_Files_@ : List of ASN.1 Files with path
@@-- @_Timers_@ : List of timers (just names)
@@-- @_Has_Context_@ : Flag, True if there are context parameters
@@-- @_CP_Names_@ : List of Context Parameter names
@@-- @_CP_Types_@ : List of Context Parameter types
@@-- @_Provided_Interfaces_@ : From template: Provided interfaces with params
@@-- @_Required_Interfaces_@ : From template: Required interfaces with params
@@-- @_Property_Names_@ : List of User-defined properties (names)
@@-- @_Property_Values_@ : List of User-defined properties (values)
@@-- @_Is_Type_@ : Flag, True if function is a component type
@@-- @_Instance_Of_@ : Optional name of component type
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
// debug_printf is used for logging and error reporting
//
typedef enum tagDebugLevel {
LVL_INFO,
LVL_WARN,
LVL_ERROR,
LVL_PANIC
} DebugLevel;
void debug_printf(DebugLevel level, const char *fmt, ...);
#ifdef __cplusplus
}
#endif
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the interface
@@-- @_Direction_@ : "PI" or "RI"
@@-- @_Kind_@ : The RCM Kind
@@-- @_Parent_Function_@ : The name of the function
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The function name
@@-- @_ASN1_Files_@ : List of all ASN.1 files
@@-- @_ASN1_Modules_@ : List of all ASN.1 modules
@@-- @_Is_Type_@ : Flag set to True for function type
@@-- @_Instance_Of_@ : Name of function type if instance
@@-- This template must return either TRUE or something else (meaning FALSE)
@@-- It is used to determine if the other templates in this folder will be
@@-- processed or ignored.
@@-- One folder can contain two templates: one for a function, and one for
@@-- a corresponding makefile (or build script)
@@-- The name of the function is read from template "function-filename.tmplt"
@@-- The name of the makefile is read from template "makefile-filename.tmplt"
@@-- These files are optional, if absent no error is raised
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@@-- @_Is_Type_@ : True if function type
@@-- @_Instance_Of_@ : Name of instance or empty string
@@-- @_Language_@ : Implementation language for the function
@@-- @_Filename_Is_Present_@ : True if target function output already exists
@@-- @_Makefile_Is_Present_@ : True if target build script already exists
@@-- @_C_Middleware_@ : True if middleware is in C (e.g. PO-HI-C)
@@IF@@ @_Language_@ = "GUI"
TRUE
@@END_IF@@
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@@-- @_Is_Type_@ : True if function type
@@-- @_Instance_Of_@ : Name of instance or empty string
queue_manager.h
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@@-- @_Language_@ : The implementation language
@@-- @_List_Of_PIs_@ : List of all Provided Interfaces (just names)
@@-- @_List_Of_RIs_@ : List of all Required Interfaces (just names)
@@-- @_List_Of_Sync_PIs@ : List of synchronous Provided Interfaces
@@-- @_List_Of_Sync_RIs@ : List of synchronous Required Interfaces
@@-- @_List_Of_ASync_PIs@ : List of asynchronous Provided Interfaces
@@-- @_List_Of_ASync_RIs@ : List of asynchronous Required Interfaces
@@-- @_ASN1_Modules_@ : List of ASN.1 Modules names
@@-- @_ASN1_Files_@ : List of ASN.1 Files with path
@@-- @_Timers_@ : List of timers (just names)
@@-- @_Has_Context_@ : Flag, True if there are context parameters
@@-- @_CP_Names_@ : List of Context Parameter names
@@-- @_CP_Types_@ : List of Context Parameter types
@@-- @_Provided_Interfaces_@ : From template: Provided interfaces with params
@@-- @_Required_Interfaces_@ : From template: Required interfaces with params
@@-- @_Property_Names_@ : List of User-defined properties (names)
@@-- @_Property_Values_@ : List of User-defined properties (values)
@@-- @_Is_Type_@ : Flag, True if function is a component type
@@-- @_Instance_Of_@ : Optional name of component type
#pragma once
/* Written by Cyril Colombo, 2006, updated later by other TASTE contributors... */
#ifdef __cplusplus
extern "C" {
#endif
//Includes POSIX queue management system, see http://www.opengroup.org/
#include <mqueue.h>
#include "timeInMS.h"
//
//This package allows to wrap POSIX management queues for the need of
//message passing in the frame of GUI management in the frae of the ASSERT
//project.
//
//Basically, this package allows :
// - To create a queue given caracteristics wanted for this queue, mainly
// its size. The queue can contain any type of data provided the biggest
// element size to be stored in the queue is properly provided at creation.
// e.g. : The queue may be used to store integers, floats and even structures.
// The maximum element size to be provided at creation of the queue will
// then be the size of the biggest type to be handled by the queue.
// The other size parameter (max_msg_nubmer) detemrnines the number of message
// to be handled.
//
//Warning : Storing a pointer in the queue may be dangerous, because nothing
// assure for sure that the adresse will reference the same data area
// on both the consumer and producer side.
//
// - To read and write elements inside the queue. Note that it is forseen that
// messages to be exchanged shall be some records, whose first field in an
// enumerated type (int) to be used as a dsicriminant for the rest of the
// message (functional part of the massage, that could be a structure of
// the usefull fonctional data).
//
// - To delete an existing queue.
//
//
// Exported function declaration
//
//This function creates a queue for message sharing
//
// queue_name : [in] Name of the queue to be created
// max_msg_nubmer : [in] Maximum number of messages to be put in the queue
// max_msg_size : [in] Maximum message size. Message can be of different type, so
// this corresponds to the size of the biggest message type
// p_queue_id : [out] Pointer on a message queue handling structure
//
// Returns : 0 on success, -1 otherwise
//
int create_exchange_queue(char* queue_name,
long max_msg_number,
long max_msg_size,
mqd_t* p_queue_id);
//
//This function retrieves a single message from a queue create_exchange_queue
//
// queue_id : [in] Handle to the queue adressed as returned by
// max_message_length : [in] Maximum size of an element to be stored in the queue
// (functional data plus discriminant) in bytes
// message_data_recieved: [out] Pointer on the functional data retrieved in the queue
// Note that this buffer only contains the functional part
// of the message and not the first field allowing to identify
// the message type.
// message_recieved_type: [out] Identifier of the type of message recieved.
//
// Returns : 0 on success, -1 otherwise
//
int retrieve_message_from_queue(mqd_t queue_id,
long max_message_length,
void* message_data_recieved,
int* message_recieved_type);
//
//This function writes a single message from a queue create_exchange_queue
//
// queue_id : [in] Handle to the queue adressed as returned by
// message_data_length : [in] Size of the functional data (ie. without discriminant) to be written in bytes
// message_data_sent : [in] Pointer on the functional data to be written in the queue
// Note that this buffer only contains the functional part
// of the message and not the first field allowing to identify
// the message type.
// message_recieved_type: [in] Identifier of the type of message to be sent
//
// Returns : 0 on success, -1 otherwise
//
int write_message_to_queue(mqd_t queue_id,
long message_data_length,
void* message_data_sent,
int message_sent_type);
//
//This function destroys an existing exchange queue
//
// queue_name : [in] Name of the queue to be created
// queue_id : [out] Pointer on the handle to the queue adressed as opened by oSpen_exchange_queue_for_reading
// Returns : 0 on success, -1 otherwise
//
int open_exchange_queue_for_reading(char* queue_name,
mqd_t* queue_id);
int open_exchange_queue_for_writing(char* queue_name,
mqd_t* queue_id);
//
//This function destroy an existing exchange queue
//
// queue_id : [in] Handle to the queue adressed as returned by create_exchange_queue
// queue_name : [in] Name of the queue to be created
//
// Returns : 0 on success, -1 otherwise
//
int delete_exchange_queue(mqd_t queue_id,
char* queue_name);
#ifdef __cplusplus
}
#endif
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the interface
@@-- @_Direction_@ : "PI" or "RI"
@@-- @_Kind_@ : The RCM Kind
@@-- @_Parent_Function_@ : The name of the function
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The function name
@@-- @_ASN1_Files_@ : List of all ASN.1 files
@@-- @_ASN1_Modules_@ : List of all ASN.1 modules
@@-- @_Is_Type_@ : Flag set to True for function type
@@-- @_Instance_Of_@ : Name of function type if instance
@@-- This template must return either TRUE or something else (meaning FALSE)
@@-- It is used to determine if the other templates in this folder will be
@@-- processed or ignored.
@@-- One folder can contain two templates: one for a function, and one for
@@-- a corresponding makefile (or build script)
@@-- The name of the function is read from template "function-filename.tmplt"
@@-- The name of the makefile is read from template "makefile-filename.tmplt"
@@-- These files are optional, if absent no error is raised
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@@-- @_Is_Type_@ : True if function type
@@-- @_Instance_Of_@ : Name of instance or empty string
@@-- @_Language_@ : Implementation language for the function
@@-- @_Filename_Is_Present_@ : True if target function output already exists
@@-- @_Makefile_Is_Present_@ : True if target build script already exists
@@-- @_C_Middleware_@ : True if middleware is in C (e.g. PO-HI-C)
@@IF@@ @_Language_@ = "GUI"
TRUE
@@END_IF@@
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment