540
543
if (dbus_message_get_args(reply, NULL,
541
544
DBUS_TYPE_STRING, &digit,
542
DBUS_TYPE_INVALID) == FALSE ||
543
strlen(digit) != 1 ||
544
!valid_phone_number_format(digit)) {
545
DBUS_TYPE_INVALID) == FALSE) {
545
546
ofono_error("Can't parse the reply to GetDigit()");
546
547
remove_agent = TRUE;
551
if (strlen(digit) != 1 || !strspn(digit, "0123456789*#+")) {
552
ofono_error("Invalid character");
557
if (agent->hidden_entry && digit[0] == '+') {
558
ofono_error("The character + is not allowed in this mode");
550
563
cb(result, digit, agent->user_data);
578
591
agent->user_cb = cb;
579
592
agent->user_data = user_data;
580
593
agent->user_destroy = destroy;
594
agent->hidden_entry = FALSE;
596
dbus_pending_call_set_notify(agent->call, get_digit_cb, agent, NULL);
601
int stk_agent_request_quick_digit(struct stk_agent *agent, const char *text,
602
const struct stk_icon_id *icon,
603
stk_agent_string_cb cb, void *user_data,
604
ofono_destroy_func destroy, int timeout)
606
DBusConnection *conn = ofono_dbus_get_connection();
608
agent->msg = dbus_message_new_method_call(agent->bus, agent->path,
609
OFONO_SIM_APP_INTERFACE,
610
"RequestQuickDigit");
611
if (agent->msg == NULL)
614
dbus_message_append_args(agent->msg,
615
DBUS_TYPE_STRING, &text,
616
DBUS_TYPE_BYTE, &icon->id,
619
if (dbus_connection_send_with_reply(conn, agent->msg, &agent->call,
625
agent->user_data = user_data;
626
agent->user_destroy = destroy;
627
agent->hidden_entry = TRUE;
582
629
dbus_pending_call_set_notify(agent->call, get_digit_cb, agent, NULL);
660
707
enum stk_agent_result result;
661
708
gboolean remove_agent;
664
712
if (check_error(agent, reply,
665
713
ALLOWED_ERROR_GO_BACK | ALLOWED_ERROR_TERMINATE,
732
len = strlen(string);
734
if (len < agent->min_length || len > agent->max_length) {
735
ofono_error("Length not acceptable");
740
if (agent->hidden_entry)
741
span = strspn(string, "0123456789*#");
743
span = strspn(string, "0123456789*#+");
746
ofono_error("Invalid character found");
684
751
cb(result, string, agent->user_data);
724
791
agent->user_cb = cb;
725
792
agent->user_data = user_data;
726
793
agent->user_destroy = destroy;
794
agent->min_length = min_val;
795
agent->max_length = max_val;
796
agent->hidden_entry = hidden_val;
728
798
dbus_pending_call_set_notify(agent->call, get_digits_cb, agent, NULL);
738
808
enum stk_agent_result result;
739
809
gboolean remove_agent;
742
813
if (check_error(agent, reply,
743
814
ALLOWED_ERROR_GO_BACK | ALLOWED_ERROR_TERMINATE,
833
len = g_utf8_strlen(string, -1);
835
if (len < agent->min_length || len > agent->max_length) {
836
ofono_error("Length not acceptable");
762
841
cb(result, string, agent->user_data);
803
882
agent->user_cb = cb;
804
883
agent->user_data = user_data;
805
884
agent->user_destroy = destroy;
885
agent->min_length = min_val;
886
agent->max_length = max_val;
887
agent->hidden_entry = hidden_val;
807
889
dbus_pending_call_set_notify(agent->call, get_input_cb, agent, NULL);