sms-part: add helper debug logs
This commit is contained in:
@@ -248,12 +248,16 @@ sms_decode_text (const guint8 *text, int len, SmsEncoding encoding, int bit_offs
|
|||||||
guint32 unpacked_len;
|
guint32 unpacked_len;
|
||||||
|
|
||||||
if (encoding == MM_SMS_ENCODING_GSM7) {
|
if (encoding == MM_SMS_ENCODING_GSM7) {
|
||||||
|
mm_dbg ("Converting SMS part text from GSM7 to UTF8...");
|
||||||
unpacked = gsm_unpack ((const guint8 *) text, len, bit_offset, &unpacked_len);
|
unpacked = gsm_unpack ((const guint8 *) text, len, bit_offset, &unpacked_len);
|
||||||
utf8 = (char *) mm_charset_gsm_unpacked_to_utf8 (unpacked, unpacked_len);
|
utf8 = (char *) mm_charset_gsm_unpacked_to_utf8 (unpacked, unpacked_len);
|
||||||
|
mm_dbg (" Got UTF-8 text: '%s'", utf8);
|
||||||
g_free (unpacked);
|
g_free (unpacked);
|
||||||
} else if (encoding == MM_SMS_ENCODING_UCS2)
|
} else if (encoding == MM_SMS_ENCODING_UCS2) {
|
||||||
|
mm_dbg ("Converting SMS part text from UCS-2BE to UTF8...");
|
||||||
utf8 = g_convert ((char *) text, len, "UTF8", "UCS-2BE", NULL, NULL, NULL);
|
utf8 = g_convert ((char *) text, len, "UTF8", "UCS-2BE", NULL, NULL, NULL);
|
||||||
else {
|
mm_dbg (" Got UTF-8 text: '%s'", utf8);
|
||||||
|
} else {
|
||||||
g_warn_if_reached ();
|
g_warn_if_reached ();
|
||||||
utf8 = g_strdup ("");
|
utf8 = g_strdup ("");
|
||||||
}
|
}
|
||||||
@@ -575,6 +579,7 @@ mm_sms_part_new_from_binary_pdu (guint index,
|
|||||||
/* 8-bit encoding is usually binary data, and we have no idea what
|
/* 8-bit encoding is usually binary data, and we have no idea what
|
||||||
* actual encoding the data is in so we can't convert it.
|
* actual encoding the data is in so we can't convert it.
|
||||||
*/
|
*/
|
||||||
|
mm_dbg ("Skipping SMS part text: 8-bit or Unknown encoding");
|
||||||
mm_sms_part_set_text (sms_part, "");
|
mm_sms_part_set_text (sms_part, "");
|
||||||
} else {
|
} else {
|
||||||
/* Otherwise if it's 7-bit or UCS2 we can decode it */
|
/* Otherwise if it's 7-bit or UCS2 we can decode it */
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "mm-sms-part.h"
|
#include "mm-sms-part.h"
|
||||||
#include "mm-utils.h"
|
#include "mm-utils.h"
|
||||||
|
#include "mm-log.h"
|
||||||
|
|
||||||
/* If defined will print debugging traces */
|
/* If defined will print debugging traces */
|
||||||
#ifdef TEST_SMS_PART_ENABLE_TRACE
|
#ifdef TEST_SMS_PART_ENABLE_TRACE
|
||||||
@@ -668,6 +669,16 @@ test_create_pdu_gsm_no_validity (void)
|
|||||||
1); /* expected_msgstart */
|
1); /* expected_msgstart */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_mm_log (const char *loc,
|
||||||
|
const char *func,
|
||||||
|
guint32 level,
|
||||||
|
const char *fmt,
|
||||||
|
...)
|
||||||
|
{
|
||||||
|
/* Dummy log function */
|
||||||
|
}
|
||||||
|
|
||||||
int main (int argc, char **argv)
|
int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
g_type_init ();
|
g_type_init ();
|
||||||
|
Reference in New Issue
Block a user