From: Denis Kenzior Date: Fri, 5 Jun 2009 22:56:11 +0000 (-0500) Subject: Add utility for parsing MWI SMS DCS types X-Git-Tag: 0.1~152 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f9f30807816700c44c30c7d04b80c65497f0558d;p=platform%2Fupstream%2Fofono.git Add utility for parsing MWI SMS DCS types --- diff --git a/src/smsutil.c b/src/smsutil.c index ca301dd..b381b8c 100644 --- a/src/smsutil.c +++ b/src/smsutil.c @@ -172,6 +172,50 @@ gboolean sms_dcs_decode(guint8 dcs, enum sms_class *cls, return TRUE; } +gboolean sms_mwi_dcs_decode(guint8 dcs, enum sms_mwi_type *type, + enum sms_charset *charset, + gboolean *active, gboolean *discard) +{ + guint8 upper = (dcs & 0xf0) >> 4; + enum sms_mwi_type t; + enum sms_charset ch; + gboolean dis; + gboolean act; + + if (upper < 0xC || upper > 0xE) + return FALSE; + + upper = (dcs & 0x30) >> 4; + + if (upper == 0) + dis = TRUE; + else + dis = FALSE; + + if (upper == 3) + ch = SMS_CHARSET_UCS2; + else + ch = SMS_CHARSET_7BIT; + + act = dcs & 0x8; + + t = (enum sms_mwi_type) (dcs & 0x3); + + if (type) + *type = t; + + if (charset) + *charset = ch; + + if (active) + *active = act; + + if (discard) + *discard = dis; + + return TRUE; +} + int sms_udl_in_bytes(guint8 ud_len, guint8 dcs) { int len_7bit = (ud_len + 1) * 7 / 8; diff --git a/src/smsutil.h b/src/smsutil.h index b5f15c7..37dffb1 100644 --- a/src/smsutil.h +++ b/src/smsutil.h @@ -156,6 +156,13 @@ enum sms_charset { SMS_CHARSET_UCS2 = 2, }; +enum sms_mwi_type { + SMS_MWI_TYPE_VOICE = 0, + SMS_MWI_TYPE_FAX = 1, + SMS_MWI_TYPE_EMAIL = 2, + SMS_MWI_TYPE_OTHER = 3, +}; + struct sms_address { enum sms_number_type number_type; enum sms_numbering_plan numbering_plan; @@ -317,4 +324,9 @@ gboolean sms_udh_iter_next(struct sms_udh_iter *iter); gboolean sms_dcs_decode(guint8 dcs, enum sms_class *cls, enum sms_charset *charset, gboolean *compressed, gboolean *autodelete); + +gboolean sms_mwi_dcs_decode(guint8 dcs, enum sms_mwi_type *type, + enum sms_charset *charset, + gboolean *active, gboolean *discard); + #endif