#define INTF_MSG_ERR 1 /* error message */
#define INTF_MSG_INTF 2 /* interface message */
#define INTF_MSG_DBG 3 /* debug message */
+#define INTF_MSG_WARN 4 /* warning message*/
+
/*****************************************************************************
* intf_msg_t
int i_log_file; /* log file */
#endif
+//#if 0
#if !defined(INTF_MSG_QUEUE) && !defined(DEBUG_LOG)
/* If neither messages queue, neither log file is used, then the structure
* is empty. However, empty structures are not allowed in C. Therefore, a
* dummy integer is used to fill it. */
int i_dummy; /* unused filler */
#endif
+// int i_warning_level;
} intf_msg_t;
/*****************************************************************************
p_msg->i_count = 0; /* queue is empty */
#endif
+
#ifdef DEBUG_LOG
/* Log file initialization - on failure, file pointer will be null,
* and no log will be issued, but this is not considered as an
* This function is the same as intf_Msg, except that it prints its messages
* on stderr.
*****************************************************************************/
-void intf_ErrMsg( char *psz_format, ...)
+void intf_ErrMsg( char *psz_format, ... )
{
va_list ap;
va_end( ap );
}
+/*****************************************************************************
+ * intf_WarnMsg : print a warning message
+ *****************************************************************************
+ * This function is the same as intf_Msg, except that it concerns warning
+ * messages for testing purpose.
+ *****************************************************************************/
+void intf_WarnMsg( int i_level, char *psz_format, ... )
+{
+ va_list ap;
+
+ if( i_level >= p_main->p_intf->i_warning_level )
+ {
+ va_start( ap, psz_format );
+ QueueMsg( p_main->p_msg, INTF_MSG_WARN, psz_format, ap );
+ va_end( ap );
+ }
+}
+
+
/*****************************************************************************
* intf_IntfMsg : print an interface message (ok ?)
*****************************************************************************
#endif
/*****************************************************************************
- * intf_ErrMsgImm: print a message (ok ?)
+ * intf_MsgImm: print a message (ok ?)
*****************************************************************************
* This function prints a message immediately. If the queue is used, all
* waiting messages are also printed.
intf_FlushMsg();
}
+/*****************************************************************************
+ * intf_WarnMsgImm : print a warning message
+ *****************************************************************************
+ * This function is the same as intf_MsgImm, except that it concerns warning
+ * messages for testing purpose.
+ *****************************************************************************/
+void intf_WarnMsgImm( int i_level, char *psz_format, ... )
+{
+ va_list ap;
+
+ if( i_level >= p_main->p_intf->i_warning_level )
+ {
+ va_start( ap, psz_format );
+ QueueMsg( p_main->p_msg, INTF_MSG_WARN, psz_format, ap );
+ va_end( ap );
+ }
+ intf_FlushMsg();
+}
+
+
+
/*****************************************************************************
* _intf_DbgMsgImm: print a debugging message immediately (ok ?)
*****************************************************************************
asprintf( &psz_msg, "%s", p_msg->psz_msg );
break;
+ case INTF_MSG_WARN: /* Warning message */
+ asprintf( &psz_msg, "%s", p_msg->psz_msg );
+ break;
+
case INTF_MSG_INTF: /* interface messages */
asprintf( &psz_msg, "%s", p_msg->psz_msg );
break;
break;
}
- /* Check if formatting function suceeded */
+ /* Check if formatting function succeeded */
if( psz_msg == NULL )
{
fprintf( stderr, "error: can not format message (%s): %s\n",
fprintf( stdout, psz_msg );
break;
case INTF_MSG_ERR: /* error messages */
+ case INTF_MSG_WARN:
#ifndef DEBUG_LOG_ONLY
case INTF_MSG_DBG: /* debugging messages */
#endif
fprintf( stdout, p_msg->psz_msg );
break;
case INTF_MSG_ERR: /* error messages */
- fprintf( stderr, p_msg->psz_msg );
+ case INTF_MSG_WARN:
+ fprintf( stderr, p_msg->psz_msg ); /* warning message */
break;
case INTF_MSG_INTF: /* interface messages */
intf_ConsolePrint( p_main->p_intf->p_console, p_msg->psz_msg );
#define OPT_SYNCHRO 180
+#define OPT_WARNING 190
+
/* Usage fashion */
#define USAGE 0
#define SHORT_HELP 1
/* Synchro options */
{ "synchro", 1, 0, OPT_SYNCHRO },
+ /* Interface messages */
+ { "warning", 1, 0, OPT_WARNING },
{ 0, 0, 0, 0 }
};
static void SetDefaultConfiguration( void )
{
/*
- * All features are activated by default
+ * All features are activated by default execpted vlans
*/
p_main->b_audio = 1;
p_main->b_video = 1;
break;
/* Input options */
- case OPT_VLANS: /* --vlans */
+ case OPT_VLANS: /* --vlans */
p_main->b_vlans = 1;
break;
case OPT_SERVER: /* --server */
break;
/* Synchro options */
- case OPT_SYNCHRO:
+ case OPT_SYNCHRO:
main_PutPszVariable( VPAR_SYNCHRO_VAR, optarg );
break;
+ /* Interface warning messages level */
+ case OPT_WARNING: /* --warning */
+ main_PutIntVariable( INTF_WARNING_VAR, atoi(optarg) );
+ break;
+
/* Internal error: unknown option */
case '?':
default:
"\n"
" --synchro <type> \tforce synchro algorithm\n"
"\n"
+ " --warning <level> \tdisplay warning messages\n"
+ "\n"
" -h, --help \tprint help and exit\n"
" -H, --longhelp \tprint long help and exit\n"
" -v, --version \toutput version information and exit\n" );
intf_Msg( "\n"
"Interface parameters:\n"
" " INTF_INIT_SCRIPT_VAR "=<filename> \tinitialization script\n"
- " " INTF_CHANNELS_VAR "=<filename> \tchannels list\n" );
+ " " INTF_CHANNELS_VAR "=<filename> \tchannels list\n"
+ " " INTF_WARNING_VAR "=<level> \twarning level\n" );
/* Audio parameters */
intf_Msg( "\n"