ussd: Add __ofono_ussd_is_busy
authorYang Gu <yang.gu@intel.com>
Mon, 6 Sep 2010 02:19:55 +0000 (10:19 +0800)
committerDenis Kenzior <denkenz@gmail.com>
Thu, 9 Sep 2010 13:57:36 +0000 (08:57 -0500)
Send SS requires Call Forwarding / Call Settings / Call Barring to check
whether USSD is currently busy.  If it is, then the SIM should be
notified appropriately.

We introduce a function __ofono_ussd_is_busy to help with this.

src/ofono.h
src/ussd.c

index d95f2f2..9b2e53f 100644 (file)
@@ -254,6 +254,7 @@ gboolean __ofono_ussd_passwd_register(struct ofono_ussd *ussd, const char *sc,
                                        ofono_ussd_passwd_cb_t cb, void *data,
                                        ofono_destroy_func destroy);
 void __ofono_ussd_passwd_unregister(struct ofono_ussd *ussd, const char *sc);
+gboolean __ofono_ussd_is_busy(struct ofono_ussd *ussd);
 
 #include <ofono/netreg.h>
 
index 825d560..fbb07d2 100644 (file)
@@ -65,6 +65,17 @@ struct ssc_entry {
        ofono_destroy_func destroy;
 };
 
+gboolean __ofono_ussd_is_busy(struct ofono_ussd *ussd)
+{
+       if (!ussd)
+               return FALSE;
+
+       if (ussd->pending || ussd->state != USSD_STATE_IDLE)
+               return TRUE;
+
+       return FALSE;
+}
+
 static struct ssc_entry *ssc_entry_create(const char *sc, void *cb, void *data,
                                                ofono_destroy_func destroy)
 {