[OSADL-svn-commits] r65 - fapia-trunk/interface

OSADL repository commits osadl-svn-commits at lists.osadl.org
Tue Oct 2 11:45:40 CEST 2007


Author: tb10rts
Date: Thu Jul 19 07:01:28 2007
New Revision: 65

Log:
Added a folder remotely

Added:
   fapia-trunk/interface/
   fapia-trunk/interface/FAPIA.h
   fapia-trunk/interface/FAPIATrace.h

Added: fapia-trunk/interface/FAPIA.h
==============================================================================
--- (empty file)
+++ fapia-trunk/interface/FAPIA.h	Thu Jul 19 07:01:28 2007
@@ -0,0 +1,549 @@
+/* -*- C -*- */
+
+//=============================================================================
+/**
+ *  @file    FAPIA.h
+ *
+ *  $Id$
+ *
+ *  @author Thomas Rothfuss <thomas.rothfuss at homag.de>
+ */
+//=============================================================================
+
+
+#ifndef _FAPI_ACYCLIC_H_
+#define _FAPI_ACYCLIC_H_
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+//=============================================================================
+/**
+ * Structures
+ */
+//=============================================================================
+
+/**
+ * @struct FAPIAParameter
+ *
+ * @brief This structure is used to identify a Parameter.
+ *
+ */
+typedef struct
+  {
+    /// Name of the parameter. E.g. "<parameter_number>[;<subindex>]".
+    char *                parameter_name;
+  } FAPIAParameter;
+
+
+/**
+ * @enum FAPIADataType
+ *
+ * @brief Enumeration for datatypes.
+ *
+ */
+typedef enum
+  {
+    FAPIA_DATA_TYPE_UNS08                = 1,
+    FAPIA_DATA_TYPE_SGN08                = 2,
+    FAPIA_DATA_TYPE_UNS16                = 3,
+    FAPIA_DATA_TYPE_SGN16                = 4,
+    FAPIA_DATA_TYPE_UNS32                = 5,
+    FAPIA_DATA_TYPE_SGN32                = 6,
+    FAPIA_DATA_TYPE_STRING               = 7,
+    FAPIA_DATA_TYPE_REAL32               = 8,
+    FAPIA_DATA_TYPE_REAL64               = 9
+  } FAPIADataType;
+
+
+/**
+ * @struct FAPIAValue
+ *
+ * @brief This structure is used to transmit the value for a parameter.
+ *
+ */
+typedef struct
+  {
+    /// Datatype of the value.
+    FAPIADataType                        data_type;
+
+    /// Length in bytes of the value.
+    unsigned long                        data_length;
+
+    /// Pointer to the value. Dependend on the data_type it must be casted.
+    void*                                data_value;
+  } FAPIAValue;
+
+
+
+/**
+ * @enum FAPIAErrorCode
+ *
+ * @brief Possible error codes.
+ *
+ */
+typedef enum
+  {
+    FAPIA_ERROR_OK                                    = 0,
+    FAPIA_ERROR_COMMUNICATION                         = -1,
+    FAPIA_ERROR_DESTINATION_NOT_ONLINE                = -2,
+    FAPIA_ERROR_OBJECT_NOT_FOUND                      = -3,
+    FAPIA_ERROR_PARAMETER_NOT_FOUND                   = -4,
+    FAPIA_ERROR_CONFIG_PARSE_ERROR                    = -5,
+    FAPIA_ERROR_CONFIG_HAS_WRONG_FORMAT               = -6,
+    FAPIA_ERROR_SYNCHRONIZE_COULD_NOT_BE_INITIALIZED  = -7,
+    FAPIA_ERROR_SHARED_MEMORY_ERROR                   = -8
+  } FAPIAErrorCode;
+
+
+/**
+ * @struct FAPIAError
+ *
+ * @brief This structure holds the error information.
+ *
+ */
+typedef struct
+  {
+    /// Error code of the error.
+    FAPIAErrorCode                       error_code;
+
+    /// Reason as a string.
+    char *                               reason;
+  } FAPIAError;
+
+
+/**
+ * @enum FAPIACommunicationPriority
+ *
+ * @brief Priority of the Message. Default should be
+ * FAPIA_COMMUNICATION_PRIORITY_NORMAL.
+ *
+ */
+typedef enum
+  {
+    FAPIA_COMMUNICATION_PRIORITY_LOWEST  = 1,
+    FAPIA_COMMUNICATION_PRIORITY_LOW     = 2,
+    FAPIA_COMMUNICATION_PRIORITY_NORMAL  = 3,
+    FAPIA_COMMUNICATION_PRIORITY_HIGH    = 4,
+    FAPIA_COMMUNICATION_PRIORITY_HIGHEST = 5
+  } FAPIACommunicationPriority;
+
+
+/**
+ * @struct FAPIACommunication
+ *
+ * @brief This structure holds the necessary communication parameters.
+ *
+ */
+typedef struct
+  {
+    /// Possible communication error. If the error_code is not ok then the
+    /// whole transaction was canceled.
+    FAPIAError                           communication_error;
+
+    /// Id of the transaction. It is unique within this process.
+    unsigned long                        transaction_id;
+
+    /// Name of the logical object. Maybe e.g. the device_name.
+    char *                               logical_object_name;
+
+    /// Name of the physical source object. Needed for replies. Requests do not
+    /// need to set it. It can be NULLL.
+    char *                               source_physical_object_name;
+
+    /// Priority of the transaction.
+    FAPIACommunicationPriority           priority;
+
+    /// Indicates whether the caller likes to have a reply or not. This is only
+    /// reasonable on write requests. Otherwise an error occurs.
+    unsigned char                        send_reply;
+
+    /// Number of entries. This belongs to the amount of FAPIAParameter,
+    /// FAPIAValue and FAPIAError elements following.
+    unsigned long                        number_of_entries;
+  } FAPIACommunication;
+
+
+/**
+ * @enum FAPIACommunicationPriority
+ *
+ * @brief Priority of the Message. Default should be
+ * FAPIA_COMMUNICATION_PRIORITY_NORMAL.
+ *
+ */
+typedef enum
+  {
+    FAPIA_ACCESS_RIGHTS_READ             = 1,
+    FAPIA_ACCESS_RIGHTS_WRITE            = 2,
+    FAPIA_ACCESS_RIGHTS_READWRITE        = 3
+  } FAPIAAccessRights;
+
+
+/**
+ * @struct FAPIAInfo
+ *
+ * @brief This structure is used to hold information about a Parameter.
+ *
+ */
+typedef struct
+  {
+    /// Datatype of the value.
+    FAPIADataType                        data_type;
+
+    /// Length in bytes of the value.
+    unsigned long                        data_length;
+
+    /// Pointer to the minimum value. Dependend on the data_type
+    /// it must be casted.
+    void*                                min_value;
+
+    /// Pointer to the minimum value. Dependend on the data_type
+    /// it must be casted.
+    void*                                max_value;
+
+    /// Priority of the transaction.
+    FAPIAAccessRights                    access_rights;
+
+    /// Unit of the value.
+    char *                               unit;
+
+    /// Exponent of base 10 to determine value for corresponding unit.
+    /// If exponent is not used it must be 0.
+    long                                 exponent;
+
+    /// Factor to determine value for corresponding unit.
+    /// If factor is not used it must be 1.
+    long                                 factor;
+
+    /// Descriptoin of the parameter.
+    char *                               description;
+
+  } FAPIAInfo;
+
+
+//=============================================================================
+/**
+ * Functions
+ */
+//=============================================================================
+
+
+/**
+ * @brief Initializes the FAPIA. name is the physical_object_name of this
+ * communication node.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_init (
+    int                        argc,
+    char*                      argv[],
+    const char *               const name);
+
+
+/**
+ * @brief Deinitializes the FAPIA. FAPIA has to deallocate all allocated memory
+ * and shut down.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_deinit (void);
+
+
+/**
+ * @brief Retrieves the logical object names from the FAPIA.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_logical_object_names (
+    char***          logical_object_names,
+    unsigned long*  number_of_logical_object_names);
+
+
+//-----------------------------------------------------------------------------
+/**
+ * Callback setting functions
+ */
+//-----------------------------------------------------------------------------
+
+/**
+ * @brief Initializing the caller for responses of read requests. FAPIA holds a
+ * reference to the function and calls it when a response is received.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_set_callback_for_parameter_read_response_callback (
+    long (*f) (const FAPIACommunication *,
+               const FAPIAParameter *,
+               const FAPIAValue *,
+               const FAPIAError *));
+
+
+/**
+ * @brief Initializing the caller for responses of write requests. FAPIA holds a
+ * reference to the function and calls it when a response is received.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_set_callback_for_parameter_write_response_callback (
+    long (*f) (const FAPIACommunication *,
+               const FAPIAParameter *,
+               const FAPIAError *));
+
+
+/**
+ * @brief Initializing the caller for responses of info requests. FAPIA holds a
+ * reference to the function and calls it when a response is received.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_set_callback_for_parameter_info_response_callback (
+    long (*f) (const FAPIACommunication *,
+               const FAPIAParameter *,
+               const FAPIAInfo *,
+               const FAPIAError *));
+
+
+/**
+ * @brief Initializing the callee for read requests. FAPIA holds a
+ * reference to the function and calls it when a request is received.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_set_callback_for_parameter_read_request_callback (
+    long (*f) (const FAPIACommunication *,
+               const FAPIAParameter *));
+
+
+/**
+ * @brief Initializing the callee for write requests. FAPIA holds a
+ * reference to the function and calls it when a request is received.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_set_callback_for_parameter_write_request_callback (
+    long (*f) (const FAPIACommunication *,
+               const FAPIAParameter *,
+               const FAPIAValue *));
+
+
+/**
+ * @brief Initializing the callee for info requests. FAPIA holds a
+ * reference to the function and calls it when a request is received.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_set_callback_for_parameter_info_request_callback (
+    long (*f) (const FAPIACommunication *,
+               const FAPIAParameter *));
+
+
+//-----------------------------------------------------------------------------
+/**
+ * Read functions
+ */
+//-----------------------------------------------------------------------------
+
+/**
+ * @brief Sends a read request to the callee. fapia_communication.transaction_id
+ * and fapia_communication.source_physical_object_name are filled out by the
+ * FAPIA.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_parameter_read_request (
+    FAPIACommunication *        const fapia_communication,
+    const FAPIAParameter *      const fapia_parameters);
+
+
+#if 0
+/**
+ * @brief This is the callback response function of the read_request. It is _not_
+ * implemented by FAPIA. This may be done by the caller application. A function
+ * with this signature must be set by function
+ * fapia_set_callback_for_parameter_read_response_callback.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_parameter_read_response_callback (
+    const FAPIACommunication *  const fapia_communication,
+    const FAPIAParameter *      const fapia_parameters,
+    const FAPIAValue *          const fapia_values,
+    const FAPIAError *          const fapia_errors);
+
+
+
+/**
+ * @brief This is the callback request function of the read_request. It is _not_
+ * implemented by FAPIA. This may be done by the callee application. A function
+ * with this signature must be set by function
+ * fapia_set_callback_for_parameter_read_request_callback.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_parameter_read_request_callback (
+    const FAPIACommunication *  const fapia_communication,
+    const FAPIAParameter *      const fapia_parameters);
+#endif
+
+
+/**
+ * @brief Sends a read response to the caller.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_parameter_read_response (
+    const FAPIACommunication *  const fapia_communication,
+    const FAPIAParameter *      const fapia_parameters,
+    const FAPIAValue *          const fapia_values,
+    const FAPIAError *          const fapia_errors);
+
+
+//-----------------------------------------------------------------------------
+/**
+ * Write functions
+ */
+//-----------------------------------------------------------------------------
+
+/**
+ * @brief Sends a write request to the callee. fapia_communication.transaction_id
+ * and fapia_communication.source_physical_object_name are filled out by the
+ * FAPIA.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_parameter_write_request (
+    FAPIACommunication *        const fapia_communication,
+    const FAPIAParameter *      const fapia_parameters,
+    const FAPIAValue *          const fapia_values);
+
+
+#if 0
+/**
+ * @brief This is the callback response function of the write_request. It is _not_
+ * implemented by FAPIA. This may be done by the caller application. A function
+ * with this signature must be set by function
+ * fapia_set_callback_for_parameter_write_response_callback.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_parameter_write_response_callback (
+    const FAPIACommunication *  const fapia_communication,
+    const FAPIAParameter *      const fapia_parameters,
+    const FAPIAError *          const fapia_errors);
+
+
+/**
+ * @brief This is the callback response function of the write_request. It is _not_
+ * implemented by FAPIA. This may be done by the caller application. A function
+ * with this signature must be set by function
+ * fapia_set_callback_for_parameter_write_response_callback.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_parameter_write_request_callback (
+    const FAPIACommunication *  const fapia_communication,
+    const FAPIAParameter *      const fapia_parameters,
+    const FAPIAValue *          const fapia_values);
+#endif
+
+
+/**
+ * @brief Sends a write response to the caller.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_parameter_write_response (
+    const FAPIACommunication *  const fapia_communication,
+    const FAPIAParameter *      const fapia_parameters,
+    const FAPIAError *          const fapia_errors);
+
+
+//-----------------------------------------------------------------------------
+/**
+ * Info functions
+ */
+//-----------------------------------------------------------------------------
+
+/**
+ * @brief Sends a info request to the callee. fapia_communication.transaction_id
+ * and fapia_communication.source_physical_object_name are filled out by the
+ * FAPIA.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_parameter_info_request (
+    FAPIACommunication *        const fapia_communication,
+    const FAPIAParameter *      const fapia_parameters);
+
+
+#if 0
+/**
+ * @brief This is the callback response function of the info_request. It is _not_
+ * implemented by FAPIA. This may be done by the caller application. A function
+ * with this signature must be set by function
+ * fapia_set_callback_for_parameter_info_response_callback.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_parameter_info_response_callback (
+    const FAPIACommunication *  const fapia_communication,
+    const FAPIAParameter *      const fapia_parameters,
+    const FAPIAInfo *           const fapia_infos,
+    const FAPIAError *          const fapia_errors);
+
+
+/**
+ * @brief This is the callback response function of the info_request. It is _not_
+ * implemented by FAPIA. This may be done by the caller application. A function
+ * with this signature must be set by function
+ * fapia_set_callback_for_parameter_info_response_callback.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_parameter_info_request_callback (
+    const FAPIACommunication *  const fapia_communication,
+    const FAPIAParameter *      const fapia_parameters);
+#endif
+
+
+/**
+ * @brief Sends a info response to the caller.
+ *
+ * If it returns a negative number there was an error.
+ *
+ */
+long fapia_parameter_info_response (
+    const FAPIACommunication *  const fapia_communication,
+    const FAPIAParameter *      const fapia_parameters,
+    const FAPIAInfo *           const fapia_infos,
+    const FAPIAError *          const fapia_errors);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _FAPI_ACYCLIC_H_ */

