Commit 3dbf9c4e authored by winckel's avatar winckel

Changed tree view fields and filtering to use integers in place of strings comparison.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4374 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 45f52474
...@@ -74,7 +74,7 @@ int locate_type(const char *type_name, types_t *head, types_t **type) { ...@@ -74,7 +74,7 @@ int locate_type(const char *type_name, types_t *head, types_t **type) {
return (next_type == NULL) ? RC_FAIL : RC_OK; return (next_type == NULL) ? RC_FAIL : RC_OK;
} }
int get_message_id(types_t *head, buffer_t *buffer, uint32_t *message_id) { uint32_t get_message_id(types_t *head, buffer_t *buffer, uint32_t *message_id) {
uint32_t value; uint32_t value;
g_assert(message_id != NULL); g_assert(message_id != NULL);
...@@ -87,32 +87,28 @@ int get_message_id(types_t *head, buffer_t *buffer, uint32_t *message_id) { ...@@ -87,32 +87,28 @@ int get_message_id(types_t *head, buffer_t *buffer, uint32_t *message_id) {
return RC_OK; return RC_OK;
} }
char *get_origin_task_id(buffer_t *buffer) { uint32_t get_task_id(buffer_t *buffer, types_t *task_id_type) {
char *origin_task_id = "UNKNOWN"; uint32_t task_id_value;
uint32_t origin_task_id_value;
/* Fetch task id value */ /* Fetch task id value */
if (buffer_fetch_bits(buffer, origin_task_id_type->offset, if (buffer_fetch_bits (buffer, task_id_type->offset, task_id_type->child->size, &task_id_value) != RC_OK)
origin_task_id_type->child->size, &origin_task_id_value) == RC_OK) { {
origin_task_id = enum_type_get_name_from_value(origin_task_id_type->child, return ~0;
origin_task_id_value);
} }
return origin_task_id; return task_id_value;
} }
char *get_destination_task_id(buffer_t *buffer) { char *task_id_to_string(uint32_t task_id_value, types_t *task_id_type) {
char *destination_task_id = "UNKNOWN"; char *task_id = "UNKNOWN";
uint32_t destination_task_id_value;
/* Fetch task id value */ if (task_id_value < ((uint32_t) ~0))
if (buffer_fetch_bits(buffer, destination_task_id_type->offset, {
destination_task_id_type->child->size, &destination_task_id_value) == RC_OK) { /* Search task id name */
destination_task_id = enum_type_get_name_from_value(destination_task_id_type->child, task_id = enum_type_get_name_from_value (task_id_type->child, task_id_value);
destination_task_id_value);
} }
return destination_task_id; return task_id;
} }
uint32_t get_instance(buffer_t *buffer) { uint32_t get_instance(buffer_t *buffer) {
......
...@@ -10,13 +10,13 @@ int locate_root(const char *root_name, types_t *head, types_t **root); ...@@ -10,13 +10,13 @@ int locate_root(const char *root_name, types_t *head, types_t **root);
int locate_type(const char *type_name, types_t *head, types_t **type); int locate_type(const char *type_name, types_t *head, types_t **type);
int get_message_id(types_t *head, buffer_t *buffer, uint32_t *message_id); uint32_t get_message_id(types_t *head, buffer_t *buffer, uint32_t *message_id);
char *message_id_to_string(uint32_t message_id); char *message_id_to_string(uint32_t message_id);
char *get_origin_task_id(buffer_t *buffer); uint32_t get_task_id(buffer_t *buffer, types_t *task_id_type);
char *get_destination_task_id(buffer_t *buffer); char *task_id_to_string(uint32_t task_id_value, types_t *task_id_type);
uint32_t get_instance(buffer_t *buffer); uint32_t get_instance(buffer_t *buffer);
......
...@@ -111,15 +111,20 @@ void ui_signal_add_to_list(gpointer data, gpointer user_data) ...@@ -111,15 +111,20 @@ void ui_signal_add_to_list(gpointer data, gpointer user_data)
buffer_t *signal_buffer; buffer_t *signal_buffer;
GtkTreePath *path; GtkTreePath *path;
GtkTreeViewColumn *focus_column; GtkTreeViewColumn *focus_column;
uint32_t origin_task_id;
uint32_t destination_task_id;
gtk_tree_view_get_cursor (GTK_TREE_VIEW(ui_main_data.signalslist), &path, &focus_column); gtk_tree_view_get_cursor (GTK_TREE_VIEW(ui_main_data.signalslist), &path, &focus_column);
signal_buffer = (buffer_t *) data; signal_buffer = (buffer_t *) data;
get_message_id (root, signal_buffer, &signal_buffer->message_id); get_message_id (root, signal_buffer, &signal_buffer->message_id);
origin_task_id = get_task_id (signal_buffer, origin_task_id_type);
destination_task_id = get_task_id (signal_buffer, destination_task_id_type);
ui_tree_view_new_signal_ind (signal_buffer->message_number, message_id_to_string (signal_buffer->message_id), ui_tree_view_new_signal_ind (signal_buffer->message_number, signal_buffer->message_id, message_id_to_string (signal_buffer->message_id),
get_origin_task_id (signal_buffer), get_destination_task_id (signal_buffer), origin_task_id, task_id_to_string (origin_task_id, origin_task_id_type),
destination_task_id, task_id_to_string (destination_task_id, destination_task_id_type),
get_instance (signal_buffer), data); get_instance (signal_buffer), data);
/* Increment number of messages */ /* Increment number of messages */
...@@ -394,7 +399,7 @@ gboolean ui_callback_on_tree_column_header_click(GtkWidget *widget, gpointer dat ...@@ -394,7 +399,7 @@ gboolean ui_callback_on_tree_column_header_click(GtkWidget *widget, gpointer dat
g_debug("ui_callback_on_tree_column_header_click %x", col); g_debug("ui_callback_on_tree_column_header_click %x", col);
switch (col) switch (col)
{ {
case COL_SIGNAL: case COL_MESSAGE:
ui_show_filter_menu (&ui_main_data.menu_filter_messages, &ui_filters.messages); ui_show_filter_menu (&ui_main_data.menu_filter_messages, &ui_filters.messages);
break; break;
......
...@@ -75,7 +75,6 @@ static int ui_search_name(ui_filter_t *filter, const char *name) ...@@ -75,7 +75,6 @@ static int ui_search_name(ui_filter_t *filter, const char *name)
return (item); return (item);
} }
/*
static int ui_search_id(ui_filter_t *filter, uint32_t value) static int ui_search_id(ui_filter_t *filter, uint32_t value)
{ {
int item; int item;
...@@ -90,7 +89,6 @@ static int ui_search_id(ui_filter_t *filter, uint32_t value) ...@@ -90,7 +89,6 @@ static int ui_search_id(ui_filter_t *filter, uint32_t value)
return (item); return (item);
} }
*/
static void ui_filter_set_enabled(uint8_t *enabled, ui_entry_enabled_e entry_enabled, gboolean new) static void ui_filter_set_enabled(uint8_t *enabled, ui_entry_enabled_e entry_enabled, gboolean new)
{ {
...@@ -167,13 +165,13 @@ void ui_filters_add(ui_filter_e filter, uint32_t value, const char *name, ui_ent ...@@ -167,13 +165,13 @@ void ui_filters_add(ui_filter_e filter, uint32_t value, const char *name, ui_ent
} }
} }
static gboolean ui_item_enabled(ui_filter_t *filter, const char *name) static gboolean ui_item_enabled(ui_filter_t *filter, const uint32_t value)
{ {
int item; int item;
if (name != NULL) if (value != (uint32_t) ~0)
{ {
item = ui_search_name (filter, name); item = ui_search_id (filter, value);
if (item < filter->used) if (item < filter->used)
{ {
...@@ -183,7 +181,7 @@ static gboolean ui_item_enabled(ui_filter_t *filter, const char *name) ...@@ -183,7 +181,7 @@ static gboolean ui_item_enabled(ui_filter_t *filter, const char *name)
return (FALSE); return (FALSE);
} }
gboolean ui_filters_message_enabled(const char *message, const char *origin_task, const char *destination_task) gboolean ui_filters_message_enabled(const uint32_t message, const uint32_t origin_task, const uint32_t destination_task)
{ {
gboolean result; gboolean result;
......
...@@ -43,7 +43,7 @@ int ui_init_filters(int reset, int clear_ids); ...@@ -43,7 +43,7 @@ int ui_init_filters(int reset, int clear_ids);
void ui_filters_add(ui_filter_e filter, uint32_t value, const char *name, ui_entry_enabled_e entry_enabled); void ui_filters_add(ui_filter_e filter, uint32_t value, const char *name, ui_entry_enabled_e entry_enabled);
gboolean ui_filters_message_enabled(const char *message, const char *origin_task, const char *destination_task); gboolean ui_filters_message_enabled(const uint32_t message, const uint32_t origin_task, const uint32_t destination_task);
int ui_filters_read(const char *file_name); int ui_filters_read(const char *file_name);
......
...@@ -27,29 +27,25 @@ static ui_store_t ui_store; ...@@ -27,29 +27,25 @@ static ui_store_t ui_store;
static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter, ui_store_t *store) static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter, ui_store_t *store)
{ {
uint32_t msg_number; uint32_t msg_number;
char *message; uint32_t message_id;
char *origin_task; uint32_t origin_task_id;
char *destination_task; uint32_t destination_task_id;
gboolean enabled = FALSE; gboolean enabled = FALSE;
gtk_tree_model_get (model, iter, COL_MSG_NUM, &msg_number, COL_SIGNAL, &message, COL_FROM_TASK, &origin_task, gtk_tree_model_get (model, iter, COL_MSG_NUM, &msg_number, COL_MESSAGE_ID, &message_id, COL_FROM_TASK_ID, &origin_task_id,
COL_TO_TASK, &destination_task, -1); COL_TO_TASK_ID, &destination_task_id, -1);
if (msg_number != 0) if (msg_number != 0)
{ {
enabled = ui_filters_message_enabled (message, origin_task, destination_task); enabled = ui_filters_message_enabled (message_id, origin_task_id, destination_task_id);
if ((enabled) && (ui_store.filtered_last_msg < msg_number)) if ((enabled) && (ui_store.filtered_last_msg < msg_number))
{ {
ui_store.filtered_last_msg = msg_number; ui_store.filtered_last_msg = msg_number;
ui_store.filtered_msg_number++; ui_store.filtered_msg_number++;
} }
g_debug("%p %p %d %s %s %s %d %d", model, iter, msg_number, message, origin_task, destination_task, enabled, ui_store.filtered_msg_number); g_debug("%p %p %d %d %d %d %d %d", model, iter, msg_number, message_id, origin_task_id, destination_task_id, enabled, ui_store.filtered_msg_number);
} }
g_free (message);
g_free (origin_task);
g_free (destination_task);
return enabled; return enabled;
} }
...@@ -65,10 +61,10 @@ ui_tree_view_init_list(GtkWidget *list) ...@@ -65,10 +61,10 @@ ui_tree_view_init_list(GtkWidget *list)
gtk_tree_view_append_column(GTK_TREE_VIEW(list), column); gtk_tree_view_append_column(GTK_TREE_VIEW(list), column);
column = gtk_tree_view_column_new_with_attributes( column = gtk_tree_view_column_new_with_attributes(
"Signal", renderer, "text", COL_SIGNAL, NULL); "Signal", renderer, "text", COL_MESSAGE, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(list), column); gtk_tree_view_append_column(GTK_TREE_VIEW(list), column);
g_signal_connect(G_OBJECT(column), "clicked", g_signal_connect(G_OBJECT(column), "clicked",
G_CALLBACK(ui_callback_on_tree_column_header_click), (gpointer) COL_SIGNAL); G_CALLBACK(ui_callback_on_tree_column_header_click), (gpointer) COL_MESSAGE);
column = gtk_tree_view_column_new_with_attributes( column = gtk_tree_view_column_new_with_attributes(
"From", renderer, "text", COL_FROM_TASK, NULL); "From", renderer, "text", COL_FROM_TASK, NULL);
...@@ -118,9 +114,9 @@ ui_tree_view_init_list(GtkWidget *list) ...@@ -118,9 +114,9 @@ ui_tree_view_init_list(GtkWidget *list)
gtk_tree_view_columns_autosize(GTK_TREE_VIEW(list)); gtk_tree_view_columns_autosize(GTK_TREE_VIEW(list));
} }
static void ui_tree_view_add_to_list(GtkWidget *list, const uint32_t message_number, static void ui_tree_view_add_to_list(GtkWidget *list, const uint32_t message_number, const uint32_t message_id, const gchar *signal_name,
const gchar *signal_name, const char *origin_task, const uint32_t origin_task_id, const char *origin_task,
const char *to_task, uint32_t instance, gpointer buffer) const uint32_t destination_task_id, const char *destination_task, uint32_t instance, gpointer buffer)
{ {
GtkTreeIter iter; GtkTreeIter iter;
...@@ -128,13 +124,13 @@ static void ui_tree_view_add_to_list(GtkWidget *list, const uint32_t message_num ...@@ -128,13 +124,13 @@ static void ui_tree_view_add_to_list(GtkWidget *list, const uint32_t message_num
gtk_list_store_set(ui_store.store, &iter, gtk_list_store_set(ui_store.store, &iter,
/* Columns */ /* Columns */
COL_MSG_NUM , message_number, COL_MSG_NUM , message_number,
COL_SIGNAL , signal_name, COL_MESSAGE , signal_name,
COL_FROM_TASK , origin_task, COL_FROM_TASK , origin_task,
COL_TO_TASK , to_task, COL_TO_TASK , destination_task,
COL_INSTANCE , instance, COL_INSTANCE , instance,
COL_SIGNAL_ID , 0, COL_MESSAGE_ID , message_id,
COL_FROM_TASK_ID , 0, COL_FROM_TASK_ID , origin_task_id,
COL_TO_TASK_ID , 0, COL_TO_TASK_ID , destination_task_id,
COL_BUFFER , buffer, COL_BUFFER , buffer,
/* End of columns */ /* End of columns */
-1); -1);
...@@ -194,15 +190,14 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox) ...@@ -194,15 +190,14 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox)
return 0; return 0;
} }
int ui_tree_view_new_signal_ind(const uint32_t message_number, const char *signal_name, int ui_tree_view_new_signal_ind(const uint32_t message_number,
const char *origin_task, const char *to_task, uint32_t instance, gpointer buffer) const uint32_t message_id, const char *message_name,
const uint32_t origin_task_id, const char *origin_task,
const uint32_t destination_task_id, const char *destination_task,
uint32_t instance, gpointer buffer)
{ {
gchar message_number_str[11]; ui_tree_view_add_to_list(ui_main_data.signalslist, message_number, message_id, message_name,
origin_task_id, origin_task, destination_task_id, destination_task, instance, (buffer_t *)buffer);
sprintf(message_number_str, "%u", message_number);
ui_tree_view_add_to_list(ui_main_data.signalslist, message_number, signal_name,
origin_task, to_task, instance, (buffer_t *)buffer);
return RC_OK; return RC_OK;
} }
......
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
typedef enum typedef enum
{ {
COL_MSG_NUM = 0, COL_MSG_NUM = 0,
COL_SIGNAL, COL_MESSAGE,
COL_FROM_TASK, COL_FROM_TASK,
COL_TO_TASK, COL_TO_TASK,
COL_INSTANCE, COL_INSTANCE,
COL_SIGNAL_ID, COL_MESSAGE_ID,
COL_FROM_TASK_ID, COL_FROM_TASK_ID,
COL_TO_TASK_ID, COL_TO_TASK_ID,
...@@ -19,8 +19,11 @@ typedef enum ...@@ -19,8 +19,11 @@ typedef enum
int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox); int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox);
int ui_tree_view_new_signal_ind(const uint32_t message_number, const char *signal_name, int ui_tree_view_new_signal_ind(const uint32_t message_number,
const char *origin_task, const char *to_task, uint32_t instance, gpointer buffer); const uint32_t message_id, const char *message_name,
const uint32_t origin_task_id, const char *origin_task,
const uint32_t destination_task_id, const char *to_task,
uint32_t instance, gpointer buffer);
void ui_tree_view_destroy_list(GtkWidget *list); void ui_tree_view_destroy_list(GtkWidget *list);
......
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