|
|
|
@ -343,6 +343,7 @@ gboolean cb_thread_network_data_add (gpointer data) {
|
|
|
|
|
GtkTextTag *tag_data;
|
|
|
|
|
GtkTextTag *tag_info;
|
|
|
|
|
GtkTextTag *tag_modbus;
|
|
|
|
|
GtkTextTag *tag_error;
|
|
|
|
|
time_t _tm =time(NULL);
|
|
|
|
|
struct tm * curtime = localtime (&_tm);
|
|
|
|
|
static int _once = 0;
|
|
|
|
@ -355,6 +356,8 @@ gboolean cb_thread_network_data_add (gpointer data) {
|
|
|
|
|
"foreground", "black", "style", PANGO_WEIGHT_NORMAL, "family", "Monospace", NULL);
|
|
|
|
|
tag_info = gtk_text_buffer_create_tag (textbuffer, "Info",
|
|
|
|
|
"foreground", "green", "style", PANGO_WEIGHT_THIN, "family", "Sans", NULL);
|
|
|
|
|
tag_error = gtk_text_buffer_create_tag (textbuffer, "Error",
|
|
|
|
|
"foreground", "red", "style", PANGO_WEIGHT_BOLD, "family", "Sans", NULL);
|
|
|
|
|
tag_modbus = gtk_text_buffer_create_tag (textbuffer, "Modbus",
|
|
|
|
|
"foreground", "black", "style", PANGO_WEIGHT_NORMAL, "family", "Sans", NULL);
|
|
|
|
|
}
|
|
|
|
@ -372,11 +375,12 @@ gboolean cb_thread_network_data_add (gpointer data) {
|
|
|
|
|
else if (i % 32 == 0) text += "\n ";
|
|
|
|
|
else if (i % 4 == 0 && i > 0) text += " : ";
|
|
|
|
|
else if (i % 2 == 0 && i > 0) text += ":";
|
|
|
|
|
// else text += " ";
|
|
|
|
|
|
|
|
|
|
text += hexnum[c/16];
|
|
|
|
|
text += hexnum[c%16];
|
|
|
|
|
}
|
|
|
|
|
text += "\n";
|
|
|
|
|
|
|
|
|
|
gtk_text_buffer_get_start_iter(textbuffer, &start);
|
|
|
|
|
gtk_text_buffer_insert_with_tags_by_name(textbuffer, &start, text.c_str(), -1, "Data", NULL);
|
|
|
|
|
|
|
|
|
@ -407,20 +411,30 @@ gboolean cb_thread_network_data_add (gpointer data) {
|
|
|
|
|
text = text + " Cnt: " + std::to_string (mbdata->regcnt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
text = text + "\n";
|
|
|
|
|
text = text + " Bytecnt: "+ std::to_string (mbdata->bytecnt) +"\n";
|
|
|
|
|
gtk_text_buffer_get_start_iter(textbuffer, &start);
|
|
|
|
|
gtk_text_buffer_insert_with_tags_by_name(textbuffer, &start, text.c_str(), -1, "Modbus", NULL);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// number of bytes
|
|
|
|
|
text = std::to_string(mbdata->bufferlen) + " Bytes";
|
|
|
|
|
gtk_text_buffer_get_start_iter(textbuffer, &start);
|
|
|
|
|
gtk_text_buffer_insert_with_tags_by_name(textbuffer, &start, text.c_str(), -1, "Info", NULL);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
text ="";
|
|
|
|
|
text += mbdata->hostname;
|
|
|
|
|
if (mbdata->direction == 0) text = text + " RECV ";
|
|
|
|
|
else text = text + " SEND ";
|
|
|
|
|
text = text + std::to_string(mbdata->bufferlen) + " Bytes";
|
|
|
|
|
// Hostname
|
|
|
|
|
text = mbdata->hostname;
|
|
|
|
|
gtk_text_buffer_get_start_iter(textbuffer, &start);
|
|
|
|
|
gtk_text_buffer_insert_with_tags_by_name(textbuffer, &start, text.c_str(), -1, "Info", NULL);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// direction or error
|
|
|
|
|
if (mbdata->direction == 0)
|
|
|
|
|
gtk_text_buffer_insert_with_tags_by_name(textbuffer, &start, (const char*)" RECV ", -1, "Info", NULL);
|
|
|
|
|
else if (mbdata->direction == 1)
|
|
|
|
|
gtk_text_buffer_insert_with_tags_by_name(textbuffer, &start, (const char*)" SEND ", -1, "Info", NULL);
|
|
|
|
|
else
|
|
|
|
|
gtk_text_buffer_insert_with_tags_by_name(textbuffer, &start, (const char*)" ** ERROR **", -1, "Error", NULL);
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// add date
|
|
|
|
|