Commit 643870cd authored by winckel's avatar winckel
Browse files

Added an instance column.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4370 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent aa27146a
...@@ -778,6 +778,7 @@ static int xml_parse_doc(xmlDocPtr doc) { ...@@ -778,6 +778,7 @@ static int xml_parse_doc(xmlDocPtr doc) {
CHECK_FCT(locate_type("MessagesIds", head, &messages_id_enum)); CHECK_FCT(locate_type("MessagesIds", head, &messages_id_enum));
CHECK_FCT(locate_type("originTaskId", head, &origin_task_id_type)); CHECK_FCT(locate_type("originTaskId", head, &origin_task_id_type));
CHECK_FCT(locate_type("destinationTaskId", head, &destination_task_id_type)); CHECK_FCT(locate_type("destinationTaskId", head, &destination_task_id_type));
CHECK_FCT(locate_type("instance", head, &instance_type));
// root->type_hr_display(root, 0); // root->type_hr_display(root, 0);
update_filters(); update_filters();
if (dissect_file != NULL) { if (dissect_file != NULL) {
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
types_t *messages_id_enum = NULL; types_t *messages_id_enum = NULL;
types_t *origin_task_id_type = NULL; types_t *origin_task_id_type = NULL;
types_t *destination_task_id_type = NULL; types_t *destination_task_id_type = NULL;
types_t *instance_type = NULL;
int locate_root(const char *root_name, types_t *head, types_t **root_elm) { int locate_root(const char *root_name, types_t *head, types_t **root_elm) {
types_t *next_type; types_t *next_type;
...@@ -114,6 +115,15 @@ char *get_destination_task_id(buffer_t *buffer) { ...@@ -114,6 +115,15 @@ char *get_destination_task_id(buffer_t *buffer) {
return destination_task_id; return destination_task_id;
} }
uint32_t get_instance(buffer_t *buffer) {
uint32_t instance_value;
/* Fetch instance value */
buffer_fetch_bits (buffer, instance_type->offset, instance_type->child->child->child->size, &instance_value);
return instance_value;
}
char *message_id_to_string(uint32_t message_id) char *message_id_to_string(uint32_t message_id)
{ {
return enum_type_get_name_from_value(messages_id_enum, message_id); return enum_type_get_name_from_value(messages_id_enum, message_id);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
extern types_t *messages_id_enum; extern types_t *messages_id_enum;
extern types_t *origin_task_id_type; extern types_t *origin_task_id_type;
extern types_t *destination_task_id_type; extern types_t *destination_task_id_type;
extern types_t *instance_type;
int locate_root(const char *root_name, types_t *head, types_t **root); int locate_root(const char *root_name, types_t *head, types_t **root);
...@@ -17,4 +18,6 @@ char *get_origin_task_id(buffer_t *buffer); ...@@ -17,4 +18,6 @@ char *get_origin_task_id(buffer_t *buffer);
char *get_destination_task_id(buffer_t *buffer); char *get_destination_task_id(buffer_t *buffer);
uint32_t get_instance(buffer_t *buffer);
#endif /* LOCATE_ROOT_H_ */ #endif /* LOCATE_ROOT_H_ */
...@@ -119,7 +119,8 @@ void ui_signal_add_to_list(gpointer data, gpointer user_data) ...@@ -119,7 +119,8 @@ void ui_signal_add_to_list(gpointer data, gpointer user_data)
get_message_id (root, signal_buffer, &signal_buffer->message_id); get_message_id (root, signal_buffer, &signal_buffer->message_id);
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, message_id_to_string (signal_buffer->message_id),
get_origin_task_id (signal_buffer), get_destination_task_id (signal_buffer), data); get_origin_task_id (signal_buffer), get_destination_task_id (signal_buffer),
get_instance (signal_buffer), data);
/* Increment number of messages */ /* Increment number of messages */
ui_main_data.nb_message_received++; ui_main_data.nb_message_received++;
......
...@@ -18,16 +18,15 @@ typedef struct ...@@ -18,16 +18,15 @@ typedef struct
{ {
GtkListStore *store; GtkListStore *store;
GtkTreeModelFilter *filtered; GtkTreeModelFilter *filtered;
guint filtered_last_msg; uint32_t filtered_last_msg;
guint filtered_msg_number; uint32_t filtered_msg_number;
} ui_store_t; } ui_store_t;
static ui_store_t ui_store; 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)
{ {
char *msg_number; uint32_t msg_number;
guint number = 0;
char *message; char *message;
char *origin_task; char *origin_task;
char *destination_task; char *destination_task;
...@@ -35,17 +34,16 @@ static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter, ...@@ -35,17 +34,16 @@ static gboolean ui_tree_filter_messages(GtkTreeModel *model, GtkTreeIter *iter,
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_SIGNAL, &message, COL_FROM_TASK, &origin_task,
COL_TO_TASK, &destination_task, -1); COL_TO_TASK, &destination_task, -1);
if (msg_number != NULL) if (msg_number != 0)
{ {
number = atoi (msg_number);
enabled = ui_filters_message_enabled (message, origin_task, destination_task); enabled = ui_filters_message_enabled (message, origin_task, destination_task);
if ((enabled) && (ui_store.filtered_last_msg < number)) if ((enabled) && (ui_store.filtered_last_msg < msg_number))
{ {
ui_store.filtered_last_msg = number; ui_store.filtered_last_msg = msg_number;
ui_store.filtered_msg_number++; ui_store.filtered_msg_number++;
} }
// g_debug("%x %x %d %s %s %s %d %d", (int) model, (int) iter, number, message, origin_task, destination_task, enabled, ui_store.filtered_msg_number); g_debug("%x %x %d %s %s %s %d %d", (int) model, (int) iter, msg_number, message, origin_task, destination_task, enabled, ui_store.filtered_msg_number);
} }
g_free (message); g_free (message);
...@@ -84,17 +82,32 @@ ui_tree_view_init_list(GtkWidget *list) ...@@ -84,17 +82,32 @@ ui_tree_view_init_list(GtkWidget *list)
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_TO_TASK); G_CALLBACK(ui_callback_on_tree_column_header_click), (gpointer) COL_TO_TASK);
column = gtk_tree_view_column_new_with_attributes(
"Ins", renderer, "text", COL_INSTANCE, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(list), column);
ui_store.store = gtk_list_store_new(NUM_COLS, ui_store.store = gtk_list_store_new(NUM_COLS,
G_TYPE_STRING, G_TYPE_UINT, // COL_MSG_NUM
G_TYPE_STRING, G_TYPE_STRING, // COL_SIGNAL
G_TYPE_STRING, G_TYPE_STRING, // COL_FROM_TASK
G_TYPE_STRING, G_TYPE_STRING, // COL_TO_TASK
G_TYPE_UINT, // COL_INSTANCE
/* HACK: add id of message fields to speed-up filtering
*/
G_TYPE_UINT, // COL_SIGNAL_ID
G_TYPE_UINT, // COL_FROM_TASK_ID
G_TYPE_UINT, // COL_TO_TASK_ID
/* HACK: add a reference to the buffer here /* HACK: add a reference to the buffer here
* to avoid maintining multiple lists. * to avoid maintining multiple lists.
* The reference is not displayed * The reference is not displayed
*/ */
G_TYPE_POINTER); G_TYPE_POINTER);
if(ui_store.store == NULL)
{
g_error("gtk_list_store_new failed");
}
ui_store.filtered = GTK_TREE_MODEL_FILTER (gtk_tree_model_filter_new (GTK_TREE_MODEL (ui_store.store), NULL)); ui_store.filtered = GTK_TREE_MODEL_FILTER (gtk_tree_model_filter_new (GTK_TREE_MODEL (ui_store.store), NULL));
gtk_tree_model_filter_set_visible_func (ui_store.filtered, gtk_tree_model_filter_set_visible_func (ui_store.filtered,
(GtkTreeModelFilterVisibleFunc) ui_tree_filter_messages, (GtkTreeModelFilterVisibleFunc) ui_tree_filter_messages,
...@@ -105,20 +118,24 @@ ui_tree_view_init_list(GtkWidget *list) ...@@ -105,20 +118,24 @@ 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 gchar *message_number, static void ui_tree_view_add_to_list(GtkWidget *list, const uint32_t message_number,
const gchar *signal_name, const char *origin_task, const gchar *signal_name, const char *origin_task,
const char *to_task, gpointer buffer) const char *to_task, uint32_t instance, gpointer buffer)
{ {
GtkTreeIter iter; GtkTreeIter iter;
gtk_list_store_append(ui_store.store, &iter); gtk_list_store_append(ui_store.store, &iter);
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_SIGNAL , signal_name,
COL_FROM_TASK , origin_task, COL_FROM_TASK , origin_task,
COL_TO_TASK , to_task, COL_TO_TASK , to_task,
COL_BUFFER , buffer, COL_INSTANCE , instance,
COL_SIGNAL_ID , 0,
COL_FROM_TASK_ID , 0,
COL_TO_TASK_ID , 0,
COL_BUFFER , buffer,
/* End of columns */ /* End of columns */
-1); -1);
} }
...@@ -162,7 +179,7 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox) ...@@ -162,7 +179,7 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox)
ui_tree_view_init_list(ui_main_data.signalslist); ui_tree_view_init_list(ui_main_data.signalslist);
gtk_tree_view_set_headers_clickable(GTK_TREE_VIEW(ui_main_data.signalslist), TRUE); gtk_tree_view_set_headers_clickable(GTK_TREE_VIEW(ui_main_data.signalslist), TRUE);
gtk_widget_set_size_request(GTK_WIDGET(scrolled_window), 500, -1); gtk_widget_set_size_request(GTK_WIDGET(scrolled_window), 530, -1);
gtk_box_pack_start(GTK_BOX(hbox), scrolled_window, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), scrolled_window, FALSE, FALSE, 0);
ui_main_data.text_view = ui_signal_dissect_new(hbox); ui_main_data.text_view = ui_signal_dissect_new(hbox);
...@@ -178,14 +195,14 @@ int ui_tree_view_create(GtkWidget *window, GtkWidget *vbox) ...@@ -178,14 +195,14 @@ 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 *signal_name,
const char *origin_task, const char *to_task, gpointer buffer) const char *origin_task, const char *to_task, uint32_t instance, gpointer buffer)
{ {
gchar message_number_str[11]; gchar message_number_str[11];
sprintf(message_number_str, "%u", message_number); sprintf(message_number_str, "%u", message_number);
ui_tree_view_add_to_list(ui_main_data.signalslist, message_number_str, signal_name, ui_tree_view_add_to_list(ui_main_data.signalslist, message_number, signal_name,
origin_task, to_task, (buffer_t *)buffer); origin_task, to_task, instance, (buffer_t *)buffer);
return RC_OK; return RC_OK;
} }
......
...@@ -7,6 +7,12 @@ typedef enum ...@@ -7,6 +7,12 @@ typedef enum
COL_SIGNAL, COL_SIGNAL,
COL_FROM_TASK, COL_FROM_TASK,
COL_TO_TASK, COL_TO_TASK,
COL_INSTANCE,
COL_SIGNAL_ID,
COL_FROM_TASK_ID,
COL_TO_TASK_ID,
COL_BUFFER, COL_BUFFER,
NUM_COLS NUM_COLS
} col_type_e; } col_type_e;
...@@ -14,7 +20,7 @@ typedef enum ...@@ -14,7 +20,7 @@ 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 *signal_name,
const char *origin_task, const char *to_task, gpointer buffer); const char *origin_task, 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