|
|
|
@ -21,6 +21,11 @@ void log_addtext (int logtype, std::string text, NWTReqResult *data) {
|
|
|
|
|
struct tm * curtime = localtime (&_tm);
|
|
|
|
|
static int _once = 0;
|
|
|
|
|
|
|
|
|
|
if (textview == NULL || textbuffer == NULL) {
|
|
|
|
|
fprintf (stderr, "%s:%d textview (%p) or textbuffer (%p) empty.\n", __FILE__, __LINE__, textview, textbuffer);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_once == 0) {
|
|
|
|
|
_once = 1;
|
|
|
|
|
tag_datetime = gtk_text_buffer_create_tag (textbuffer, "LogDateTime",
|
|
|
|
@ -40,12 +45,14 @@ void log_addtext (int logtype, std::string text, NWTReqResult *data) {
|
|
|
|
|
// display data if there are any
|
|
|
|
|
//
|
|
|
|
|
if (data != NULL && data->rawdatalen > 0 && data->rawdata != NULL) {
|
|
|
|
|
str = "";
|
|
|
|
|
printf ("%s rawdatalen:%d rawdata:%p\n", __FUNCTION__, data->rawdatalen, data->rawdata);
|
|
|
|
|
str = "";
|
|
|
|
|
for (int i = 0; i < data->rawdatalen; i++) {
|
|
|
|
|
if (i & 16) str += "\n ";
|
|
|
|
|
else if (i & 4 && i > 0) str += " ";
|
|
|
|
|
if ((i % 16) == 0) str += "\n ";
|
|
|
|
|
else if ((i % 4) == 0 && i > 0) str += " ";
|
|
|
|
|
str += to_hex8(data->rawdata[i]);
|
|
|
|
|
}
|
|
|
|
|
printf ("\n%s:%d \n'%s'\n", __FILE__, __LINE__, str.c_str());
|
|
|
|
|
gtk_text_buffer_insert_with_tags_by_name(textbuffer, &start, str.c_str(), -1, "LogData", NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|