Commit 2de57dd6 authored by winckel's avatar winckel

Added function to save filtered messages.

Added an exclusifity flag for file choosers execution.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4853 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 758e766b
...@@ -29,6 +29,9 @@ extern int debug_parser; ...@@ -29,6 +29,9 @@ extern int debug_parser;
# define INDENT_START 0 # define INDENT_START 0
#endif #endif
void *xml_raw_data;
uint32_t xml_raw_data_size;
types_t *xml_head; types_t *xml_head;
types_t *root; types_t *root;
...@@ -667,13 +670,21 @@ static int free_elements(types_t *parent, int indent) { ...@@ -667,13 +670,21 @@ static int free_elements(types_t *parent, int indent) {
return RC_OK; return RC_OK;
} }
int xml_parse_buffer(const char *xml_buffer, const int size) { int xml_parse_buffer(char *xml_buffer, const int size) {
xmlDocPtr doc; /* the resulting document tree */ xmlDocPtr doc; /* the resulting document tree */
if (xml_buffer == NULL) { if (xml_buffer == NULL) {
return RC_NULL_POINTER; return RC_NULL_POINTER;
} }
if (xml_raw_data != NULL)
{
/* Free previous raw data */
free (xml_raw_data);
}
xml_raw_data = xml_buffer;
xml_raw_data_size = size;
if (xml_head != NULL) if (xml_head != NULL)
{ {
/* Free previous definitions */ /* Free previous definitions */
......
...@@ -4,11 +4,14 @@ ...@@ -4,11 +4,14 @@
#ifndef XML_PARSE_H_ #ifndef XML_PARSE_H_
#define XML_PARSE_H_ #define XML_PARSE_H_
extern void *xml_raw_data;
extern uint32_t xml_raw_data_size;
extern types_t *root; extern types_t *root;
int xml_parse_file(const char *filename); int xml_parse_file(const char *filename);
int xml_parse_buffer(const char *xml_buffer, const int size); int xml_parse_buffer(char *xml_buffer, const int size);
int dissect_signal(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_cb, int dissect_signal(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_cb,
gpointer user_data); gpointer user_data);
......
#ifndef LOCATE_ROOT_H_ #ifndef LOCATE_ROOT_H_
#define LOCATE_ROOT_H_ #define LOCATE_ROOT_H_
#include "types.h"
extern types_t *messages_id_enum; extern types_t *messages_id_enum;
extern types_t *lte_time_type; extern types_t *lte_time_type;
extern types_t *lte_time_frame_type; extern types_t *lte_time_frame_type;
......
...@@ -53,7 +53,9 @@ gboolean ui_callback_on_open_messages(GtkWidget *widget, gpointer data) ...@@ -53,7 +53,9 @@ gboolean ui_callback_on_open_messages(GtkWidget *widget, gpointer data)
gboolean ui_callback_on_save_messages(GtkWidget *widget, gpointer data) gboolean ui_callback_on_save_messages(GtkWidget *widget, gpointer data)
{ {
g_message("Save messages event occurred"); g_message("Save messages event occurred");
// CHECK_FCT(ui_file_chooser());
CHECK_FCT(ui_messages_save_file_chooser());
return TRUE; return TRUE;
} }
...@@ -497,8 +499,6 @@ static gboolean ui_handle_socket_xml_definition(gint fd, void *data, size_t data ...@@ -497,8 +499,6 @@ static gboolean ui_handle_socket_xml_definition(gint fd, void *data, size_t data
xml_parse_buffer (xml_definition_message->xml_definition, xml_definition_message->xml_definition_length); xml_parse_buffer (xml_definition_message->xml_definition, xml_definition_message->xml_definition_length);
free (data);
return TRUE; return TRUE;
} }
......
#ifndef UI_NOTIFICATIONS_H_ #ifndef UI_NOTIFICATIONS_H_
#define UI_NOTIFICATIONS_H_ #define UI_NOTIFICATIONS_H_
typedef void (*message_write_callback_t) (const gpointer buffer, const gchar *signal_name);
int ui_disable_connect_button(void); int ui_disable_connect_button(void);
int ui_enable_connect_button(void); int ui_enable_connect_button(void);
...@@ -9,6 +11,8 @@ int ui_messages_read(char *filename); ...@@ -9,6 +11,8 @@ int ui_messages_read(char *filename);
int ui_messages_open_file_chooser(void); int ui_messages_open_file_chooser(void);
int ui_messages_save_file_chooser(void);
int ui_filters_open_file_chooser(void); int ui_filters_open_file_chooser(void);
int ui_filters_save_file_chooser(void); int ui_filters_save_file_chooser(void);
......
...@@ -450,7 +450,7 @@ int ui_tree_view_new_signal_ind(const uint32_t message_number, const gchar *lte_ ...@@ -450,7 +450,7 @@ int ui_tree_view_new_signal_ind(const uint32_t message_number, const gchar *lte_
ui_tree_view_add_to_list (ui_main_data.messages_list, lte_time, message_number, message_id, message_name, ui_tree_view_add_to_list (ui_main_data.messages_list, lte_time, message_number, message_id, message_name,
origin_task_id, origin_task_name, destination_task_id, destination_task_name, instance_id, instance_name, origin_task_id, origin_task_name, destination_task_id, destination_task_name, instance_id, instance_name,
(buffer_t *) buffer); buffer);
return RC_OK; return RC_OK;
} }
...@@ -526,6 +526,51 @@ void ui_tree_view_refilter() ...@@ -526,6 +526,51 @@ void ui_tree_view_refilter()
g_info("ui_tree_view_refilter: last message %d, %d messages displayed", ui_store.filtered_last_msg, ui_store.filtered_msg_number); g_info("ui_tree_view_refilter: last message %d, %d messages displayed", ui_store.filtered_last_msg, ui_store.filtered_msg_number);
} }
typedef struct foreach_message_params_s
{
message_write_callback_t callback;
gboolean filter;
} foreach_message_params_t;
static gboolean foreach_message(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
{
foreach_message_params_t *params = (foreach_message_params_t *) data;
const gchar *signal_name;
uint32_t message_id;
uint32_t origin_task_id;
uint32_t destination_task_id;
uint32_t instance;
gpointer buffer = NULL;
gtk_tree_model_get (model, iter, COL_MESSAGE, &signal_name, COL_MESSAGE_ID, &message_id, COL_FROM_TASK_ID, &origin_task_id, COL_TO_TASK_ID,
&destination_task_id, COL_INSTANCE_ID, &instance, COL_BUFFER, &buffer, -1);
if (params->filter == TRUE)
{
gboolean enabled = FALSE;
enabled = ui_filters_message_enabled (message_id, origin_task_id, destination_task_id, instance);
if (enabled == FALSE)
{
buffer = NULL;
}
}
if (buffer != NULL)
{
params->callback(buffer, signal_name);
}
return FALSE;
}
void ui_tree_view_foreach_message(message_write_callback_t callback, gboolean filter)
{
foreach_message_params_t params = {callback, filter};
gtk_tree_model_foreach (GTK_TREE_MODEL(ui_store.store), foreach_message, (void *) &params);
}
guint ui_tree_view_get_filtered_number(void) guint ui_tree_view_get_filtered_number(void)
{ {
return ui_store.filtered_msg_number; return ui_store.filtered_msg_number;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define UI_TREE_VIEW_H_ #define UI_TREE_VIEW_H_
#include "ui_filters.h" #include "ui_filters.h"
#include "ui_notifications.h"
typedef enum col_type_e typedef enum col_type_e
{ {
...@@ -64,6 +65,8 @@ void ui_tree_view_select_row(gint row); ...@@ -64,6 +65,8 @@ void ui_tree_view_select_row(gint row);
void ui_tree_view_refilter(void); void ui_tree_view_refilter(void);
void ui_tree_view_foreach_message(message_write_callback_t callback, gboolean filter);
guint ui_tree_view_get_filtered_number(void); guint ui_tree_view_get_filtered_number(void);
#endif /* UI_TREE_VIEW_H_ */ #endif /* UI_TREE_VIEW_H_ */
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