Added: fapia-trunk/interface/FAPIATrace.h
==============================================================================
--- (empty file)
+++ fapia-trunk/interface/FAPIATrace.h	Thu Jul 19 07:01:28 2007
@@ -0,0 +1,68 @@
+/* -*- C -*- */
+
+//=============================================================================
+/**
+ *  @file    FAPIATrace.h
+ *
+ *  $Id$
+ *
+ *  @author Friedhelm Wolf <friedhelm.wolf at homag.de>
+ */
+//=============================================================================
+
+
+#ifndef _FAPI_ACYCLIC_TRACE_H_
+#define _FAPI_ACYCLIC_TRACE_H_
+
+#include <ace/Log_Msg.h>
+
+//=============================================================================
+/**
+ * Preprocessor Definitions
+ */
+//=============================================================================
+
+/**
+ * 
+ * @brief The <code>FAPIA_DEBUG</code> macro behaves like the 
+ *        <code>ACE_DEBUG</code> macro, but adds additional information
+ *        to the printed message
+ *
+ * appropriate debug levels are:
+ * 1.   LM_TRACE        -   not used (use FAPIA_TRACE instead)
+ * 2.   LM_DEBUG        -   detailed output of data content
+ * 3.   LM_INFO         -   internal messages
+ * 4.   LM_NOTICE       -   description of the general program progress
+ * 5.   LM_WARNING      -   warning without program termination
+ * 6.   LM_ERROR        -   error message without program termination
+ * 7.   LM_CRITICAL     -   error message leading to transaction termination
+ * 8.   LM_ALERT        -   error message leading to program termination
+ * 9.   LM_EMERGENCY    -   not used
+ *
+ */
+#if (ACE_NTRACE == 1)
+#define FAPIA_DEBUG(LEVEL, ...) do \
+  { \
+    ACE_DEBUG((LEVEL, ACE_TEXT("(%t) "))); \
+    ACE_DEBUG((LEVEL, __VA_ARGS__)); \
+    ACE_DEBUG((LEVEL, ACE_TEXT("\t[line %l, func=%s file=%N]\n"), __FUNCTION__)); \
+  } while (0)
+#else
+#define FAPIA_DEBUG(LEVEL, ...) do \
+  { \
+    ACE_DEBUG((LEVEL, ACE_TEXT("%I(%t) "))); \
+    ACE_DEBUG((LEVEL, __VA_ARGS__)); \
+    ACE_DEBUG((LEVEL, ACE_TEXT("%I\t\t[line %l, func=%s file=%N]\n"), __FUNCTION__)); \
+  } while (0)
+#endif
+/**
+ * 
+ * @brief The <code>FAPIA_TRACE</code> macro uses the <code>ACE_TRACE</code>
+ *        macros to print out the start and the end of a function call
+ *        automatically, by using the <code>__FUNCTION__</code> compiler
+ *        macro.
+ *
+ */
+#define FAPIA_TRACE ACE_TRACE (ACE_TEXT (__FUNCTION__))
+
+#endif /* _FAPI_ACYCLIC_H_ */


More information about the OSADL-svn-commits mailing list