From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 04/11] Changes for SMS statur report.
Date: Fri, 28 May 2010 12:12:51 -0500 [thread overview]
Message-ID: <201005281212.51760.denkenz@gmail.com> (raw)
In-Reply-To: <1274957690-4893-4-git-send-email-pasi.miettinen@ixonos.com>
[-- Attachment #1: Type: text/plain, Size: 7273 bytes --]
Hi Pasi,
> From: Pasi Miettinen <pasi.miettinen@ixonos.com>
>
> ---
> include/sms.h | 2 +-
> src/sms.c | 124
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files
changed,
> 119 insertions(+), 7 deletions(-)
>
> diff --git a/include/sms.h b/include/sms.h
> index daaec37..c007675 100644
> --- a/include/sms.h
> +++ b/include/sms.h
> @@ -54,7 +54,7 @@ struct ofono_sms_driver {
>
> void ofono_sms_deliver_notify(struct ofono_sms *sms, unsigned char *pdu,
> int len, int tpdu_len);
> -void ofono_sms_status_notify(struct ofono_sms *sms, unsigned char *pdu,
> +void ofono_sms_status_report_notify(struct ofono_sms *sms, unsigned char
> *pdu, int len, int tpdu_len);
Please leave the rename out for now.
>
> int ofono_sms_driver_register(const struct ofono_sms_driver *d);
> diff --git a/src/sms.c b/src/sms.c
> index 855bef8..63e0190 100644
> --- a/src/sms.c
> +++ b/src/sms.c
> @@ -459,9 +459,10 @@ static GDBusMethodTable sms_manager_methods[] = {
> };
>
> static GDBusSignalTable sms_manager_signals[] = {
> - { "PropertyChanged", "sv" },
> - { "IncomingMessage", "sa{sv}" },
> - { "ImmediateMessage", "sa{sv}" },
> + { "PropertyChanged", "sv" },
> + { "IncomingMessage", "sa{sv}" },
> + { "ImmediateMessage", "sa{sv}" },
> + { "IncomingStatusReport", "{sv}" },
Your patch does too much here. If you want to reformat this table, send a
separate patch please. The current patch should only add the new entry.
> { }
> };
>
> @@ -471,6 +472,7 @@ static void dispatch_app_datagram(struct ofono_sms
> *sms, int dst, int src, DBG("Got app datagram for dst port: %d, src port:
> %d",
> dst, src);
> DBG("Contents-Len: %ld", len);
> + //DBG("buf: %s", buf);
Submissions should never contain commented-out code, you either need it or you
don't.
> }
>
> static void dispatch_text_message(struct ofono_sms *sms,
> @@ -539,6 +541,74 @@ 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)
> +{
> + DBusConnection *conn = ofono_dbus_get_connection();
> + const char *path = __ofono_atom_get_path(sms->atom);
> + DBusMessage *signal;
> + DBusMessageIter iter;
> + DBusMessageIter dict;
> + char buf[128];
> + const char *signal_name;
> + time_t ts;
> + struct tm remote;
> + struct tm local;
> + const char *str = buf;
> +
> + if (!st){
> + DBG("status unavailable");
> + return;
> + }
> +
> + signal_name = "IncomingStatusReport";
> +
> + signal = dbus_message_new_signal(path, OFONO_SMS_MANAGER_INTERFACE,
> + signal_name);
This variable and assignment is not needed, simply use the string in the
dbus_message_new_signal call.
> +
> + if (!signal)
> + return;
> +
> +
Two consecutive empty lines is a no-no ;)
> + /*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);
> +
Your signature here does not match the IncomingStatusReport signature.
> + /*This is the time when sender sent the message,
> + should be delivery time?*/
> + 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);
> +
> + strftime(buf, 127, "%Y-%m-%dT%H:%M:%S%z", &remote);
> + buf[127] = '\0';
> + ofono_dbus_dict_append(&dict, "SentTime", DBUS_TYPE_STRING, &str);
SentTime and LocalSentTime?
> +
> + /*Status*/
> + if(*st==0x00){
> + str = sms_address_to_string(raddr);
> + ofono_dbus_dict_append(&dict, "Message was delivered to",
> DBUS_TYPE_STRING, &str); + }
> + else{
> + str = sms_address_to_string(raddr);
> + ofono_dbus_dict_append(&dict, "Message was not delivered to",
> DBUS_TYPE_STRING, &str); + }
I suggest using simple string types, like 'delivered', 'undeliverable', etc.
Also, the status report enum has nice definitions on whether this is a final /
non-final result, etc. These should be handled appropriately.
> +
> + /*dbus-message assembled*/
> + dbus_message_iter_close_container(&iter, &dict);
> +
> + g_dbus_send_message(conn, signal);
> +
> +}
> +
> static void sms_dispatch(struct ofono_sms *sms, GSList *sms_list)
> {
> GSList *l;
> @@ -646,6 +716,18 @@ static void sms_dispatch(struct ofono_sms *sms, GSList
> *sms_list) }
> }
>
> +static void sms_status_report_dispatch(struct ofono_sms *sms, GSList
> *sms_list) +{
> + const struct sms *s;
> + enum sms_charset uninitialized_var(old_charset);
What is the purpose of this variable?
> +
> + s = sms_list->data;
> + dispatch_sms_delivery_report(sms, &s->status_report.st,
> + &s->status_report.raddr,
> + &s->status_report.scts);
> +
> +}
> +
Not quite sure why all of this is in a separate function...
> static void handle_deliver(struct ofono_sms *sms, const struct sms
> *incoming) {
> GSList *l;
> @@ -679,6 +761,19 @@ static void handle_deliver(struct ofono_sms *sms,
> const struct sms *incoming) g_slist_free(l);
> }
>
> +static void handle_sms_status_report(struct ofono_sms *sms, const struct
> sms *incoming) +{
> + GSList *l;
> +
> + /*TODO:
> + fragmented SMS delivery report? check handle_deliver()
> + */
I suggest that we figure this part out first actually :)
> +
> + l = g_slist_append(NULL, (void *)incoming);
Casting is not required.
> + sms_status_report_dispatch(sms, l);
> + g_slist_free(l);
> +}
> +
> static inline gboolean handle_mwi(struct ofono_sms *sms, struct sms *s)
> {
> gboolean discard;
> @@ -696,7 +791,7 @@ void ofono_sms_deliver_notify(struct ofono_sms *sms,
> unsigned char *pdu, {
> struct sms s;
> enum sms_class cls;
> -
> + DBG("ofono_sms_deliver_notify");
You should use a newline to separate the variable definitions and code. If
statement blocks should generally be preceded and followed by an empty line.
> if (!sms_decode(pdu, len, FALSE, tpdu_len, &s)) {
> ofono_error("Unable to decode PDU");
> return;
> @@ -807,10 +902,27 @@ out:
> handle_deliver(sms, &s);
> }
>
> -void ofono_sms_status_notify(struct ofono_sms *sms, unsigned char *pdu,
> +void ofono_sms_status_report_notify(struct ofono_sms *sms, unsigned char
> *pdu, int len, int tpdu_len)
> {
> - ofono_error("SMS Status-Report not yet handled");
> + struct sms s;
> + enum sms_class cls;
> +
> + if (!sms_decode(pdu, len, FALSE, tpdu_len, &s)) {
> + ofono_error("Unable to decode PDU");
> + return;
> + }
> +
> + if (s.type != SMS_TYPE_STATUS_REPORT) {
> + ofono_error("Expecting a STATUS REPORT pdu");
> + }
> +
> + if (!sms_dcs_decode(s.deliver.dcs, &cls, NULL, NULL, NULL)) {
> + ofono_error("Unknown / Reserved DCS. Ignoring");
> + return;
> + }
> +
> + handle_sms_status_report(sms, &s);
> }
>
> int ofono_sms_driver_register(const struct ofono_sms_driver *d)
>
Regards,
-Denis
next prev parent reply other threads:[~2010-05-28 17:12 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-27 10:54 [PATCH 01/11] In drivers/atmodem/sms.c:at_cmgl_cpms_cb() there is a temporary fix for Siemens TC65. If AT+CMGL=4 is sent to TC65, the AT command queue jams pasi.miettinen
2010-05-27 10:54 ` [PATCH 02/11] Made needed changes to at_cds_notify() for status report and corrected at_cmgl_cpms_cb() to meet the ISO standard pasi.miettinen
2010-05-27 10:54 ` [PATCH 03/11] Enable status report pasi.miettinen
2010-05-27 10:54 ` [PATCH 04/11] Changes for SMS statur report pasi.miettinen
2010-05-27 10:54 ` [PATCH 05/11] Added message delivery time to dbus message pasi.miettinen
2010-05-27 10:54 ` [PATCH 06/11] Made it possible to ask for status report via SendMessage method parameters. True=status report on, false=off pasi.miettinen
2010-05-27 10:54 ` [PATCH 07/11] Removed Siemens TC65 specific code pasi.miettinen
2010-05-27 10:54 ` [PATCH 08/11] Some style corrections pasi.miettinen
2010-05-27 10:54 ` [PATCH 09/11] Support for concatenated SMS status report. And ofono_history_sms is now updated according to received status reports pasi.miettinen
2010-05-27 10:54 ` [PATCH 10/11] Some naming changes to enum sms_status_report_result pasi.miettinen
2010-05-27 10:54 ` [PATCH 11/11] Style corrections pasi.miettinen
2010-05-28 17:20 ` Denis Kenzior
2010-05-28 17:26 ` [PATCH 09/11] Support for concatenated SMS status report. And ofono_history_sms is now updated according to received status reports Denis Kenzior
2010-05-31 12:33 ` VS: " Miettinen Pasi
2010-05-31 16:18 ` Denis Kenzior
2010-05-28 17:15 ` [PATCH 07/11] Removed Siemens TC65 specific code Denis Kenzior
2010-05-27 11:32 ` [PATCH 06/11] Made it possible to ask for status report via SendMessage method parameters. True=status report on, false=off Aki Niemi
2010-05-27 11:39 ` Marcel Holtmann
2010-05-27 11:56 ` Aki Niemi
2010-06-09 22:21 ` Inaky Perez-Gonzalez
2010-06-09 22:47 ` Denis Kenzior
2010-06-09 23:29 ` Inaky Perez-Gonzalez
2010-06-10 1:11 ` Marcel Holtmann
2010-05-27 11:51 ` Denis Kenzior
2010-05-27 13:19 ` Marcel Holtmann
2010-05-28 9:08 ` VS: " Miettinen Pasi
2010-05-28 17:34 ` Denis Kenzior
2010-05-27 11:41 ` [PATCH 04/11] Changes for SMS statur report Aki Niemi
2010-05-28 12:02 ` VS: " Miettinen Pasi
2010-05-28 17:12 ` Denis Kenzior [this message]
2010-05-28 16:56 ` [PATCH 03/11] Enable status report Denis Kenzior
2010-05-28 16:55 ` [PATCH 02/11] Made needed changes to at_cds_notify() for status report and corrected at_cmgl_cpms_cb() to meet the ISO standard Denis Kenzior
2010-05-28 16:48 ` [PATCH 01/11] In drivers/atmodem/sms.c:at_cmgl_cpms_cb() there is a temporary fix for Siemens TC65. If AT+CMGL=4 is sent to TC65, the AT command queue jams Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201005281212.51760.denkenz@gmail.com \
--to=denkenz@gmail.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.