api: new `DeliveryState' property in the SMS interface
Given only for STATUS REPORT SMS messages.
This commit is contained in:
@@ -21,6 +21,7 @@ MMModemState
|
||||
MMModemStateChangeReason
|
||||
MMSmsPduType
|
||||
MMSmsState
|
||||
MMSmsDeliveryState
|
||||
MMSmsStorage
|
||||
</SECTION>
|
||||
|
||||
|
@@ -390,6 +390,77 @@ typedef enum { /*< underscore_name=mm_sms_state >*/
|
||||
MM_SMS_STATE_SENT = 5,
|
||||
} MMSmsState;
|
||||
|
||||
/**
|
||||
* MMSmsDeliveryState:
|
||||
* @MM_SMS_DELIVERY_STATE_COMPLETED_RECEIVED: Delivery completed, message received by the SME.
|
||||
* @MM_SMS_DELIVERY_STATE_COMPLETED_FORWARDED_UNCONFIRMED: Forwarded by the SC to the SME but the SC is unable to confirm delivery.
|
||||
* @MM_SMS_DELIVERY_STATE_COMPLETED_REPLACED_BY_SC: Message replaced by the SC.
|
||||
* @MM_SMS_DELIVERY_STATE_TEMPORARY_ERROR_CONGESTION: Temporary error, congestion.
|
||||
* @MM_SMS_DELIVERY_STATE_TEMPORARY_ERROR_SME_BUSY: Temporary error, SME busy.
|
||||
* @MM_SMS_DELIVERY_STATE_TEMPORARY_ERROR_NO_RESPONSE_FROM_SME: Temporary error, no response from the SME.
|
||||
* @MM_SMS_DELIVERY_STATE_TEMPORARY_ERROR_SERVICE_REJECTED: Temporary error, service rejected.
|
||||
* @MM_SMS_DELIVERY_STATE_TEMPORARY_ERROR_QOS_NOT_AVAILABLE: Temporary error, QoS not available.
|
||||
* @MM_SMS_DELIVERY_STATE_TEMPORARY_ERROR_IN_SME: Temporary error in the SME.
|
||||
* @MM_SMS_DELIVERY_STATE_ERROR_REMOTE_PROCEDURE: Permanent remote procedure error.
|
||||
* @MM_SMS_DELIVERY_STATE_ERROR_INCOMPATIBLE_DESTINATION: Permanent error, incompatible destination.
|
||||
* @MM_SMS_DELIVERY_STATE_ERROR_CONNECTION_REJECTED: Permanent error, connection rejected by the SME.
|
||||
* @MM_SMS_DELIVERY_STATE_ERROR_NOT_OBTAINABLE: Permanent error, not obtainable.
|
||||
* @MM_SMS_DELIVERY_STATE_ERROR_QOS_NOT_AVAILABLE: Permanent error, QoS not available.
|
||||
* @MM_SMS_DELIVERY_STATE_ERROR_NO_INTERWORKING_AVAILABLE: Permanent error, no interworking available.
|
||||
* @MM_SMS_DELIVERY_STATE_ERROR_VALIDITY_PERIOD_EXPIRED: Permanent error, message validity period expired.
|
||||
* @MM_SMS_DELIVERY_STATE_ERROR_DELETED_BY_ORIGINATING_SME: Permanent error, deleted by originating SME.
|
||||
* @MM_SMS_DELIVERY_STATE_ERROR_DELETED_BY_SC_ADMINISTRATION: Permanent error, deleted by SC administration.
|
||||
* @MM_SMS_DELIVERY_STATE_ERROR_MESSAGE_DOES_NOT_EXIST: Permanent error, message does no longer exist.
|
||||
* @MM_SMS_DELIVERY_STATE_TEMPORARY_FATAL_ERROR_CONGESTION: Permanent error, congestion.
|
||||
* @MM_SMS_DELIVERY_STATE_TEMPORARY_FATAL_ERROR_SME_BUSY: Permanent error, SME busy.
|
||||
* @MM_SMS_DELIVERY_STATE_TEMPORARY_FATAL_ERROR_NO_RESPONSE_FROM_SME: Permanent error, no response from the SME.
|
||||
* @MM_SMS_DELIVERY_STATE_TEMPORARY_FATAL_ERROR_SERVICE_REJECTED: Permanent error, service rejected.
|
||||
* @MM_SMS_DELIVERY_STATE_TEMPORARY_FATAL_ERROR_QOS_NOT_AVAILABLE: Permanent error, QoS not available.
|
||||
* @MM_SMS_DELIVERY_STATE_TEMPORARY_FATAL_ERROR_IN_SME: Permanent error in SME.
|
||||
* @MM_SMS_DELIVERY_STATE_UNKNOWN: Unknown state.
|
||||
*
|
||||
* Enumeration of known SMS delivery states as defined in 3GPP TS 03.40.
|
||||
*
|
||||
* States out of the known ranges may also be valid (either reserved or SC-specific).
|
||||
*/
|
||||
typedef enum { /*< underscore_name=mm_sms_delivery_state >*/
|
||||
/* Completed deliveries */
|
||||
MM_SMS_DELIVERY_STATE_COMPLETED_RECEIVED = 0x00,
|
||||
MM_SMS_DELIVERY_STATE_COMPLETED_FORWARDED_UNCONFIRMED = 0x01,
|
||||
MM_SMS_DELIVERY_STATE_COMPLETED_REPLACED_BY_SC = 0x02,
|
||||
|
||||
/* Temporary failures */
|
||||
MM_SMS_DELIVERY_STATE_TEMPORARY_ERROR_CONGESTION = 0x20,
|
||||
MM_SMS_DELIVERY_STATE_TEMPORARY_ERROR_SME_BUSY = 0x21,
|
||||
MM_SMS_DELIVERY_STATE_TEMPORARY_ERROR_NO_RESPONSE_FROM_SME = 0x22,
|
||||
MM_SMS_DELIVERY_STATE_TEMPORARY_ERROR_SERVICE_REJECTED = 0x23,
|
||||
MM_SMS_DELIVERY_STATE_TEMPORARY_ERROR_QOS_NOT_AVAILABLE = 0x24,
|
||||
MM_SMS_DELIVERY_STATE_TEMPORARY_ERROR_IN_SME = 0x25,
|
||||
|
||||
/* Permanent failures */
|
||||
MM_SMS_DELIVERY_STATE_ERROR_REMOTE_PROCEDURE = 0x40,
|
||||
MM_SMS_DELIVERY_STATE_ERROR_INCOMPATIBLE_DESTINATION = 0x41,
|
||||
MM_SMS_DELIVERY_STATE_ERROR_CONNECTION_REJECTED = 0x42,
|
||||
MM_SMS_DELIVERY_STATE_ERROR_NOT_OBTAINABLE = 0x43,
|
||||
MM_SMS_DELIVERY_STATE_ERROR_QOS_NOT_AVAILABLE = 0x44,
|
||||
MM_SMS_DELIVERY_STATE_ERROR_NO_INTERWORKING_AVAILABLE = 0x45,
|
||||
MM_SMS_DELIVERY_STATE_ERROR_VALIDITY_PERIOD_EXPIRED = 0x46,
|
||||
MM_SMS_DELIVERY_STATE_ERROR_DELETED_BY_ORIGINATING_SME = 0x47,
|
||||
MM_SMS_DELIVERY_STATE_ERROR_DELETED_BY_SC_ADMINISTRATION = 0x48,
|
||||
MM_SMS_DELIVERY_STATE_ERROR_MESSAGE_DOES_NOT_EXIST = 0x49,
|
||||
|
||||
/* Temporary failures that became permanent */
|
||||
MM_SMS_DELIVERY_STATE_TEMPORARY_FATAL_ERROR_CONGESTION = 0x60,
|
||||
MM_SMS_DELIVERY_STATE_TEMPORARY_FATAL_ERROR_SME_BUSY = 0x61,
|
||||
MM_SMS_DELIVERY_STATE_TEMPORARY_FATAL_ERROR_NO_RESPONSE_FROM_SME = 0x62,
|
||||
MM_SMS_DELIVERY_STATE_TEMPORARY_FATAL_ERROR_SERVICE_REJECTED = 0x63,
|
||||
MM_SMS_DELIVERY_STATE_TEMPORARY_FATAL_ERROR_QOS_NOT_AVAILABLE = 0x64,
|
||||
MM_SMS_DELIVERY_STATE_TEMPORARY_FATAL_ERROR_IN_SME = 0x65,
|
||||
|
||||
/* Unknown, out of any possible valid value [0x00-0xFF] */
|
||||
MM_SMS_DELIVERY_STATE_UNKNOWN = 0x100
|
||||
} MMSmsDeliveryState;
|
||||
|
||||
/**
|
||||
* MMSmsStorage:
|
||||
* @MM_SMS_STORAGE_UNKNOWN: Storage unknown.
|
||||
|
@@ -153,6 +153,17 @@
|
||||
-->
|
||||
<property name="DischargeTimestamp" type="s" access="read" />
|
||||
|
||||
<!--
|
||||
DeliveryState:
|
||||
|
||||
A <link linkend="MMSmsDeliveryState">MMSmsDeliveryState</link> value,
|
||||
describing the state of the delivery reported in the Status Report message.
|
||||
|
||||
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="DeliveryState" type="u" access="read" />
|
||||
|
||||
<!--
|
||||
Storage:
|
||||
|
||||
|
@@ -761,3 +761,47 @@ mm_get_string_unquoted_from_match_info (GMatchInfo *match_info,
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
const gchar *
|
||||
mm_sms_delivery_state_get_string_extended (guint delivery_state)
|
||||
{
|
||||
if (delivery_state > 0x02 && delivery_state < 0x20) {
|
||||
if (delivery_state < 0x10)
|
||||
return "completed-reason-reserved";
|
||||
else
|
||||
return "completed-sc-specific-reason";
|
||||
}
|
||||
|
||||
if (delivery_state > 0x25 && delivery_state < 0x40) {
|
||||
if (delivery_state < 0x30)
|
||||
return "temporary-error-reason-reserved";
|
||||
else
|
||||
return "temporary-error-sc-specific-reason";
|
||||
}
|
||||
|
||||
if (delivery_state > 0x49 && delivery_state < 0x60) {
|
||||
if (delivery_state < 0x50)
|
||||
return "error-reason-reserved";
|
||||
else
|
||||
return "error-sc-specific-reason";
|
||||
}
|
||||
|
||||
if (delivery_state > 0x65 && delivery_state < 0x80) {
|
||||
if (delivery_state < 0x70)
|
||||
return "temporary-fatal-error-reason-reserved";
|
||||
else
|
||||
return "temporary-fatal-error-sc-specific-reason";
|
||||
}
|
||||
|
||||
if (delivery_state >= 0x80 && delivery_state < 0x100)
|
||||
return "unknown-reason-reserved";
|
||||
|
||||
if (delivery_state >= 0x100)
|
||||
return "unknown";
|
||||
|
||||
/* Otherwise, use the MMSmsDeliveryState enum as we can match the known
|
||||
* value */
|
||||
return mm_sms_delivery_state_get_string ((MMSmsDeliveryState)delivery_state);
|
||||
}
|
||||
|
@@ -87,4 +87,6 @@ gboolean mm_get_double_from_match_info (GMatchInfo *match_info,
|
||||
gchar *mm_get_string_unquoted_from_match_info (GMatchInfo *match_info,
|
||||
guint32 match_index);
|
||||
|
||||
const gchar *mm_sms_delivery_state_get_string_extended (guint delivery_state);
|
||||
|
||||
#endif /* MM_COMMON_HELPERS_H */
|
||||
|
@@ -331,6 +331,8 @@ struct _MMSmsPart {
|
||||
guint validity;
|
||||
gboolean delivery_report_request;
|
||||
guint message_reference;
|
||||
/* NOT a MMSmsDeliveryState, which just includes the known values */
|
||||
guint delivery_state;
|
||||
|
||||
gboolean should_concat;
|
||||
guint concat_reference;
|
||||
@@ -413,6 +415,8 @@ PART_GET_FUNC (gboolean, delivery_report_request)
|
||||
PART_SET_FUNC (gboolean, delivery_report_request)
|
||||
PART_GET_FUNC (guint, message_reference)
|
||||
PART_SET_FUNC (guint, message_reference)
|
||||
PART_GET_FUNC (guint, delivery_state)
|
||||
PART_SET_FUNC (guint, delivery_state)
|
||||
|
||||
PART_GET_FUNC (guint, concat_reference)
|
||||
|
||||
@@ -459,6 +463,8 @@ mm_sms_part_new (guint index,
|
||||
sms_part = g_slice_new0 (MMSmsPart);
|
||||
sms_part->index = index;
|
||||
sms_part->pdu_type = pdu_type;
|
||||
sms_part->encoding = MM_SMS_ENCODING_UNKNOWN;
|
||||
sms_part->delivery_state = MM_SMS_DELIVERY_STATE_UNKNOWN;
|
||||
|
||||
return sms_part;
|
||||
}
|
||||
@@ -693,7 +699,8 @@ mm_sms_part_new_from_binary_pdu (guint index,
|
||||
offset += 7;
|
||||
|
||||
/* ----- TP-STATUS (1 byte) ------ */
|
||||
mm_dbg (" status: %u", (guint)pdu[offset]);
|
||||
mm_dbg (" delivery state: %u", (guint)pdu[offset]);
|
||||
mm_sms_part_set_delivery_state (sms_part, pdu[offset]);
|
||||
offset++;
|
||||
|
||||
/* ------ TP-PI (1 byte) OPTIONAL ------ */
|
||||
|
@@ -108,6 +108,10 @@ guint mm_sms_part_get_validity (MMSmsPart *part);
|
||||
void mm_sms_part_set_validity (MMSmsPart *part,
|
||||
guint validity);
|
||||
|
||||
guint mm_sms_part_get_delivery_state (MMSmsPart *part);
|
||||
void mm_sms_part_set_delivery_state (MMSmsPart *part,
|
||||
guint delivery_state);
|
||||
|
||||
guint mm_sms_part_get_message_reference (MMSmsPart *part);
|
||||
void mm_sms_part_set_message_reference (MMSmsPart *part,
|
||||
guint message_reference);
|
||||
|
@@ -1252,6 +1252,7 @@ assemble_sms (MMSms *self,
|
||||
"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-state", mm_sms_part_get_delivery_state (sorted_parts[0]),
|
||||
/* delivery report request and message reference taken always from the last part */
|
||||
"message-reference", mm_sms_part_get_message_reference (sorted_parts[self->priv->max_parts - 1]),
|
||||
"delivery-report-request", mm_sms_part_get_delivery_report_request (sorted_parts[self->priv->max_parts - 1]),
|
||||
|
Reference in New Issue
Block a user