[RFC PATCH 3/6] Support for basic SMS Status Report.

Denis Kenzior denkenz at gmail.com
Fri Jun 4 10:01:21 PDT 2010


Hi Pasi,

> ---
>  src/sms.c |  110
>  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 
1 files
>  changed, 109 insertions(+), 1 deletions(-)
> 
> diff --git a/src/sms.c b/src/sms.c
> index 618e035..14748c6 100644
> --- a/src/sms.c
> +++ b/src/sms.c
> @@ -553,6 +553,75 @@ static void dispatch_text_message(struct ofono_sms
>  *sms, }
>  }
> 
> +static void dispatch_sms_delivery_report(struct ofono_sms *sms,
> +					const enum sms_st *st,
> +					const struct sms_address *raddr,
> +					const struct sms_scts *scts,
> +					const struct sms_scts *dt)
> +{
> +	DBusConnection *conn = ofono_dbus_get_connection();
> +	const char *path = __ofono_atom_get_path(sms->atom);
> +	DBusMessage *signal;
> +	DBusMessageIter iter;
> +	DBusMessageIter dict;
> +	char buf[128];
> +	time_t ts;
> +	struct tm remote;
> +	struct tm local;
> +	const char *str = buf;
> +
> +	if (!st) {
> +		DBG("status unavailable");
> +		return;
> +	}
> +
> +	signal = dbus_message_new_signal(path, OFONO_SMS_MANAGER_INTERFACE,
> +						"IncomingStatusReport");
> +
> +	if (!signal)
> +		return;
> +
> +	/*Start assembling dbus-message*/
> +	dbus_message_iter_init_append(signal, &iter);
> +
> +	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
> +					OFONO_PROPERTIES_ARRAY_SIGNATURE,
> +						&dict);
> +
> +	/*This is the time when sender sent the message*/
> +	ts = sms_scts_to_time(scts, &remote);
> +	localtime_r(&ts, &local);
> +
> +	strftime(buf, 127, "%Y-%m-%dT%H:%M:%S%z", &local);
> +	buf[127] = '\0';
> +	ofono_dbus_dict_append(&dict, "LocalSentTime", DBUS_TYPE_STRING, &str);
> +
> +	/*This is the time when the message was delivered to the recipient*/
> +	ts = sms_scts_to_time(dt, &remote);
> +	localtime_r(&ts, &local);
> +
> +	strftime(buf, 127, "%Y-%m-%dT%H:%M:%S%z", &local);
> +	buf[127] = '\0';
> +	ofono_dbus_dict_append(&dict, "LocalDeliverTime",
> +					DBUS_TYPE_STRING, &str);
> +
> +	/*Status*/
> +	if (*st == 0x00) {
> +		str = sms_address_to_string(raddr);
> +		ofono_dbus_dict_append(&dict, "delivered",
> +					DBUS_TYPE_STRING, &str);
> +	} else {
> +		str = sms_address_to_string(raddr);
> +		ofono_dbus_dict_append(&dict, "undeliverable",
> +					DBUS_TYPE_STRING, &str);
> +	}
> +
> +	/*dbus-message assembled*/
> +	dbus_message_iter_close_container(&iter, &dict);
> +
> +	g_dbus_send_message(conn, signal);
> +}
> +

We tend to do things bottom up here, so this patch should really come last and 
merged with changes from Patch 5.

Regards,
-Denis


More information about the ofono mailing list