Commit e5422aa3 authored by Claes Sjofors's avatar Claes Sjofors

Programmers reference manual, errh added

parent 500da2e1
...@@ -22,6 +22,7 @@ This manual will give a description of the following API's ...@@ -22,6 +22,7 @@ This manual will give a description of the following API's
- QCom Using the Proview communication protocol. - QCom Using the Proview communication protocol.
- Time Functions to convert and compare time values. - Time Functions to convert and compare time values.
- Cdh Convert and compare object attributes. - Cdh Convert and compare object attributes.
- Errh Print messages on system log.
- NMps Interface to NMps Cell objects. - NMps Interface to NMps Cell objects.
- rt_appl A base class for applications i c++. - rt_appl A base class for applications i c++.
*/ */
...@@ -307,11 +308,16 @@ This manual will give a description of the following API's ...@@ -307,11 +308,16 @@ This manual will give a description of the following API's
This module contains utilites for time management. This module contains utilites for time management.
*/ */
/*! \defgroup Cdh Class definition handler /*! \defgroup Cdh Cdh Class definition handler
\ingroup PRM \ingroup PRM
This module contains functions for class definitions. This module contains functions for class definitions.
*/ */
/*! \defgroup Errh Errh System log messages
\ingroup PRM
This module contains functions for logging error messages.
*/
/*! \defgroup NMpsAppl NMpsAppl NMps API /*! \defgroup NMpsAppl NMpsAppl NMps API
\ingroup PRM \ingroup PRM
This module contains interface functions for application access to NMps. This module contains interface functions for application access to NMps.
......
...@@ -539,6 +539,7 @@ INPUT = $(pwre_sroot)/doc/prm/src/doxygen.dx \ ...@@ -539,6 +539,7 @@ INPUT = $(pwre_sroot)/doc/prm/src/doxygen.dx \
$(pwre_sroot)/lib/co/src/co_time.h \ $(pwre_sroot)/lib/co/src/co_time.h \
$(pwre_sroot)/lib/co/src/co_cdh.h \ $(pwre_sroot)/lib/co/src/co_cdh.h \
$(pwre_sroot)/lib/rt/src/rt_gdh.h \ $(pwre_sroot)/lib/rt/src/rt_gdh.h \
$(pwre_sroot)/lib/rt/src/rt_errh.h \
$(pwre_sroot)/lib/rt/src/rt_mh_appl.h \ $(pwre_sroot)/lib/rt/src/rt_mh_appl.h \
$(pwre_sroot)/lib/rt/src/rt_qcom.h \ $(pwre_sroot)/lib/rt/src/rt_qcom.h \
$(pwre_croot)/nmps/lib/nmps/src/nmps_appl.h \ $(pwre_croot)/nmps/lib/nmps/src/nmps_appl.h \
...@@ -547,6 +548,7 @@ INPUT = $(pwre_sroot)/doc/prm/src/doxygen.dx \ ...@@ -547,6 +548,7 @@ INPUT = $(pwre_sroot)/doc/prm/src/doxygen.dx \
$(pwre_sroot)/lib/co/src/co_time.c \ $(pwre_sroot)/lib/co/src/co_time.c \
$(pwre_sroot)/lib/co/src/co_cdh.c \ $(pwre_sroot)/lib/co/src/co_cdh.c \
$(pwre_sroot)/lib/rt/src/rt_gdh.c \ $(pwre_sroot)/lib/rt/src/rt_gdh.c \
$(pwre_sroot)/lib/rt/src/rt_errh.c \
$(pwre_sroot)/lib/rt/src/rt_mh_appl.c \ $(pwre_sroot)/lib/rt/src/rt_mh_appl.c \
$(pwre_sroot)/lib/rt/src/rt_qcom.c \ $(pwre_sroot)/lib/rt/src/rt_qcom.c \
$(pwre_croot)/nmps/lib/nmps/src/nmps_appl.c \ $(pwre_croot)/nmps/lib/nmps/src/nmps_appl.c \
......
...@@ -2948,6 +2948,7 @@ cdh_NextObjectName ( ...@@ -2948,6 +2948,7 @@ cdh_NextObjectName (
\param outname Out string. \param outname Out string.
\param name In string. \param name In string.
\param segments Number of segments to return.
*/ */
void cdh_CutNameSegments ( void cdh_CutNameSegments (
char *outname, char *outname,
......
...@@ -183,8 +183,17 @@ errh_Interactive () ...@@ -183,8 +183,17 @@ errh_Interactive ()
interactive = 1; interactive = 1;
} }
/* Set up a queue to write to, set module name. */
/**
* @brief Initialize errh.
* Set up a queue to write to, set application name.
*
* \param name Name of application. This name is written in the logging entry
* to identify the process.
* \param anix Application index. Applications should choose a index in the range
* errh_eAnix_appl1 - errh_eAnix_appl20.
* \return Status or operation.
*/
pwr_tStatus pwr_tStatus
errh_Init ( errh_Init (
const char *name, const char *name,
...@@ -204,6 +213,13 @@ errh_Init ( ...@@ -204,6 +213,13 @@ errh_Init (
return 1; return 1;
} }
/**
* @brief Set application status.
* The application status is showed in the Node graph. The application can set this status
* with a call to errh_SetStatus. The status should be defined in the message file.
*
* \param sts New application status.
*/
void void
errh_SetStatus( pwr_tStatus sts) errh_SetStatus( pwr_tStatus sts)
{ {
...@@ -211,6 +227,10 @@ errh_SetStatus( pwr_tStatus sts) ...@@ -211,6 +227,10 @@ errh_SetStatus( pwr_tStatus sts)
errh_send(0, 0, sts, errh_eMsgType_Status); errh_send(0, 0, sts, errh_eMsgType_Status);
} }
/**
* @brief Get application index for the process.
* \return Application index.
*/
errh_eAnix errh_eAnix
errh_Anix() errh_Anix()
{ {
...@@ -270,8 +290,18 @@ errh_Log ( ...@@ -270,8 +290,18 @@ errh_Log (
return buff; return buff;
} }
/* Log a success message. */ /**
* @brief Log a success message.
* The function has a variable argument list similar to sprintf.
*
* \param msg String with message to log. The string can contain format specifiers.
*
* Example
*
* errh_Success("Process initialized");
*/
void void
errh_Success ( errh_Success (
const char *msg, const char *msg,
...@@ -284,8 +314,17 @@ errh_Success ( ...@@ -284,8 +314,17 @@ errh_Success (
log_message(NULL, 'S', msg, args); log_message(NULL, 'S', msg, args);
va_end(args); va_end(args);
} }
/* Log an info message */ /**
* @brief Log an info message.
* The function has a variable argument list similar to sprintf.
*
* \param msg String with message to log. The string can contain format specifiers.
*
* Example
*
* errh_Info("Reset count %d", cnt);
*/
void void
errh_Info (const char *msg, ...) errh_Info (const char *msg, ...)
...@@ -296,8 +335,17 @@ errh_Info (const char *msg, ...) ...@@ -296,8 +335,17 @@ errh_Info (const char *msg, ...)
log_message(NULL, 'I', msg, args); log_message(NULL, 'I', msg, args);
va_end(args); va_end(args);
} }
/* Log a warning message */ /**
* @brief Log a warning message.
* The function has a variable argument list similar to sprintf.
*
* \param msg String with message to log. The string can contain format specifiers.
*
* Example
*
* errh_Warning("Connection lost to %s", name);
*/
void void
errh_Warning(const char *msg, ...) errh_Warning(const char *msg, ...)
...@@ -308,8 +356,17 @@ errh_Warning(const char *msg, ...) ...@@ -308,8 +356,17 @@ errh_Warning(const char *msg, ...)
log_message(NULL, 'W', msg, args); log_message(NULL, 'W', msg, args);
va_end(args); va_end(args);
} }
/* Log an error message */ /**
* @brief Log an error message.
* The function has a variable argument list similar to sprintf.
*
* \param msg String with message to log. The string can contain format specifiers.
*
* Example
*
* errh_Error("Configuration error");
*/
void void
errh_Error(const char *msg, ...) errh_Error(const char *msg, ...)
...@@ -320,8 +377,17 @@ errh_Error(const char *msg, ...) ...@@ -320,8 +377,17 @@ errh_Error(const char *msg, ...)
log_message(NULL, 'E', msg, args); log_message(NULL, 'E', msg, args);
va_end(args); va_end(args);
} }
/* Log a fatal message */ /**
* @brief Log a fatal message.
* The function has a variable argument list similar to sprintf.
*
* \param msg String with message to log. The string can contain format specifiers.
*
* Example
*
* errh_Fatal("Process terminated, %m", sts);
*/
void void
errh_Fatal(const char *msg, ...) errh_Fatal(const char *msg, ...)
......
...@@ -53,6 +53,9 @@ ...@@ -53,6 +53,9 @@
extern "C" { extern "C" {
#endif #endif
/** @addtogroup Errh */
/*@{*/
#ifndef errh_Bugcheck #ifndef errh_Bugcheck
# if defined OS_ELN || defined OS_VMS # if defined OS_ELN || defined OS_VMS
# define errh_Bugcheck(sts, str) \ # define errh_Bugcheck(sts, str) \
...@@ -76,6 +79,9 @@ extern "C" { ...@@ -76,6 +79,9 @@ extern "C" {
#define errh_SeverityError(sts) (((sts) & 7) == 2) #define errh_SeverityError(sts) (((sts) & 7) == 2)
#define errh_SeverityFatal(sts) (((sts) & 7) == 4) #define errh_SeverityFatal(sts) (((sts) & 7) == 4)
/**
* Severity enumeration
*/
typedef enum { typedef enum {
errh_eSeverity_Null, errh_eSeverity_Null,
errh_eSeverity_Success, errh_eSeverity_Success,
...@@ -88,6 +94,9 @@ typedef enum { ...@@ -88,6 +94,9 @@ typedef enum {
#define errh_cAnix_SrvSize 40 #define errh_cAnix_SrvSize 40
/**
* Application index
*/
typedef enum { typedef enum {
errh_eNAnix = 0, errh_eNAnix = 0,
errh_eAnix_ini = 1, errh_eAnix_ini = 1,
...@@ -132,9 +141,12 @@ typedef enum { ...@@ -132,9 +141,12 @@ typedef enum {
errh_eAnix_appl20 = 40 errh_eAnix_appl20 = 40
} errh_eAnix; } errh_eAnix;
/**
* Message type
*/
typedef enum { typedef enum {
errh_eMsgType_Log = 1, errh_eMsgType_Log = 1, /**< Write to console log */
errh_eMsgType_Status = 2 errh_eMsgType_Status = 2 /**< Set application status */
} errh_eMsgType; } errh_eMsgType;
...@@ -178,6 +190,9 @@ void errh_CErrLog (pwr_tStatus sts, ...); ...@@ -178,6 +190,9 @@ void errh_CErrLog (pwr_tStatus sts, ...);
char *errh_Message (char *string, char severity, char *msg, ...); char *errh_Message (char *string, char severity, char *msg, ...);
errh_eAnix errh_Anix (); errh_eAnix errh_Anix ();
errh_eSeverity errh_Severity (pwr_tStatus); errh_eSeverity errh_Severity (pwr_tStatus);
/** @} */
#if defined __cplusplus #if defined __cplusplus
} }
#endif #endif
......
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