Commit a9004add authored by Claes Sjofors's avatar Claes Sjofors

Xtt logging in python format

parent 05b57d00
...@@ -102,8 +102,8 @@ static int logccm_getd_func(void* filectx, ccm_sArg* arg_list, int arg_count, ...@@ -102,8 +102,8 @@ static int logccm_getd_func(void* filectx, ccm_sArg* arg_list, int arg_count,
XttLogging::XttLogging() XttLogging::XttLogging()
: xnav(0), index(0), active(0), intern(0), stop_logg(0), : xnav(0), index(0), active(0), intern(0), stop_logg(0),
logg_type(xtt_LoggType_Cont), logg_priority(0), condition_ptr(0), logg_type(xtt_LoggType_Cont), logg_priority(0), logg_format(xtt_eLoggFormat_Std),
logg_time(200), logg_file(0), line_size(10000), parameter_count(0), condition_ptr(0), logg_time(200), logg_file(0), line_size(10000), parameter_count(0),
print_shortname(0), buffer_size(100), wanted_buffer_size(100), print_shortname(0), buffer_size(100), wanted_buffer_size(100),
buffer_count(0), buffer_ptr(0), cond_ccm_ctx(0) buffer_count(0), buffer_ptr(0), cond_ccm_ctx(0)
{ {
...@@ -144,7 +144,7 @@ XttLogging::~XttLogging() ...@@ -144,7 +144,7 @@ XttLogging::~XttLogging()
**************************************************************************/ **************************************************************************/
int XttLogging::logging_set(float a_logg_time, char* filename, char* parameter, int XttLogging::logging_set(float a_logg_time, char* filename, char* parameter,
char* condition, int a_logg_type, int insert, int a_buffer_size, int stop, char* condition, int a_logg_type, int a_logg_format, int insert, int a_buffer_size, int stop,
int priority, int create, int a_line_size, int shortname) int priority, int create, int a_line_size, int shortname)
{ {
int i, sts; int i, sts;
...@@ -238,6 +238,9 @@ int XttLogging::logging_set(float a_logg_time, char* filename, char* parameter, ...@@ -238,6 +238,9 @@ int XttLogging::logging_set(float a_logg_time, char* filename, char* parameter,
if (a_logg_type != 0) if (a_logg_type != 0)
logg_type = a_logg_type; logg_type = a_logg_type;
if (a_logg_format >= 0)
logg_format = (xtt_eLoggFormat)a_logg_format;
if (priority < -1 || priority > 32) { if (priority < -1 || priority > 32) {
message('E', "Priority out of range"); message('E', "Priority out of range");
return XNAV__HOLDCOMMAND; return XNAV__HOLDCOMMAND;
...@@ -420,6 +423,33 @@ int XttLogging::show_entry(char* buff, int* buff_cnt) ...@@ -420,6 +423,33 @@ int XttLogging::show_entry(char* buff, int* buff_cnt)
return XNAV__SUCCESS; return XNAV__SUCCESS;
} }
/*************************************************************************
*
* Name: rtt_logging_analyse()
*
* Type int
*
* Type Parameter IOGF Description
*
* Description:
* Analyse an entry.
*
**************************************************************************/
int XttLogging::analyse()
{
pwr_tCmd cmd;
if (logg_format != xtt_eLoggFormat_Py) {
message('E', "File format has to be \"Py\"");
return XNAV__HOLDCOMMAND;
}
sprintf( cmd, "sev_analyse.py -f %s &", logg_filename);
system(cmd);
return 1;
}
/************************************************************************* /*************************************************************************
* *
* Name: rtt_logging_store_entry() * Name: rtt_logging_store_entry()
...@@ -438,6 +468,7 @@ int XttLogging::store(char* filename) ...@@ -438,6 +468,7 @@ int XttLogging::store(char* filename)
int i; int i;
pwr_tFileName filename_str; pwr_tFileName filename_str;
FILE* outfile; FILE* outfile;
char msg[120];
int found_parameter; int found_parameter;
found_parameter = 0; found_parameter = 0;
...@@ -478,6 +509,11 @@ int XttLogging::store(char* filename) ...@@ -478,6 +509,11 @@ int XttLogging::store(char* filename)
else if (logg_type == xtt_LoggType_Cont) else if (logg_type == xtt_LoggType_Cont)
fprintf(outfile, "logging set/entry=current/type=cont\n"); fprintf(outfile, "logging set/entry=current/type=cont\n");
if (logg_format == xtt_eLoggFormat_Std)
fprintf(outfile, "logging set/entry=current/format=std\n");
else if (logg_format == xtt_eLoggFormat_Py)
fprintf(outfile, "logging set/entry=current/format=py\n");
for (i = 0; i < RTT_LOGG_MAXPAR; i++) { for (i = 0; i < RTT_LOGG_MAXPAR; i++) {
if (parameterstr[i][0] != 0) if (parameterstr[i][0] != 0)
fprintf(outfile, "logging set/entry=current/parameter=\"%s\"\n", fprintf(outfile, "logging set/entry=current/parameter=\"%s\"\n",
...@@ -508,7 +544,6 @@ int XttLogging::store(char* filename) ...@@ -508,7 +544,6 @@ int XttLogging::store(char* filename)
dcli_fgetname(outfile, filename_str, filename_str); dcli_fgetname(outfile, filename_str, filename_str);
fclose(outfile); fclose(outfile);
char msg[sizeof(filename_str) + 8 + 1];
sprintf(msg, "%s created", filename_str); sprintf(msg, "%s created", filename_str);
message('I', msg); message('I', msg);
return XNAV__SUCCESS; return XNAV__SUCCESS;
...@@ -620,9 +655,7 @@ int XttLogging::start() ...@@ -620,9 +655,7 @@ int XttLogging::start()
if (logg_filename[0] != 0) { if (logg_filename[0] != 0) {
logg_file = fopen(logg_filename, "w"); logg_file = fopen(logg_filename, "w");
if (logg_file == 0) { if (logg_file == 0) {
char tmp[280]; message('E', "Unable to open file");
snprintf(tmp, sizeof(tmp), "Unable to open file \"%s\"", logg_filename);
message('E', tmp);
return XNAV__HOLDCOMMAND; return XNAV__HOLDCOMMAND;
} }
} else { } else {
...@@ -815,8 +848,15 @@ static void* xtt_logproc(void* arg) ...@@ -815,8 +848,15 @@ static void* xtt_logproc(void* arg)
switch (logg->logg_type) { switch (logg->logg_type) {
case xtt_LoggType_Cont: case xtt_LoggType_Cont:
if (logg->logg_file) switch (logg->logg_format) {
fprintf(logg->logg_file, "\"%s\"", time_str); case xtt_eLoggFormat_Py:
if (logg->logg_file)
char_cnt += fprintf(logg->logg_file, "Time");
break;
default:
if (logg->logg_file)
char_cnt += fprintf(logg->logg_file, "\"%s\"", time_str);
}
/* Find a unique shortname for each parameter */ /* Find a unique shortname for each parameter */
for (i = 0; i < RTT_LOGG_MAXPAR; i++) { for (i = 0; i < RTT_LOGG_MAXPAR; i++) {
if (logg->print_shortname) { if (logg->print_shortname) {
...@@ -857,11 +897,17 @@ static void* xtt_logproc(void* arg) ...@@ -857,11 +897,17 @@ static void* xtt_logproc(void* arg)
for (i = 0; i < RTT_LOGG_MAXPAR; i++) { for (i = 0; i < RTT_LOGG_MAXPAR; i++) {
if (logg->parameterstr[i][0] != 0) { if (logg->parameterstr[i][0] != 0) {
if (logg->logg_file) { if (logg->logg_file) {
char_cnt += fprintf(logg->logg_file, " %s", logg->shortname[i]); switch (logg->logg_format) {
if (char_cnt + 120 > logg->line_size) { case xtt_eLoggFormat_Py:
fprintf(logg->logg_file, "\n"); char_cnt += fprintf(logg->logg_file, ",%s", logg->shortname[i]);
char_cnt = 0; break;
} default:
char_cnt += fprintf(logg->logg_file, " %s", logg->shortname[i]);
if (char_cnt + 120 > logg->line_size) {
fprintf(logg->logg_file, "\n");
char_cnt = 0;
}
}
} }
} }
} }
...@@ -930,51 +976,136 @@ static void* xtt_logproc(void* arg) ...@@ -930,51 +976,136 @@ static void* xtt_logproc(void* arg)
if (first_scan) if (first_scan)
time_float = 0.; time_float = 0.;
/* Print time and the value of the parameter on the file */ /* Print time and the value of the parameter on the file */
char_cnt += logg->log_print("%12.4f", time_float); switch (logg->logg_format) {
case xtt_eLoggFormat_Py:
time_AtoAscii(&time, time_eFormat_NumDateAndTime, time_str, sizeof(time_str));
char_cnt += logg->log_print("%s", time_str);
break;
default:
char_cnt += logg->log_print("%12.4f", time_float);
}
for (i = 0; i < RTT_LOGG_MAXPAR; i++) { for (i = 0; i < RTT_LOGG_MAXPAR; i++) {
if (logg->parameterstr[i][0] != 0) { if (logg->parameterstr[i][0] != 0) {
value_ptr = logg->parameter_ptr[i]; value_ptr = logg->parameter_ptr[i];
switch (logg->parameter_type[i]) { switch (logg->parameter_type[i]) {
case pwr_eType_Float32: case pwr_eType_Float32:
char_cnt += logg->log_print(" %f", *(pwr_tFloat32*)value_ptr); switch (logg->logg_format) {
case xtt_eLoggFormat_Py:
char_cnt += logg->log_print(",%f", *(pwr_tFloat32*)value_ptr);
break;
default:
char_cnt += logg->log_print(" %f", *(pwr_tFloat32*)value_ptr);
}
break; break;
case pwr_eType_Float64: case pwr_eType_Float64:
char_cnt += logg->log_print(" %f", *(pwr_tFloat64*)value_ptr); switch (logg->logg_format) {
case xtt_eLoggFormat_Py:
char_cnt += logg->log_print(",%f", *(pwr_tFloat64*)value_ptr);
break;
default:
char_cnt += logg->log_print(" %f", *(pwr_tFloat64*)value_ptr);
}
break; break;
case pwr_eType_UInt8: case pwr_eType_UInt8:
char_cnt += logg->log_print(" %d", *(pwr_tUInt8*)value_ptr); switch (logg->logg_format) {
case xtt_eLoggFormat_Py:
char_cnt += logg->log_print(",%d", *(pwr_tUInt8*)value_ptr);
break;
default:
char_cnt += logg->log_print(" %d", *(pwr_tUInt8*)value_ptr);
}
break; break;
case pwr_eType_Boolean: case pwr_eType_Boolean:
char_cnt += logg->log_print(" %d", *(pwr_tBoolean*)value_ptr); switch (logg->logg_format) {
case xtt_eLoggFormat_Py:
char_cnt += logg->log_print(",%d", *(pwr_tBoolean*)value_ptr);
break;
default:
char_cnt += logg->log_print(" %d", *(pwr_tBoolean*)value_ptr);
}
break; break;
case pwr_eType_Char: case pwr_eType_Char:
char_cnt += logg->log_print(" %c", *(pwr_tChar*)value_ptr); switch (logg->logg_format) {
case xtt_eLoggFormat_Py:
char_cnt += logg->log_print(",%c", *(pwr_tChar*)value_ptr);
break;
default:
char_cnt += logg->log_print(" %c", *(pwr_tChar*)value_ptr);
}
break; break;
case pwr_eType_Int8: case pwr_eType_Int8:
char_cnt += logg->log_print(" %d", *(pwr_tInt8*)value_ptr); switch (logg->logg_format) {
case xtt_eLoggFormat_Py:
char_cnt += logg->log_print(",%d", *(pwr_tInt8*)value_ptr);
break;
default:
char_cnt += logg->log_print(" %d", *(pwr_tInt8*)value_ptr);
}
break; break;
case pwr_eType_Int16: case pwr_eType_Int16:
char_cnt += logg->log_print(" %d", *(pwr_tInt16*)value_ptr); switch (logg->logg_format) {
case xtt_eLoggFormat_Py:
char_cnt += logg->log_print(",%d", *(pwr_tInt16*)value_ptr);
break;
default:
char_cnt += logg->log_print(" %d", *(pwr_tInt16*)value_ptr);
}
break; break;
case pwr_eType_UInt16: case pwr_eType_UInt16:
char_cnt += logg->log_print(" %d", *(pwr_tUInt16*)value_ptr); switch (logg->logg_format) {
case xtt_eLoggFormat_Py:
char_cnt += logg->log_print(",%d", *(pwr_tUInt16*)value_ptr);
break;
default:
char_cnt += logg->log_print(" %d", *(pwr_tUInt16*)value_ptr);
}
break; break;
case pwr_eType_Int32: case pwr_eType_Int32:
char_cnt += logg->log_print(" %d", *(pwr_tInt32*)value_ptr); switch (logg->logg_format) {
case xtt_eLoggFormat_Py:
char_cnt += logg->log_print(",%d", *(pwr_tInt32*)value_ptr);
break;
default:
char_cnt += logg->log_print(" %d", *(pwr_tInt32*)value_ptr);
}
break; break;
case pwr_eType_UInt32: case pwr_eType_UInt32:
char_cnt += logg->log_print(" %d", *(pwr_tUInt32*)value_ptr); switch (logg->logg_format) {
case xtt_eLoggFormat_Py:
char_cnt += logg->log_print(",%d", *(pwr_tUInt32*)value_ptr);
break;
default:
char_cnt += logg->log_print(" %d", *(pwr_tUInt32*)value_ptr);
}
break; break;
case pwr_eType_Int64: case pwr_eType_Int64:
char_cnt += logg->log_print(" %lld", *(pwr_tInt64*)value_ptr); switch (logg->logg_format) {
case xtt_eLoggFormat_Py:
char_cnt += logg->log_print(",%lld", *(pwr_tInt64*)value_ptr);
break;
default:
char_cnt += logg->log_print(" %lld", *(pwr_tInt64*)value_ptr);
}
break; break;
case pwr_eType_UInt64: case pwr_eType_UInt64:
char_cnt += logg->log_print(" %llu", *(pwr_tUInt64*)value_ptr); switch (logg->logg_format) {
case xtt_eLoggFormat_Py:
char_cnt += logg->log_print(",%llu", *(pwr_tUInt64*)value_ptr);
break;
default:
char_cnt += logg->log_print(" %llu", *(pwr_tUInt64*)value_ptr);
}
break; break;
case pwr_eType_String: case pwr_eType_String:
char_cnt += logg->log_print(" %s", value_ptr); switch (logg->logg_format) {
case xtt_eLoggFormat_Py:
char_cnt += logg->log_print(",%s", value_ptr);
break;
default:
char_cnt += logg->log_print(" %s", value_ptr);
}
break; break;
case pwr_eType_Objid: case pwr_eType_Objid:
objid = *(pwr_tObjid*)value_ptr; objid = *(pwr_tObjid*)value_ptr;
...@@ -986,7 +1117,13 @@ static void* xtt_logproc(void* arg) ...@@ -986,7 +1117,13 @@ static void* xtt_logproc(void* arg)
objid, hiername, sizeof(hiername), cdh_mNName); objid, hiername, sizeof(hiername), cdh_mNName);
if (EVEN(sts)) if (EVEN(sts))
strcpy(hiername, "** Unknown objid"); strcpy(hiername, "** Unknown objid");
char_cnt += logg->log_print(" %s", hiername); switch (logg->logg_format) {
case xtt_eLoggFormat_Py:
char_cnt += logg->log_print(",%s", hiername);
break;
default:
char_cnt += logg->log_print(" %s", hiername);
}
break; break;
case pwr_eType_AttrRef: case pwr_eType_AttrRef:
attrref = (pwr_sAttrRef*)value_ptr; attrref = (pwr_sAttrRef*)value_ptr;
...@@ -994,28 +1131,57 @@ static void* xtt_logproc(void* arg) ...@@ -994,28 +1131,57 @@ static void* xtt_logproc(void* arg)
attrref, hiername, sizeof(hiername), cdh_mNName); attrref, hiername, sizeof(hiername), cdh_mNName);
if (EVEN(sts)) if (EVEN(sts))
strcpy(hiername, "** Unknown attrref"); strcpy(hiername, "** Unknown attrref");
char_cnt += logg->log_print(" %s", hiername); switch (logg->logg_format) {
case xtt_eLoggFormat_Py:
char_cnt += logg->log_print(",%s", hiername);
break;
default:
char_cnt += logg->log_print(" %s", hiername);
}
break; break;
case pwr_eType_Time: case pwr_eType_Time:
sts = time_AtoAscii((pwr_tTime*)value_ptr, time_eFormat_DateAndTime, sts = time_AtoAscii((pwr_tTime*)value_ptr, time_eFormat_DateAndTime,
timstr, sizeof(timstr)); timstr, sizeof(timstr));
if (EVEN(sts)) if (EVEN(sts))
strcpy(timstr, "Undefined time"); strcpy(timstr, "Undefined time");
char_cnt += logg->log_print(" %s", timstr); switch (logg->logg_format) {
case xtt_eLoggFormat_Py:
char_cnt += logg->log_print(",%s", timstr);
break;
default:
char_cnt += logg->log_print(" %s", timstr);
}
break; break;
case pwr_eType_DeltaTime: case pwr_eType_DeltaTime:
sts = time_DtoAscii( sts = time_DtoAscii(
(pwr_tDeltaTime*)value_ptr, 1, timstr, sizeof(timstr)); (pwr_tDeltaTime*)value_ptr, 1, timstr, sizeof(timstr));
if (EVEN(sts)) if (EVEN(sts))
strcpy(timstr, "Undefined time"); strcpy(timstr, "Undefined time");
char_cnt += logg->log_print(" %s", timstr); switch (logg->logg_format) {
case xtt_eLoggFormat_Py:
char_cnt += logg->log_print(",%s", timstr);
break;
default:
char_cnt += logg->log_print(" %s", timstr);
}
break; break;
default: default:
char_cnt += logg->log_print(" %s", "Type error"); switch (logg->logg_format) {
case xtt_eLoggFormat_Py:
char_cnt += logg->log_print(",%s", "Type error");
break;
default:
char_cnt += logg->log_print(" %s", "Type error");
}
} }
if (char_cnt + 10 > logg->line_size) { if (char_cnt + 10 > logg->line_size) {
logg->log_print("\n"); switch (logg->logg_format) {
char_cnt = 0; case xtt_eLoggFormat_Py:
break;
default:
logg->log_print("\n");
char_cnt = 0;
}
} }
} }
} }
......
...@@ -49,6 +49,10 @@ ...@@ -49,6 +49,10 @@
#define RTT_LOGG_LINE_DEFSIZE 512 #define RTT_LOGG_LINE_DEFSIZE 512
typedef enum { xtt_LoggType_Cont = 1, xtt_LoggType_Mod = 2 } xtt_LoggType; typedef enum { xtt_LoggType_Cont = 1, xtt_LoggType_Mod = 2 } xtt_LoggType;
typedef enum {
xtt_eLoggFormat_Std,
xtt_eLoggFormat_Py
} xtt_eLoggFormat;
class XttLogging { class XttLogging {
public: public:
...@@ -62,6 +66,7 @@ public: ...@@ -62,6 +66,7 @@ public:
int stop_logg; int stop_logg;
int logg_type; int logg_type;
int logg_priority; int logg_priority;
xtt_eLoggFormat logg_format;
pwr_tAName parameterstr[RTT_LOGG_MAXPAR]; pwr_tAName parameterstr[RTT_LOGG_MAXPAR];
pwr_tAName shortname[RTT_LOGG_MAXPAR]; pwr_tAName shortname[RTT_LOGG_MAXPAR];
char* parameter_ptr[RTT_LOGG_MAXPAR]; char* parameter_ptr[RTT_LOGG_MAXPAR];
...@@ -88,10 +93,11 @@ public: ...@@ -88,10 +93,11 @@ public:
void init(int logg_index, void* logg_xnav); void init(int logg_index, void* logg_xnav);
int logging_set(float logg_time, char* filename, char* parameterstr, int logging_set(float logg_time, char* filename, char* parameterstr,
char* conditionstr, int logg_type, int insert, int buffer_size, int stop, char* conditionstr, int logg_type, int logg_format, int insert, int buffer_size, int stop,
int priority, int create, int line_size, int shortname); int priority, int create, int line_size, int shortname);
int show(); int show();
int show_entry(char* buff, int* buff_cnt); int show_entry(char* buff, int* buff_cnt);
int analyse();
int store(char* filename); int store(char* filename);
int start(); int start();
int stop(); int stop();
......
...@@ -3211,6 +3211,10 @@ int XNav::show_logging(int index) ...@@ -3211,6 +3211,10 @@ int XNav::show_logging(int index)
new ItemCommand(brow, Lng::translate("Show curve"), 0, NULL, new ItemCommand(brow, Lng::translate("Show curve"), 0, NULL,
flow_eDest_IntoLast, command, 0, brow->pixmap_action); flow_eDest_IntoLast, command, 0, brow->pixmap_action);
sprintf(command, "logging analyse/entry=current");
new ItemCommand(brow, Lng::translate("Analyse"), 0, NULL,
flow_eDest_IntoLast, command, 0, brow->pixmap_action);
new ItemLocal(brow, Lng::translate("Scantime (ms)"), "logg_Time", new ItemLocal(brow, Lng::translate("Scantime (ms)"), "logg_Time",
pwr_eType_Float32, sizeof(logg[0].logg_time), 0, 100000, 0, pwr_eType_Float32, sizeof(logg[0].logg_time), 0, 100000, 0,
(void*)&logg[index].logg_time, NULL, flow_eDest_IntoLast); (void*)&logg[index].logg_time, NULL, flow_eDest_IntoLast);
...@@ -3220,6 +3224,9 @@ int XNav::show_logging(int index) ...@@ -3220,6 +3224,9 @@ int XNav::show_logging(int index)
new ItemLocal(brow, Lng::translate("Type"), "logg_Type", pwr_eType_Int32, new ItemLocal(brow, Lng::translate("Type"), "logg_Type", pwr_eType_Int32,
sizeof(logg[0].logg_type), 0, 0, 0, (void*)&logg[index].logg_type, NULL, sizeof(logg[0].logg_type), 0, 0, 0, (void*)&logg[index].logg_type, NULL,
flow_eDest_IntoLast); flow_eDest_IntoLast);
new ItemLocal(brow, Lng::translate("Format"), "logg_Format", pwr_eType_Int32,
sizeof(logg[0].logg_type), 0, 0, 0, (void*)&logg[index].logg_format, NULL,
flow_eDest_IntoLast);
new ItemLocal(brow, Lng::translate("BufferSize"), "logg_BufferSize", new ItemLocal(brow, Lng::translate("BufferSize"), "logg_BufferSize",
pwr_eType_Int32, sizeof(logg[0].wanted_buffer_size), 0, 0, 0, pwr_eType_Int32, sizeof(logg[0].wanted_buffer_size), 0, 0, 0,
(void*)&logg[index].wanted_buffer_size, NULL, flow_eDest_IntoLast); (void*)&logg[index].wanted_buffer_size, NULL, flow_eDest_IntoLast);
......
...@@ -285,7 +285,7 @@ dcli_tCmdTable xnav_command_table[] = { ...@@ -285,7 +285,7 @@ dcli_tCmdTable xnav_command_table[] = {
} }, } },
{ "TEST", &xnav_test_func, { "dcli_arg1", "dcli_arg2", "" } }, { "TEST", &xnav_test_func, { "dcli_arg1", "dcli_arg2", "" } },
{ "LOGGING", &xnav_logging_func, { "LOGGING", &xnav_logging_func,
{ "dcli_arg1", "dcli_arg2", "/FILE", "/TIME", "/ENTRY", "/TYPE", { "dcli_arg1", "dcli_arg2", "/FILE", "/TIME", "/ENTRY", "/TYPE", "/FORMAT",
"/PARAMETER", "/CONDITION", "/INSERT", "/BUFFER_SIZE", "/PRIORITY", "/PARAMETER", "/CONDITION", "/INSERT", "/BUFFER_SIZE", "/PRIORITY",
"/STOP", "/NOSTOP", "/CREATE", "/ALL", "/LINE_SIZE", "/SHORTNAME", "/STOP", "/NOSTOP", "/CREATE", "/ALL", "/LINE_SIZE", "/SHORTNAME",
"/NOSHORTNAME", "" } }, "/NOSHORTNAME", "" } },
...@@ -6636,6 +6636,7 @@ static int xnav_logging_func(void* client_data, void* client_flag) ...@@ -6636,6 +6636,7 @@ static int xnav_logging_func(void* client_data, void* client_flag)
int buffer_size; int buffer_size;
int nr; int nr;
int logg_type = 0; int logg_type = 0;
int logg_format = -1;
int insert; int insert;
int create; int create;
int shortname; int shortname;
...@@ -6717,6 +6718,14 @@ static int xnav_logging_func(void* client_data, void* client_flag) ...@@ -6717,6 +6718,14 @@ static int xnav_logging_func(void* client_data, void* client_flag)
} else } else
logg_type = 0; logg_type = 0;
if (ODD(dcli_get_qualifier("/FORMAT", str, sizeof(str)))) {
if (str_NoCaseStrncmp(str, "STD", strlen(str)) == 0)
logg_format = xtt_eLoggFormat_Std;
else if (str_NoCaseStrncmp(str, "PY", strlen(str)) == 0)
logg_format = xtt_eLoggFormat_Py;
} else
logg_format = -1;
if (ODD(dcli_get_qualifier( if (ODD(dcli_get_qualifier(
"/PRIORITY", priority_str, sizeof(priority_str)))) { "/PRIORITY", priority_str, sizeof(priority_str)))) {
/* convert to integer */ /* convert to integer */
...@@ -6758,7 +6767,7 @@ static int xnav_logging_func(void* client_data, void* client_flag) ...@@ -6758,7 +6767,7 @@ static int xnav_logging_func(void* client_data, void* client_flag)
} }
sts = xnav->logg[entry - 1].logging_set(logg_time, file_ptr, parameter_ptr, sts = xnav->logg[entry - 1].logging_set(logg_time, file_ptr, parameter_ptr,
condition_ptr, logg_type, insert, buffer_size, stop, priority, create, condition_ptr, logg_type, logg_format, insert, buffer_size, stop, priority, create,
line_size, shortname); line_size, shortname);
return sts; return sts;
} }
...@@ -6889,6 +6898,40 @@ static int xnav_logging_func(void* client_data, void* client_flag) ...@@ -6889,6 +6898,40 @@ static int xnav_logging_func(void* client_data, void* client_flag)
sts = xnav->logg[entry - 1].show(); sts = xnav->logg[entry - 1].show();
return sts; return sts;
} else if (str_NoCaseStrncmp(arg1_str, "ANALYSE", strlen(arg1_str)) == 0) {
/* Command is "LOGGING ANALYSE" */
char entry_str[80];
int entry;
int nr;
if (ODD(dcli_get_qualifier("/ENTRY", entry_str, sizeof(entry_str)))) {
if (!str_NoCaseStrcmp(entry_str, "CURRENT")) {
if (xnav->current_logging_index == -1) {
xnav->message('E', "No current logging entry");
return XNAV__HOLDCOMMAND;
}
entry = xnav->current_logging_index + 1;
} else {
/* convert to integer */
nr = sscanf(entry_str, "%d", &entry);
if (nr != 1) {
xnav->message('E', "Entry syntax error");
return XNAV__HOLDCOMMAND;
}
}
} else {
xnav->message('E', "Enter entry");
return XNAV__HOLDCOMMAND;
}
if (entry > XNAV_LOGG_MAX || entry < 1) {
xnav->message('E', "Entry out of range");
return XNAV__HOLDCOMMAND;
}
sts = xnav->logg[entry - 1].analyse();
return sts;
} else if (str_NoCaseStrncmp(arg1_str, "STORE", strlen(arg1_str)) == 0) { } else if (str_NoCaseStrncmp(arg1_str, "STORE", strlen(arg1_str)) == 0) {
/* Command is "LOGGING STORE" */ /* Command is "LOGGING STORE" */
......
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