From 1f3935429d6cb85dacacd401989b59174a303530 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Danis?= Date: Wed, 14 Mar 2012 17:00:52 +0100 Subject: [PATCH] emulator: Force indicator event implementation --- src/emulator.c | 23 +++++++++++++++++++++++ src/ofono.h | 3 +++ 2 files changed, 26 insertions(+) diff --git a/src/emulator.c b/src/emulator.c index 0f1ceca..e7c7d41 100644 --- a/src/emulator.c +++ b/src/emulator.c @@ -1245,3 +1245,26 @@ start_ring: em->callsetup_source = g_timeout_add_seconds(RING_TIMEOUT, notify_ring, em); } + +void __ofono_emulator_set_indicator_forced(struct ofono_emulator *em, + const char *name, int value) +{ + int i; + struct indicator *ind; + char buf[20]; + + ind = find_indicator(em, name, &i); + + if (ind == NULL || value < ind->min || value > ind->max) + return; + + ind->value = value; + + if (em->events_mode == 3 && em->events_ind && em->slc && ind->active) { + if (!g_at_server_command_pending(em->server)) { + sprintf(buf, "+CIEV: %d,%d", i, ind->value); + g_at_server_send_unsolicited(em->server, buf); + } else + ind->deferred = TRUE; + } +} diff --git a/src/ofono.h b/src/ofono.h index a42e153..a6f1af1 100644 --- a/src/ofono.h +++ b/src/ofono.h @@ -494,6 +494,9 @@ void __ofono_gprs_provision_free_settings( int count); #include +void __ofono_emulator_set_indicator_forced(struct ofono_emulator *em, + const char *name, int value); + #include #include #include -- 2.7.4