Hi Petteri,
 
+static void at_barring_query_enabled(struct ofono_sim *sim,
+                               ofono_sim_locked_cb_t cb, void *data) {
+       struct sim_data *sd = ofono_sim_get_data(sim);
+       struct cb_data *cbd = cb_data_new(cb, data);
+       char buf[64];
+
+       if (!cbd)
+               goto error;
+
+       snprintf(buf, sizeof(buf), "AT+CLCK=\"FD\",2");
+
+       if (g_at_chat_send(sd->chat, buf, clck_prefix,
+                               at_lock_status_cb, cbd, g_free) > 0)
+               return;
+
+error:
+       g_free(cbd);
+
+       CALLBACK_WITH_FAILURE(cb, -1, data);
+}
+
 static gboolean at_sim_register(gpointer user)  {
        struct ofono_sim *sim = user;
@@ -898,6 +920,7 @@ static struct ofono_sim_driver driver = {
        .lock                   = at_pin_enable,
        .change_passwd          = at_change_passwd,
        .query_locked           = at_pin_query_enabled,
+       .query_call_barred      = at_barring_query_enabled,
 };
  
@@ -156,6 +157,8 @@ struct ofono_sim_driver {
        void (*query_locked)(struct ofono_sim *sim,
                        enum ofono_sim_password_type type,
                        ofono_sim_locked_cb_t cb, void *data);
+       void (*query_call_barred)(struct ofono_sim *sim,
+                       ofono_sim_locked_cb_t cb, void *data);
 };
 
 
+static void sim_call_barred_query_cb(const struct ofono_error *error,
+                               int locked,
+                               gpointer data)
+{
+       struct ofono_sim *sim = data;
+
+       if (error->type != OFONO_ERROR_TYPE_NO_ERROR || locked) {
+
+               ofono_error("Fixed Dialing is enabled, emergency calls
only");
+               sim_set_not_ready(sim);
+       }
+}
+
+static void sim_call_barring_check(struct ofono_sim *sim) {
+       if (!sim->driver->query_call_barred)
+               return;
+
+       sim->driver->query_call_barred(sim, sim_call_barred_query_cb,
sim); }
+
 
Function names are misleading(eg: query_call_barred,
sim_call_barring_check). Is it better to use the function name like
query_fdn_status??

Regards,
jeevaka
_______________________________________________
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono

Reply via email to