api: add 'ServiceCategory' property to the SMS interface

Will be used in 3GPP2 SMS messages.
This commit is contained in:
Aleksander Morgado
2013-07-18 13:32:16 +02:00
parent d0fb94c49f
commit 0bb91ce53d
8 changed files with 126 additions and 3 deletions

View File

@@ -200,15 +200,17 @@ print_sms_info (MMSms *sms)
VALIDATE (mm_sms_get_smsc (sms)),
mm_sms_get_class (sms));
}
/* Teleservice ID is 3GPP2 specific */
/* Teleservice ID and service category are 3GPP2 specific */
else if (pdu_type == MM_SMS_PDU_TYPE_CDMA_DELIVER ||
pdu_type == MM_SMS_PDU_TYPE_CDMA_SUBMIT ||
pdu_type == MM_SMS_PDU_TYPE_CDMA_CANCELLATION ||
pdu_type == MM_SMS_PDU_TYPE_CDMA_DELIVERY_ACKNOWLEDGEMENT ||
pdu_type == MM_SMS_PDU_TYPE_CDMA_USER_ACKNOWLEDGEMENT ||
pdu_type == MM_SMS_PDU_TYPE_CDMA_READ_ACKNOWLEDGEMENT) {
g_print (" | teleservice id: '%s'\n",
mm_sms_cdma_teleservice_id_get_string (mm_sms_get_teleservice_id (sms)));
g_print (" | teleservice id: '%s'\n"
" | service category: '%s'\n",
mm_sms_cdma_teleservice_id_get_string (mm_sms_get_teleservice_id (sms)),
mm_sms_cdma_service_category_get_string (mm_sms_get_service_category (sms)));
}
if (pdu_type == MM_SMS_PDU_TYPE_SUBMIT)

View File

@@ -44,6 +44,7 @@ MMSmsDeliveryState
MMSmsStorage
MMSmsValidityType
MMSmsCdmaTeleserviceId
MMSmsCdmaServiceCategory
</SECTION>
<SECTION>

View File

@@ -1051,6 +1051,7 @@ mm_sms_dup_smsc
mm_sms_get_message_reference
mm_sms_get_class
mm_sms_get_teleservice_id
mm_sms_get_service_category
mm_sms_get_validity_type
mm_sms_get_validity_relative
mm_sms_get_timestamp
@@ -1151,6 +1152,7 @@ mm_sms_delivery_state_get_string
mm_sms_storage_get_string
mm_sms_validity_type_get_string
mm_sms_cdma_teleservice_id_get_string
mm_sms_cdma_service_category_get_string
mm_firmware_image_type_get_string
mm_oma_feature_build_string_from_mask
mm_oma_session_type_get_string
@@ -1172,6 +1174,7 @@ mm_sms_delivery_state_build_string_from_mask
mm_sms_storage_build_string_from_mask
mm_sms_validity_type_build_string_from_mask
mm_sms_cdma_teleservice_id_build_string_from_mask
mm_sms_cdma_service_category_build_string_from_mask
mm_modem_location_source_get_string
mm_modem_contacts_storage_build_string_from_mask
mm_bearer_ip_family_build_string_from_mask
@@ -1222,6 +1225,7 @@ MM_TYPE_SMS_STATE
MM_TYPE_SMS_STORAGE
MM_TYPE_SMS_VALIDITY_TYPE
MM_TYPE_SMS_CDMA_TELESERVICE_ID
MM_TYPE_SMS_CDMA_SERVICE_CATEGORY
MM_TYPE_OMA_FEATURE
MM_TYPE_OMA_SESSION_STATE
MM_TYPE_OMA_SESSION_STATE_FAILED_REASON
@@ -1256,6 +1260,7 @@ mm_sms_state_get_type
mm_sms_storage_get_type
mm_sms_validity_type_get_type
mm_sms_cdma_teleservice_id_get_type
mm_sms_cdma_service_category_get_type
mm_oma_feature_get_type
mm_oma_session_state_failed_reason_get_type
mm_oma_session_state_get_type
@@ -2614,6 +2619,7 @@ mm_gdbus_sms_get_validity
mm_gdbus_sms_dup_validity
mm_gdbus_sms_get_class
mm_gdbus_sms_get_teleservice_id
mm_gdbus_sms_get_service_category
mm_gdbus_sms_get_timestamp
mm_gdbus_sms_dup_timestamp
mm_gdbus_sms_get_discharge_timestamp
@@ -2630,6 +2636,7 @@ mm_gdbus_sms_call_store_sync
<SUBSECTION Private>
mm_gdbus_sms_set_class
mm_gdbus_sms_set_teleservice_id
mm_gdbus_sms_set_service_category
mm_gdbus_sms_set_data
mm_gdbus_sms_set_delivery_report_request
mm_gdbus_sms_set_delivery_state

