Re: ModemManager USSD resonse patch



Hey!

On 11/04/13 16:30, Golikov Pavel wrote:
This patch fixes USSD respose handling.
    
Some operators sends answer to USSD message with connection termination code.
When the connection termination state recieved, we should check if we can decode
the answer string. If we can, we should return this string as answer instead of error.

diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index abc5a5c..2036490 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -4486,13 +4486,37 @@ cusd_process_string (MMBroadbandModem *self,
             break;
         }
 
-        case 2:
-            if (self->priv->pending_ussd_action)
-                g_simple_async_result_set_error (self->priv->pending_ussd_action,
-                                                 MM_CORE_ERROR,
-                                                 MM_CORE_ERROR_CANCELLED,
-                                                 "USSD terminated by network.");
+        case 2: /* Some operators can send response with connection termination*/ {
+            gchar *converted;
+            GError *error = NULL;
+

I would move the /* Some operators... */ comment to here, not in between
the case: and the brace.

+            converted = decode_ussd_response (self, str, &error);
+            if (self->priv->pending_ussd_action) {
+                /* Response to the user's request */
+                if (error)
+                    g_simple_async_result_set_error (self->priv->pending_ussd_action,
+                                                     MM_CORE_ERROR,
+                                                     MM_CORE_ERROR_CANCELLED,
+                                                     "USSD terminated by network.");
+                else
+                    g_simple_async_result_set_op_res_gpointer (self->priv->pending_ussd_action,
+                                                               converted,
+                                                               g_free);
+            } else {
+                if (error) {
+                    mm_warn ("Invalid network initiated USSD notification: %s",
+                             error->message);
+                    g_error_free (error);
+                } else {
+                    /* Network-initiated USSD-Notify */
+                    mm_iface_modem_3gpp_ussd_update_network_notification (
+                        MM_IFACE_MODEM_3GPP_USSD (self),
+                        converted);
+                    g_free (converted);


Should we really process this case? Will it ever happen a
network-initiated USSD notification with a connection termination code?
Probably will not harm, but just wondering.


+                }
+            }
             break;
+        }
 
         case 4:
             if (self->priv->pending_ussd_action)
_______________________________________________
networkmanager-list mailing list
networkmanager-list gnome org
https://mail.gnome.org/mailman/listinfo/networkmanager-list



-- 
Aleksander


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]