Commit 46f294df authored by Claes Sjofors's avatar Claes Sjofors Committed by Claes Sjöfors

Xtt logging in python format

parent 09c0dfc6
This diff is collapsed.
......@@ -49,6 +49,10 @@
#define RTT_LOGG_LINE_DEFSIZE 512
typedef enum { xtt_LoggType_Cont = 1, xtt_LoggType_Mod = 2 } xtt_LoggType;
typedef enum {
xtt_eLoggFormat_Std,
xtt_eLoggFormat_Py
} xtt_eLoggFormat;
class XttLogging {
public:
......@@ -62,6 +66,7 @@ public:
int stop_logg;
int logg_type;
int logg_priority;
xtt_eLoggFormat logg_format;
pwr_tAName parameterstr[RTT_LOGG_MAXPAR];
pwr_tAName shortname[RTT_LOGG_MAXPAR];
char* parameter_ptr[RTT_LOGG_MAXPAR];
......@@ -88,10 +93,11 @@ public:
void init(int logg_index, void* logg_xnav);
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 show();
int show_entry(char* buff, int* buff_cnt);
int analyse();
int store(char* filename);
int start();
int stop();
......
......@@ -3211,6 +3211,10 @@ int XNav::show_logging(int index)
new ItemCommand(brow, Lng::translate("Show curve"), 0, NULL,
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",
pwr_eType_Float32, sizeof(logg[0].logg_time), 0, 100000, 0,
(void*)&logg[index].logg_time, NULL, flow_eDest_IntoLast);
......@@ -3220,6 +3224,9 @@ int XNav::show_logging(int index)
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,
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",
pwr_eType_Int32, sizeof(logg[0].wanted_buffer_size), 0, 0, 0,
(void*)&logg[index].wanted_buffer_size, NULL, flow_eDest_IntoLast);
......
......@@ -285,7 +285,7 @@ dcli_tCmdTable xnav_command_table[] = {
} },
{ "TEST", &xnav_test_func, { "dcli_arg1", "dcli_arg2", "" } },
{ "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",
"/STOP", "/NOSTOP", "/CREATE", "/ALL", "/LINE_SIZE", "/SHORTNAME",
"/NOSHORTNAME", "" } },
......@@ -6636,6 +6636,7 @@ static int xnav_logging_func(void* client_data, void* client_flag)
int buffer_size;
int nr;
int logg_type = 0;
int logg_format = -1;
int insert;
int create;
int shortname;
......@@ -6717,6 +6718,14 @@ static int xnav_logging_func(void* client_data, void* client_flag)
} else
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(
"/PRIORITY", priority_str, sizeof(priority_str)))) {
/* convert to integer */
......@@ -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,
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);
return sts;
}
......@@ -6889,6 +6898,40 @@ static int xnav_logging_func(void* client_data, void* client_flag)
sts = xnav->logg[entry - 1].show();
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) {
/* 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