Commit 8abe8653 authored by Matteo Quintiliani's avatar Matteo Quintiliani

Added sending ew messages


git-svn-id: file:///home/quintiliani/svncopy/nmxptool/trunk@638 3cd66e75-5955-46cb-a940-c26e5fc5497d
parent 1292477f
......@@ -65,3 +65,10 @@ restartMe
# blanks.
# Each module may also issue a text string for an error.
#
err: 0 nerr: 1 tsec: 0 page: 0 mail: 99
text: "Missed message"
#
err: 1 nerr: 1 tsec: 0 page: 0 mail: 99
text: "Error receiving data (in desc)"
#
......@@ -28,9 +28,9 @@
#include "nmxptool_ew.h"
char *NMXPTOOL_EW_ERR_MSG[NMXPTOOL_EW_ERR_MAXVALUE + 1] = {
"",
"Error receiving data."
NMXPTOOL_EW_ERR_MSG nmxptool_ew_err_msg[NMXPTOOL_EW_ERR_MAXVALUE] = {
{ NMXPTOOL_EW_ERR_NULL, ""} ,
{ NMXPTOOL_EW_ERR_RECVDATA, "Error receiving data." }
};
......@@ -552,11 +552,17 @@ void nmxptool_ew_send_heartbeat_if_needed() {
}
}
void nmxptool_ew_send_error(short ierr) {
if(ierr >= 0 && ierr <= NMXPTOOL_EW_ERR_MAXVALUE) {
nmxptool_ew_report_status ( &errLogo, ierr, NMXPTOOL_EW_ERR_MSG[ierr] );
void nmxptool_ew_send_error(unsigned int ierr) {
int i;
i=0;
while(i < NMXPTOOL_EW_ERR_MAXVALUE && nmxptool_ew_err_msg[i].error != ierr) {
i++;
}
if(i < NMXPTOOL_EW_ERR_MAXVALUE) {
nmxptool_ew_report_status ( &errLogo, nmxptool_ew_err_msg[i].error, nmxptool_ew_err_msg[i].message);
} else {
/* TODO */
nmxptool_ew_report_status ( &errLogo, 0, "Unknown error");
}
}
......
......@@ -22,10 +22,16 @@
#include <transport.h>
#include <trace_buf.h>
/* TODO is number of different kinds of error */
#define NMXPTOOL_EW_ERR_MAXVALUE 2
#define NMXPTOOL_EW_ERR_NULL 0
#define NMXPTOOL_EW_ERR_RECVDATA 1
/* TODO */
#define NMXPTOOL_EW_ERR_MAXVALUE 1
typedef struct {
unsigned int error;
char message[1024];
} NMXPTOOL_EW_ERR_MSG;
void nmxptool_ew_attach();
void nmxptool_ew_detach();
......@@ -42,7 +48,7 @@ void nmxptool_ew_report_status ( MSG_LOGO *pLogo, short code, char * message );
int nmxptool_ew_check_flag_terminate();
void nmxptool_ew_send_heartbeat_if_needed();
void nmxptool_ew_send_error(short ierr);
void nmxptool_ew_send_error(unsigned int ierr);
int nmxptool_ew_logit_msg ( char *msg );
int nmxptool_ew_logit_err ( char *msg );
......
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