View File

@@ -600,6 +600,88 @@ typedef enum { /*< underscore_name=mm_sms_cdma_teleservice_id >*/
MM_SMS_CDMA_TELESERVICE_ID_CATPT = 0x1007,
} MMSmsCdmaTeleserviceId;
/**
* MMSmsCdmaServiceCategory:
* @MM_SMS_CDMA_SERVICE_CATEGORY_UNKNOWN: Unknown.
* @MM_SMS_CDMA_SERVICE_CATEGORY_EMERGENCY_BROADCAST: Emergency broadcast.
* @MM_SMS_CDMA_SERVICE_CATEGORY_ADMINISTRATIVE: Administrative.
* @MM_SMS_CDMA_SERVICE_CATEGORY_MAINTENANCE: Maintenance.
* @MM_SMS_CDMA_SERVICE_CATEGORY_GENERAL_NEWS_LOCAL: General news (local).
* @MM_SMS_CDMA_SERVICE_CATEGORY_GENERAL_NEWS_REGIONAL: General news (regional).
* @MM_SMS_CDMA_SERVICE_CATEGORY_GENERAL_NEWS_NATIONAL: General news (national).
* @MM_SMS_CDMA_SERVICE_CATEGORY_GENERAL_NEWS_INTERNATIONAL: General news (international).
* @MM_SMS_CDMA_SERVICE_CATEGORY_BUSINESS_NEWS_LOCAL: Business/Financial news (local).
* @MM_SMS_CDMA_SERVICE_CATEGORY_BUSINESS_NEWS_REGIONAL: Business/Financial news (regional).
* @MM_SMS_CDMA_SERVICE_CATEGORY_BUSINESS_NEWS_NATIONAL: Business/Financial news (national).
* @MM_SMS_CDMA_SERVICE_CATEGORY_BUSINESS_NEWS_INTERNATIONAL: Business/Financial news (international).
* @MM_SMS_CDMA_SERVICE_CATEGORY_SPORTS_NEWS_LOCAL: Sports news (local).
* @MM_SMS_CDMA_SERVICE_CATEGORY_SPORTS_NEWS_REGIONAL: Sports news (regional).
* @MM_SMS_CDMA_SERVICE_CATEGORY_SPORTS_NEWS_NATIONAL: Sports news (national).
* @MM_SMS_CDMA_SERVICE_CATEGORY_SPORTS_NEWS_INTERNATIONAL: Sports news (international).
* @MM_SMS_CDMA_SERVICE_CATEGORY_ENTERTAINMENT_NEWS_LOCAL: Entertainment news (local).
* @MM_SMS_CDMA_SERVICE_CATEGORY_ENTERTAINMENT_NEWS_REGIONAL: Entertainment news (regional).
* @MM_SMS_CDMA_SERVICE_CATEGORY_ENTERTAINMENT_NEWS_NATIONAL: Entertainment news (national).
* @MM_SMS_CDMA_SERVICE_CATEGORY_ENTERTAINMENT_NEWS_INTERNATIONAL: Entertainment news (international).
* @MM_SMS_CDMA_SERVICE_CATEGORY_LOCAL_WEATHER: Local weather.
* @MM_SMS_CDMA_SERVICE_CATEGORY_TRAFFIC_REPORT: Area traffic report.
* @MM_SMS_CDMA_SERVICE_CATEGORY_FLIGHT_SCHEDULES: Local airport flight schedules.
* @MM_SMS_CDMA_SERVICE_CATEGORY_RESTAURANTS: Restaurants.
* @MM_SMS_CDMA_SERVICE_CATEGORY_LODGINGS: Lodgings.
* @MM_SMS_CDMA_SERVICE_CATEGORY_RETAIL_DIRECTORY: Retail directory.
* @MM_SMS_CDMA_SERVICE_CATEGORY_ADVERTISEMENTS: Advertisements.
* @MM_SMS_CDMA_SERVICE_CATEGORY_STOCK_QUOTES: Stock quotes.
* @MM_SMS_CDMA_SERVICE_CATEGORY_EMPLOYMENT: Employment.
* @MM_SMS_CDMA_SERVICE_CATEGORY_HOSPITALS: Medical / Health / Hospitals.
* @MM_SMS_CDMA_SERVICE_CATEGORY_TECHNOLOGY_NEWS: Technology news.
* @MM_SMS_CDMA_SERVICE_CATEGORY_MULTICATEGORY: Multi-category.
* @MM_SMS_CDMA_SERVICE_CATEGORY_CMAS_PRESIDENTIAL_ALERT: Presidential alert.
* @MM_SMS_CDMA_SERVICE_CATEGORY_CMAS_EXTREME_THREAT: Extreme threat.
* @MM_SMS_CDMA_SERVICE_CATEGORY_CMAS_SEVERE_THREAT: Severe threat.
* @MM_SMS_CDMA_SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY: Child abduction emergency.
* @MM_SMS_CDMA_SERVICE_CATEGORY_CMAS_TEST: CMAS test.
*
* Service category for CDMA SMS, as defined in 3GPP2 C.R1001-D (section 9.3).
*/
typedef enum { /*< underscore_name=mm_sms_cdma_service_category >*/
MM_SMS_CDMA_SERVICE_CATEGORY_UNKNOWN = 0x0000,
MM_SMS_CDMA_SERVICE_CATEGORY_EMERGENCY_BROADCAST = 0x0001,
MM_SMS_CDMA_SERVICE_CATEGORY_ADMINISTRATIVE = 0x0002,
MM_SMS_CDMA_SERVICE_CATEGORY_MAINTENANCE = 0x0003,
MM_SMS_CDMA_SERVICE_CATEGORY_GENERAL_NEWS_LOCAL = 0x0004,
MM_SMS_CDMA_SERVICE_CATEGORY_GENERAL_NEWS_REGIONAL = 0x0005,
MM_SMS_CDMA_SERVICE_CATEGORY_GENERAL_NEWS_NATIONAL = 0x0006,
MM_SMS_CDMA_SERVICE_CATEGORY_GENERAL_NEWS_INTERNATIONAL = 0x0007,
MM_SMS_CDMA_SERVICE_CATEGORY_BUSINESS_NEWS_LOCAL = 0x0008,
MM_SMS_CDMA_SERVICE_CATEGORY_BUSINESS_NEWS_REGIONAL = 0x0009,
MM_SMS_CDMA_SERVICE_CATEGORY_BUSINESS_NEWS_NATIONAL = 0x000A,
MM_SMS_CDMA_SERVICE_CATEGORY_BUSINESS_NEWS_INTERNATIONAL = 0x000B,
MM_SMS_CDMA_SERVICE_CATEGORY_SPORTS_NEWS_LOCAL = 0x000C,
MM_SMS_CDMA_SERVICE_CATEGORY_SPORTS_NEWS_REGIONAL = 0x000D,
MM_SMS_CDMA_SERVICE_CATEGORY_SPORTS_NEWS_NATIONAL = 0x000E,
MM_SMS_CDMA_SERVICE_CATEGORY_SPORTS_NEWS_INTERNATIONAL = 0x000F,
MM_SMS_CDMA_SERVICE_CATEGORY_ENTERTAINMENT_NEWS_LOCAL = 0x0010,
MM_SMS_CDMA_SERVICE_CATEGORY_ENTERTAINMENT_NEWS_REGIONAL = 0x0011,
MM_SMS_CDMA_SERVICE_CATEGORY_ENTERTAINMENT_NEWS_NATIONAL = 0x0012,
MM_SMS_CDMA_SERVICE_CATEGORY_ENTERTAINMENT_NEWS_INTERNATIONAL = 0x0013,
MM_SMS_CDMA_SERVICE_CATEGORY_LOCAL_WEATHER = 0x0014,
MM_SMS_CDMA_SERVICE_CATEGORY_TRAFFIC_REPORT = 0x0015,
MM_SMS_CDMA_SERVICE_CATEGORY_FLIGHT_SCHEDULES = 0x0016,
MM_SMS_CDMA_SERVICE_CATEGORY_RESTAURANTS = 0x0017,
MM_SMS_CDMA_SERVICE_CATEGORY_LODGINGS = 0x0018,
MM_SMS_CDMA_SERVICE_CATEGORY_RETAIL_DIRECTORY = 0x0019,
MM_SMS_CDMA_SERVICE_CATEGORY_ADVERTISEMENTS = 0x001A,
MM_SMS_CDMA_SERVICE_CATEGORY_STOCK_QUOTES = 0x001B,
MM_SMS_CDMA_SERVICE_CATEGORY_EMPLOYMENT = 0x001C,
MM_SMS_CDMA_SERVICE_CATEGORY_HOSPITALS = 0x001D,
MM_SMS_CDMA_SERVICE_CATEGORY_TECHNOLOGY_NEWS = 0x001E,
MM_SMS_CDMA_SERVICE_CATEGORY_MULTICATEGORY = 0x001F,
MM_SMS_CDMA_SERVICE_CATEGORY_CMAS_PRESIDENTIAL_ALERT = 0x1000,
MM_SMS_CDMA_SERVICE_CATEGORY_CMAS_EXTREME_THREAT = 0x1001,
MM_SMS_CDMA_SERVICE_CATEGORY_CMAS_SEVERE_THREAT = 0x1002,
MM_SMS_CDMA_SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY = 0x1003,
MM_SMS_CDMA_SERVICE_CATEGORY_CMAS_TEST = 0x1004,
} MMSmsCdmaServiceCategory;
/**
* MMModemLocationSource:
* @MM_MODEM_LOCATION_SOURCE_NONE: None.

View File

@@ -137,6 +137,15 @@
-->
<property name="TeleserviceId" type="u" access="read" />
<!--
ServiceCategory:
A <link linkend="MMSmsCdmaServiceCategory">MMSmsCdmaServiceCategory</link> value.
Always <link linkend="MM-SMS-CDMA-SERVICE-CATEGORY-UNKNOWN:CAPS">MM_SMS_CDMA_SERVICE_CATEGORY_UNKNOWN</link> for 3GPP.
-->
<property name="ServiceCategory" type="u" access="read" />
<!--
DeliveryReportRequest:

View File

@@ -588,6 +588,24 @@ mm_sms_get_teleservice_id (MMSms *self)
/*****************************************************************************/
/**
* mm_sms_get_service_category:
* @self: A #MMSms.
*
* Gets the 3GPP2 Service Category.
*
* Returns: a #MMSmsCdmaServiceCategory.
*/
MMSmsCdmaServiceCategory
mm_sms_get_service_category (MMSms *self)
{
g_return_val_if_fail (MM_IS_SMS (self), MM_SMS_CDMA_SERVICE_CATEGORY_UNKNOWN);
return (MMSmsCdmaServiceCategory) mm_gdbus_sms_get_service_category (MM_GDBUS_SMS (self));
}
/*****************************************************************************/
/**
* mm_sms_send_finish:
* @self: A #MMSms.

View File

@@ -105,6 +105,8 @@ MMSmsPduType mm_sms_get_pdu_type (MMSms *self);
MMSmsCdmaTeleserviceId mm_sms_get_teleservice_id (MMSms *self);
MMSmsCdmaServiceCategory mm_sms_get_service_category (MMSms *self);
void mm_sms_send (MMSms *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,

View File

@@ -1500,6 +1500,7 @@ assemble_sms (MMSms *self,
"smsc", mm_sms_part_get_smsc (sorted_parts[0]),
"class", mm_sms_part_get_class (sorted_parts[0]),
"teleservice-id", MM_SMS_CDMA_TELESERVICE_ID_UNKNOWN,
"service-category", MM_SMS_CDMA_SERVICE_CATEGORY_UNKNOWN,
"number", mm_sms_part_get_number (sorted_parts[0]),
"validity", (validity_relative ?
g_variant_new ("(uv)", MM_SMS_VALIDITY_TYPE_RELATIVE, g_variant_new_uint32 (validity_relative)) :
@@ -1739,6 +1740,7 @@ mm_sms_new_from_properties (MMBaseModem *modem,
"smsc", mm_sms_properties_get_smsc (properties),
"class", mm_sms_properties_get_class (properties),
"teleservice-id", MM_SMS_CDMA_TELESERVICE_ID_UNKNOWN,
"service-category", MM_SMS_CDMA_SERVICE_CATEGORY_UNKNOWN,
"delivery-report-request", mm_sms_properties_get_delivery_report_request (properties),
"validity", (mm_sms_properties_get_validity_type (properties) == MM_SMS_VALIDITY_TYPE_RELATIVE ?
g_variant_new ("(uv)", MM_SMS_VALIDITY_TYPE_RELATIVE, g_variant_new_uint32 (mm_sms_properties_get_validity_relative (properties))) :