api: new `DischargeTimestamp' property for Status Report SMS messages

This commit is contained in:
Aleksander Morgado
2012-09-11 15:03:08 +02:00
parent f1a73a5719
commit 320984a4a0
4 changed files with 31 additions and 4 deletions

View File

@@ -120,12 +120,28 @@
<!-- <!--
Timestamp: Timestamp:
Time message was received or was sent, in Time when the first PDU of the SMS message arrived the SMSC, in
<ulink url="http://en.wikipedia.org/wiki/ISO_8601">ISO8601</ulink> <ulink url="http://en.wikipedia.org/wiki/ISO_8601">ISO8601</ulink>
format. format.
This field is only applicable if the PDU type is
<link linkend="MM-SMS-PDU-TYPE-DELIVER:CAPS"><constant>MM_SMS_PDU_TYPE_DELIVER</constant></link>.
or
<link linkend="MM-SMS-PDU-TYPE-STATUS-REPORT:CAPS"><constant>MM_SMS_PDU_TYPE_STATUS_REPORT</constant></link>.
--> -->
<property name="Timestamp" type="s" access="read" /> <property name="Timestamp" type="s" access="read" />
<!--
DischargeTimestamp:
Time when the first PDU of the SMS message left the SMSC, in
<ulink url="http://en.wikipedia.org/wiki/ISO_8601">ISO8601</ulink>
format.
This field is only applicable if the PDU type is
<link linkend="MM-SMS-PDU-TYPE-STATUS-REPORT:CAPS"><constant>MM_SMS_PDU_TYPE_STATUS_REPORT</constant></link>.
-->
<property name="DischargeTimestamp" type="s" access="read" />
<!-- <!--
Storage: Storage:

View File

@@ -321,6 +321,7 @@ struct _MMSmsPart {
MMSmsPduType pdu_type; MMSmsPduType pdu_type;
gchar *smsc; gchar *smsc;
gchar *timestamp; gchar *timestamp;
gchar *discharge_timestamp;
gchar *number; gchar *number;
gchar *text; gchar *text;
MMSmsEncoding encoding; MMSmsEncoding encoding;
@@ -339,6 +340,7 @@ struct _MMSmsPart {
void void
mm_sms_part_free (MMSmsPart *self) mm_sms_part_free (MMSmsPart *self)
{ {
g_free (self->discharge_timestamp);
g_free (self->timestamp); g_free (self->timestamp);
g_free (self->smsc); g_free (self->smsc);
g_free (self->number); g_free (self->number);
@@ -390,6 +392,8 @@ PART_GET_FUNC (const gchar *, number)
PART_SET_TAKE_STR_FUNC (number) PART_SET_TAKE_STR_FUNC (number)
PART_GET_FUNC (const gchar *, timestamp) PART_GET_FUNC (const gchar *, timestamp)
PART_SET_TAKE_STR_FUNC (timestamp) PART_SET_TAKE_STR_FUNC (timestamp)
PART_GET_FUNC (const gchar *, discharge_timestamp)
PART_SET_TAKE_STR_FUNC (discharge_timestamp)
PART_GET_FUNC (guint, concat_max) PART_GET_FUNC (guint, concat_max)
PART_SET_FUNC (guint, concat_max) PART_SET_FUNC (guint, concat_max)
PART_GET_FUNC (guint, concat_sequence) PART_GET_FUNC (guint, concat_sequence)
@@ -680,8 +684,8 @@ mm_sms_part_new_from_binary_pdu (guint index,
offset += 7; offset += 7;
/* ------ Discharge Timestamp (7 bytes) ------ */ /* ------ Discharge Timestamp (7 bytes) ------ */
mm_sms_part_take_timestamp (sms_part, mm_sms_part_take_discharge_timestamp (sms_part,
sms_decode_timestamp (&pdu[offset])); sms_decode_timestamp (&pdu[offset]));
offset += 7; offset += 7;
/* ----- TP-STATUS (1 byte) ------ */ /* ----- TP-STATUS (1 byte) ------ */

View File

@@ -74,6 +74,12 @@ void mm_sms_part_set_timestamp (MMSmsPart *part,
void mm_sms_part_take_timestamp (MMSmsPart *part, void mm_sms_part_take_timestamp (MMSmsPart *part,
gchar *timestamp); gchar *timestamp);
const gchar *mm_sms_part_get_discharge_timestamp (MMSmsPart *part);
void mm_sms_part_set_discharge_timestamp (MMSmsPart *part,
const gchar *timestamp);
void mm_sms_part_take_discharge_timestamp (MMSmsPart *part,
gchar *timestamp);
const gchar *mm_sms_part_get_text (MMSmsPart *part); const gchar *mm_sms_part_get_text (MMSmsPart *part);
void mm_sms_part_set_text (MMSmsPart *part, void mm_sms_part_set_text (MMSmsPart *part,
const gchar *text); const gchar *text);

View File

@@ -1182,8 +1182,9 @@ assemble_sms (MMSms *self,
"smsc", mm_sms_part_get_smsc (sorted_parts[0]), "smsc", mm_sms_part_get_smsc (sorted_parts[0]),
"class", mm_sms_part_get_class (sorted_parts[0]), "class", mm_sms_part_get_class (sorted_parts[0]),
"number", mm_sms_part_get_number (sorted_parts[0]), "number", mm_sms_part_get_number (sorted_parts[0]),
"timestamp", mm_sms_part_get_timestamp (sorted_parts[0]),
"validity", mm_sms_part_get_validity (sorted_parts[0]), "validity", mm_sms_part_get_validity (sorted_parts[0]),
"timestamp", mm_sms_part_get_timestamp (sorted_parts[0]),
"discharge-timestamp", mm_sms_part_get_discharge_timestamp (sorted_parts[0]),
/* delivery report request usually set in the last part only */ /* delivery report request usually set in the last part only */
"delivery-report-request", mm_sms_part_get_delivery_report_request (sorted_parts[self->priv->max_parts - 1]), "delivery-report-request", mm_sms_part_get_delivery_report_request (sorted_parts[self->priv->max_parts - 1]),
NULL); NULL);