mirror of
https://github.com/sailfishos/ofono
synced 2025-11-29 06:01:05 +08:00
Compare commits
136 Commits
mer/1.14+g
...
mer/1.14+g
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
edc0035d18 | ||
|
|
121f308cdb | ||
|
|
2fcf1aee03 | ||
|
|
a14ebf50e0 | ||
|
|
1b0d419355 | ||
|
|
43f444db00 | ||
|
|
1eb6243bc9 | ||
|
|
6ed50ecab7 | ||
|
|
17ddc04788 | ||
|
|
4fd3c6386a | ||
|
|
a069557b27 | ||
|
|
da81a85578 | ||
|
|
79e18f9d77 | ||
|
|
38f4886a97 | ||
|
|
b154268fd9 | ||
|
|
cb3a89a702 | ||
|
|
133d92f265 | ||
|
|
ad6fd49dbc | ||
|
|
888e857779 | ||
|
|
e189cd138b | ||
|
|
6b8b5d29a1 | ||
|
|
960ef29014 | ||
|
|
30f3dd2c53 | ||
|
|
feb1126123 | ||
|
|
420651829a | ||
|
|
0835875b65 | ||
|
|
153599eb70 | ||
|
|
fafef8bfd3 | ||
|
|
3bce306f6e | ||
|
|
68767f6ea2 | ||
|
|
a3cd7b0898 | ||
|
|
d0364f89cd | ||
|
|
9aa8375233 | ||
|
|
77b3adfd60 | ||
|
|
b4bb7e72d8 | ||
|
|
8e20975660 | ||
|
|
0e8a53bdf0 | ||
|
|
9a29fdde06 | ||
|
|
269fa3db0e | ||
|
|
64dab08751 | ||
|
|
7a72726d9a | ||
|
|
b6fb89c3a0 | ||
|
|
d51d858cd6 | ||
|
|
24d1be80c5 | ||
|
|
19c2a6fc64 | ||
|
|
6e3236b739 | ||
|
|
22b20efdc4 | ||
|
|
ce1ed053fd | ||
|
|
e9d562e4a3 | ||
|
|
e5223ac8af | ||
|
|
9505b6baf3 | ||
|
|
4c268731b9 | ||
|
|
5b158c3a28 | ||
|
|
9745d202d3 | ||
|
|
2329468e25 | ||
|
|
2b352aedb4 | ||
|
|
b319c77bcc | ||
|
|
4b95656d72 | ||
|
|
b3dc0d0146 | ||
|
|
319866c450 | ||
|
|
2847cfcd03 | ||
|
|
65501536d3 | ||
|
|
eef58998c0 | ||
|
|
571d440c14 | ||
|
|
25fc82a073 | ||
|
|
e50518effa | ||
|
|
84e1386978 | ||
|
|
0cdd483894 | ||
|
|
7dbeba0e83 | ||
|
|
d7cf952a16 | ||
|
|
e8379285b3 | ||
|
|
f9a91c8453 | ||
|
|
882f75b500 | ||
|
|
5b6ddee098 | ||
|
|
5cbf0de041 | ||
|
|
8ce12b2232 | ||
|
|
62d42e0407 | ||
|
|
5053a342e7 | ||
|
|
9bbc98651f | ||
|
|
5c53260938 | ||
|
|
e3e691fb48 | ||
|
|
8fa99a07e8 | ||
|
|
23f92a5b3e | ||
|
|
94494f3a63 | ||
|
|
098b3d4a64 | ||
|
|
cfeb58f2a8 | ||
|
|
5f821b4a9a | ||
|
|
516165c311 | ||
|
|
b37f5e842d | ||
|
|
e7f055385f | ||
|
|
8cfcfa4519 | ||
|
|
ca3ae87d0a | ||
|
|
02138901d3 | ||
|
|
24e87d2580 | ||
|
|
057c4d788f | ||
|
|
805c3068be | ||
|
|
eb4fd9f5aa | ||
|
|
8327d528a9 | ||
|
|
7420d327e3 | ||
|
|
e589094113 | ||
|
|
ca5b269002 | ||
|
|
910ec60927 | ||
|
|
5f76525961 | ||
|
|
6fdcfc309c | ||
|
|
4585969568 | ||
|
|
f8819b588b | ||
|
|
c3f528908d | ||
|
|
29fefe6450 | ||
|
|
65e6df8e50 | ||
|
|
8a7b8b0521 | ||
|
|
5705a0078e | ||
|
|
b2b3943717 | ||
|
|
6b8f46a916 | ||
|
|
2e78ea1830 | ||
|
|
dafbd0da25 | ||
|
|
13ce99e360 | ||
|
|
352e3ebb76 | ||
|
|
46de4df677 | ||
|
|
6a96eea978 | ||
|
|
ebe25412a4 | ||
|
|
c94c4fad54 | ||
|
|
c027ab9fbc | ||
|
|
ad4f90684f | ||
|
|
5bf5cf8ddd | ||
|
|
0393a41e35 | ||
|
|
0c1fcd2b50 | ||
|
|
c54e4763f8 | ||
|
|
ea2b34eacd | ||
|
|
472e6650d4 | ||
|
|
201d34b0a1 | ||
|
|
76a7f9014d | ||
|
|
29401d8587 | ||
|
|
90abd44ead | ||
|
|
278dba2ec8 | ||
|
|
f83233d295 | ||
|
|
c2e58405ee |
@@ -92,3 +92,7 @@ Jesper Larsen <jesper.larsen@ixonos.com>
|
|||||||
Slava Monich <slava.monich@jolla.com>
|
Slava Monich <slava.monich@jolla.com>
|
||||||
Andrew Earl <andrewx.earl@intel.com>
|
Andrew Earl <andrewx.earl@intel.com>
|
||||||
Krzysztof Wilk <krzysztofx.wilk@intel.com>
|
Krzysztof Wilk <krzysztofx.wilk@intel.com>
|
||||||
|
Tony Espy <espy@canonical.com>
|
||||||
|
Martin Pitt <martin.pitt@ubuntu.com>
|
||||||
|
Alfonso Sanchez-Beato <alfonso.sanchez-beato@canonical.com>
|
||||||
|
Jussi Pakkanen <jussi.pakkanen@canonical.com>
|
||||||
|
|||||||
@@ -514,7 +514,7 @@ if PROVISION
|
|||||||
builtin_sources += plugins/mbpi.h plugins/mbpi.c
|
builtin_sources += plugins/mbpi.h plugins/mbpi.c
|
||||||
|
|
||||||
builtin_modules += provision
|
builtin_modules += provision
|
||||||
builtin_sources += plugins/provision.c
|
builtin_sources += plugins/provision.h plugins/provision.c
|
||||||
|
|
||||||
builtin_modules += cdma_provision
|
builtin_modules += cdma_provision
|
||||||
builtin_sources += plugins/cdma-provision.c
|
builtin_sources += plugins/cdma-provision.c
|
||||||
@@ -587,7 +587,7 @@ src_ofonod_SOURCES = $(builtin_sources) src/ofono.ver \
|
|||||||
src/cdma-provision.c src/handsfree.c \
|
src/cdma-provision.c src/handsfree.c \
|
||||||
src/handsfree-audio.c src/bluetooth.h \
|
src/handsfree-audio.c src/bluetooth.h \
|
||||||
src/hfp.h src/sim-mnclength.c src/oemraw.c \
|
src/hfp.h src/sim-mnclength.c src/oemraw.c \
|
||||||
src/siri.c
|
src/siri.c src/voicecallagent.c
|
||||||
|
|
||||||
src_ofonod_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
|
src_ofonod_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
|
||||||
@GLIB_LIBS@ @DBUS_LIBS@ -ldl
|
@GLIB_LIBS@ @DBUS_LIBS@ -ldl
|
||||||
@@ -720,13 +720,16 @@ test_scripts = test/backtrace \
|
|||||||
test/set-context-property \
|
test/set-context-property \
|
||||||
test/test-gnss \
|
test/test-gnss \
|
||||||
test/swap-calls \
|
test/swap-calls \
|
||||||
|
test/transfer-call \
|
||||||
test/release-and-answer \
|
test/release-and-answer \
|
||||||
test/release-and-swap \
|
test/release-and-swap \
|
||||||
test/hold-and-answer \
|
test/hold-and-answer \
|
||||||
test/hangup-multiparty \
|
test/hangup-multiparty \
|
||||||
test/hangup-call \
|
test/hangup-call \
|
||||||
test/display-icon \
|
test/display-icon \
|
||||||
test/set-msisdn
|
test/set-msisdn \
|
||||||
|
test/test-voicecallagent \
|
||||||
|
test/get-network-time
|
||||||
|
|
||||||
if TEST
|
if TEST
|
||||||
testdir = $(pkglibdir)/test
|
testdir = $(pkglibdir)/test
|
||||||
@@ -747,7 +750,8 @@ unit_tests = unit/test-common unit/test-util unit/test-idmap \
|
|||||||
unit/test-grilrequest \
|
unit/test-grilrequest \
|
||||||
unit/test-grilreply \
|
unit/test-grilreply \
|
||||||
unit/test-grilunsol \
|
unit/test-grilunsol \
|
||||||
unit/test-sms unit/test-cdmasms
|
unit/test-sms unit/test-cdmasms \
|
||||||
|
unit/test-provision
|
||||||
|
|
||||||
noinst_PROGRAMS = $(unit_tests) \
|
noinst_PROGRAMS = $(unit_tests) \
|
||||||
unit/test-sms-root unit/test-mux unit/test-caif
|
unit/test-sms-root unit/test-mux unit/test-caif
|
||||||
@@ -814,6 +818,13 @@ unit_test_grilunsol_SOURCES = unit/test-grilunsol.c $(gril_sources) \
|
|||||||
unit_test_grilunsol_LDADD = @GLIB_LIBS@ -ldl
|
unit_test_grilunsol_LDADD = @GLIB_LIBS@ -ldl
|
||||||
unit_objects += $(unit_test_grilunsol_OBJECTS)
|
unit_objects += $(unit_test_grilunsol_OBJECTS)
|
||||||
|
|
||||||
|
unit_test_provision_SOURCES = unit/test-provision.c \
|
||||||
|
plugins/provision.h plugins/provision.c \
|
||||||
|
plugins/mbpi.c src/gprs-provision.c \
|
||||||
|
src/log.c
|
||||||
|
unit_test_provision_LDADD = @GLIB_LIBS@ -ldl
|
||||||
|
unit_objects += $(unit_test_provision_OBJECTS)
|
||||||
|
|
||||||
TESTS = $(unit_tests)
|
TESTS = $(unit_tests)
|
||||||
|
|
||||||
if TOOLS
|
if TOOLS
|
||||||
|
|||||||
@@ -45,6 +45,12 @@ Properties array{string} Features [readonly]
|
|||||||
"voice-recognition"
|
"voice-recognition"
|
||||||
"attach-voice-tag"
|
"attach-voice-tag"
|
||||||
"echo-canceling-and-noise-reduction"
|
"echo-canceling-and-noise-reduction"
|
||||||
|
"three-way-calling"
|
||||||
|
"release-all-held"
|
||||||
|
"release-specified-active-call"
|
||||||
|
"private-chat"
|
||||||
|
"create-multiparty"
|
||||||
|
"transfer"
|
||||||
|
|
||||||
boolean InbandRinging [readonly]
|
boolean InbandRinging [readonly]
|
||||||
|
|
||||||
@@ -70,3 +76,7 @@ Properties array{string} Features [readonly]
|
|||||||
|
|
||||||
The current charge level of the battery. The value
|
The current charge level of the battery. The value
|
||||||
can be between 0 and 5 respectively.
|
can be between 0 and 5 respectively.
|
||||||
|
|
||||||
|
array{string} SubscriberNumbers [readonly]
|
||||||
|
|
||||||
|
List of subscriber numbers provided by the AG.
|
||||||
|
|||||||
@@ -198,6 +198,25 @@ Methods dict GetProperties()
|
|||||||
[service].Error.InvalidFormat
|
[service].Error.InvalidFormat
|
||||||
[service].Error.Failed
|
[service].Error.Failed
|
||||||
|
|
||||||
|
void RegisterVoicecallAgent(object path)
|
||||||
|
|
||||||
|
Registers an agent which will be called whenever a
|
||||||
|
specific voice call related event requiring a client
|
||||||
|
action occurs. Currently, the only such action is
|
||||||
|
playing a ringback tone locally.
|
||||||
|
|
||||||
|
Possible Errors: [service].Error.InProgress
|
||||||
|
[service].Error.InvalidArguments
|
||||||
|
[service].Error.InvalidFormat
|
||||||
|
[service].Error.Failed
|
||||||
|
|
||||||
|
void UnregisterVoicecallAgent(object path)
|
||||||
|
|
||||||
|
Unregisters an agent.
|
||||||
|
|
||||||
|
Possible Errors: [service].Error.InvalidArguments
|
||||||
|
[service].Error.Failed
|
||||||
|
|
||||||
Signals CallAdded(object path, dict properties)
|
Signals CallAdded(object path, dict properties)
|
||||||
|
|
||||||
Signal that is sent when a new call is added. It
|
Signal that is sent when a new call is added. It
|
||||||
@@ -257,3 +276,26 @@ Properties array{string} EmergencyNumbers [readonly]
|
|||||||
of numbers provided by the specification and any
|
of numbers provided by the specification and any
|
||||||
extra numbers provisioned by the carrier on the
|
extra numbers provisioned by the carrier on the
|
||||||
SIM.
|
SIM.
|
||||||
|
|
||||||
|
VoiceCallAgent Hierarchy
|
||||||
|
========================
|
||||||
|
|
||||||
|
Service unique name
|
||||||
|
Interface org.ofono.VoiceCallAgent
|
||||||
|
Object path freely definable
|
||||||
|
|
||||||
|
Methods void RingbackTone(boolean playTone)
|
||||||
|
|
||||||
|
Requests the client to generate an alerting tone locally
|
||||||
|
(3GPP 24.008; 5.2.1.5). This can happen when an outgoing
|
||||||
|
voice call is made and network is not providing the
|
||||||
|
alerting tone. Value 0 stands for "stop playing ringback
|
||||||
|
tone" and 1 for "start playing ringback tone".
|
||||||
|
|
||||||
|
void Release() [noreply]
|
||||||
|
|
||||||
|
Agent is being released, possibly because of oFono
|
||||||
|
terminating, voicecall interface is being torn down or
|
||||||
|
modem is switched off. No UnregisterVoicecallAgent
|
||||||
|
call is needed.
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ static const char *bvra_prefix[] = { "+BVRA:", NULL };
|
|||||||
struct hf_data {
|
struct hf_data {
|
||||||
GAtChat *chat;
|
GAtChat *chat;
|
||||||
unsigned int ag_features;
|
unsigned int ag_features;
|
||||||
|
unsigned int ag_chld_features;
|
||||||
int battchg_index;
|
int battchg_index;
|
||||||
guint register_source;
|
guint register_source;
|
||||||
};
|
};
|
||||||
@@ -124,6 +125,87 @@ static void ciev_notify(GAtResult *result, gpointer user_data)
|
|||||||
ofono_handsfree_battchg_notify(hf, value);
|
ofono_handsfree_battchg_notify(hf, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void cnum_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
|
{
|
||||||
|
struct cb_data *cbd = user_data;
|
||||||
|
ofono_handsfree_cnum_query_cb_t cb = cbd->cb;
|
||||||
|
GAtResultIter iter;
|
||||||
|
struct ofono_phone_number *list = NULL;
|
||||||
|
int num = 0;
|
||||||
|
struct ofono_error error;
|
||||||
|
|
||||||
|
decode_at_error(&error, g_at_result_final_response(result));
|
||||||
|
|
||||||
|
if (!ok)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
g_at_result_iter_init(&iter, result);
|
||||||
|
|
||||||
|
while (g_at_result_iter_next(&iter, "+CNUM:"))
|
||||||
|
num++;
|
||||||
|
|
||||||
|
if (num == 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
list = g_new0(struct ofono_phone_number, num);
|
||||||
|
|
||||||
|
g_at_result_iter_init(&iter, result);
|
||||||
|
|
||||||
|
for (num = 0; g_at_result_iter_next(&iter, "+CNUM:"); ) {
|
||||||
|
const char *number;
|
||||||
|
int service;
|
||||||
|
int type;
|
||||||
|
|
||||||
|
if (!g_at_result_iter_skip_next(&iter))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!g_at_result_iter_next_string(&iter, &number))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!g_at_result_iter_next_number(&iter, &type))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!g_at_result_iter_skip_next(&iter))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!g_at_result_iter_next_number(&iter, &service))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* We are only interested in Voice services */
|
||||||
|
if (service != 4)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
strncpy(list[num].number, number,
|
||||||
|
OFONO_MAX_PHONE_NUMBER_LENGTH);
|
||||||
|
list[num].number[OFONO_MAX_PHONE_NUMBER_LENGTH] = '\0';
|
||||||
|
list[num].type = type;
|
||||||
|
|
||||||
|
DBG("cnum_notify:%s", list[num].number);
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
cb(&error, num, list, cbd->data);
|
||||||
|
|
||||||
|
g_free(list);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hfp_cnum_query(struct ofono_handsfree *hf,
|
||||||
|
ofono_handsfree_cnum_query_cb_t cb, void *data)
|
||||||
|
{
|
||||||
|
struct hf_data *hd = ofono_handsfree_get_data(hf);
|
||||||
|
struct cb_data *cbd = cb_data_new(cb, data);
|
||||||
|
|
||||||
|
if (g_at_chat_send(hd->chat, "AT+CNUM", NULL,
|
||||||
|
cnum_query_cb, cbd, g_free) > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_free(cbd);
|
||||||
|
|
||||||
|
CALLBACK_WITH_FAILURE(cb, -1, NULL, data);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean hfp_handsfree_register(gpointer user_data)
|
static gboolean hfp_handsfree_register(gpointer user_data)
|
||||||
{
|
{
|
||||||
struct ofono_handsfree *hf = user_data;
|
struct ofono_handsfree *hf = user_data;
|
||||||
@@ -139,6 +221,7 @@ static gboolean hfp_handsfree_register(gpointer user_data)
|
|||||||
ofono_handsfree_set_inband_ringing(hf, TRUE);
|
ofono_handsfree_set_inband_ringing(hf, TRUE);
|
||||||
|
|
||||||
ofono_handsfree_set_ag_features(hf, hd->ag_features);
|
ofono_handsfree_set_ag_features(hf, hd->ag_features);
|
||||||
|
ofono_handsfree_set_ag_chld_features(hf, hd->ag_chld_features);
|
||||||
ofono_handsfree_register(hf);
|
ofono_handsfree_register(hf);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -154,6 +237,7 @@ static int hfp_handsfree_probe(struct ofono_handsfree *hf,
|
|||||||
hd = g_new0(struct hf_data, 1);
|
hd = g_new0(struct hf_data, 1);
|
||||||
hd->chat = g_at_chat_clone(info->chat);
|
hd->chat = g_at_chat_clone(info->chat);
|
||||||
hd->ag_features = info->ag_features;
|
hd->ag_features = info->ag_features;
|
||||||
|
hd->ag_chld_features = info->ag_mpty_features;
|
||||||
|
|
||||||
ofono_handsfree_set_data(hf, hd);
|
ofono_handsfree_set_data(hf, hd);
|
||||||
|
|
||||||
@@ -280,6 +364,7 @@ static struct ofono_handsfree_driver driver = {
|
|||||||
.name = "hfpmodem",
|
.name = "hfpmodem",
|
||||||
.probe = hfp_handsfree_probe,
|
.probe = hfp_handsfree_probe,
|
||||||
.remove = hfp_handsfree_remove,
|
.remove = hfp_handsfree_remove,
|
||||||
|
.cnum_query = hfp_cnum_query,
|
||||||
.request_phone_number = hfp_request_phone_number,
|
.request_phone_number = hfp_request_phone_number,
|
||||||
.voice_recognition = hfp_voice_recognition,
|
.voice_recognition = hfp_voice_recognition,
|
||||||
.disable_nrec = hfp_disable_nrec,
|
.disable_nrec = hfp_disable_nrec,
|
||||||
|
|||||||
@@ -128,19 +128,19 @@ static void chld_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
|||||||
|
|
||||||
while (g_at_result_iter_next_unquoted_string(&iter, &str)) {
|
while (g_at_result_iter_next_unquoted_string(&iter, &str)) {
|
||||||
if (!strcmp(str, "0"))
|
if (!strcmp(str, "0"))
|
||||||
ag_mpty_feature |= AG_CHLD_0;
|
ag_mpty_feature |= HFP_AG_CHLD_0;
|
||||||
else if (!strcmp(str, "1"))
|
else if (!strcmp(str, "1"))
|
||||||
ag_mpty_feature |= AG_CHLD_1;
|
ag_mpty_feature |= HFP_AG_CHLD_1;
|
||||||
else if (!strcmp(str, "1x"))
|
else if (!strcmp(str, "1x"))
|
||||||
ag_mpty_feature |= AG_CHLD_1x;
|
ag_mpty_feature |= HFP_AG_CHLD_1x;
|
||||||
else if (!strcmp(str, "2"))
|
else if (!strcmp(str, "2"))
|
||||||
ag_mpty_feature |= AG_CHLD_2;
|
ag_mpty_feature |= HFP_AG_CHLD_2;
|
||||||
else if (!strcmp(str, "2x"))
|
else if (!strcmp(str, "2x"))
|
||||||
ag_mpty_feature |= AG_CHLD_2x;
|
ag_mpty_feature |= HFP_AG_CHLD_2x;
|
||||||
else if (!strcmp(str, "3"))
|
else if (!strcmp(str, "3"))
|
||||||
ag_mpty_feature |= AG_CHLD_3;
|
ag_mpty_feature |= HFP_AG_CHLD_3;
|
||||||
else if (!strcmp(str, "4"))
|
else if (!strcmp(str, "4"))
|
||||||
ag_mpty_feature |= AG_CHLD_4;
|
ag_mpty_feature |= HFP_AG_CHLD_4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_at_result_iter_close_list(&iter))
|
if (!g_at_result_iter_close_list(&iter))
|
||||||
|
|||||||
@@ -19,14 +19,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define AG_CHLD_0 0x01
|
|
||||||
#define AG_CHLD_1 0x02
|
|
||||||
#define AG_CHLD_1x 0x04
|
|
||||||
#define AG_CHLD_2 0x08
|
|
||||||
#define AG_CHLD_2x 0x10
|
|
||||||
#define AG_CHLD_3 0x20
|
|
||||||
#define AG_CHLD_4 0x40
|
|
||||||
|
|
||||||
enum hfp_indicator {
|
enum hfp_indicator {
|
||||||
HFP_INDICATOR_SERVICE = 0,
|
HFP_INDICATOR_SERVICE = 0,
|
||||||
HFP_INDICATOR_CALL,
|
HFP_INDICATOR_CALL,
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include <ofono/voicecall.h>
|
#include <ofono/voicecall.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "hfp.h"
|
||||||
|
|
||||||
#include "hfpmodem.h"
|
#include "hfpmodem.h"
|
||||||
#include "slc.h"
|
#include "slc.h"
|
||||||
@@ -447,7 +448,7 @@ static void hfp_hold_all_active(struct ofono_voicecall *vc,
|
|||||||
{
|
{
|
||||||
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
|
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
|
||||||
|
|
||||||
if (vd->ag_mpty_features & AG_CHLD_2) {
|
if (vd->ag_mpty_features & HFP_AG_CHLD_2) {
|
||||||
hfp_template("AT+CHLD=2", vc, generic_cb, 0, cb, data);
|
hfp_template("AT+CHLD=2", vc, generic_cb, 0, cb, data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -461,7 +462,7 @@ static void hfp_release_all_held(struct ofono_voicecall *vc,
|
|||||||
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
|
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
|
||||||
unsigned int held_status = 1 << CALL_STATUS_HELD;
|
unsigned int held_status = 1 << CALL_STATUS_HELD;
|
||||||
|
|
||||||
if (vd->ag_mpty_features & AG_CHLD_0) {
|
if (vd->ag_mpty_features & HFP_AG_CHLD_0) {
|
||||||
hfp_template("AT+CHLD=0", vc, generic_cb, held_status,
|
hfp_template("AT+CHLD=0", vc, generic_cb, held_status,
|
||||||
cb, data);
|
cb, data);
|
||||||
return;
|
return;
|
||||||
@@ -476,7 +477,7 @@ static void hfp_set_udub(struct ofono_voicecall *vc,
|
|||||||
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
|
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
|
||||||
unsigned int incoming_or_waiting = 1 << CALL_STATUS_WAITING;
|
unsigned int incoming_or_waiting = 1 << CALL_STATUS_WAITING;
|
||||||
|
|
||||||
if (vd->ag_mpty_features & AG_CHLD_0) {
|
if (vd->ag_mpty_features & HFP_AG_CHLD_0) {
|
||||||
hfp_template("AT+CHLD=0", vc, generic_cb, incoming_or_waiting,
|
hfp_template("AT+CHLD=0", vc, generic_cb, incoming_or_waiting,
|
||||||
cb, data);
|
cb, data);
|
||||||
return;
|
return;
|
||||||
@@ -528,7 +529,7 @@ static void hfp_release_all_active(struct ofono_voicecall *vc,
|
|||||||
{
|
{
|
||||||
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
|
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
|
||||||
|
|
||||||
if (vd->ag_mpty_features & AG_CHLD_1) {
|
if (vd->ag_mpty_features & HFP_AG_CHLD_1) {
|
||||||
hfp_template("AT+CHLD=1", vc, release_all_active_cb, 0x1, cb,
|
hfp_template("AT+CHLD=1", vc, release_all_active_cb, 0x1, cb,
|
||||||
data);
|
data);
|
||||||
return;
|
return;
|
||||||
@@ -559,7 +560,7 @@ static void hfp_release_specific(struct ofono_voicecall *vc, int id,
|
|||||||
struct release_id_req *req = NULL;
|
struct release_id_req *req = NULL;
|
||||||
char buf[32];
|
char buf[32];
|
||||||
|
|
||||||
if (!(vd->ag_mpty_features & AG_CHLD_1x))
|
if (!(vd->ag_mpty_features & HFP_AG_CHLD_1x))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
req = g_try_new0(struct release_id_req, 1);
|
req = g_try_new0(struct release_id_req, 1);
|
||||||
@@ -590,7 +591,7 @@ static void hfp_private_chat(struct ofono_voicecall *vc, int id,
|
|||||||
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
|
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
|
||||||
char buf[32];
|
char buf[32];
|
||||||
|
|
||||||
if (vd->ag_mpty_features & AG_CHLD_2x) {
|
if (vd->ag_mpty_features & HFP_AG_CHLD_2x) {
|
||||||
snprintf(buf, sizeof(buf), "AT+CHLD=2%d", id);
|
snprintf(buf, sizeof(buf), "AT+CHLD=2%d", id);
|
||||||
|
|
||||||
hfp_template(buf, vc, generic_cb, 0, cb, data);
|
hfp_template(buf, vc, generic_cb, 0, cb, data);
|
||||||
@@ -606,7 +607,7 @@ static void hfp_create_multiparty(struct ofono_voicecall *vc,
|
|||||||
{
|
{
|
||||||
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
|
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
|
||||||
|
|
||||||
if (vd->ag_mpty_features & AG_CHLD_3) {
|
if (vd->ag_mpty_features & HFP_AG_CHLD_3) {
|
||||||
hfp_template("AT+CHLD=3", vc, generic_cb, 0, cb, data);
|
hfp_template("AT+CHLD=3", vc, generic_cb, 0, cb, data);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -625,7 +626,7 @@ static void hfp_transfer(struct ofono_voicecall *vc,
|
|||||||
*/
|
*/
|
||||||
unsigned int transfer = 0x1 | 0x2 | 0x4 | 0x8;
|
unsigned int transfer = 0x1 | 0x2 | 0x4 | 0x8;
|
||||||
|
|
||||||
if (vd->ag_mpty_features & AG_CHLD_4) {
|
if (vd->ag_mpty_features & HFP_AG_CHLD_4) {
|
||||||
hfp_template("AT+CHLD=4", vc, generic_cb, transfer, cb, data);
|
hfp_template("AT+CHLD=4", vc, generic_cb, transfer, cb, data);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -52,30 +52,14 @@ static void ril_query_manufacturer(struct ofono_devinfo *info,
|
|||||||
ofono_devinfo_query_cb_t cb,
|
ofono_devinfo_query_cb_t cb,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
const char *attr = "Fake Manufacturer";
|
CALLBACK_WITH_FAILURE(cb, "", data);
|
||||||
struct cb_data *cbd = cb_data_new(cb, data);
|
|
||||||
struct ofono_error error;
|
|
||||||
decode_ril_error(&error, "OK");
|
|
||||||
|
|
||||||
cb(&error, attr, cbd->data);
|
|
||||||
|
|
||||||
/* Note: this will need to change if cbd passed to gril layer */
|
|
||||||
g_free(cbd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ril_query_model(struct ofono_devinfo *info,
|
static void ril_query_model(struct ofono_devinfo *info,
|
||||||
ofono_devinfo_query_cb_t cb,
|
ofono_devinfo_query_cb_t cb,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
const char *attr = "Fake Modem Model";
|
CALLBACK_WITH_FAILURE(cb, "", data);
|
||||||
struct cb_data *cbd = cb_data_new(cb, data);
|
|
||||||
struct ofono_error error;
|
|
||||||
decode_ril_error(&error, "OK");
|
|
||||||
|
|
||||||
cb(&error, attr, cbd->data);
|
|
||||||
|
|
||||||
/* Note: this will need to change if cbd passed to gril layer */
|
|
||||||
g_free(cbd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void query_revision_cb(struct ril_msg *message, gpointer user_data)
|
static void query_revision_cb(struct ril_msg *message, gpointer user_data)
|
||||||
@@ -98,6 +82,7 @@ static void query_revision_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
revision = parcel_r_string(&rilp);
|
revision = parcel_r_string(&rilp);
|
||||||
|
|
||||||
cb(&error, revision, cbd->data);
|
cb(&error, revision, cbd->data);
|
||||||
|
g_free(revision);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ril_query_revision(struct ofono_devinfo *info,
|
static void ril_query_revision(struct ofono_devinfo *info,
|
||||||
@@ -137,10 +122,10 @@ static void query_serial_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ril_util_init_parcel(message, &rilp);
|
ril_util_init_parcel(message, &rilp);
|
||||||
|
|
||||||
imei = parcel_r_string(&rilp);
|
imei = parcel_r_string(&rilp);
|
||||||
|
|
||||||
cb(&error, imei, cbd->data);
|
cb(&error, imei, cbd->data);
|
||||||
|
g_free(imei);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ril_query_serial(struct ofono_devinfo *info,
|
static void ril_query_serial(struct ofono_devinfo *info,
|
||||||
|
|||||||
@@ -45,6 +45,12 @@
|
|||||||
|
|
||||||
#include "rilmodem.h"
|
#include "rilmodem.h"
|
||||||
|
|
||||||
|
enum data_call_state {
|
||||||
|
DATA_CALL_INACTIVE,
|
||||||
|
DATA_CALL_LINK_DOWN,
|
||||||
|
DATA_CALL_ACTIVE,
|
||||||
|
};
|
||||||
|
|
||||||
enum state {
|
enum state {
|
||||||
STATE_IDLE,
|
STATE_IDLE,
|
||||||
STATE_ENABLING,
|
STATE_ENABLING,
|
||||||
@@ -60,24 +66,13 @@ struct gprs_context_data {
|
|||||||
guint regid;
|
guint regid;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ril_gprs_context_deactivate_primary(struct ofono_gprs_context *gc,
|
|
||||||
unsigned int id,
|
|
||||||
ofono_gprs_context_cb_t cb, void *data);
|
|
||||||
|
|
||||||
static void set_context_disconnected(struct gprs_context_data *gcd)
|
static void set_context_disconnected(struct gprs_context_data *gcd)
|
||||||
{
|
{
|
||||||
DBG("");
|
|
||||||
|
|
||||||
gcd->active_ctx_cid = -1;
|
gcd->active_ctx_cid = -1;
|
||||||
gcd->active_rild_cid = -1;
|
gcd->active_rild_cid = -1;
|
||||||
gcd->state = STATE_IDLE;
|
gcd->state = STATE_IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void disconnect_context(struct ofono_gprs_context *gc)
|
|
||||||
{
|
|
||||||
ril_gprs_context_deactivate_primary(gc, 0, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ril_gprs_context_call_list_changed(struct ril_msg *message,
|
static void ril_gprs_context_call_list_changed(struct ril_msg *message,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
@@ -85,7 +80,6 @@ static void ril_gprs_context_call_list_changed(struct ril_msg *message,
|
|||||||
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
|
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
|
||||||
struct data_call *call = NULL;
|
struct data_call *call = NULL;
|
||||||
struct unsol_data_call_list *unsol;
|
struct unsol_data_call_list *unsol;
|
||||||
gboolean active_cid_found = FALSE;
|
|
||||||
gboolean disconnect = FALSE;
|
gboolean disconnect = FALSE;
|
||||||
GSList *iterator = NULL;
|
GSList *iterator = NULL;
|
||||||
struct ofono_error error;
|
struct ofono_error error;
|
||||||
@@ -100,19 +94,62 @@ static void ril_gprs_context_call_list_changed(struct ril_msg *message,
|
|||||||
for (iterator = unsol->call_list; iterator; iterator = iterator->next) {
|
for (iterator = unsol->call_list; iterator; iterator = iterator->next) {
|
||||||
call = (struct data_call *) iterator->data;
|
call = (struct data_call *) iterator->data;
|
||||||
|
|
||||||
if (call->cid == gcd->active_rild_cid) {
|
/*
|
||||||
active_cid_found = TRUE;
|
* Every context receives notifications about all data calls
|
||||||
|
* but should only handle its own.
|
||||||
|
*/
|
||||||
|
if (call->cid != gcd->active_rild_cid)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (call->active == 0) {
|
if (call->status != 0)
|
||||||
disconnect = TRUE;
|
ofono_info("data call status:%d", call->status);
|
||||||
ofono_gprs_context_deactivated(gc, gcd->active_ctx_cid);
|
|
||||||
|
if (call->active == DATA_CALL_INACTIVE) {
|
||||||
|
disconnect = TRUE;
|
||||||
|
ofono_gprs_context_deactivated(gc, gcd->active_ctx_cid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (call->active == DATA_CALL_ACTIVE) {
|
||||||
|
char **dns_addresses;
|
||||||
|
|
||||||
|
if (call->ifname) {
|
||||||
|
ofono_gprs_context_set_interface(gc,
|
||||||
|
call->ifname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (call->addresses) {
|
||||||
|
char **split_ip_addr;
|
||||||
|
ofono_gprs_context_set_ipv4_netmask(gc,
|
||||||
|
ril_util_get_netmask(call->addresses));
|
||||||
|
|
||||||
|
split_ip_addr = g_strsplit(call->addresses,
|
||||||
|
"/", 2);
|
||||||
|
ofono_gprs_context_set_ipv4_address(gc,
|
||||||
|
split_ip_addr[0], TRUE);
|
||||||
|
g_strfreev(split_ip_addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (call->gateways) {
|
||||||
|
ofono_gprs_context_set_ipv4_gateway(gc,
|
||||||
|
call->gateways);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (call->dnses)
|
||||||
|
DBG("dnses:%s", call->dnses);
|
||||||
|
|
||||||
|
dns_addresses = (call->dnses ?
|
||||||
|
g_strsplit(call->dnses, " ", 3) : NULL);
|
||||||
|
|
||||||
|
ofono_gprs_context_set_ipv4_dns_servers(gc,
|
||||||
|
(const char**)dns_addresses);
|
||||||
|
g_strfreev(dns_addresses);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disconnect || active_cid_found == FALSE) {
|
if (disconnect) {
|
||||||
ofono_error("Clearing active context");
|
ofono_error("Clearing active context");
|
||||||
set_context_disconnected(gcd);
|
set_context_disconnected(gcd);
|
||||||
}
|
}
|
||||||
@@ -149,10 +186,7 @@ static void ril_setup_data_call_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
gcd->active_rild_cid = reply->cid;
|
gcd->active_rild_cid = reply->cid;
|
||||||
|
|
||||||
if (error.type != OFONO_ERROR_TYPE_NO_ERROR) {
|
if (error.type != OFONO_ERROR_TYPE_NO_ERROR) {
|
||||||
if (gcd->active_rild_cid != -1) {
|
ofono_error("no active context. disconnect");
|
||||||
ofono_error("no active context. disconnect");
|
|
||||||
disconnect_context(gc);
|
|
||||||
}
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +198,6 @@ static void ril_setup_data_call_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
error.type = OFONO_ERROR_TYPE_FAILURE;
|
error.type = OFONO_ERROR_TYPE_FAILURE;
|
||||||
error.error = reply->status;
|
error.error = reply->status;
|
||||||
|
|
||||||
set_context_disconnected(gcd);
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +205,7 @@ static void ril_setup_data_call_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
* TODO: consier moving this into parse_data_reply
|
* TODO: consier moving this into parse_data_reply
|
||||||
*
|
*
|
||||||
* Note - the address may optionally include a prefix size
|
* Note - the address may optionally include a prefix size
|
||||||
* ( Eg. "/30" ). As this confuses NetworkManager, we
|
* ( Eg. "/30" ). As this may confuse client, we
|
||||||
* explicitly strip any prefix after calculating the netmask.
|
* explicitly strip any prefix after calculating the netmask.
|
||||||
*/
|
*/
|
||||||
split_ip_addr = g_strsplit(reply->ip_addrs[0], "/", 2);
|
split_ip_addr = g_strsplit(reply->ip_addrs[0], "/", 2);
|
||||||
@@ -209,7 +242,7 @@ static void ril_setup_data_call_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
ofono_gprs_context_set_ipv4_gateway(gc, reply->gateways[0]);
|
ofono_gprs_context_set_ipv4_gateway(gc, reply->gateways[0]);
|
||||||
|
|
||||||
ofono_gprs_context_set_ipv4_dns_servers(gc,
|
ofono_gprs_context_set_ipv4_dns_servers(gc,
|
||||||
(const char **) reply->dns_addresses);
|
(const char **) reply->dns_addresses);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
g_ril_reply_free_setup_data_call(reply);
|
g_ril_reply_free_setup_data_call(reply);
|
||||||
@@ -219,8 +252,8 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void ril_gprs_context_activate_primary(struct ofono_gprs_context *gc,
|
static void ril_gprs_context_activate_primary(struct ofono_gprs_context *gc,
|
||||||
const struct ofono_gprs_primary_context *ctx,
|
const struct ofono_gprs_primary_context *ctx,
|
||||||
ofono_gprs_context_cb_t cb, void *data)
|
ofono_gprs_context_cb_t cb, void *data)
|
||||||
{
|
{
|
||||||
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
|
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
|
||||||
struct cb_data *cbd = cb_data_new(cb, data);
|
struct cb_data *cbd = cb_data_new(cb, data);
|
||||||
@@ -284,7 +317,8 @@ error:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ril_deactivate_data_call_cb(struct ril_msg *message, gpointer user_data)
|
static void ril_deactivate_data_call_cb(struct ril_msg *message,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
struct cb_data *cbd = user_data;
|
struct cb_data *cbd = user_data;
|
||||||
ofono_gprs_context_cb_t cb = cbd->cb;
|
ofono_gprs_context_cb_t cb = cbd->cb;
|
||||||
@@ -322,7 +356,8 @@ static void ril_deactivate_data_call_cb(struct ril_msg *message, gpointer user_d
|
|||||||
|
|
||||||
static void ril_gprs_context_deactivate_primary(struct ofono_gprs_context *gc,
|
static void ril_gprs_context_deactivate_primary(struct ofono_gprs_context *gc,
|
||||||
unsigned int id,
|
unsigned int id,
|
||||||
ofono_gprs_context_cb_t cb, void *data)
|
ofono_gprs_context_cb_t cb,
|
||||||
|
void *data)
|
||||||
{
|
{
|
||||||
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
|
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
|
||||||
struct cb_data *cbd = NULL;
|
struct cb_data *cbd = NULL;
|
||||||
@@ -375,6 +410,7 @@ error:
|
|||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
ofono_error("Send RIL_REQUEST_DEACTIVATE_DATA_CALL failed.");
|
ofono_error("Send RIL_REQUEST_DEACTIVATE_DATA_CALL failed.");
|
||||||
g_free(cbd);
|
g_free(cbd);
|
||||||
|
|
||||||
if (cb)
|
if (cb)
|
||||||
CALLBACK_WITH_FAILURE(cb, data);
|
CALLBACK_WITH_FAILURE(cb, data);
|
||||||
}
|
}
|
||||||
@@ -402,7 +438,6 @@ static int ril_gprs_context_probe(struct ofono_gprs_context *gc,
|
|||||||
set_context_disconnected(gcd);
|
set_context_disconnected(gcd);
|
||||||
|
|
||||||
ofono_gprs_context_set_data(gc, gcd);
|
ofono_gprs_context_set_data(gc, gcd);
|
||||||
gcd->regid = -1;
|
|
||||||
|
|
||||||
gcd->regid = g_ril_register(gcd->ril, RIL_UNSOL_DATA_CALL_LIST_CHANGED,
|
gcd->regid = g_ril_register(gcd->ril, RIL_UNSOL_DATA_CALL_LIST_CHANGED,
|
||||||
ril_gprs_context_call_list_changed, gc);
|
ril_gprs_context_call_list_changed, gc);
|
||||||
@@ -415,14 +450,13 @@ static void ril_gprs_context_remove(struct ofono_gprs_context *gc)
|
|||||||
|
|
||||||
DBG("");
|
DBG("");
|
||||||
|
|
||||||
if (gcd->state != STATE_IDLE) {
|
if (gcd->state != STATE_IDLE)
|
||||||
ril_gprs_context_detach_shutdown(gc, 0);
|
ril_gprs_context_detach_shutdown(gc, 0);
|
||||||
}
|
|
||||||
|
|
||||||
ofono_gprs_context_set_data(gc, NULL);
|
ofono_gprs_context_set_data(gc, NULL);
|
||||||
|
|
||||||
if (gcd->regid != -1)
|
if (gcd->regid != -1)
|
||||||
g_ril_unregister(gcd->ril,gcd->regid);
|
g_ril_unregister(gcd->ril, gcd->regid);
|
||||||
|
|
||||||
g_ril_unref(gcd->ril);
|
g_ril_unref(gcd->ril);
|
||||||
g_free(gcd);
|
g_free(gcd);
|
||||||
@@ -432,9 +466,9 @@ static struct ofono_gprs_context_driver driver = {
|
|||||||
.name = RILMODEM,
|
.name = RILMODEM,
|
||||||
.probe = ril_gprs_context_probe,
|
.probe = ril_gprs_context_probe,
|
||||||
.remove = ril_gprs_context_remove,
|
.remove = ril_gprs_context_remove,
|
||||||
.activate_primary = ril_gprs_context_activate_primary,
|
.activate_primary = ril_gprs_context_activate_primary,
|
||||||
.deactivate_primary = ril_gprs_context_deactivate_primary,
|
.deactivate_primary = ril_gprs_context_deactivate_primary,
|
||||||
.detach_shutdown = ril_gprs_context_detach_shutdown,
|
.detach_shutdown = ril_gprs_context_detach_shutdown,
|
||||||
};
|
};
|
||||||
|
|
||||||
void ril_gprs_context_init(void)
|
void ril_gprs_context_init(void)
|
||||||
|
|||||||
@@ -45,6 +45,8 @@
|
|||||||
#include "rilmodem.h"
|
#include "rilmodem.h"
|
||||||
|
|
||||||
#include <ofono/netreg.h>
|
#include <ofono/netreg.h>
|
||||||
|
#include <ofono/sim.h>
|
||||||
|
#include "storage.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This module is the ofono_gprs_driver implementation for rilmodem.
|
* This module is the ofono_gprs_driver implementation for rilmodem.
|
||||||
@@ -63,16 +65,23 @@
|
|||||||
* +CREG ( see 27.003 7.2 ).
|
* +CREG ( see 27.003 7.2 ).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define FAKE_STATE_TIMER 5
|
||||||
|
|
||||||
struct gprs_data {
|
struct gprs_data {
|
||||||
GRil *ril;
|
GRil *ril;
|
||||||
gboolean ofono_attached;
|
gboolean ofono_attached;
|
||||||
int max_cids;
|
int max_cids;
|
||||||
int rild_status;
|
int rild_status;
|
||||||
|
int true_status;
|
||||||
gboolean notified;
|
gboolean notified;
|
||||||
guint registerid;
|
guint registerid;
|
||||||
guint timer_id;
|
guint timer_id;
|
||||||
|
guint fake_timer_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*if we have called ofono_gprs_register or not*/
|
||||||
|
static gboolean registered;
|
||||||
|
|
||||||
static void ril_gprs_registration_status(struct ofono_gprs *gprs,
|
static void ril_gprs_registration_status(struct ofono_gprs *gprs,
|
||||||
ofono_gprs_status_cb_t cb,
|
ofono_gprs_status_cb_t cb,
|
||||||
void *data);
|
void *data);
|
||||||
@@ -81,7 +90,10 @@ static void ril_gprs_state_change(struct ril_msg *message, gpointer user_data)
|
|||||||
{
|
{
|
||||||
struct ofono_gprs *gprs = user_data;
|
struct ofono_gprs *gprs = user_data;
|
||||||
|
|
||||||
g_assert(message->req == RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED);
|
g_assert(message->req ==
|
||||||
|
RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED);
|
||||||
|
|
||||||
|
DBG("");
|
||||||
|
|
||||||
/* We need to notify core always to cover situations when
|
/* We need to notify core always to cover situations when
|
||||||
* connection drops temporarily for example when user is
|
* connection drops temporarily for example when user is
|
||||||
@@ -97,6 +109,7 @@ static gboolean ril_gprs_set_attached_callback(gpointer user_data)
|
|||||||
ofono_gprs_cb_t cb = cbd->cb;
|
ofono_gprs_cb_t cb = cbd->cb;
|
||||||
struct ofono_gprs *gprs = cbd->user;
|
struct ofono_gprs *gprs = cbd->user;
|
||||||
struct gprs_data *gd = ofono_gprs_get_data(gprs);
|
struct gprs_data *gd = ofono_gprs_get_data(gprs);
|
||||||
|
|
||||||
DBG("");
|
DBG("");
|
||||||
|
|
||||||
gd->timer_id = 0;
|
gd->timer_id = 0;
|
||||||
@@ -129,11 +142,12 @@ static void ril_gprs_set_attached(struct ofono_gprs *gprs, int attached,
|
|||||||
* are met.
|
* are met.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
gd->notified = (gd->ofono_attached == attached) ? TRUE : FALSE;
|
||||||
|
|
||||||
gd->ofono_attached = attached;
|
gd->ofono_attached = attached;
|
||||||
|
|
||||||
cbd->user = gprs;
|
cbd->user = gprs;
|
||||||
|
|
||||||
ril_gprs_registration_status(gprs, NULL, NULL);
|
|
||||||
/*
|
/*
|
||||||
* However we cannot respond immediately, since core sets the
|
* However we cannot respond immediately, since core sets the
|
||||||
* value of driver_attached after calling set_attached and that
|
* value of driver_attached after calling set_attached and that
|
||||||
@@ -144,6 +158,42 @@ static void ril_gprs_set_attached(struct ofono_gprs *gprs, int attached,
|
|||||||
cbd);
|
cbd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean ril_fake_response(gpointer user_data)
|
||||||
|
{
|
||||||
|
struct cb_data *cbd = user_data;
|
||||||
|
struct ofono_gprs *gprs = cbd->user;
|
||||||
|
struct gprs_data *gd = ofono_gprs_get_data(gprs);
|
||||||
|
|
||||||
|
DBG("");
|
||||||
|
|
||||||
|
ofono_gprs_status_notify(gprs, gd->true_status);
|
||||||
|
g_free(cbd);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean ril_roaming_allowed()
|
||||||
|
{
|
||||||
|
GError *error;
|
||||||
|
error = NULL;
|
||||||
|
GKeyFile *settings;
|
||||||
|
struct ofono_sim *sim;
|
||||||
|
|
||||||
|
sim = get_sim();
|
||||||
|
const char *imsi = ofono_sim_get_imsi(sim);
|
||||||
|
settings = storage_open(imsi, "gprs");
|
||||||
|
gboolean roaming_allowed = g_key_file_get_boolean(settings,
|
||||||
|
"Settings",
|
||||||
|
"RoamingAllowed",
|
||||||
|
&error);
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
g_error_free(error);
|
||||||
|
|
||||||
|
storage_close(imsi, "gprs", settings, FALSE);
|
||||||
|
|
||||||
|
return roaming_allowed;
|
||||||
|
}
|
||||||
|
|
||||||
static void ril_data_reg_cb(struct ril_msg *message, gpointer user_data)
|
static void ril_data_reg_cb(struct ril_msg *message, gpointer user_data)
|
||||||
{
|
{
|
||||||
struct cb_data *cbd = user_data;
|
struct cb_data *cbd = user_data;
|
||||||
@@ -153,7 +203,8 @@ static void ril_data_reg_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
struct ofono_error error;
|
struct ofono_error error;
|
||||||
int status, lac, ci, tech;
|
int status, lac, ci, tech;
|
||||||
int max_cids = 1;
|
int max_cids = 1;
|
||||||
int id = RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED;
|
|
||||||
|
DBG("");
|
||||||
|
|
||||||
if (gd && message->error == RIL_E_SUCCESS) {
|
if (gd && message->error == RIL_E_SUCCESS) {
|
||||||
decode_ril_error(&error, "OK");
|
decode_ril_error(&error, "OK");
|
||||||
@@ -174,12 +225,20 @@ static void ril_data_reg_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gd->rild_status == -1) {
|
if ((gd->fake_timer_id > 0) &&
|
||||||
ofono_gprs_register(gprs);
|
((status == (NETWORK_REGISTRATION_STATUS_REGISTERED
|
||||||
|
|| NETWORK_REGISTRATION_STATUS_ROAMING)) ||
|
||||||
|
!(gd->ofono_attached))) {
|
||||||
|
g_source_remove(gd->fake_timer_id);
|
||||||
|
gd->true_status = -1;
|
||||||
|
}
|
||||||
|
|
||||||
DBG("Starting to listen network status");
|
if (status > 10)
|
||||||
gd->registerid = g_ril_register(gd->ril,
|
status = status - 10;
|
||||||
id, ril_gprs_state_change, gprs);
|
|
||||||
|
if (!registered) {
|
||||||
|
ofono_gprs_register(gprs);
|
||||||
|
registered = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max_cids > gd->max_cids) {
|
if (max_cids > gd->max_cids) {
|
||||||
@@ -193,63 +252,130 @@ static void ril_data_reg_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
if (status == NETWORK_REGISTRATION_STATUS_ROAMING)
|
if (status == NETWORK_REGISTRATION_STATUS_ROAMING)
|
||||||
status = check_if_really_roaming(status);
|
status = check_if_really_roaming(status);
|
||||||
|
|
||||||
if (gd->ofono_attached && !gd->notified) {
|
DBG(" attached:%d, status:%d", gd->ofono_attached, status);
|
||||||
if (status == NETWORK_REGISTRATION_STATUS_ROAMING ||
|
|
||||||
status == NETWORK_REGISTRATION_STATUS_REGISTERED) {
|
if (!gd->ofono_attached) {
|
||||||
DBG("connection becomes available");
|
if (status == NETWORK_REGISTRATION_STATUS_ROAMING) {
|
||||||
gd->ofono_attached = TRUE;
|
if (!gd->notified && cb) {
|
||||||
|
if (ril_roaming_allowed() == FALSE)
|
||||||
|
ofono_gprs_detached_notify(gprs);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This prevents core ending
|
||||||
|
* into eternal loop with driver
|
||||||
|
*/
|
||||||
|
decode_ril_error(&error, "FAIL");
|
||||||
|
|
||||||
|
ofono_gprs_status_notify(gprs, status);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (status == NETWORK_REGISTRATION_STATUS_SEARCHING &&
|
||||||
|
!gd->notified &&
|
||||||
|
cb)
|
||||||
|
/*
|
||||||
|
* This is a hack that prevents core ending
|
||||||
|
* into eternal loop with driver
|
||||||
|
*/
|
||||||
|
decode_ril_error(&error, "FAIL");
|
||||||
|
|
||||||
ofono_gprs_status_notify(gprs, status);
|
ofono_gprs_status_notify(gprs, status);
|
||||||
gd->notified = TRUE;
|
|
||||||
gd->rild_status = status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cb)
|
||||||
|
gd->notified = TRUE;
|
||||||
|
|
||||||
|
gd->rild_status = status;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gd->ofono_attached &&
|
if (status == NETWORK_REGISTRATION_STATUS_ROAMING ||
|
||||||
status != NETWORK_REGISTRATION_STATUS_SEARCHING) {
|
status == NETWORK_REGISTRATION_STATUS_REGISTERED) {
|
||||||
DBG("ofono attached, start faking responses");
|
|
||||||
if (status != NETWORK_REGISTRATION_STATUS_ROAMING) {
|
|
||||||
/*
|
|
||||||
* Only core can succesfully drop the connection
|
|
||||||
* If we drop the connection from here it leads
|
|
||||||
* to race situation where core asks context
|
|
||||||
* deactivation and at the same time we get
|
|
||||||
* Registered notification from modem.
|
|
||||||
*/
|
|
||||||
status = NETWORK_REGISTRATION_STATUS_REGISTERED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gd->registerid != -1)
|
|
||||||
g_ril_unregister(gd->ril, gd->registerid);
|
|
||||||
gd->registerid = -1;
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* Client is not approving succesful result
|
|
||||||
* This covers the situation when context is
|
|
||||||
* active in roaming situation and client closes
|
|
||||||
* it directly by calling RoamingAllowed in API
|
|
||||||
*/
|
|
||||||
DBG("data registration status is %d", status);
|
|
||||||
|
|
||||||
if (status != NETWORK_REGISTRATION_STATUS_SEARCHING) {
|
|
||||||
DBG("ofono not attached, notify core");
|
|
||||||
status = NETWORK_REGISTRATION_STATUS_NOT_REGISTERED;
|
|
||||||
ofono_gprs_detached_notify(gprs);
|
|
||||||
gd->notified = FALSE;
|
|
||||||
gd->ofono_attached = FALSE;
|
|
||||||
} else if (gd->notified && check_if_really_searching()) {
|
|
||||||
DBG("hide the searching state");
|
|
||||||
status = NETWORK_REGISTRATION_STATUS_REGISTERED;
|
|
||||||
ofono_gprs_status_notify(gprs, status);
|
ofono_gprs_status_notify(gprs, status);
|
||||||
gd->ofono_attached = TRUE;
|
gd->rild_status = status;
|
||||||
|
} else {
|
||||||
|
if (gd->fake_timer_id <= 0) {
|
||||||
|
struct cb_data *fake_cbd = cb_data_new(NULL, NULL);
|
||||||
|
|
||||||
|
fake_cbd->user = gprs;
|
||||||
|
gd->fake_timer_id = g_timeout_add_seconds(
|
||||||
|
FAKE_STATE_TIMER,
|
||||||
|
ril_fake_response, fake_cbd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gd->true_status = status;
|
||||||
|
|
||||||
|
if (gd->rild_status == NETWORK_REGISTRATION_STATUS_ROAMING)
|
||||||
|
status = NETWORK_REGISTRATION_STATUS_ROAMING;
|
||||||
|
else
|
||||||
|
status = NETWORK_REGISTRATION_STATUS_REGISTERED;
|
||||||
|
|
||||||
|
gd->rild_status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error:
|
||||||
|
ofono_info("data registration status is %d", status);
|
||||||
|
|
||||||
|
if (cb)
|
||||||
|
cb(&error, status, cbd->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ril_data_probe_reg_cb(struct ril_msg *message, gpointer user_data)
|
||||||
|
{
|
||||||
|
struct cb_data *cbd = user_data;
|
||||||
|
struct ofono_gprs *gprs = cbd->user;
|
||||||
|
struct gprs_data *gd = ofono_gprs_get_data(gprs);
|
||||||
|
struct ofono_error error;
|
||||||
|
int status, lac, ci, tech;
|
||||||
|
int max_cids = 1;
|
||||||
|
int id = RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED;
|
||||||
|
|
||||||
|
DBG("");
|
||||||
|
|
||||||
|
if (!(gd && message->error == RIL_E_SUCCESS)) {
|
||||||
|
ofono_error("ril_data_reg_cb: reply failure: %s",
|
||||||
|
ril_error_to_string(message->error));
|
||||||
|
decode_ril_error(&error, "FAIL");
|
||||||
|
error.error = message->error;
|
||||||
|
status = NETWORK_REGISTRATION_STATUS_UNKNOWN;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
decode_ril_error(&error, "OK");
|
||||||
|
status = -1;
|
||||||
|
|
||||||
|
if (ril_util_parse_reg(gd->ril, message, &status,
|
||||||
|
&lac, &ci, &tech, &max_cids) == FALSE) {
|
||||||
|
ofono_error("Failure parsing data registration response.");
|
||||||
|
decode_ril_error(&error, "FAIL");
|
||||||
|
|
||||||
|
if (status == -1)
|
||||||
|
status = NETWORK_REGISTRATION_STATUS_UNKNOWN;
|
||||||
|
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
ofono_gprs_register(gprs);
|
||||||
|
|
||||||
|
registered = TRUE;
|
||||||
|
|
||||||
|
if (max_cids > gd->max_cids) {
|
||||||
|
DBG("Setting max cids to %d", max_cids);
|
||||||
|
gd->max_cids = max_cids;
|
||||||
|
ofono_gprs_set_cid_range(gprs, 1, max_cids);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == NETWORK_REGISTRATION_STATUS_ROAMING)
|
||||||
|
status = check_if_really_roaming(status);
|
||||||
|
|
||||||
|
out:
|
||||||
|
ofono_info("data registration status is %d", status);
|
||||||
|
|
||||||
|
DBG("Starting to listen network status");
|
||||||
|
gd->registerid = g_ril_register(gd->ril,
|
||||||
|
id, ril_gprs_state_change, gprs);
|
||||||
|
|
||||||
gd->rild_status = status;
|
gd->rild_status = status;
|
||||||
|
|
||||||
error:
|
|
||||||
if (cb)
|
|
||||||
cb(&error, status, cbd->data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ril_gprs_registration_status(struct ofono_gprs *gprs,
|
static void ril_gprs_registration_status(struct ofono_gprs *gprs,
|
||||||
@@ -261,20 +387,27 @@ static void ril_gprs_registration_status(struct ofono_gprs *gprs,
|
|||||||
int request = RIL_REQUEST_DATA_REGISTRATION_STATE;
|
int request = RIL_REQUEST_DATA_REGISTRATION_STATE;
|
||||||
guint ret;
|
guint ret;
|
||||||
|
|
||||||
|
DBG("");
|
||||||
|
|
||||||
if (gd == NULL || cbd == NULL)
|
if (gd == NULL || cbd == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cbd->user = gprs;
|
cbd->user = gprs;
|
||||||
|
|
||||||
ret = g_ril_send(gd->ril, request,
|
ret = g_ril_send(gd->ril, request,
|
||||||
NULL, 0, ril_data_reg_cb, cbd, g_free);
|
NULL, 0,
|
||||||
|
((gd->rild_status == -1)
|
||||||
|
? ril_data_probe_reg_cb
|
||||||
|
: ril_data_reg_cb), cbd, g_free);
|
||||||
|
|
||||||
g_ril_print_request_no_args(gd->ril, ret, request);
|
g_ril_print_request_no_args(gd->ril, ret, request);
|
||||||
|
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
ofono_error("Send RIL_REQUEST_DATA_RESTISTRATION_STATE failed.");
|
ofono_error("Send RIL_REQUEST_DATA_RESTISTRATION_STATE fail.");
|
||||||
g_free(cbd);
|
g_free(cbd);
|
||||||
CALLBACK_WITH_FAILURE(cb, -1, data);
|
|
||||||
|
if (cb)
|
||||||
|
CALLBACK_WITH_FAILURE(cb, -1, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,9 +425,13 @@ static int ril_gprs_probe(struct ofono_gprs *gprs,
|
|||||||
gd->ofono_attached = FALSE;
|
gd->ofono_attached = FALSE;
|
||||||
gd->max_cids = 0;
|
gd->max_cids = 0;
|
||||||
gd->rild_status = -1;
|
gd->rild_status = -1;
|
||||||
|
gd->true_status = -1;
|
||||||
gd->notified = FALSE;
|
gd->notified = FALSE;
|
||||||
gd->registerid = -1;
|
gd->registerid = -1;
|
||||||
gd->timer_id = 0;
|
gd->timer_id = 0;
|
||||||
|
|
||||||
|
registered = FALSE;
|
||||||
|
|
||||||
ofono_gprs_set_data(gprs, gd);
|
ofono_gprs_set_data(gprs, gd);
|
||||||
|
|
||||||
ril_gprs_registration_status(gprs, NULL, NULL);
|
ril_gprs_registration_status(gprs, NULL, NULL);
|
||||||
@@ -316,6 +453,9 @@ static void ril_gprs_remove(struct ofono_gprs *gprs)
|
|||||||
if (gd->timer_id > 0)
|
if (gd->timer_id > 0)
|
||||||
g_source_remove(gd->timer_id);
|
g_source_remove(gd->timer_id);
|
||||||
|
|
||||||
|
if (gd->fake_timer_id > 0)
|
||||||
|
g_source_remove(gd->fake_timer_id);
|
||||||
|
|
||||||
g_ril_unref(gd->ril);
|
g_ril_unref(gd->ril);
|
||||||
g_free(gd);
|
g_free(gd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -573,11 +573,13 @@ error:
|
|||||||
ofono_error("Unable to notify ofono about nitz");
|
ofono_error("Unable to notify ofono about nitz");
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean check_if_really_searching()
|
gboolean check_if_ok_to_attach()
|
||||||
{
|
{
|
||||||
int status = NETWORK_REGISTRATION_STATUS_SEARCHING;
|
int status = NETWORK_REGISTRATION_STATUS_SEARCHING;
|
||||||
status = ofono_netreg_get_status(current_netreg);
|
status = ofono_netreg_get_status(current_netreg);
|
||||||
if (status == NETWORK_REGISTRATION_STATUS_SEARCHING)
|
if (status == NETWORK_REGISTRATION_STATUS_SEARCHING
|
||||||
|
|| status == NETWORK_REGISTRATION_STATUS_ROAMING
|
||||||
|
|| status == NETWORK_REGISTRATION_STATUS_REGISTERED)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -667,6 +669,7 @@ static void ril_netreg_remove(struct ofono_netreg *netreg)
|
|||||||
g_source_remove(nd->nitz_timeout);
|
g_source_remove(nd->nitz_timeout);
|
||||||
|
|
||||||
ofono_netreg_set_data(netreg, NULL);
|
ofono_netreg_set_data(netreg, NULL);
|
||||||
|
current_netreg = NULL;
|
||||||
|
|
||||||
if (nd->timer_id > 0)
|
if (nd->timer_id > 0)
|
||||||
g_source_remove(nd->timer_id);
|
g_source_remove(nd->timer_id);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
* Copyright (C) ST-Ericsson SA 2010.
|
* Copyright (C) ST-Ericsson SA 2010.
|
||||||
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
||||||
* Copyright (C) 2013 Jolla Ltd
|
* Copyright (C) 2013 Jolla Ltd
|
||||||
* Contact: Jussi Kangas <jussi.kangas@tieto.com>
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -162,11 +161,18 @@ void handle_adn(size_t len, char *name, const unsigned char *msg,
|
|||||||
char *number, struct pb_file_info *next_file,
|
char *number, struct pb_file_info *next_file,
|
||||||
struct pb_data *pbd)
|
struct pb_data *pbd)
|
||||||
{
|
{
|
||||||
const uint8_t name_length = len - 14;
|
uint8_t name_length;
|
||||||
const uint8_t number_start = name_length;
|
uint8_t number_start;
|
||||||
uint8_t number_length = 0;
|
uint8_t number_length = 0;
|
||||||
uint8_t extension_record = UNUSED;
|
uint8_t extension_record = UNUSED;
|
||||||
uint8_t i, prefix;
|
uint8_t i, prefix;
|
||||||
|
|
||||||
|
if (len < 14)
|
||||||
|
return;
|
||||||
|
|
||||||
|
name_length = len - 14;
|
||||||
|
number_start = name_length;
|
||||||
|
|
||||||
name = sim_string_to_utf8(msg, name_length);
|
name = sim_string_to_utf8(msg, name_length);
|
||||||
/* Length contains also TON&NPI */
|
/* Length contains also TON&NPI */
|
||||||
number_length = msg[number_start];
|
number_length = msg[number_start];
|
||||||
@@ -256,15 +262,19 @@ void handle_adn(size_t len, char *name, const unsigned char *msg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_sne(size_t len,
|
void handle_sne(size_t len, const unsigned char *msg, char *sne)
|
||||||
const unsigned char *msg,
|
|
||||||
char *sne)
|
|
||||||
{
|
{
|
||||||
const uint8_t sne_length = len - 2;
|
uint8_t sne_length;
|
||||||
uint8_t phonebook_entry_nbr = msg[len - 1];
|
uint8_t phonebook_entry_nbr;
|
||||||
|
|
||||||
DBG("SNE");
|
DBG("SNE");
|
||||||
|
|
||||||
|
if (len < 2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
sne_length = len - 2;
|
||||||
|
phonebook_entry_nbr = msg[len - 1];
|
||||||
|
|
||||||
sne = sim_string_to_utf8(msg, sne_length);
|
sne = sim_string_to_utf8(msg, sne_length);
|
||||||
|
|
||||||
if (sne) {
|
if (sne) {
|
||||||
@@ -299,20 +309,26 @@ void handle_sne(size_t len,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_anr(size_t len,
|
void handle_anr(size_t len,const unsigned char *msg,char *anr,
|
||||||
const unsigned char *msg,
|
struct pb_file_info *next_file, struct pb_data *pbd)
|
||||||
char *anr,
|
|
||||||
struct pb_file_info *next_file,
|
|
||||||
struct pb_data *pbd)
|
|
||||||
{
|
{
|
||||||
uint8_t number_length = 0;
|
uint8_t number_length = 0;
|
||||||
uint8_t extension_record = UNUSED;
|
uint8_t extension_record = UNUSED;
|
||||||
uint8_t aas_record = UNUSED;
|
uint8_t aas_record = UNUSED;
|
||||||
uint8_t i, prefix;
|
uint8_t i, prefix;
|
||||||
uint8_t phonebook_entry_nbr = msg[len - 1];
|
uint8_t phonebook_entry_nbr;
|
||||||
GSList *list_entry;
|
GSList *list_entry;
|
||||||
|
|
||||||
DBG("ANR");
|
DBG("ANR");
|
||||||
|
|
||||||
|
if (!msg)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (len < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
phonebook_entry_nbr = msg[len - 1];
|
||||||
|
|
||||||
if (msg[0] == UNUSED)
|
if (msg[0] == UNUSED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -328,7 +344,7 @@ void handle_anr(size_t len,
|
|||||||
prefix = 0;
|
prefix = 0;
|
||||||
|
|
||||||
if ((msg[2] & TON_MASK) ==
|
if ((msg[2] & TON_MASK) ==
|
||||||
TON_INTERNATIONAL) {
|
TON_INTERNATIONAL) {
|
||||||
anr[0] = '+';
|
anr[0] = '+';
|
||||||
prefix = 1;
|
prefix = 1;
|
||||||
}
|
}
|
||||||
@@ -398,11 +414,18 @@ void handle_anr(size_t len,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_email(size_t len,
|
void handle_email(size_t len, const unsigned char *msg, char *email)
|
||||||
const unsigned char *msg,
|
|
||||||
char *email)
|
|
||||||
{
|
{
|
||||||
uint8_t phonebook_entry_nbr = msg[len - 1];
|
uint8_t phonebook_entry_nbr;
|
||||||
|
|
||||||
|
if (!msg)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (len < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
phonebook_entry_nbr = msg[len - 1];
|
||||||
|
|
||||||
email = sim_string_to_utf8(msg, len - 2);
|
email = sim_string_to_utf8(msg, len - 2);
|
||||||
|
|
||||||
/* GSlist nth counts from 0, PB entries from 1 */
|
/* GSlist nth counts from 0, PB entries from 1 */
|
||||||
@@ -434,13 +457,13 @@ void handle_email(size_t len,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_ext1(struct pb_data *pbd,
|
void handle_ext1(struct pb_data *pbd, const unsigned char *msg,
|
||||||
const unsigned char *msg,
|
char *ext_number, struct pb_file_info *next_file)
|
||||||
char *ext_number,
|
|
||||||
struct pb_file_info *next_file)
|
|
||||||
{
|
{
|
||||||
uint8_t number_length, i, next_extension_record;
|
uint8_t number_length, i, next_extension_record;
|
||||||
|
|
||||||
|
if (!msg)
|
||||||
|
return;
|
||||||
|
|
||||||
number_length = msg[1];
|
number_length = msg[1];
|
||||||
|
|
||||||
@@ -494,7 +517,7 @@ void handle_ext1(struct pb_data *pbd,
|
|||||||
list_entry->data;
|
list_entry->data;
|
||||||
if (entry) {
|
if (entry) {
|
||||||
strcat(entry->anr,
|
strcat(entry->anr,
|
||||||
ext_number);
|
ext_number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -610,8 +633,10 @@ static void pb_adn_sim_data_cb(const struct ofono_error *error,
|
|||||||
file_info = cbd_outer->user;
|
file_info = cbd_outer->user;
|
||||||
cbd = cbd_outer->data;
|
cbd = cbd_outer->data;
|
||||||
|
|
||||||
if (!cbd)
|
if (!cbd) {
|
||||||
|
g_free(cbd_outer);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
pb = cbd->user;
|
pb = cbd->user;
|
||||||
cb = cbd->cb;
|
cb = cbd->cb;
|
||||||
@@ -694,8 +719,10 @@ static void pb_adn_sim_data_cb(const struct ofono_error *error,
|
|||||||
g_slist_free(phonebook_entry_start);
|
g_slist_free(phonebook_entry_start);
|
||||||
g_slist_free(pb_files);
|
g_slist_free(pb_files);
|
||||||
g_free(cbd_outer);
|
g_free(cbd_outer);
|
||||||
|
void *pb = cbd->data;
|
||||||
|
g_free(cbd);
|
||||||
DBG("Finally all PB data read");
|
DBG("Finally all PB data read");
|
||||||
CALLBACK_WITH_SUCCESS(cb, cbd->data);
|
CALLBACK_WITH_SUCCESS(cb, pb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -765,8 +792,12 @@ static void pb_adn_sim_info_cb(const struct ofono_error *error,
|
|||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
|
|
||||||
if (cb && cbd)
|
if (cbd){
|
||||||
CALLBACK_WITH_FAILURE(cb, cbd->data);
|
void *pb = cbd->data;
|
||||||
|
g_free(cbd);
|
||||||
|
if(cb)
|
||||||
|
CALLBACK_WITH_FAILURE(cb, pb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean is_reading_required(uint8_t file_type)
|
static gboolean is_reading_required(uint8_t file_type)
|
||||||
@@ -799,9 +830,28 @@ static void pb_content_data_cb(const struct ofono_error *error,
|
|||||||
if (extension_file_info)
|
if (extension_file_info)
|
||||||
file_info = decode_read_response(extension_file_info, sdata,
|
file_info = decode_read_response(extension_file_info, sdata,
|
||||||
length, pb);
|
length, pb);
|
||||||
else
|
else {
|
||||||
|
/*
|
||||||
|
* These checks are crash hacks.
|
||||||
|
* AFAIK there's a possibility that we end up here and pb_next is NULL
|
||||||
|
* in case remove hase been called while phonebook reading is in
|
||||||
|
* process. If you find better solution to this issue feel free to
|
||||||
|
* change this.
|
||||||
|
*/
|
||||||
|
if (pb_next == NULL) {
|
||||||
|
ofono_error("phonebook reading failed");
|
||||||
|
if (cbd){
|
||||||
|
void *pb = cbd->data;
|
||||||
|
g_free(cbd);
|
||||||
|
if(cb && pbd)
|
||||||
|
CALLBACK_WITH_FAILURE(cb, pb);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
file_info =
|
file_info =
|
||||||
decode_read_response(pb_next->data, sdata, length, pb);
|
decode_read_response(pb_next->data, sdata, length, pb);
|
||||||
|
}
|
||||||
|
|
||||||
if (file_info) {
|
if (file_info) {
|
||||||
DBG("Reading extension file %04X, record %d, structure %d",
|
DBG("Reading extension file %04X, record %d, structure %d",
|
||||||
@@ -818,7 +868,7 @@ static void pb_content_data_cb(const struct ofono_error *error,
|
|||||||
file_info = pb_next->data;
|
file_info = pb_next->data;
|
||||||
|
|
||||||
if (((file_info->structure ==
|
if (((file_info->structure ==
|
||||||
OFONO_SIM_FILE_STRUCTURE_FIXED) ||
|
OFONO_SIM_FILE_STRUCTURE_FIXED) ||
|
||||||
(file_info->structure ==
|
(file_info->structure ==
|
||||||
OFONO_SIM_FILE_STRUCTURE_CYCLIC))
|
OFONO_SIM_FILE_STRUCTURE_CYCLIC))
|
||||||
&& (file_info->record <
|
&& (file_info->record <
|
||||||
@@ -855,7 +905,7 @@ static void pb_content_data_cb(const struct ofono_error *error,
|
|||||||
DBG("All data requested, start vCard creation");
|
DBG("All data requested, start vCard creation");
|
||||||
while (list_entry) {
|
while (list_entry) {
|
||||||
struct phonebook_entry *entry =
|
struct phonebook_entry *entry =
|
||||||
list_entry->data;
|
list_entry->data;
|
||||||
|
|
||||||
if (entry) {
|
if (entry) {
|
||||||
DBG("vCard:\nname=%s\n",
|
DBG("vCard:\nname=%s\n",
|
||||||
@@ -892,8 +942,10 @@ static void pb_content_data_cb(const struct ofono_error *error,
|
|||||||
|
|
||||||
g_slist_free(phonebook_entry_start);
|
g_slist_free(phonebook_entry_start);
|
||||||
g_slist_free(pb_files);
|
g_slist_free(pb_files);
|
||||||
|
void *pb = cbd->data;
|
||||||
|
g_free(cbd);
|
||||||
DBG("Finally all PB data read");
|
DBG("Finally all PB data read");
|
||||||
CALLBACK_WITH_SUCCESS(cb, cbd->data);
|
CALLBACK_WITH_SUCCESS(cb, pb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -958,8 +1010,12 @@ static void pb_content_data_read(struct pb_data *pbd,
|
|||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
|
|
||||||
if (cb && cbd)
|
if (cbd){
|
||||||
CALLBACK_WITH_FAILURE(cb, cbd->data);
|
void *pb = cbd->data;
|
||||||
|
g_free(cbd);
|
||||||
|
if(cb)
|
||||||
|
CALLBACK_WITH_FAILURE(cb, pb);
|
||||||
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
DBG("Exiting");
|
DBG("Exiting");
|
||||||
@@ -1032,9 +1088,11 @@ static void pb_content_info_cb(const struct ofono_error *error,
|
|||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
|
|
||||||
if (cb && cbd) {
|
if (cbd){
|
||||||
DBG("Error cbd=%p, pbd=%p, file_info=%p", cbd, pbd, file_info);
|
void *pb = cbd->data;
|
||||||
CALLBACK_WITH_FAILURE(cb, cbd->data);
|
g_free(cbd);
|
||||||
|
if(cb)
|
||||||
|
CALLBACK_WITH_FAILURE(cb, pb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1149,8 +1207,12 @@ static void pb_reference_data_cb(const struct ofono_error *error,
|
|||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
|
|
||||||
if (cb && cbd)
|
if (cbd){
|
||||||
CALLBACK_WITH_FAILURE(cb, cbd->data);
|
void *pb = cbd->data;
|
||||||
|
g_free(cbd);
|
||||||
|
if(cb)
|
||||||
|
CALLBACK_WITH_FAILURE(cb, pb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pb_reference_info_cb(const struct ofono_error *error,
|
static void pb_reference_info_cb(const struct ofono_error *error,
|
||||||
@@ -1201,8 +1263,12 @@ static void pb_reference_info_cb(const struct ofono_error *error,
|
|||||||
pb_reference_data_cb, cbd);
|
pb_reference_data_cb, cbd);
|
||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
if (cb && cbd)
|
if (cbd){
|
||||||
CALLBACK_WITH_FAILURE(cb, cbd->data);
|
void *pb = cbd->data;
|
||||||
|
g_free(cbd);
|
||||||
|
if(cb)
|
||||||
|
CALLBACK_WITH_FAILURE(cb, pb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ril_export_entries(struct ofono_phonebook *pb,
|
static void ril_export_entries(struct ofono_phonebook *pb,
|
||||||
@@ -1241,10 +1307,12 @@ static void ril_export_entries(struct ofono_phonebook *pb,
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
|
|
||||||
if (cb && cbd)
|
if (cbd){
|
||||||
CALLBACK_WITH_FAILURE(cb, cbd->data);
|
void *pb = cbd->data;
|
||||||
|
g_free(cbd);
|
||||||
g_free(cbd);
|
if(cb)
|
||||||
|
CALLBACK_WITH_FAILURE(cb, pb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean ril_delayed_register(gpointer user_data)
|
static gboolean ril_delayed_register(gpointer user_data)
|
||||||
@@ -1292,7 +1360,7 @@ static struct ofono_phonebook_driver driver = {
|
|||||||
.name = "rilmodem",
|
.name = "rilmodem",
|
||||||
.probe = ril_phonebook_probe,
|
.probe = ril_phonebook_probe,
|
||||||
.remove = ril_phonebook_remove,
|
.remove = ril_phonebook_remove,
|
||||||
.export_entries = ril_export_entries
|
.export_entries = ril_export_entries
|
||||||
};
|
};
|
||||||
|
|
||||||
void ril_phonebook_init(void)
|
void ril_phonebook_init(void)
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ static void ril_set_rat_mode(struct ofono_radio_settings *rs,
|
|||||||
int pref = rd->ratmode;
|
int pref = rd->ratmode;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
ofono_info("setting rat mode");
|
ofono_info("setting rat mode:%d", mode);
|
||||||
|
|
||||||
parcel_init(&rilp);
|
parcel_init(&rilp);
|
||||||
|
|
||||||
@@ -209,7 +209,6 @@ static gboolean ril_get_net_config(struct radio_data *rsd)
|
|||||||
rsd->ratmode = PREF_NET_TYPE_GSM_WCDMA_AUTO;
|
rsd->ratmode = PREF_NET_TYPE_GSM_WCDMA_AUTO;
|
||||||
GDir *config_dir;
|
GDir *config_dir;
|
||||||
const gchar *config_file;
|
const gchar *config_file;
|
||||||
char *path;
|
|
||||||
gsize length;
|
gsize length;
|
||||||
gchar **codes = NULL;
|
gchar **codes = NULL;
|
||||||
int i;
|
int i;
|
||||||
@@ -225,11 +224,14 @@ static gboolean ril_get_net_config(struct radio_data *rsd)
|
|||||||
|
|
||||||
config_dir = g_dir_open(config_path, 0, NULL);
|
config_dir = g_dir_open(config_path, 0, NULL);
|
||||||
while ((config_file = g_dir_read_name(config_dir)) != NULL) {
|
while ((config_file = g_dir_read_name(config_dir)) != NULL) {
|
||||||
path = g_strconcat(RIL_CONFIG_DIR "/", config_file, NULL);
|
char *path = g_strconcat(RIL_CONFIG_DIR "/", config_file, NULL);
|
||||||
|
DBG("Rilconfig handling %s", path);
|
||||||
|
gboolean ok = g_key_file_load_from_file(keyfile, path, 0, &err);
|
||||||
|
|
||||||
if (!g_key_file_load_from_file(keyfile, path, 0, &err)) {
|
g_free(path);
|
||||||
|
if (!ok) {
|
||||||
g_error_free(err);
|
g_error_free(err);
|
||||||
needsconfig = TRUE;
|
DBG("Rilconfig file skipped");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,6 +260,7 @@ static gboolean ril_get_net_config(struct radio_data *rsd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_key_file_free(keyfile);
|
g_key_file_free(keyfile);
|
||||||
|
g_dir_close(config_dir);
|
||||||
|
|
||||||
/* Then we need to check if it already set */
|
/* Then we need to check if it already set */
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ struct ofono_sim *get_sim();
|
|||||||
|
|
||||||
gint check_if_really_roaming(gint status);
|
gint check_if_really_roaming(gint status);
|
||||||
|
|
||||||
gboolean check_if_really_searching();
|
gboolean check_if_ok_to_attach();
|
||||||
|
|
||||||
void ril_util_free_sim_apps(struct sim_app **apps, guint num_apps);
|
void ril_util_free_sim_apps(struct sim_app **apps, guint num_apps);
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ static inline struct cb_data *cb_data_new2(void *user, void *cb,
|
|||||||
{
|
{
|
||||||
struct cb_data *ret;
|
struct cb_data *ret;
|
||||||
|
|
||||||
ret = g_try_new0(struct cb_data, 1);
|
ret = g_new0(struct cb_data, 1);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ret->cb = cb;
|
ret->cb = cb;
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ struct sim_data {
|
|||||||
enum ofono_sim_password_type passwd_state;
|
enum ofono_sim_password_type passwd_state;
|
||||||
guint card_state;
|
guint card_state;
|
||||||
guint idle_id;
|
guint idle_id;
|
||||||
|
gboolean removed;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ril_pin_change_state_cb(struct ril_msg *message,
|
static void ril_pin_change_state_cb(struct ril_msg *message,
|
||||||
@@ -180,6 +181,15 @@ static void ril_file_info_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
|
|
||||||
DBG("");
|
DBG("");
|
||||||
|
|
||||||
|
/* In case sim card has been removed prior to this callback has been
|
||||||
|
* called we must not call the core call back method as otherwise the
|
||||||
|
* core will crash.
|
||||||
|
*/
|
||||||
|
if (sd->removed == TRUE) {
|
||||||
|
ofono_error("RIL_CARDSTATE_ABSENT");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (message->error == RIL_E_SUCCESS) {
|
if (message->error == RIL_E_SUCCESS) {
|
||||||
decode_ril_error(&error, "OK");
|
decode_ril_error(&error, "OK");
|
||||||
} else {
|
} else {
|
||||||
@@ -659,6 +669,7 @@ static void sim_status_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
if (sd->card_state != RIL_CARDSTATE_PRESENT) {
|
if (sd->card_state != RIL_CARDSTATE_PRESENT) {
|
||||||
ofono_sim_inserted_notify(sim, TRUE);
|
ofono_sim_inserted_notify(sim, TRUE);
|
||||||
sd->card_state = RIL_CARDSTATE_PRESENT;
|
sd->card_state = RIL_CARDSTATE_PRESENT;
|
||||||
|
sd->removed = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -696,6 +707,7 @@ static void sim_status_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
parcel_w_int32(&rilp, 1);
|
parcel_w_int32(&rilp, 1);
|
||||||
parcel_w_int32(&rilp, 1);
|
parcel_w_int32(&rilp, 1);
|
||||||
|
|
||||||
|
ofono_info("RIL_REQUEST_RADIO_POWER ON");
|
||||||
g_ril_send(sd->ril,
|
g_ril_send(sd->ril,
|
||||||
RIL_REQUEST_RADIO_POWER,
|
RIL_REQUEST_RADIO_POWER,
|
||||||
rilp.data,
|
rilp.data,
|
||||||
@@ -715,7 +727,10 @@ static void sim_status_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
if (status.card_state == RIL_CARDSTATE_ABSENT) {
|
if (status.card_state == RIL_CARDSTATE_ABSENT) {
|
||||||
DBG("sd->card_state:%u,status.card_state:%u,",
|
DBG("sd->card_state:%u,status.card_state:%u,",
|
||||||
sd->card_state, status.card_state);
|
sd->card_state, status.card_state);
|
||||||
|
ofono_info("RIL_CARDSTATE_ABSENT");
|
||||||
ofono_sim_inserted_notify(sim, FALSE);
|
ofono_sim_inserted_notify(sim, FALSE);
|
||||||
|
if (sd->card_state == RIL_CARDSTATE_PRESENT)
|
||||||
|
sd->removed = TRUE;
|
||||||
sd->card_state = RIL_CARDSTATE_ABSENT;
|
sd->card_state = RIL_CARDSTATE_ABSENT;
|
||||||
|
|
||||||
if (current_passwd)
|
if (current_passwd)
|
||||||
@@ -1100,6 +1115,7 @@ static int ril_sim_probe(struct ofono_sim *sim, unsigned int vendor,
|
|||||||
sd->passwd_type = OFONO_SIM_PASSWORD_NONE;
|
sd->passwd_type = OFONO_SIM_PASSWORD_NONE;
|
||||||
sd->sim_registered = FALSE;
|
sd->sim_registered = FALSE;
|
||||||
sd->card_state = RIL_CARDSTATE_ABSENT;
|
sd->card_state = RIL_CARDSTATE_ABSENT;
|
||||||
|
sd->removed = FALSE;
|
||||||
|
|
||||||
for (i = 0; i < OFONO_SIM_PASSWORD_INVALID; i++)
|
for (i = 0; i < OFONO_SIM_PASSWORD_INVALID; i++)
|
||||||
sd->retries[i] = -1;
|
sd->retries[i] = -1;
|
||||||
@@ -1133,6 +1149,8 @@ static void ril_sim_remove(struct ofono_sim *sim)
|
|||||||
if (sd->idle_id > 0)
|
if (sd->idle_id > 0)
|
||||||
g_source_remove(sd->idle_id);
|
g_source_remove(sd->idle_id);
|
||||||
|
|
||||||
|
g_free(sd->aid_str);
|
||||||
|
g_free(sd->app_str);
|
||||||
g_ril_unref(sd->ril);
|
g_ril_unref(sd->ril);
|
||||||
g_free(sd);
|
g_free(sd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,10 +38,18 @@
|
|||||||
#include <ofono/log.h>
|
#include <ofono/log.h>
|
||||||
#include <ofono/modem.h>
|
#include <ofono/modem.h>
|
||||||
#include <ofono/sms.h>
|
#include <ofono/sms.h>
|
||||||
|
#include <ofono/types.h>
|
||||||
|
#include <ofono/sim.h>
|
||||||
|
|
||||||
#include "smsutil.h"
|
#include "smsutil.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#include "rilmodem.h"
|
#include "rilmodem.h"
|
||||||
|
#include "simutil.h"
|
||||||
|
|
||||||
|
#define SIM_EFSMS_FILEID 0x6F3C
|
||||||
|
#define EFSMS_LENGTH 176
|
||||||
|
|
||||||
|
unsigned char path[4] = {0x3F, 0x00, 0x7F, 0x10};
|
||||||
|
|
||||||
struct sms_data {
|
struct sms_data {
|
||||||
GRil *ril;
|
GRil *ril;
|
||||||
@@ -131,7 +139,7 @@ static void ril_csca_query_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
sca.number[OFONO_MAX_PHONE_NUMBER_LENGTH] = '\0';
|
sca.number[OFONO_MAX_PHONE_NUMBER_LENGTH] = '\0';
|
||||||
|
|
||||||
DBG("csca_query_cb: %s, %d", sca.number, sca.type);
|
DBG("csca_query_cb: %s, %d", sca.number, sca.type);
|
||||||
|
g_free(temp_buf); /*g_utf16_to_utf8 used by parcel_r_string*/
|
||||||
cb(&error, &sca, cbd->data);
|
cb(&error, &sca, cbd->data);
|
||||||
} else {
|
} else {
|
||||||
ofono_error("return value invalid");
|
ofono_error("return value invalid");
|
||||||
@@ -345,6 +353,97 @@ error:
|
|||||||
ofono_error("Unable to parse NEW_SMS notification");
|
ofono_error("Unable to parse NEW_SMS notification");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ril_new_sms_on_sim_cb(struct ril_msg *message, gpointer user_data)
|
||||||
|
{
|
||||||
|
DBG("");
|
||||||
|
if (message->error == RIL_E_SUCCESS)
|
||||||
|
ofono_info("sms deleted from sim");
|
||||||
|
else
|
||||||
|
ofono_error("deleting sms from sim failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ril_request_delete_sms_om_sim(struct ofono_sms *sms,int record)
|
||||||
|
{
|
||||||
|
struct sms_data *data = ofono_sms_get_data(sms);
|
||||||
|
struct parcel rilp;
|
||||||
|
int request = RIL_REQUEST_DELETE_SMS_ON_SIM;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
DBG("Deleting record: %d", record);
|
||||||
|
|
||||||
|
parcel_init(&rilp);
|
||||||
|
parcel_w_int32(&rilp, 1); /* Number of int32 values in array */
|
||||||
|
parcel_w_int32(&rilp, record);
|
||||||
|
|
||||||
|
ret = g_ril_send(data->ril, request, rilp.data,
|
||||||
|
rilp.size, ril_new_sms_on_sim_cb, NULL, NULL);
|
||||||
|
|
||||||
|
parcel_free(&rilp);
|
||||||
|
|
||||||
|
if (ret <= 0)
|
||||||
|
ofono_error("cannot delete sms from sim");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ril_read_sms_on_sim_cb(const struct ofono_error *error,
|
||||||
|
const unsigned char *sdata,
|
||||||
|
int length, void *data)
|
||||||
|
{
|
||||||
|
struct cb_data *cbd = data;
|
||||||
|
struct ofono_sms *sms = cbd->user;
|
||||||
|
int record;
|
||||||
|
unsigned int smsc_len;
|
||||||
|
|
||||||
|
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
|
||||||
|
ofono_error("cannot read sms from sim");
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* It seems when reading EFsms RIL returns the whole record including
|
||||||
|
* the first status byte therefore we ignore that as we are only
|
||||||
|
* interested of the following pdu
|
||||||
|
*/
|
||||||
|
/* The first octect in the pdu contains the SMSC address length
|
||||||
|
* which is the X following octects it reads. We add 1 octet to
|
||||||
|
* the read length to take into account this read octet in order
|
||||||
|
* to calculate the proper tpdu length.
|
||||||
|
*/
|
||||||
|
smsc_len = sdata[1] + 1;
|
||||||
|
|
||||||
|
ofono_sms_deliver_notify(sms, sdata + 1, length - 1,
|
||||||
|
length - smsc_len - 1);
|
||||||
|
|
||||||
|
record = (int)cbd->data;
|
||||||
|
ril_request_delete_sms_om_sim(sms,record);
|
||||||
|
|
||||||
|
exit:
|
||||||
|
g_free(cbd);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ril_new_sms_on_sim(struct ril_msg *message, gpointer user_data)
|
||||||
|
{
|
||||||
|
struct ofono_sms *sms = user_data;
|
||||||
|
struct parcel rilp;
|
||||||
|
int record;
|
||||||
|
|
||||||
|
ofono_info("new sms on sim");
|
||||||
|
|
||||||
|
ril_util_init_parcel(message, &rilp);
|
||||||
|
|
||||||
|
/* data length of the response */
|
||||||
|
record = parcel_r_int32(&rilp);
|
||||||
|
|
||||||
|
if (record > 0) {
|
||||||
|
record = parcel_r_int32(&rilp);
|
||||||
|
struct cb_data *cbd = cb_data_new2(sms, NULL, (void*)record);
|
||||||
|
DBG(":%d", record);
|
||||||
|
get_sim_driver()->read_file_linear(get_sim(), SIM_EFSMS_FILEID,
|
||||||
|
record, EFSMS_LENGTH, path,
|
||||||
|
sizeof(path),
|
||||||
|
ril_read_sms_on_sim_cb, cbd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean ril_delayed_register(gpointer user_data)
|
static gboolean ril_delayed_register(gpointer user_data)
|
||||||
{
|
{
|
||||||
struct ofono_sms *sms = user_data;
|
struct ofono_sms *sms = user_data;
|
||||||
@@ -360,6 +459,8 @@ static gboolean ril_delayed_register(gpointer user_data)
|
|||||||
ril_sms_notify, sms);
|
ril_sms_notify, sms);
|
||||||
g_ril_register(data->ril, RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT,
|
g_ril_register(data->ril, RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT,
|
||||||
ril_sms_notify, sms);
|
ril_sms_notify, sms);
|
||||||
|
g_ril_register(data->ril, RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM,
|
||||||
|
ril_new_sms_on_sim, sms);
|
||||||
|
|
||||||
/* This makes the timeout a single-shot */
|
/* This makes the timeout a single-shot */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -275,6 +275,7 @@ void ril_stk_set_lang()
|
|||||||
setenv("LANG", pch + strlen(CFG_LANG), 1);
|
setenv("LANG", pch + strlen(CFG_LANG), 1);
|
||||||
DBG("LANG %s", getenv("LANG"));
|
DBG("LANG %s", getenv("LANG"));
|
||||||
}
|
}
|
||||||
|
g_free(contents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,12 +75,30 @@ static void ril_ussd_request(struct ofono_ussd *ussd, int dcs,
|
|||||||
if (charset == SMS_CHARSET_7BIT) {
|
if (charset == SMS_CHARSET_7BIT) {
|
||||||
unsigned char unpacked_buf[182] = "";
|
unsigned char unpacked_buf[182] = "";
|
||||||
long written;
|
long written;
|
||||||
|
int length;
|
||||||
|
|
||||||
unpack_7bit_own_buf(pdu, len, 0, TRUE,
|
unpack_7bit_own_buf(pdu, len, 0, TRUE,
|
||||||
sizeof(unpacked_buf), &written, 0,
|
sizeof(unpacked_buf), &written, 0,
|
||||||
unpacked_buf);
|
unpacked_buf);
|
||||||
|
|
||||||
if (written >= 1) {
|
if (written >= 1) {
|
||||||
|
/*
|
||||||
|
* When USSD was packed, additional CR
|
||||||
|
might have been added (according to
|
||||||
|
23.038 6.1.2.3.1). So if the last
|
||||||
|
character is CR, it should be removed
|
||||||
|
here. And in addition written doesn't
|
||||||
|
contain correct length...
|
||||||
|
|
||||||
|
Over 2 characters long USSD string must
|
||||||
|
end with # (checked in
|
||||||
|
valid_ussd_string() ), so it should be
|
||||||
|
safe to remove extra CR.
|
||||||
|
*/
|
||||||
|
length = strlen((char *)unpacked_buf);
|
||||||
|
if (length > 2 &&
|
||||||
|
unpacked_buf[length-1] == '\r')
|
||||||
|
unpacked_buf[length-1] = 0;
|
||||||
struct parcel rilp;
|
struct parcel rilp;
|
||||||
parcel_init(&rilp);
|
parcel_init(&rilp);
|
||||||
parcel_w_string(&rilp, (char *)unpacked_buf);
|
parcel_w_string(&rilp, (char *)unpacked_buf);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
||||||
* Copyright (C) 2012 Canonical Ltd.
|
* Copyright (C) 2012 Canonical Ltd.
|
||||||
* Copyright (C) 2013 Jolla Ltd.
|
* Copyright (C) 2014 Jolla Ltd.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -278,6 +278,8 @@ static void generic_cb(struct ril_msg *message, gpointer user_data)
|
|||||||
int request = RIL_REQUEST_GET_CURRENT_CALLS;
|
int request = RIL_REQUEST_GET_CURRENT_CALLS;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
ofono_info("request:%d",message->req);
|
||||||
|
|
||||||
if (message->error == RIL_E_SUCCESS) {
|
if (message->error == RIL_E_SUCCESS) {
|
||||||
decode_ril_error(&error, "OK");
|
decode_ril_error(&error, "OK");
|
||||||
} else {
|
} else {
|
||||||
@@ -676,6 +678,13 @@ static void ril_create_multiparty(struct ofono_voicecall *vc,
|
|||||||
cb(&error, data);
|
cb(&error, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ril_transfer(struct ofono_voicecall *vc,
|
||||||
|
ofono_voicecall_cb_t cb, void *data)
|
||||||
|
{
|
||||||
|
ril_template(RIL_REQUEST_EXPLICIT_CALL_TRANSFER, vc, generic_cb, 0,
|
||||||
|
NULL, 0, cb, data);
|
||||||
|
}
|
||||||
|
|
||||||
static void private_chat_cb(struct ril_msg *message, gpointer user_data)
|
static void private_chat_cb(struct ril_msg *message, gpointer user_data)
|
||||||
{
|
{
|
||||||
struct ofono_error error;
|
struct ofono_error error;
|
||||||
@@ -769,6 +778,23 @@ static gboolean enable_supp_svc(gpointer user_data)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ril_ringback_tone_notify(struct ril_msg *message,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
struct parcel rilp;
|
||||||
|
struct ofono_voicecall *vc = user_data;
|
||||||
|
gboolean playTone = FALSE;
|
||||||
|
|
||||||
|
ril_util_init_parcel(message, &rilp);
|
||||||
|
|
||||||
|
if (message->req == RIL_UNSOL_RINGBACK_TONE) {
|
||||||
|
if (parcel_r_int32(&rilp) > 0)
|
||||||
|
playTone = parcel_r_int32(&rilp);
|
||||||
|
DBG("play ringback tone: %d", playTone);
|
||||||
|
ofono_voicecall_ringback_tone_notify(vc, playTone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean ril_delayed_register(gpointer user_data)
|
static gboolean ril_delayed_register(gpointer user_data)
|
||||||
{
|
{
|
||||||
struct ofono_voicecall *vc = user_data;
|
struct ofono_voicecall *vc = user_data;
|
||||||
@@ -789,6 +815,10 @@ static gboolean ril_delayed_register(gpointer user_data)
|
|||||||
g_ril_register(vd->ril, RIL_UNSOL_SUPP_SVC_NOTIFICATION,
|
g_ril_register(vd->ril, RIL_UNSOL_SUPP_SVC_NOTIFICATION,
|
||||||
ril_ss_notify, vc);
|
ril_ss_notify, vc);
|
||||||
|
|
||||||
|
/* Register for ringback tone notifications */
|
||||||
|
g_ril_register(vd->ril, RIL_UNSOL_RINGBACK_TONE,
|
||||||
|
ril_ringback_tone_notify, vc);
|
||||||
|
|
||||||
/* request supplementary service notifications*/
|
/* request supplementary service notifications*/
|
||||||
enable_supp_svc(vc);
|
enable_supp_svc(vc);
|
||||||
|
|
||||||
@@ -845,6 +875,7 @@ static void ril_voicecall_remove(struct ofono_voicecall *vc)
|
|||||||
if (vd->timer_id > 0)
|
if (vd->timer_id > 0)
|
||||||
g_source_remove(vd->timer_id);
|
g_source_remove(vd->timer_id);
|
||||||
|
|
||||||
|
g_free(vd->tone_queue);
|
||||||
g_ril_unref(vd->ril);
|
g_ril_unref(vd->ril);
|
||||||
g_free(vd);
|
g_free(vd);
|
||||||
}
|
}
|
||||||
@@ -859,12 +890,13 @@ static struct ofono_voicecall_driver driver = {
|
|||||||
.release_specific = ril_hangup_specific,
|
.release_specific = ril_hangup_specific,
|
||||||
.send_tones = ril_send_dtmf,
|
.send_tones = ril_send_dtmf,
|
||||||
.create_multiparty = ril_create_multiparty,
|
.create_multiparty = ril_create_multiparty,
|
||||||
|
.transfer = ril_transfer,
|
||||||
.private_chat = ril_private_chat,
|
.private_chat = ril_private_chat,
|
||||||
.swap_without_accept = ril_swap_without_accept,
|
.swap_without_accept = ril_swap_without_accept,
|
||||||
.hold_all_active = ril_hold_all_active,
|
.hold_all_active = ril_hold_all_active,
|
||||||
.release_all_held = ril_release_all_held,
|
.release_all_held = ril_release_all_held,
|
||||||
.set_udub = ril_set_udub,
|
.set_udub = ril_set_udub,
|
||||||
.release_all_active = ril_release_all_active,
|
.release_all_active = ril_release_all_active,
|
||||||
};
|
};
|
||||||
|
|
||||||
void ril_voicecall_init(void)
|
void ril_voicecall_init(void)
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ struct GDBusClient {
|
|||||||
void *signal_data;
|
void *signal_data;
|
||||||
GDBusProxyFunction proxy_added;
|
GDBusProxyFunction proxy_added;
|
||||||
GDBusProxyFunction proxy_removed;
|
GDBusProxyFunction proxy_removed;
|
||||||
|
GDBusClientFunction ready;
|
||||||
|
void *ready_data;
|
||||||
GDBusPropertyFunction property_changed;
|
GDBusPropertyFunction property_changed;
|
||||||
void *user_data;
|
void *user_data;
|
||||||
GList *proxy_list;
|
GList *proxy_list;
|
||||||
@@ -725,6 +727,93 @@ gboolean g_dbus_proxy_set_property_basic(GDBusProxy *proxy,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean g_dbus_proxy_set_property_array(GDBusProxy *proxy,
|
||||||
|
const char *name, int type, const void *value,
|
||||||
|
size_t size, GDBusResultFunction function,
|
||||||
|
void *user_data, GDBusDestroyFunction destroy)
|
||||||
|
{
|
||||||
|
struct set_property_data *data;
|
||||||
|
GDBusClient *client;
|
||||||
|
DBusMessage *msg;
|
||||||
|
DBusMessageIter iter, variant, array;
|
||||||
|
DBusPendingCall *call;
|
||||||
|
char array_sig[3];
|
||||||
|
char type_sig[2];
|
||||||
|
|
||||||
|
if (!proxy || !name || !value)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!dbus_type_is_basic(type))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
client = proxy->client;
|
||||||
|
if (!client)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
data = g_try_new0(struct set_property_data, 1);
|
||||||
|
if (!data)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
data->function = function;
|
||||||
|
data->user_data = user_data;
|
||||||
|
data->destroy = destroy;
|
||||||
|
|
||||||
|
msg = dbus_message_new_method_call(client->service_name,
|
||||||
|
proxy->obj_path,
|
||||||
|
DBUS_INTERFACE_PROPERTIES,
|
||||||
|
"Set");
|
||||||
|
if (!msg) {
|
||||||
|
g_free(data);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
array_sig[0] = DBUS_TYPE_ARRAY;
|
||||||
|
array_sig[1] = (char) type;
|
||||||
|
array_sig[2] = '\0';
|
||||||
|
|
||||||
|
type_sig[0] = (char) type;
|
||||||
|
type_sig[1] = '\0';
|
||||||
|
|
||||||
|
dbus_message_iter_init_append(msg, &iter);
|
||||||
|
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING,
|
||||||
|
&proxy->interface);
|
||||||
|
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &name);
|
||||||
|
|
||||||
|
dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT,
|
||||||
|
array_sig, &variant);
|
||||||
|
|
||||||
|
dbus_message_iter_open_container(&variant, DBUS_TYPE_ARRAY,
|
||||||
|
type_sig, &array);
|
||||||
|
|
||||||
|
if (dbus_type_is_fixed(type))
|
||||||
|
dbus_message_iter_append_fixed_array(&array, type, &value,
|
||||||
|
size);
|
||||||
|
else if (type == DBUS_TYPE_STRING || type == DBUS_TYPE_OBJECT_PATH) {
|
||||||
|
const char **str = (const char **) value;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
dbus_message_iter_append_basic(&array, type, &str[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
dbus_message_iter_close_container(&variant, &array);
|
||||||
|
dbus_message_iter_close_container(&iter, &variant);
|
||||||
|
|
||||||
|
if (g_dbus_send_message_with_reply(client->dbus_conn, msg,
|
||||||
|
&call, -1) == FALSE) {
|
||||||
|
dbus_message_unref(msg);
|
||||||
|
g_free(data);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
dbus_pending_call_set_notify(call, set_property_reply, data, g_free);
|
||||||
|
dbus_pending_call_unref(call);
|
||||||
|
|
||||||
|
dbus_message_unref(msg);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
struct method_call_data {
|
struct method_call_data {
|
||||||
GDBusReturnFunction function;
|
GDBusReturnFunction function;
|
||||||
void *user_data;
|
void *user_data;
|
||||||
@@ -982,6 +1071,9 @@ static void parse_managed_objects(GDBusClient *client, DBusMessage *msg)
|
|||||||
|
|
||||||
dbus_message_iter_next(&dict);
|
dbus_message_iter_next(&dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (client->ready)
|
||||||
|
client->ready(client, client->ready_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_managed_objects_reply(DBusPendingCall *call, void *user_data)
|
static void get_managed_objects_reply(DBusPendingCall *call, void *user_data)
|
||||||
@@ -1243,6 +1335,18 @@ gboolean g_dbus_client_set_signal_watch(GDBusClient *client,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean g_dbus_client_set_ready_watch(GDBusClient *client,
|
||||||
|
GDBusClientFunction ready, void *user_data)
|
||||||
|
{
|
||||||
|
if (client == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
client->ready = ready;
|
||||||
|
client->ready_data = user_data;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
gboolean g_dbus_client_set_proxy_handlers(GDBusClient *client,
|
gboolean g_dbus_client_set_proxy_handlers(GDBusClient *client,
|
||||||
GDBusProxyFunction proxy_added,
|
GDBusProxyFunction proxy_added,
|
||||||
GDBusProxyFunction proxy_removed,
|
GDBusProxyFunction proxy_removed,
|
||||||
|
|||||||
@@ -329,6 +329,11 @@ gboolean g_dbus_proxy_set_property_basic(GDBusProxy *proxy,
|
|||||||
GDBusResultFunction function, void *user_data,
|
GDBusResultFunction function, void *user_data,
|
||||||
GDBusDestroyFunction destroy);
|
GDBusDestroyFunction destroy);
|
||||||
|
|
||||||
|
gboolean g_dbus_proxy_set_property_array(GDBusProxy *proxy,
|
||||||
|
const char *name, int type, const void *value,
|
||||||
|
size_t size, GDBusResultFunction function,
|
||||||
|
void *user_data, GDBusDestroyFunction destroy);
|
||||||
|
|
||||||
typedef void (* GDBusSetupFunction) (DBusMessageIter *iter, void *user_data);
|
typedef void (* GDBusSetupFunction) (DBusMessageIter *iter, void *user_data);
|
||||||
typedef void (* GDBusReturnFunction) (DBusMessage *message, void *user_data);
|
typedef void (* GDBusReturnFunction) (DBusMessage *message, void *user_data);
|
||||||
|
|
||||||
@@ -337,6 +342,7 @@ gboolean g_dbus_proxy_method_call(GDBusProxy *proxy, const char *method,
|
|||||||
GDBusReturnFunction function, void *user_data,
|
GDBusReturnFunction function, void *user_data,
|
||||||
GDBusDestroyFunction destroy);
|
GDBusDestroyFunction destroy);
|
||||||
|
|
||||||
|
typedef void (* GDBusClientFunction) (GDBusClient *client, void *user_data);
|
||||||
typedef void (* GDBusProxyFunction) (GDBusProxy *proxy, void *user_data);
|
typedef void (* GDBusProxyFunction) (GDBusProxy *proxy, void *user_data);
|
||||||
typedef void (* GDBusPropertyFunction) (GDBusProxy *proxy, const char *name,
|
typedef void (* GDBusPropertyFunction) (GDBusProxy *proxy, const char *name,
|
||||||
DBusMessageIter *iter, void *user_data);
|
DBusMessageIter *iter, void *user_data);
|
||||||
@@ -359,7 +365,8 @@ gboolean g_dbus_client_set_disconnect_watch(GDBusClient *client,
|
|||||||
GDBusWatchFunction function, void *user_data);
|
GDBusWatchFunction function, void *user_data);
|
||||||
gboolean g_dbus_client_set_signal_watch(GDBusClient *client,
|
gboolean g_dbus_client_set_signal_watch(GDBusClient *client,
|
||||||
GDBusMessageFunction function, void *user_data);
|
GDBusMessageFunction function, void *user_data);
|
||||||
|
gboolean g_dbus_client_set_ready_watch(GDBusClient *client,
|
||||||
|
GDBusClientFunction ready, void *user_data);
|
||||||
gboolean g_dbus_client_set_proxy_handlers(GDBusClient *client,
|
gboolean g_dbus_client_set_proxy_handlers(GDBusClient *client,
|
||||||
GDBusProxyFunction proxy_added,
|
GDBusProxyFunction proxy_added,
|
||||||
GDBusProxyFunction proxy_removed,
|
GDBusProxyFunction proxy_removed,
|
||||||
|
|||||||
@@ -30,8 +30,6 @@
|
|||||||
|
|
||||||
#include "gdbus.h"
|
#include "gdbus.h"
|
||||||
|
|
||||||
#define DISPATCH_TIMEOUT 0
|
|
||||||
|
|
||||||
#define info(fmt...)
|
#define info(fmt...)
|
||||||
#define error(fmt...)
|
#define error(fmt...)
|
||||||
#define debug(fmt...)
|
#define debug(fmt...)
|
||||||
@@ -70,8 +68,6 @@ static gboolean message_dispatch(void *data)
|
|||||||
{
|
{
|
||||||
DBusConnection *conn = data;
|
DBusConnection *conn = data;
|
||||||
|
|
||||||
dbus_connection_ref(conn);
|
|
||||||
|
|
||||||
/* Dispatch messages */
|
/* Dispatch messages */
|
||||||
while (dbus_connection_dispatch(conn) == DBUS_DISPATCH_DATA_REMAINS);
|
while (dbus_connection_dispatch(conn) == DBUS_DISPATCH_DATA_REMAINS);
|
||||||
|
|
||||||
@@ -84,7 +80,7 @@ static inline void queue_dispatch(DBusConnection *conn,
|
|||||||
DBusDispatchStatus status)
|
DBusDispatchStatus status)
|
||||||
{
|
{
|
||||||
if (status == DBUS_DISPATCH_DATA_REMAINS)
|
if (status == DBUS_DISPATCH_DATA_REMAINS)
|
||||||
g_timeout_add(DISPATCH_TIMEOUT, message_dispatch, conn);
|
g_idle_add(message_dispatch, dbus_connection_ref(conn));
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean watch_func(GIOChannel *chan, GIOCondition cond, gpointer data)
|
static gboolean watch_func(GIOChannel *chan, GIOCondition cond, gpointer data)
|
||||||
@@ -92,9 +88,6 @@ static gboolean watch_func(GIOChannel *chan, GIOCondition cond, gpointer data)
|
|||||||
struct watch_info *info = data;
|
struct watch_info *info = data;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
DBusDispatchStatus status;
|
DBusDispatchStatus status;
|
||||||
DBusConnection *conn;
|
|
||||||
|
|
||||||
conn = dbus_connection_ref(info->conn);
|
|
||||||
|
|
||||||
if (cond & G_IO_IN) flags |= DBUS_WATCH_READABLE;
|
if (cond & G_IO_IN) flags |= DBUS_WATCH_READABLE;
|
||||||
if (cond & G_IO_OUT) flags |= DBUS_WATCH_WRITABLE;
|
if (cond & G_IO_OUT) flags |= DBUS_WATCH_WRITABLE;
|
||||||
@@ -103,10 +96,8 @@ static gboolean watch_func(GIOChannel *chan, GIOCondition cond, gpointer data)
|
|||||||
|
|
||||||
dbus_watch_handle(info->watch, flags);
|
dbus_watch_handle(info->watch, flags);
|
||||||
|
|
||||||
status = dbus_connection_get_dispatch_status(conn);
|
status = dbus_connection_get_dispatch_status(info->conn);
|
||||||
queue_dispatch(conn, status);
|
queue_dispatch(info->conn, status);
|
||||||
|
|
||||||
dbus_connection_unref(conn);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1253,6 +1253,8 @@ static struct generic_data *object_path_ref(DBusConnection *connection,
|
|||||||
|
|
||||||
if (!dbus_connection_register_object_path(connection, path,
|
if (!dbus_connection_register_object_path(connection, path,
|
||||||
&generic_table, data)) {
|
&generic_table, data)) {
|
||||||
|
dbus_connection_unref(data->conn);
|
||||||
|
g_free(data->path);
|
||||||
g_free(data->introspect);
|
g_free(data->introspect);
|
||||||
g_free(data);
|
g_free(data);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ extern "C" {
|
|||||||
struct ofono_gprs_provision_data {
|
struct ofono_gprs_provision_data {
|
||||||
enum ofono_gprs_context_type type;
|
enum ofono_gprs_context_type type;
|
||||||
enum ofono_gprs_proto proto;
|
enum ofono_gprs_proto proto;
|
||||||
|
char *provider_name;
|
||||||
|
ofono_bool_t provider_primary;
|
||||||
char *name;
|
char *name;
|
||||||
char *apn;
|
char *apn;
|
||||||
char *username;
|
char *username;
|
||||||
|
|||||||
@@ -36,12 +36,18 @@ typedef void (*ofono_handsfree_cb_t)(const struct ofono_error *error,
|
|||||||
typedef void (*ofono_handsfree_phone_cb_t)(const struct ofono_error *error,
|
typedef void (*ofono_handsfree_phone_cb_t)(const struct ofono_error *error,
|
||||||
const struct ofono_phone_number *number,
|
const struct ofono_phone_number *number,
|
||||||
void *data);
|
void *data);
|
||||||
|
typedef void (*ofono_handsfree_cnum_query_cb_t)(const struct ofono_error *error,
|
||||||
|
int total,
|
||||||
|
const struct ofono_phone_number *numbers,
|
||||||
|
void *data);
|
||||||
|
|
||||||
struct ofono_handsfree_driver {
|
struct ofono_handsfree_driver {
|
||||||
const char *name;
|
const char *name;
|
||||||
int (*probe)(struct ofono_handsfree *hf, unsigned int vendor,
|
int (*probe)(struct ofono_handsfree *hf, unsigned int vendor,
|
||||||
void *data);
|
void *data);
|
||||||
void (*remove)(struct ofono_handsfree *hf);
|
void (*remove)(struct ofono_handsfree *hf);
|
||||||
|
void (*cnum_query)(struct ofono_handsfree *hf,
|
||||||
|
ofono_handsfree_cnum_query_cb_t cb, void *data);
|
||||||
void (*request_phone_number) (struct ofono_handsfree *hf,
|
void (*request_phone_number) (struct ofono_handsfree *hf,
|
||||||
ofono_handsfree_phone_cb_t cb,
|
ofono_handsfree_phone_cb_t cb,
|
||||||
void *data);
|
void *data);
|
||||||
@@ -54,6 +60,8 @@ struct ofono_handsfree_driver {
|
|||||||
|
|
||||||
void ofono_handsfree_set_ag_features(struct ofono_handsfree *hf,
|
void ofono_handsfree_set_ag_features(struct ofono_handsfree *hf,
|
||||||
unsigned int ag_features);
|
unsigned int ag_features);
|
||||||
|
void ofono_handsfree_set_ag_chld_features(struct ofono_handsfree *hf,
|
||||||
|
unsigned int ag_chld_features);
|
||||||
void ofono_handsfree_set_inband_ringing(struct ofono_handsfree *hf,
|
void ofono_handsfree_set_inband_ringing(struct ofono_handsfree *hf,
|
||||||
ofono_bool_t enabled);
|
ofono_bool_t enabled);
|
||||||
void ofono_handsfree_voice_recognition_notify(struct ofono_handsfree *hf,
|
void ofono_handsfree_voice_recognition_notify(struct ofono_handsfree *hf,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* oFono - Open Source Telephony
|
* oFono - Open Source Telephony
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
||||||
|
* Copyright (C) 2014 Jolla Ltd.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -171,6 +172,9 @@ void ofono_voicecall_ssn_mt_notify(struct ofono_voicecall *vc, unsigned int id,
|
|||||||
int code, int index,
|
int code, int index,
|
||||||
const struct ofono_phone_number *ph);
|
const struct ofono_phone_number *ph);
|
||||||
|
|
||||||
|
void ofono_voicecall_ringback_tone_notify(struct ofono_voicecall *vc,
|
||||||
|
const ofono_bool_t playTone);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -59,6 +59,7 @@
|
|||||||
#include <drivers/atmodem/vendor.h>
|
#include <drivers/atmodem/vendor.h>
|
||||||
|
|
||||||
static const char *none_prefix[] = { NULL };
|
static const char *none_prefix[] = { NULL };
|
||||||
|
static const char *qss_prefix[] = { "#QSS:", NULL };
|
||||||
|
|
||||||
struct he910_data {
|
struct he910_data {
|
||||||
GAtChat *chat; /* AT chat */
|
GAtChat *chat; /* AT chat */
|
||||||
@@ -101,7 +102,7 @@ static GAtChat *open_device(struct ofono_modem *modem,
|
|||||||
if (channel == NULL)
|
if (channel == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
syntax = g_at_syntax_new_gsmv1();
|
syntax = g_at_syntax_new_gsm_permissive();
|
||||||
chat = g_at_chat_new(channel, syntax);
|
chat = g_at_chat_new(channel, syntax);
|
||||||
g_at_syntax_unref(syntax);
|
g_at_syntax_unref(syntax);
|
||||||
g_io_channel_unref(channel);
|
g_io_channel_unref(channel);
|
||||||
@@ -167,6 +168,31 @@ static void he910_qss_notify(GAtResult *result, gpointer user_data)
|
|||||||
switch_sim_state_status(modem, status);
|
switch_sim_state_status(modem, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void qss_query_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
|
{
|
||||||
|
struct ofono_modem *modem = user_data;
|
||||||
|
int status, mode;
|
||||||
|
GAtResultIter iter;
|
||||||
|
|
||||||
|
DBG("%p", modem);
|
||||||
|
|
||||||
|
if (!ok)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_at_result_iter_init(&iter, result);
|
||||||
|
|
||||||
|
if (!g_at_result_iter_next(&iter, "#QSS:"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!g_at_result_iter_next_number(&iter, &mode))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!g_at_result_iter_next_number(&iter, &status))
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch_sim_state_status(modem, status);
|
||||||
|
}
|
||||||
|
|
||||||
static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
||||||
{
|
{
|
||||||
struct ofono_modem *modem = user_data;
|
struct ofono_modem *modem = user_data;
|
||||||
@@ -204,6 +230,15 @@ static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
|||||||
g_at_chat_send(data->chat, "AT#AUTOATT=0", none_prefix,
|
g_at_chat_send(data->chat, "AT#AUTOATT=0", none_prefix,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
|
/* Follow sim state */
|
||||||
|
g_at_chat_register(data->chat, "#QSS:", he910_qss_notify,
|
||||||
|
FALSE, modem, NULL);
|
||||||
|
|
||||||
|
/* Enable sim state notification */
|
||||||
|
g_at_chat_send(data->chat, "AT#QSS=2", none_prefix, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
g_at_chat_send(data->chat, "AT#QSS?", qss_prefix,
|
||||||
|
qss_query_cb, modem, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int he910_enable(struct ofono_modem *modem)
|
static int he910_enable(struct ofono_modem *modem)
|
||||||
@@ -232,13 +267,6 @@ static int he910_enable(struct ofono_modem *modem)
|
|||||||
g_at_chat_send(data->chat, "ATE0 +CMEE=1", none_prefix,
|
g_at_chat_send(data->chat, "ATE0 +CMEE=1", none_prefix,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
|
|
||||||
/* Follow sim state */
|
|
||||||
g_at_chat_register(data->chat, "#QSS:", he910_qss_notify,
|
|
||||||
FALSE, modem, NULL);
|
|
||||||
|
|
||||||
/* Enable sim state notification */
|
|
||||||
g_at_chat_send(data->chat, "AT#QSS=2", none_prefix, NULL, NULL, NULL);
|
|
||||||
|
|
||||||
/* Set phone functionality */
|
/* Set phone functionality */
|
||||||
g_at_chat_send(data->chat, "AT+CFUN=1", none_prefix,
|
g_at_chat_send(data->chat, "AT+CFUN=1", none_prefix,
|
||||||
cfun_enable_cb, modem, NULL);
|
cfun_enable_cb, modem, NULL);
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ enum MBPI_ERROR {
|
|||||||
struct gsm_data {
|
struct gsm_data {
|
||||||
const char *match_mcc;
|
const char *match_mcc;
|
||||||
const char *match_mnc;
|
const char *match_mnc;
|
||||||
|
char *provider_name;
|
||||||
|
gboolean provider_primary;
|
||||||
GSList *apns;
|
GSList *apns;
|
||||||
gboolean match_found;
|
gboolean match_found;
|
||||||
gboolean allow_duplicates;
|
gboolean allow_duplicates;
|
||||||
@@ -84,6 +86,7 @@ static GQuark mbpi_error_quark(void)
|
|||||||
|
|
||||||
void mbpi_ap_free(struct ofono_gprs_provision_data *ap)
|
void mbpi_ap_free(struct ofono_gprs_provision_data *ap)
|
||||||
{
|
{
|
||||||
|
g_free(ap->provider_name);
|
||||||
g_free(ap->name);
|
g_free(ap->name);
|
||||||
g_free(ap->apn);
|
g_free(ap->apn);
|
||||||
g_free(ap->username);
|
g_free(ap->username);
|
||||||
@@ -117,6 +120,7 @@ static void text_handler(GMarkupParseContext *context,
|
|||||||
{
|
{
|
||||||
char **string = userdata;
|
char **string = userdata;
|
||||||
|
|
||||||
|
g_free(*string);
|
||||||
*string = g_strndup(text, text_len);
|
*string = g_strndup(text, text_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,6 +292,9 @@ static void apn_handler(GMarkupParseContext *context, struct gsm_data *gsm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ap = g_new0(struct ofono_gprs_provision_data, 1);
|
ap = g_new0(struct ofono_gprs_provision_data, 1);
|
||||||
|
ap->provider_name = g_strdup(gsm->provider_name);
|
||||||
|
ap->provider_primary = gsm->provider_primary;
|
||||||
|
|
||||||
ap->apn = g_strdup(apn);
|
ap->apn = g_strdup(apn);
|
||||||
ap->type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
|
ap->type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
|
||||||
ap->proto = OFONO_GPRS_PROTO_IP;
|
ap->proto = OFONO_GPRS_PROTO_IP;
|
||||||
@@ -454,27 +461,68 @@ static const GMarkupParser provider_parser = {
|
|||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void toplevel_gsm_start(GMarkupParseContext *context,
|
static void gsm_provider_start(GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const gchar *element_name,
|
||||||
const gchar **atribute_names,
|
const gchar **attribute_names,
|
||||||
const gchar **attribute_values,
|
const gchar **attribute_values,
|
||||||
gpointer userdata, GError **error)
|
gpointer userdata, GError **error)
|
||||||
{
|
{
|
||||||
struct gsm_data *gsm = userdata;
|
struct gsm_data *gsm = userdata;
|
||||||
|
|
||||||
if (g_str_equal(element_name, "gsm")) {
|
if (g_str_equal(element_name, "name")) {
|
||||||
|
g_free(gsm->provider_name);
|
||||||
|
gsm->provider_name = NULL;
|
||||||
|
g_markup_parse_context_push(context, &text_parser,
|
||||||
|
&gsm->provider_name);
|
||||||
|
} else if (g_str_equal(element_name, "gsm")) {
|
||||||
gsm->match_found = FALSE;
|
gsm->match_found = FALSE;
|
||||||
g_markup_parse_context_push(context, &gsm_parser, gsm);
|
g_markup_parse_context_push(context, &gsm_parser, gsm);
|
||||||
} else if (g_str_equal(element_name, "cdma"))
|
} else if (g_str_equal(element_name, "cdma"))
|
||||||
g_markup_parse_context_push(context, &skip_parser, NULL);
|
g_markup_parse_context_push(context, &skip_parser, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void gsm_provider_end(GMarkupParseContext *context,
|
||||||
|
const gchar *element_name,
|
||||||
|
gpointer userdata, GError **error)
|
||||||
|
{
|
||||||
|
if (g_str_equal(element_name, "name") ||
|
||||||
|
g_str_equal(element_name, "gsm") ||
|
||||||
|
g_str_equal(element_name, "cdma"))
|
||||||
|
g_markup_parse_context_pop(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const GMarkupParser gsm_provider_parser = {
|
||||||
|
gsm_provider_start,
|
||||||
|
gsm_provider_end,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void toplevel_gsm_start(GMarkupParseContext *context,
|
||||||
|
const gchar *element_name,
|
||||||
|
const gchar **attribute_names,
|
||||||
|
const gchar **attribute_values,
|
||||||
|
gpointer userdata, GError **error)
|
||||||
|
{
|
||||||
|
struct gsm_data *gsm = userdata;
|
||||||
|
|
||||||
|
if (g_str_equal(element_name, "provider")) {
|
||||||
|
g_markup_collect_attributes(element_name, attribute_names,
|
||||||
|
attribute_values, error,
|
||||||
|
G_MARKUP_COLLECT_BOOLEAN | G_MARKUP_COLLECT_OPTIONAL,
|
||||||
|
"primary", &gsm->provider_primary,
|
||||||
|
G_MARKUP_COLLECT_INVALID);
|
||||||
|
|
||||||
|
g_markup_parse_context_push(context, &gsm_provider_parser, gsm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void toplevel_gsm_end(GMarkupParseContext *context,
|
static void toplevel_gsm_end(GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const gchar *element_name,
|
||||||
gpointer userdata, GError **error)
|
gpointer userdata, GError **error)
|
||||||
{
|
{
|
||||||
if (g_str_equal(element_name, "gsm") ||
|
if (g_str_equal(element_name, "provider"))
|
||||||
g_str_equal(element_name, "cdma"))
|
|
||||||
g_markup_parse_context_pop(context);
|
g_markup_parse_context_pop(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -488,7 +536,7 @@ static const GMarkupParser toplevel_gsm_parser = {
|
|||||||
|
|
||||||
static void toplevel_cdma_start(GMarkupParseContext *context,
|
static void toplevel_cdma_start(GMarkupParseContext *context,
|
||||||
const gchar *element_name,
|
const gchar *element_name,
|
||||||
const gchar **atribute_names,
|
const gchar **attribute_names,
|
||||||
const gchar **attribute_values,
|
const gchar **attribute_values,
|
||||||
gpointer userdata, GError **error)
|
gpointer userdata, GError **error)
|
||||||
{
|
{
|
||||||
@@ -591,6 +639,7 @@ GSList *mbpi_lookup_apn(const char *mcc, const char *mnc,
|
|||||||
gsm.apns = NULL;
|
gsm.apns = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free(gsm.provider_name);
|
||||||
return gsm.apns;
|
return gsm.apns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -188,11 +188,11 @@ static int nettime_probe(struct ofono_nettime_context *context)
|
|||||||
NULL, // GDBusPropertyTable *properties
|
NULL, // GDBusPropertyTable *properties
|
||||||
NULL, // user data
|
NULL, // user data
|
||||||
NULL)) { // GDBusDestroyFunction destroy
|
NULL)) { // GDBusDestroyFunction destroy
|
||||||
ofono_error("Networkt time: Could not register interface %s, path %s",
|
ofono_error("Network time: Could not register interface %s, path %s",
|
||||||
OFONO_NETWORK_TIME_INTERFACE, path);
|
OFONO_NETWORK_TIME_INTERFACE, path);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
ofono_info("Network time: Registered inteface %s, path %s",
|
ofono_info("Network time: Registered interface %s, path %s",
|
||||||
OFONO_NETWORK_TIME_INTERFACE, path);
|
OFONO_NETWORK_TIME_INTERFACE, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,6 +235,12 @@ static void nettime_info_received(struct ofono_nettime_context *context,
|
|||||||
|
|
||||||
netreg = __ofono_atom_get_data(__ofono_modem_find_atom(
|
netreg = __ofono_atom_get_data(__ofono_modem_find_atom(
|
||||||
context->modem, OFONO_ATOM_TYPE_NETREG));
|
context->modem, OFONO_ATOM_TYPE_NETREG));
|
||||||
|
|
||||||
|
if (!(ofono_netreg_get_mcc(netreg) && ofono_netreg_get_mnc(netreg))) {
|
||||||
|
DBG("Incomplete network time received, ignoring");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ntd->path = ofono_modem_get_path(context->modem);
|
ntd->path = ofono_modem_get_path(context->modem);
|
||||||
ntd->mcc = ofono_netreg_get_mcc(netreg);
|
ntd->mcc = ofono_netreg_get_mcc(netreg);
|
||||||
ntd->mnc = ofono_netreg_get_mnc(netreg);
|
ntd->mnc = ofono_netreg_get_mnc(netreg);
|
||||||
|
|||||||
@@ -1071,6 +1071,7 @@ done:
|
|||||||
static int phonesim_init(void)
|
static int phonesim_init(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
char *conf_override = getenv("OFONO_PHONESIM_CONFIG");
|
||||||
|
|
||||||
err = ofono_modem_driver_register(&phonesim_driver);
|
err = ofono_modem_driver_register(&phonesim_driver);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
@@ -1081,7 +1082,10 @@ static int phonesim_init(void)
|
|||||||
ofono_gprs_context_driver_register(&context_driver);
|
ofono_gprs_context_driver_register(&context_driver);
|
||||||
ofono_ctm_driver_register(&ctm_driver);
|
ofono_ctm_driver_register(&ctm_driver);
|
||||||
|
|
||||||
parse_config(CONFIGDIR "/phonesim.conf");
|
if (conf_override)
|
||||||
|
parse_config(conf_override);
|
||||||
|
else
|
||||||
|
parse_config(CONFIGDIR "/phonesim.conf");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define _GNU_SOURCE
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -36,57 +37,134 @@
|
|||||||
#include <ofono/modem.h>
|
#include <ofono/modem.h>
|
||||||
#include <ofono/gprs-provision.h>
|
#include <ofono/gprs-provision.h>
|
||||||
|
|
||||||
|
#include "provision.h"
|
||||||
#include "mbpi.h"
|
#include "mbpi.h"
|
||||||
|
|
||||||
/* Returns the list containing exactly one INTERNET and one MMS access point */
|
/* Returns the list containing exactly one INTERNET and one MMS access point */
|
||||||
static GSList *provision_normalize_apn_list(GSList *apns)
|
static GSList *provision_normalize_apn_list(GSList *apns, const char* spn)
|
||||||
{
|
{
|
||||||
struct ofono_gprs_provision_data *internet = NULL;
|
struct ofono_gprs_provision_data *best_internet = NULL;
|
||||||
struct ofono_gprs_provision_data *mms = NULL;
|
struct ofono_gprs_provision_data *best_mms = NULL;
|
||||||
GSList *l = apns;
|
struct ofono_gprs_provision_data *second_best_internet = NULL;
|
||||||
|
struct ofono_gprs_provision_data *second_best_mms = NULL;
|
||||||
|
GSList *best_apns = NULL;
|
||||||
|
GSList *l;
|
||||||
|
|
||||||
|
/* 1. save the first found internet APN and the first MMS APN */
|
||||||
|
l = apns;
|
||||||
while (l != NULL) {
|
while (l != NULL) {
|
||||||
GSList *next = l->next;
|
GSList *next = l->next;
|
||||||
struct ofono_gprs_provision_data *ap = l->data;
|
struct ofono_gprs_provision_data *ap = l->data;
|
||||||
|
|
||||||
if (ap->type == OFONO_GPRS_CONTEXT_TYPE_INTERNET && !internet) {
|
if (ap->type == OFONO_GPRS_CONTEXT_TYPE_INTERNET
|
||||||
internet = ap;
|
&& !best_internet) {
|
||||||
} else if (ap->type == OFONO_GPRS_CONTEXT_TYPE_MMS && !mms) {
|
best_internet = ap;
|
||||||
mms = ap;
|
} else if (ap->type == OFONO_GPRS_CONTEXT_TYPE_MMS
|
||||||
} else {
|
&& !best_mms) {
|
||||||
/* Remove duplicate and unnecessary access points */
|
best_mms = ap;
|
||||||
DBG("Discarding APN: '%s' Name: '%s' Type: %s",
|
|
||||||
ap->apn, ap->name, mbpi_ap_type(ap->type));
|
|
||||||
mbpi_ap_free(ap);
|
|
||||||
apns = g_slist_remove_link(apns, l);
|
|
||||||
}
|
}
|
||||||
l = next;
|
l = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!internet) {
|
/*
|
||||||
internet = g_try_new0(struct ofono_gprs_provision_data, 1);
|
* 2. look for a "primary" provider (i.e. an MNO, not
|
||||||
if (internet) {
|
* an MVNO on the same radio network)
|
||||||
internet->type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
|
*/
|
||||||
internet->name = g_strdup("Internet");
|
second_best_internet = best_internet;
|
||||||
internet->apn = g_strdup("internet");
|
best_internet = NULL;
|
||||||
apns = g_slist_append(apns, internet);
|
second_best_mms = best_mms;
|
||||||
|
best_mms = NULL;
|
||||||
|
|
||||||
|
l = apns;
|
||||||
|
while (l != NULL) {
|
||||||
|
GSList *next = l->next;
|
||||||
|
struct ofono_gprs_provision_data *ap = l->data;
|
||||||
|
|
||||||
|
if (ap->provider_primary) {
|
||||||
|
if (ap->type == OFONO_GPRS_CONTEXT_TYPE_INTERNET
|
||||||
|
&& !best_internet) {
|
||||||
|
best_internet = ap;
|
||||||
|
} else if (ap->type == OFONO_GPRS_CONTEXT_TYPE_MMS
|
||||||
|
&& !best_mms) {
|
||||||
|
best_mms = ap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
l = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* no better match found */
|
||||||
|
if (!best_internet)
|
||||||
|
best_internet = second_best_internet;
|
||||||
|
if (!best_mms)
|
||||||
|
best_mms = second_best_mms;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 3. if there is an SPN given, save the first internet APN and the
|
||||||
|
* first MMS APN matching the SPN (partially, case-insensitively)
|
||||||
|
* */
|
||||||
|
if (spn) {
|
||||||
|
second_best_internet = best_internet;
|
||||||
|
best_internet = NULL;
|
||||||
|
second_best_mms = best_mms;
|
||||||
|
best_mms = NULL;
|
||||||
|
|
||||||
|
l = apns;
|
||||||
|
while (l != NULL) {
|
||||||
|
GSList *next = l->next;
|
||||||
|
struct ofono_gprs_provision_data *ap = l->data;
|
||||||
|
|
||||||
|
if ((ap->provider_name && strcasestr(ap->provider_name, spn))
|
||||||
|
|| (ap->name && strcasestr(ap->name, spn))
|
||||||
|
|| (ap->apn && strcasestr(ap->apn, spn))) {
|
||||||
|
if (ap->type == OFONO_GPRS_CONTEXT_TYPE_INTERNET
|
||||||
|
&& !best_internet) {
|
||||||
|
best_internet = ap;
|
||||||
|
} else if (ap->type == OFONO_GPRS_CONTEXT_TYPE_MMS
|
||||||
|
&& !best_mms) {
|
||||||
|
best_mms = ap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
l = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* no better match found */
|
||||||
|
if (!best_internet)
|
||||||
|
best_internet = second_best_internet;
|
||||||
|
if (!best_mms)
|
||||||
|
best_mms = second_best_mms;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 4. if none found yet, create APNs with default values */
|
||||||
|
if (!best_internet) {
|
||||||
|
best_internet = g_try_new0(struct ofono_gprs_provision_data, 1);
|
||||||
|
if (best_internet) {
|
||||||
|
best_internet->type =
|
||||||
|
OFONO_GPRS_CONTEXT_TYPE_INTERNET;
|
||||||
|
best_internet->name =
|
||||||
|
g_strdup("Internet");
|
||||||
|
best_internet->apn =
|
||||||
|
g_strdup("internet");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mms) {
|
if (!best_mms) {
|
||||||
mms = g_try_new0(struct ofono_gprs_provision_data, 1);
|
best_mms = g_try_new0(struct ofono_gprs_provision_data, 1);
|
||||||
if (mms) {
|
if (best_mms) {
|
||||||
mms->type = OFONO_GPRS_CONTEXT_TYPE_MMS;
|
best_mms->type =
|
||||||
mms->name = g_strdup("MMS");
|
OFONO_GPRS_CONTEXT_TYPE_MMS;
|
||||||
mms->apn = g_strdup("mms");
|
best_mms->name =
|
||||||
apns = g_slist_append(apns, mms);
|
g_strdup("MMS");
|
||||||
|
best_mms->apn =
|
||||||
|
g_strdup("mms");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return apns;
|
best_apns = g_slist_append(best_apns, best_internet);
|
||||||
|
best_apns = g_slist_append(best_apns, best_mms);
|
||||||
|
return best_apns;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int provision_get_settings(const char *mcc, const char *mnc,
|
int provision_get_settings(const char *mcc, const char *mnc,
|
||||||
const char *spn,
|
const char *spn,
|
||||||
struct ofono_gprs_provision_data **settings,
|
struct ofono_gprs_provision_data **settings,
|
||||||
int *count)
|
int *count)
|
||||||
@@ -97,7 +175,7 @@ static int provision_get_settings(const char *mcc, const char *mnc,
|
|||||||
int ap_count;
|
int ap_count;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
DBG("Provisioning for MCC %s, MNC %s, SPN '%s'", mcc, mnc, spn);
|
ofono_info("Provisioning for MCC %s, MNC %s, SPN '%s'", mcc, mnc, spn);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Passing FALSE to mbpi_lookup_apn() would return
|
* Passing FALSE to mbpi_lookup_apn() would return
|
||||||
@@ -109,13 +187,14 @@ static int provision_get_settings(const char *mcc, const char *mnc,
|
|||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
apns = provision_normalize_apn_list(apns);
|
ofono_info("Found %d APs in MBPI", g_slist_length(apns));
|
||||||
|
apns = provision_normalize_apn_list(apns, spn);
|
||||||
if (apns == NULL)
|
if (apns == NULL)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
ap_count = g_slist_length(apns);
|
ap_count = g_slist_length(apns);
|
||||||
|
|
||||||
DBG("Found %d APs", ap_count);
|
ofono_info("Provisioning %d APs", ap_count);
|
||||||
|
|
||||||
*settings = g_try_new0(struct ofono_gprs_provision_data, ap_count);
|
*settings = g_try_new0(struct ofono_gprs_provision_data, ap_count);
|
||||||
if (*settings == NULL) {
|
if (*settings == NULL) {
|
||||||
@@ -134,11 +213,11 @@ static int provision_get_settings(const char *mcc, const char *mnc,
|
|||||||
for (l = apns, i = 0; l; l = l->next, i++) {
|
for (l = apns, i = 0; l; l = l->next, i++) {
|
||||||
struct ofono_gprs_provision_data *ap = l->data;
|
struct ofono_gprs_provision_data *ap = l->data;
|
||||||
|
|
||||||
DBG("Name: '%s'", ap->name);
|
ofono_info("Name: '%s'", ap->name);
|
||||||
DBG("APN: '%s'", ap->apn);
|
ofono_info("APN: '%s'", ap->apn);
|
||||||
DBG("Type: %s", mbpi_ap_type(ap->type));
|
ofono_info("Type: %s", mbpi_ap_type(ap->type));
|
||||||
DBG("Username: '%s'", ap->username);
|
ofono_info("Username: '%s'", ap->username);
|
||||||
DBG("Password: '%s'", ap->password);
|
ofono_info("Password: '%s'", ap->password);
|
||||||
|
|
||||||
memcpy(*settings + i, ap,
|
memcpy(*settings + i, ap,
|
||||||
sizeof(struct ofono_gprs_provision_data));
|
sizeof(struct ofono_gprs_provision_data));
|
||||||
|
|||||||
28
ofono/plugins/provision.h
Normal file
28
ofono/plugins/provision.h
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* oFono - Open Source Telephony
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 Jolla. All rights reserved.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct ofono_gprs_provision_data;
|
||||||
|
|
||||||
|
int provision_get_settings(const char *mcc, const char *mnc,
|
||||||
|
const char *spn,
|
||||||
|
struct ofono_gprs_provision_data **settings,
|
||||||
|
int *count);
|
||||||
|
|
||||||
@@ -282,10 +282,10 @@ static void pf_modem_watch(struct ofono_modem *modem,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
pm->modem = modem;
|
pm->modem = modem;
|
||||||
pm->sim_watch_id = __ofono_modem_add_atom_watch(modem,
|
pm->sms_watch_id = __ofono_modem_add_atom_watch(modem,
|
||||||
OFONO_ATOM_TYPE_SMS, pf_sms_watch, pm,
|
OFONO_ATOM_TYPE_SMS, pf_sms_watch, pm,
|
||||||
pf_sms_watch_done);
|
pf_sms_watch_done);
|
||||||
pm->sms_watch_id = __ofono_modem_add_atom_watch(modem,
|
pm->sim_watch_id = __ofono_modem_add_atom_watch(modem,
|
||||||
OFONO_ATOM_TYPE_SIM, pf_sim_watch, pm,
|
OFONO_ATOM_TYPE_SIM, pf_sim_watch, pm,
|
||||||
pf_sim_watch_done);
|
pf_sim_watch_done);
|
||||||
modems = g_slist_append(modems, pm);
|
modems = g_slist_append(modems, pm);
|
||||||
|
|||||||
@@ -113,13 +113,12 @@ static void ril_debug(const char *str, void *user_data)
|
|||||||
|
|
||||||
static void sim_status_cb(struct ril_msg *message, gpointer user_data)
|
static void sim_status_cb(struct ril_msg *message, gpointer user_data)
|
||||||
{
|
{
|
||||||
|
DBG("error=%d", message->error);
|
||||||
struct ofono_modem *modem = user_data;
|
struct ofono_modem *modem = user_data;
|
||||||
struct ril_data *ril = ofono_modem_get_data(modem);
|
struct ril_data *ril = ofono_modem_get_data(modem);
|
||||||
struct sim_status status;
|
struct sim_status status;
|
||||||
struct sim_app *apps[MAX_UICC_APPS];
|
struct sim_app *apps[MAX_UICC_APPS];
|
||||||
|
|
||||||
DBG("");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ril.h claims this should NEVER fail!
|
* ril.h claims this should NEVER fail!
|
||||||
* However this isn't quite true. So,
|
* However this isn't quite true. So,
|
||||||
@@ -189,6 +188,7 @@ static int send_get_sim_status(struct ofono_modem *modem)
|
|||||||
|
|
||||||
static int ril_probe(struct ofono_modem *modem)
|
static int ril_probe(struct ofono_modem *modem)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
struct ril_data *ril = NULL;
|
struct ril_data *ril = NULL;
|
||||||
|
|
||||||
ril = g_try_new0(struct ril_data, 1);
|
ril = g_try_new0(struct ril_data, 1);
|
||||||
@@ -211,9 +211,9 @@ error:
|
|||||||
|
|
||||||
static void ril_remove(struct ofono_modem *modem)
|
static void ril_remove(struct ofono_modem *modem)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
struct ril_data *ril = ofono_modem_get_data(modem);
|
struct ril_data *ril = ofono_modem_get_data(modem);
|
||||||
|
|
||||||
|
|
||||||
ofono_modem_set_data(modem, NULL);
|
ofono_modem_set_data(modem, NULL);
|
||||||
|
|
||||||
if (!ril)
|
if (!ril)
|
||||||
@@ -229,7 +229,7 @@ static void ril_remove(struct ofono_modem *modem)
|
|||||||
|
|
||||||
static void ril_pre_sim(struct ofono_modem *modem)
|
static void ril_pre_sim(struct ofono_modem *modem)
|
||||||
{
|
{
|
||||||
DBG("enter");
|
DBG("");
|
||||||
struct ril_data *ril = ofono_modem_get_data(modem);
|
struct ril_data *ril = ofono_modem_get_data(modem);
|
||||||
struct ofono_sim *sim;
|
struct ofono_sim *sim;
|
||||||
|
|
||||||
@@ -242,6 +242,7 @@ static void ril_pre_sim(struct ofono_modem *modem)
|
|||||||
|
|
||||||
static void ril_post_sim(struct ofono_modem *modem)
|
static void ril_post_sim(struct ofono_modem *modem)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
struct ril_data *ril = ofono_modem_get_data(modem);
|
struct ril_data *ril = ofono_modem_get_data(modem);
|
||||||
struct ofono_gprs *gprs;
|
struct ofono_gprs *gprs;
|
||||||
struct ofono_gprs_context *gc;
|
struct ofono_gprs_context *gc;
|
||||||
@@ -277,7 +278,7 @@ static void ril_post_sim(struct ofono_modem *modem)
|
|||||||
|
|
||||||
static void ril_post_online(struct ofono_modem *modem)
|
static void ril_post_online(struct ofono_modem *modem)
|
||||||
{
|
{
|
||||||
DBG("enter");
|
DBG("");
|
||||||
struct ril_data *ril = ofono_modem_get_data(modem);
|
struct ril_data *ril = ofono_modem_get_data(modem);
|
||||||
|
|
||||||
ofono_call_volume_create(modem, 0, "rilmodem", ril->modem);
|
ofono_call_volume_create(modem, 0, "rilmodem", ril->modem);
|
||||||
@@ -290,7 +291,7 @@ static void ril_post_online(struct ofono_modem *modem)
|
|||||||
|
|
||||||
static void ril_set_online_cb(struct ril_msg *message, gpointer user_data)
|
static void ril_set_online_cb(struct ril_msg *message, gpointer user_data)
|
||||||
{
|
{
|
||||||
DBG("enter");
|
DBG("");
|
||||||
struct cb_data *cbd = user_data;
|
struct cb_data *cbd = user_data;
|
||||||
ofono_modem_online_cb_t cb = cbd->cb;
|
ofono_modem_online_cb_t cb = cbd->cb;
|
||||||
|
|
||||||
@@ -312,12 +313,13 @@ static void ril_set_online(struct ofono_modem *modem, ofono_bool_t online,
|
|||||||
parcel_init(&rilp);
|
parcel_init(&rilp);
|
||||||
parcel_w_int32(&rilp, 1); /* Number of params */
|
parcel_w_int32(&rilp, 1); /* Number of params */
|
||||||
parcel_w_int32(&rilp, online); /* Radio ON = 1, Radio OFF = 0 */
|
parcel_w_int32(&rilp, online); /* Radio ON = 1, Radio OFF = 0 */
|
||||||
DBG("1");
|
|
||||||
|
ofono_info("RIL_REQUEST_RADIO_POWER %d", online);
|
||||||
ret = g_ril_send(ril->modem, RIL_REQUEST_RADIO_POWER, rilp.data,
|
ret = g_ril_send(ril->modem, RIL_REQUEST_RADIO_POWER, rilp.data,
|
||||||
rilp.size, ril_set_online_cb, cbd, g_free);
|
rilp.size, ril_set_online_cb, cbd, g_free);
|
||||||
|
|
||||||
parcel_free(&rilp);
|
parcel_free(&rilp);
|
||||||
DBG("2");
|
DBG("RIL_REQUEST_RADIO_POWER done");
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
g_free(cbd);
|
g_free(cbd);
|
||||||
CALLBACK_WITH_FAILURE(callback, data);
|
CALLBACK_WITH_FAILURE(callback, data);
|
||||||
@@ -355,6 +357,7 @@ static int ril_screen_state(struct ofono_modem *modem, ofono_bool_t state)
|
|||||||
static gboolean display_changed(DBusConnection *conn,
|
static gboolean display_changed(DBusConnection *conn,
|
||||||
DBusMessage *message, void *user_data)
|
DBusMessage *message, void *user_data)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
struct ofono_modem *modem = user_data;
|
struct ofono_modem *modem = user_data;
|
||||||
DBusMessageIter iter;
|
DBusMessageIter iter;
|
||||||
const char *value;
|
const char *value;
|
||||||
@@ -377,6 +380,7 @@ static gboolean display_changed(DBusConnection *conn,
|
|||||||
|
|
||||||
static void mce_connect(DBusConnection *conn, void *user_data)
|
static void mce_connect(DBusConnection *conn, void *user_data)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
signal_watch = g_dbus_add_signal_watch(conn,
|
signal_watch = g_dbus_add_signal_watch(conn,
|
||||||
MCE_SERVICE, NULL,
|
MCE_SERVICE, NULL,
|
||||||
MCE_SIGNAL_IF,
|
MCE_SIGNAL_IF,
|
||||||
@@ -387,12 +391,15 @@ static void mce_connect(DBusConnection *conn, void *user_data)
|
|||||||
|
|
||||||
static void mce_disconnect(DBusConnection *conn, void *user_data)
|
static void mce_disconnect(DBusConnection *conn, void *user_data)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
g_dbus_remove_watch(conn, signal_watch);
|
g_dbus_remove_watch(conn, signal_watch);
|
||||||
signal_watch = 0;
|
signal_watch = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ril_connected(struct ril_msg *message, gpointer user_data)
|
static void ril_connected(struct ril_msg *message, gpointer user_data)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
|
|
||||||
struct ofono_modem *modem = (struct ofono_modem *) user_data;
|
struct ofono_modem *modem = (struct ofono_modem *) user_data;
|
||||||
struct ril_data *ril = ofono_modem_get_data(modem);
|
struct ril_data *ril = ofono_modem_get_data(modem);
|
||||||
|
|
||||||
@@ -412,6 +419,7 @@ static void ril_connected(struct ril_msg *message, gpointer user_data)
|
|||||||
|
|
||||||
static gboolean ril_re_init(gpointer user_data)
|
static gboolean ril_re_init(gpointer user_data)
|
||||||
{
|
{
|
||||||
|
DBG("");
|
||||||
if (reconnecting) {
|
if (reconnecting) {
|
||||||
ril_init();
|
ril_init();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -467,7 +475,7 @@ void ril_switchUser()
|
|||||||
|
|
||||||
static int ril_enable(struct ofono_modem *modem)
|
static int ril_enable(struct ofono_modem *modem)
|
||||||
{
|
{
|
||||||
DBG("enter");
|
DBG("%p", modem);
|
||||||
struct ril_data *ril = ofono_modem_get_data(modem);
|
struct ril_data *ril = ofono_modem_get_data(modem);
|
||||||
|
|
||||||
ril->have_sim = FALSE;
|
ril->have_sim = FALSE;
|
||||||
@@ -510,17 +518,18 @@ static int ril_enable(struct ofono_modem *modem)
|
|||||||
|
|
||||||
static int ril_disable(struct ofono_modem *modem)
|
static int ril_disable(struct ofono_modem *modem)
|
||||||
{
|
{
|
||||||
|
DBG("%p", modem);
|
||||||
|
|
||||||
struct ril_data *ril = ofono_modem_get_data(modem);
|
struct ril_data *ril = ofono_modem_get_data(modem);
|
||||||
struct parcel rilp;
|
struct parcel rilp;
|
||||||
int request = RIL_REQUEST_RADIO_POWER;
|
int request = RIL_REQUEST_RADIO_POWER;
|
||||||
guint ret;
|
guint ret;
|
||||||
|
|
||||||
DBG("%p", modem);
|
|
||||||
|
|
||||||
parcel_init(&rilp);
|
parcel_init(&rilp);
|
||||||
parcel_w_int32(&rilp, 1); /* size of array */
|
parcel_w_int32(&rilp, 1); /* size of array */
|
||||||
parcel_w_int32(&rilp, 0); /* POWER=OFF */
|
parcel_w_int32(&rilp, 0); /* POWER=OFF */
|
||||||
|
|
||||||
|
ofono_info("RIL_REQUEST_RADIO_POWER OFF");
|
||||||
/* fire and forget i.e. not waiting for the callback*/
|
/* fire and forget i.e. not waiting for the callback*/
|
||||||
ret = g_ril_send(ril->modem, request, rilp.data,
|
ret = g_ril_send(ril->modem, request, rilp.data,
|
||||||
rilp.size, NULL, NULL, NULL);
|
rilp.size, NULL, NULL, NULL);
|
||||||
@@ -564,7 +573,7 @@ static struct ofono_modem_driver ril_driver = {
|
|||||||
*/
|
*/
|
||||||
static int ril_init(void)
|
static int ril_init(void)
|
||||||
{
|
{
|
||||||
DBG("enter");
|
DBG("");
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
struct ofono_modem *modem;
|
struct ofono_modem *modem;
|
||||||
|
|
||||||
|
|||||||
@@ -411,9 +411,12 @@ static void set_new_cond_list(struct ofono_call_forwarding *cf,
|
|||||||
number = phone_number_to_string(
|
number = phone_number_to_string(
|
||||||
&lc->phone_number);
|
&lc->phone_number);
|
||||||
|
|
||||||
|
snprintf(attr, sizeof(attr), "%s%s",
|
||||||
|
bearer_class_to_string(lc->cls), cf_type_lut[i]);
|
||||||
|
|
||||||
ofono_dbus_signal_property_changed(conn, path,
|
ofono_dbus_signal_property_changed(conn, path,
|
||||||
OFONO_CALL_FORWARDING_INTERFACE,
|
OFONO_CALL_FORWARDING_INTERFACE,
|
||||||
cf_type_lut[i],
|
attr,
|
||||||
DBUS_TYPE_STRING, &number);
|
DBUS_TYPE_STRING, &number);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -713,8 +716,12 @@ static DBusMessage *set_property_request(struct ofono_call_forwarding *cf,
|
|||||||
if (ph->number[0] != '\0')
|
if (ph->number[0] != '\0')
|
||||||
cf->driver->registration(cf, type, cls, ph, timeout,
|
cf->driver->registration(cf, type, cls, ph, timeout,
|
||||||
set_property_callback, cf);
|
set_property_callback, cf);
|
||||||
else
|
else {
|
||||||
|
if (cf->query_next == CALL_FORWARDING_TYPE_UNCONDITIONAL)
|
||||||
|
cf->query_end = CALL_FORWARDING_TYPE_NOT_REACHABLE;
|
||||||
|
|
||||||
cf->driver->erasure(cf, type, cls, set_property_callback, cf);
|
cf->driver->erasure(cf, type, cls, set_property_callback, cf);
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@
|
|||||||
#define MAX_CONTEXTS 256
|
#define MAX_CONTEXTS 256
|
||||||
#define SUSPEND_TIMEOUT 8
|
#define SUSPEND_TIMEOUT 8
|
||||||
#define MAX_MMS_MTU 1280
|
#define MAX_MMS_MTU 1280
|
||||||
|
#define MAX_GPRS_MTU 1280
|
||||||
|
|
||||||
/* 27.007 Section 7.29 */
|
/* 27.007 Section 7.29 */
|
||||||
enum packet_bearer {
|
enum packet_bearer {
|
||||||
@@ -909,6 +910,9 @@ static void pri_activate_callback(const struct ofono_error *error, void *data)
|
|||||||
|
|
||||||
pri_context_signal_settings(ctx, gc->settings->ipv4 != NULL,
|
pri_context_signal_settings(ctx, gc->settings->ipv4 != NULL,
|
||||||
gc->settings->ipv6 != NULL);
|
gc->settings->ipv6 != NULL);
|
||||||
|
|
||||||
|
if (ctx->type == OFONO_GPRS_CONTEXT_TYPE_INTERNET)
|
||||||
|
pri_limit_mtu(gc->settings->interface, MAX_GPRS_MTU);
|
||||||
}
|
}
|
||||||
|
|
||||||
value = ctx->active;
|
value = ctx->active;
|
||||||
|
|||||||
@@ -44,25 +44,34 @@
|
|||||||
|
|
||||||
static GSList *g_drivers = NULL;
|
static GSList *g_drivers = NULL;
|
||||||
|
|
||||||
|
#define HANDSFREE_FLAG_CACHED 0x1
|
||||||
|
|
||||||
struct ofono_handsfree {
|
struct ofono_handsfree {
|
||||||
ofono_bool_t nrec;
|
ofono_bool_t nrec;
|
||||||
ofono_bool_t inband_ringing;
|
ofono_bool_t inband_ringing;
|
||||||
ofono_bool_t voice_recognition;
|
ofono_bool_t voice_recognition;
|
||||||
ofono_bool_t voice_recognition_pending;
|
ofono_bool_t voice_recognition_pending;
|
||||||
unsigned int ag_features;
|
unsigned int ag_features;
|
||||||
|
unsigned int ag_chld_features;
|
||||||
unsigned char battchg;
|
unsigned char battchg;
|
||||||
|
GSList *subscriber_numbers;
|
||||||
|
|
||||||
const struct ofono_handsfree_driver *driver;
|
const struct ofono_handsfree_driver *driver;
|
||||||
void *driver_data;
|
void *driver_data;
|
||||||
struct ofono_atom *atom;
|
struct ofono_atom *atom;
|
||||||
DBusMessage *pending;
|
DBusMessage *pending;
|
||||||
|
int flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char **ag_features_list(unsigned int features)
|
static const char **ag_features_list(unsigned int features,
|
||||||
|
unsigned int chld_features)
|
||||||
{
|
{
|
||||||
static const char *list[33];
|
static const char *list[10];
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
|
if (features & HFP_AG_FEATURE_3WAY)
|
||||||
|
list[i++] = "three-way-calling";
|
||||||
|
|
||||||
if (features & HFP_AG_FEATURE_ECNR)
|
if (features & HFP_AG_FEATURE_ECNR)
|
||||||
list[i++] = "echo-canceling-and-noise-reduction";
|
list[i++] = "echo-canceling-and-noise-reduction";
|
||||||
|
|
||||||
@@ -72,6 +81,21 @@ static const char **ag_features_list(unsigned int features)
|
|||||||
if (features & HFP_AG_FEATURE_ATTACH_VOICE_TAG)
|
if (features & HFP_AG_FEATURE_ATTACH_VOICE_TAG)
|
||||||
list[i++] = "attach-voice-tag";
|
list[i++] = "attach-voice-tag";
|
||||||
|
|
||||||
|
if (chld_features & HFP_AG_CHLD_0)
|
||||||
|
list[i++] = "release-all-held";
|
||||||
|
|
||||||
|
if (chld_features & HFP_AG_CHLD_1x)
|
||||||
|
list[i++] = "release-specified-active-call";
|
||||||
|
|
||||||
|
if (chld_features & HFP_AG_CHLD_2x)
|
||||||
|
list[i++] = "private-chat";
|
||||||
|
|
||||||
|
if (chld_features & HFP_AG_CHLD_3)
|
||||||
|
list[i++] = "create-multiparty";
|
||||||
|
|
||||||
|
if (chld_features & HFP_AG_CHLD_4)
|
||||||
|
list[i++] = "transfer";
|
||||||
|
|
||||||
list[i] = NULL;
|
list[i] = NULL;
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
@@ -125,6 +149,15 @@ void ofono_handsfree_set_ag_features(struct ofono_handsfree *hf,
|
|||||||
hf->ag_features = ag_features;
|
hf->ag_features = ag_features;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ofono_handsfree_set_ag_chld_features(struct ofono_handsfree *hf,
|
||||||
|
unsigned int ag_chld_features)
|
||||||
|
{
|
||||||
|
if (hf == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
hf->ag_chld_features = ag_chld_features;
|
||||||
|
}
|
||||||
|
|
||||||
void ofono_handsfree_battchg_notify(struct ofono_handsfree *hf,
|
void ofono_handsfree_battchg_notify(struct ofono_handsfree *hf,
|
||||||
unsigned char level)
|
unsigned char level)
|
||||||
{
|
{
|
||||||
@@ -148,10 +181,44 @@ void ofono_handsfree_battchg_notify(struct ofono_handsfree *hf,
|
|||||||
&level);
|
&level);
|
||||||
}
|
}
|
||||||
|
|
||||||
static DBusMessage *handsfree_get_properties(DBusConnection *conn,
|
static void append_subscriber_numbers(GSList *subscriber_numbers,
|
||||||
DBusMessage *msg, void *data)
|
DBusMessageIter *iter)
|
||||||
|
{
|
||||||
|
DBusMessageIter entry;
|
||||||
|
DBusMessageIter variant, array;
|
||||||
|
GSList *l;
|
||||||
|
const char *subscriber_number_string;
|
||||||
|
char arraysig[3];
|
||||||
|
const char *key = "SubscriberNumbers";
|
||||||
|
|
||||||
|
arraysig[0] = DBUS_TYPE_ARRAY;
|
||||||
|
arraysig[1] = DBUS_TYPE_STRING;
|
||||||
|
arraysig[2] = '\0';
|
||||||
|
|
||||||
|
dbus_message_iter_open_container(iter, DBUS_TYPE_DICT_ENTRY,
|
||||||
|
NULL, &entry);
|
||||||
|
dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING,
|
||||||
|
&key);
|
||||||
|
dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT,
|
||||||
|
arraysig, &variant);
|
||||||
|
dbus_message_iter_open_container(&variant, DBUS_TYPE_ARRAY,
|
||||||
|
DBUS_TYPE_STRING_AS_STRING, &array);
|
||||||
|
|
||||||
|
for (l = subscriber_numbers; l; l = l->next) {
|
||||||
|
subscriber_number_string = phone_number_to_string(l->data);
|
||||||
|
dbus_message_iter_append_basic(&array, DBUS_TYPE_STRING,
|
||||||
|
&subscriber_number_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
dbus_message_iter_close_container(&variant, &array);
|
||||||
|
|
||||||
|
dbus_message_iter_close_container(&entry, &variant);
|
||||||
|
dbus_message_iter_close_container(iter, &entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DBusMessage *generate_get_properties_reply(struct ofono_handsfree *hf,
|
||||||
|
DBusMessage *msg)
|
||||||
{
|
{
|
||||||
struct ofono_handsfree *hf = data;
|
|
||||||
DBusMessage *reply;
|
DBusMessage *reply;
|
||||||
DBusMessageIter iter;
|
DBusMessageIter iter;
|
||||||
DBusMessageIter dict;
|
DBusMessageIter dict;
|
||||||
@@ -181,18 +248,90 @@ static DBusMessage *handsfree_get_properties(DBusConnection *conn,
|
|||||||
ofono_dbus_dict_append(&dict, "VoiceRecognition", DBUS_TYPE_BOOLEAN,
|
ofono_dbus_dict_append(&dict, "VoiceRecognition", DBUS_TYPE_BOOLEAN,
|
||||||
&voice_recognition);
|
&voice_recognition);
|
||||||
|
|
||||||
features = ag_features_list(hf->ag_features);
|
features = ag_features_list(hf->ag_features, hf->ag_chld_features);
|
||||||
ofono_dbus_dict_append_array(&dict, "Features", DBUS_TYPE_STRING,
|
ofono_dbus_dict_append_array(&dict, "Features", DBUS_TYPE_STRING,
|
||||||
&features);
|
&features);
|
||||||
|
|
||||||
ofono_dbus_dict_append(&dict, "BatteryChargeLevel", DBUS_TYPE_BYTE,
|
ofono_dbus_dict_append(&dict, "BatteryChargeLevel", DBUS_TYPE_BYTE,
|
||||||
&hf->battchg);
|
&hf->battchg);
|
||||||
|
|
||||||
|
if (hf->subscriber_numbers)
|
||||||
|
append_subscriber_numbers(hf->subscriber_numbers, &dict);
|
||||||
|
|
||||||
dbus_message_iter_close_container(&iter, &dict);
|
dbus_message_iter_close_container(&iter, &dict);
|
||||||
|
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void hf_cnum_callback(const struct ofono_error *error, int total,
|
||||||
|
const struct ofono_phone_number *numbers,
|
||||||
|
void *data)
|
||||||
|
{
|
||||||
|
struct ofono_handsfree *hf = data;
|
||||||
|
int num;
|
||||||
|
struct ofono_phone_number *subscriber_number;
|
||||||
|
|
||||||
|
if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
for (num = 0; num < total; num++) {
|
||||||
|
subscriber_number = g_new0(struct ofono_phone_number, 1);
|
||||||
|
|
||||||
|
subscriber_number->type = numbers[num].type;
|
||||||
|
strncpy(subscriber_number->number, numbers[num].number,
|
||||||
|
OFONO_MAX_PHONE_NUMBER_LENGTH + 1);
|
||||||
|
|
||||||
|
hf->subscriber_numbers = g_slist_prepend(hf->subscriber_numbers,
|
||||||
|
subscriber_number);
|
||||||
|
}
|
||||||
|
|
||||||
|
hf->subscriber_numbers = g_slist_reverse(hf->subscriber_numbers);
|
||||||
|
|
||||||
|
out:
|
||||||
|
hf->flags |= HANDSFREE_FLAG_CACHED;
|
||||||
|
|
||||||
|
if (hf->pending) {
|
||||||
|
DBusMessage *reply =
|
||||||
|
generate_get_properties_reply(hf, hf->pending);
|
||||||
|
__ofono_dbus_pending_reply(&hf->pending, reply);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void query_cnum(struct ofono_handsfree *hf)
|
||||||
|
{
|
||||||
|
DBusMessage *reply;
|
||||||
|
|
||||||
|
if (hf->driver->cnum_query != NULL) {
|
||||||
|
hf->driver->cnum_query(hf, hf_cnum_callback, hf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hf->pending == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
reply = generate_get_properties_reply(hf, hf->pending);
|
||||||
|
__ofono_dbus_pending_reply(&hf->pending, reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DBusMessage *handsfree_get_properties(DBusConnection *conn,
|
||||||
|
DBusMessage *msg, void *data)
|
||||||
|
{
|
||||||
|
struct ofono_handsfree *hf = data;
|
||||||
|
|
||||||
|
if (hf->pending != NULL)
|
||||||
|
return __ofono_error_busy(msg);
|
||||||
|
|
||||||
|
if (hf->flags & HANDSFREE_FLAG_CACHED)
|
||||||
|
return generate_get_properties_reply(hf, msg);
|
||||||
|
|
||||||
|
/* Query the settings and report back */
|
||||||
|
hf->pending = dbus_message_ref(msg);
|
||||||
|
|
||||||
|
query_cnum(hf);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void voicerec_set_cb(const struct ofono_error *error, void *data)
|
static void voicerec_set_cb(const struct ofono_error *error, void *data)
|
||||||
{
|
{
|
||||||
struct ofono_handsfree *hf = data;
|
struct ofono_handsfree *hf = data;
|
||||||
@@ -424,6 +563,10 @@ static void handsfree_unregister(struct ofono_atom *atom)
|
|||||||
__ofono_dbus_pending_reply(&hf->pending, reply);
|
__ofono_dbus_pending_reply(&hf->pending, reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_slist_foreach(hf->subscriber_numbers, (GFunc) g_free, NULL);
|
||||||
|
g_slist_free(hf->subscriber_numbers);
|
||||||
|
hf->subscriber_numbers = NULL;
|
||||||
|
|
||||||
ofono_modem_remove_interface(modem, OFONO_HANDSFREE_INTERFACE);
|
ofono_modem_remove_interface(modem, OFONO_HANDSFREE_INTERFACE);
|
||||||
g_dbus_unregister_interface(conn, path,
|
g_dbus_unregister_interface(conn, path,
|
||||||
OFONO_HANDSFREE_INTERFACE);
|
OFONO_HANDSFREE_INTERFACE);
|
||||||
|
|||||||
@@ -45,6 +45,17 @@ enum hfp_hf_feature {
|
|||||||
HFP_HF_FEATURE_CODEC_NEGOTIATION = 0x80,
|
HFP_HF_FEATURE_CODEC_NEGOTIATION = 0x80,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* HFP AG supported call hold and multiparty services bitmap. Bluetooth HFP 1.6 spec page 76 */
|
||||||
|
enum hfp_ag_chld_feature {
|
||||||
|
HFP_AG_CHLD_0 = 0x1,
|
||||||
|
HFP_AG_CHLD_1 = 0x2,
|
||||||
|
HFP_AG_CHLD_1x = 0x4,
|
||||||
|
HFP_AG_CHLD_2 = 0x8,
|
||||||
|
HFP_AG_CHLD_2x = 0x10,
|
||||||
|
HFP_AG_CHLD_3 = 0x20,
|
||||||
|
HFP_AG_CHLD_4 = 0x40,
|
||||||
|
};
|
||||||
|
|
||||||
enum hfp_sdp_hf_features {
|
enum hfp_sdp_hf_features {
|
||||||
HFP_SDP_HF_FEATURE_ECNR = 0x1,
|
HFP_SDP_HF_FEATURE_ECNR = 0x1,
|
||||||
HFP_SDP_HF_FEATURE_3WAY = 0x2,
|
HFP_SDP_HF_FEATURE_3WAY = 0x2,
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ void idmap_put(struct idmap *idmap, unsigned int id)
|
|||||||
|
|
||||||
id %= BITS_PER_LONG;
|
id %= BITS_PER_LONG;
|
||||||
|
|
||||||
idmap->bits[offset] &= ~(1 << id);
|
idmap->bits[offset] &= ~(1UL << id);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int idmap_alloc(struct idmap *idmap)
|
unsigned int idmap_alloc(struct idmap *idmap)
|
||||||
@@ -149,7 +149,7 @@ unsigned int idmap_alloc(struct idmap *idmap)
|
|||||||
return idmap->max + 1;
|
return idmap->max + 1;
|
||||||
|
|
||||||
offset = bit / BITS_PER_LONG;
|
offset = bit / BITS_PER_LONG;
|
||||||
idmap->bits[offset] |= 1 << (bit % BITS_PER_LONG);
|
idmap->bits[offset] |= 1UL << (bit % BITS_PER_LONG);
|
||||||
|
|
||||||
return bit + idmap->min;
|
return bit + idmap->min;
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ void idmap_take(struct idmap *idmap, unsigned int id)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
offset = bit / BITS_PER_LONG;
|
offset = bit / BITS_PER_LONG;
|
||||||
idmap->bits[offset] |= 1 << (bit % BITS_PER_LONG);
|
idmap->bits[offset] |= 1UL << (bit % BITS_PER_LONG);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -186,7 +186,7 @@ unsigned int idmap_alloc_next(struct idmap *idmap, unsigned int last)
|
|||||||
return idmap_alloc(idmap);
|
return idmap_alloc(idmap);
|
||||||
|
|
||||||
offset = bit / BITS_PER_LONG;
|
offset = bit / BITS_PER_LONG;
|
||||||
idmap->bits[offset] |= 1 << (bit % BITS_PER_LONG);
|
idmap->bits[offset] |= 1UL << (bit % BITS_PER_LONG);
|
||||||
|
|
||||||
return bit + idmap->min;
|
return bit + idmap->min;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,7 +289,8 @@ void __ofono_log_enable(struct ofono_debug_desc *start,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int __ofono_log_init(const char *program, const char *debug,
|
int __ofono_log_init(const char *program, const char *debug,
|
||||||
ofono_bool_t detach)
|
ofono_bool_t detach,
|
||||||
|
ofono_bool_t backtrace)
|
||||||
{
|
{
|
||||||
static char path[PATH_MAX];
|
static char path[PATH_MAX];
|
||||||
int option = LOG_NDELAY | LOG_PID;
|
int option = LOG_NDELAY | LOG_PID;
|
||||||
@@ -305,7 +306,8 @@ int __ofono_log_init(const char *program, const char *debug,
|
|||||||
if (detach == FALSE)
|
if (detach == FALSE)
|
||||||
option |= LOG_PERROR;
|
option |= LOG_PERROR;
|
||||||
|
|
||||||
signal_setup(signal_handler);
|
if (backtrace == TRUE)
|
||||||
|
signal_setup(signal_handler);
|
||||||
|
|
||||||
openlog(basename(program), option, LOG_DAEMON);
|
openlog(basename(program), option, LOG_DAEMON);
|
||||||
|
|
||||||
@@ -314,13 +316,14 @@ int __ofono_log_init(const char *program, const char *debug,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __ofono_log_cleanup(void)
|
void __ofono_log_cleanup(ofono_bool_t backtrace)
|
||||||
{
|
{
|
||||||
syslog(LOG_INFO, "Exit");
|
syslog(LOG_INFO, "Exit");
|
||||||
|
|
||||||
closelog();
|
closelog();
|
||||||
|
|
||||||
signal_setup(SIG_DFL);
|
if (backtrace == TRUE)
|
||||||
|
signal_setup(SIG_DFL);
|
||||||
|
|
||||||
g_strfreev(enabled);
|
g_strfreev(enabled);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ static gchar *option_plugin = NULL;
|
|||||||
static gchar *option_noplugin = NULL;
|
static gchar *option_noplugin = NULL;
|
||||||
static gboolean option_detach = TRUE;
|
static gboolean option_detach = TRUE;
|
||||||
static gboolean option_version = FALSE;
|
static gboolean option_version = FALSE;
|
||||||
|
static gboolean option_backtrace = TRUE;
|
||||||
|
|
||||||
static gboolean parse_debug(const char *key, const char *value,
|
static gboolean parse_debug(const char *key, const char *value,
|
||||||
gpointer user_data, GError **error)
|
gpointer user_data, GError **error)
|
||||||
@@ -158,6 +159,9 @@ static GOptionEntry options[] = {
|
|||||||
"Don't run as daemon in background" },
|
"Don't run as daemon in background" },
|
||||||
{ "version", 'v', 0, G_OPTION_ARG_NONE, &option_version,
|
{ "version", 'v', 0, G_OPTION_ARG_NONE, &option_version,
|
||||||
"Show version information and exit" },
|
"Show version information and exit" },
|
||||||
|
{ "nobacktrace", 0, G_OPTION_FLAG_REVERSE,
|
||||||
|
G_OPTION_ARG_NONE, &option_backtrace,
|
||||||
|
"Don't print out backtrace information" },
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -213,7 +217,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
signal = setup_signalfd();
|
signal = setup_signalfd();
|
||||||
|
|
||||||
__ofono_log_init(argv[0], option_debug, option_detach);
|
__ofono_log_init(argv[0], option_debug, option_detach,
|
||||||
|
option_backtrace);
|
||||||
|
|
||||||
dbus_error_init(&error);
|
dbus_error_init(&error);
|
||||||
|
|
||||||
@@ -264,7 +269,7 @@ cleanup:
|
|||||||
|
|
||||||
g_main_loop_unref(event_loop);
|
g_main_loop_unref(event_loop);
|
||||||
|
|
||||||
__ofono_log_cleanup();
|
__ofono_log_cleanup(option_backtrace);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
<allow send_interface="org.ofono.SmartMessagingAgent"/>
|
<allow send_interface="org.ofono.SmartMessagingAgent"/>
|
||||||
<allow send_interface="org.ofono.PositioningRequestAgent"/>
|
<allow send_interface="org.ofono.PositioningRequestAgent"/>
|
||||||
<allow send_interface="org.ofono.HandsfreeAudioAgent"/>
|
<allow send_interface="org.ofono.HandsfreeAudioAgent"/>
|
||||||
|
<allow send_interface="org.ofono.VoiceCallAgent"/>
|
||||||
</policy>
|
</policy>
|
||||||
|
|
||||||
<policy user="radio">
|
<policy user="radio">
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
<allow send_interface="org.ofono.SmartMessagingAgent"/>
|
<allow send_interface="org.ofono.SmartMessagingAgent"/>
|
||||||
<allow send_interface="org.ofono.PositioningRequestAgent"/>
|
<allow send_interface="org.ofono.PositioningRequestAgent"/>
|
||||||
<allow send_interface="org.ofono.HandsfreeAudioAgent"/>
|
<allow send_interface="org.ofono.HandsfreeAudioAgent"/>
|
||||||
|
<allow send_interface="org.ofono.VoiceCallAgent"/>
|
||||||
</policy>
|
</policy>
|
||||||
|
|
||||||
<policy at_console="true">
|
<policy at_console="true">
|
||||||
|
|||||||
@@ -38,8 +38,9 @@ void __ofono_modem_shutdown(void);
|
|||||||
#include <ofono/log.h>
|
#include <ofono/log.h>
|
||||||
|
|
||||||
int __ofono_log_init(const char *program, const char *debug,
|
int __ofono_log_init(const char *program, const char *debug,
|
||||||
ofono_bool_t detach);
|
ofono_bool_t detach,
|
||||||
void __ofono_log_cleanup(void);
|
ofono_bool_t backtrace);
|
||||||
|
void __ofono_log_cleanup(ofono_bool_t backtrace);
|
||||||
void __ofono_log_enable(struct ofono_debug_desc *start,
|
void __ofono_log_enable(struct ofono_debug_desc *start,
|
||||||
struct ofono_debug_desc *stop);
|
struct ofono_debug_desc *stop);
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ Type=dbus
|
|||||||
BusName=org.ofono
|
BusName=org.ofono
|
||||||
User=root
|
User=root
|
||||||
EnvironmentFile=-/var/lib/environment/ofono/*.conf
|
EnvironmentFile=-/var/lib/environment/ofono/*.conf
|
||||||
ExecStart=@prefix@/sbin/ofonod -n $OFONO_ARGS
|
ExecStart=@prefix@/sbin/ofonod -n --nobacktrace $OFONO_ARGS
|
||||||
StandardError=null
|
StandardError=null
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=3
|
RestartSec=3
|
||||||
|
|||||||
@@ -3561,7 +3561,7 @@ GSList *sms_text_prepare_with_alphabet(const char *to, const char *utf8,
|
|||||||
if (gsm_encoded == NULL) {
|
if (gsm_encoded == NULL) {
|
||||||
gsize converted;
|
gsize converted;
|
||||||
|
|
||||||
ucs2_encoded = g_convert(utf8, -1, "UCS-2BE//TRANSLIT", "UTF-8",
|
ucs2_encoded = g_convert(utf8, -1, "UTF-16BE//TRANSLIT", "UTF-8",
|
||||||
NULL, &converted, NULL);
|
NULL, &converted, NULL);
|
||||||
written = converted;
|
written = converted;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* oFono - Open Source Telephony
|
* oFono - Open Source Telephony
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
|
||||||
|
* Copyright (C) 2014 Jolla Ltd.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -38,6 +39,7 @@
|
|||||||
#include "simutil.h"
|
#include "simutil.h"
|
||||||
#include "smsutil.h"
|
#include "smsutil.h"
|
||||||
#include "storage.h"
|
#include "storage.h"
|
||||||
|
#include "voicecallagent.h"
|
||||||
|
|
||||||
#define MAX_VOICE_CALLS 16
|
#define MAX_VOICE_CALLS 16
|
||||||
|
|
||||||
@@ -75,6 +77,7 @@ struct ofono_voicecall {
|
|||||||
ofono_voicecall_cb_t release_queue_done_cb;
|
ofono_voicecall_cb_t release_queue_done_cb;
|
||||||
struct ofono_emulator *pending_em;
|
struct ofono_emulator *pending_em;
|
||||||
unsigned int pending_id;
|
unsigned int pending_id;
|
||||||
|
struct voicecall_agent *vc_agent;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct voicecall {
|
struct voicecall {
|
||||||
@@ -555,6 +558,11 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn,
|
|||||||
struct ofono_voicecall *vc = v->vc;
|
struct ofono_voicecall *vc = v->vc;
|
||||||
struct ofono_call *call = v->call;
|
struct ofono_call *call = v->call;
|
||||||
gboolean single_call = vc->call_list->next == 0;
|
gboolean single_call = vc->call_list->next == 0;
|
||||||
|
struct tone_queue_entry *tone_entry = NULL;
|
||||||
|
|
||||||
|
/* clear any remaining tones */
|
||||||
|
while ((tone_entry = g_queue_peek_head(vc->toneq)))
|
||||||
|
tone_request_finish(vc, tone_entry, ENOENT, TRUE);
|
||||||
|
|
||||||
if (vc->pending || vc->pending_em)
|
if (vc->pending || vc->pending_em)
|
||||||
return __ofono_error_busy(msg);
|
return __ofono_error_busy(msg);
|
||||||
@@ -2140,6 +2148,72 @@ static DBusMessage *manager_get_calls(DBusConnection *conn,
|
|||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void voicecall_agent_notify(gpointer user_data)
|
||||||
|
{
|
||||||
|
struct ofono_voicecall *vc = user_data;
|
||||||
|
vc->vc_agent = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static DBusMessage *voicecall_register_agent(DBusConnection *conn,
|
||||||
|
DBusMessage *msg, void *data)
|
||||||
|
{
|
||||||
|
struct ofono_voicecall *vc = data;
|
||||||
|
const char *agent_path;
|
||||||
|
|
||||||
|
if (vc->vc_agent)
|
||||||
|
return __ofono_error_busy(msg);
|
||||||
|
|
||||||
|
if (dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH,
|
||||||
|
&agent_path, DBUS_TYPE_INVALID) == FALSE)
|
||||||
|
return __ofono_error_invalid_args(msg);
|
||||||
|
|
||||||
|
if (!__ofono_dbus_valid_object_path(agent_path))
|
||||||
|
return __ofono_error_invalid_format(msg);
|
||||||
|
|
||||||
|
vc->vc_agent = voicecall_agent_new(agent_path,
|
||||||
|
dbus_message_get_sender(msg));
|
||||||
|
|
||||||
|
if (vc->vc_agent == NULL)
|
||||||
|
return __ofono_error_failed(msg);
|
||||||
|
|
||||||
|
voicecall_agent_set_removed_notify(vc->vc_agent,
|
||||||
|
voicecall_agent_notify, vc);
|
||||||
|
|
||||||
|
return dbus_message_new_method_return(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DBusMessage *voicecall_unregister_agent(DBusConnection *conn,
|
||||||
|
DBusMessage *msg, void *data)
|
||||||
|
{
|
||||||
|
struct ofono_voicecall *vc = data;
|
||||||
|
const char *agent_path;
|
||||||
|
const char *agent_bus = dbus_message_get_sender(msg);
|
||||||
|
|
||||||
|
if (dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &agent_path,
|
||||||
|
DBUS_TYPE_INVALID) == FALSE)
|
||||||
|
return __ofono_error_invalid_args(msg);
|
||||||
|
|
||||||
|
if (vc->vc_agent == NULL)
|
||||||
|
return __ofono_error_failed(msg);
|
||||||
|
|
||||||
|
if (!voicecall_agent_matches(vc->vc_agent, agent_path, agent_bus))
|
||||||
|
return __ofono_error_access_denied(msg);
|
||||||
|
|
||||||
|
if (vc->vc_agent) {
|
||||||
|
voicecall_agent_free(vc->vc_agent);
|
||||||
|
vc->vc_agent = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return dbus_message_new_method_return(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ofono_voicecall_ringback_tone_notify(struct ofono_voicecall *vc,
|
||||||
|
const ofono_bool_t playTone)
|
||||||
|
{
|
||||||
|
if (vc->vc_agent)
|
||||||
|
voicecall_agent_ringback_tone(vc->vc_agent, playTone);
|
||||||
|
}
|
||||||
|
|
||||||
static const GDBusMethodTable manager_methods[] = {
|
static const GDBusMethodTable manager_methods[] = {
|
||||||
{ GDBUS_METHOD("GetProperties",
|
{ GDBUS_METHOD("GetProperties",
|
||||||
NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
|
NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
|
||||||
@@ -2172,6 +2246,12 @@ static const GDBusMethodTable manager_methods[] = {
|
|||||||
{ GDBUS_METHOD("GetCalls",
|
{ GDBUS_METHOD("GetCalls",
|
||||||
NULL, GDBUS_ARGS({ "calls_with_properties", "a(oa{sv})" }),
|
NULL, GDBUS_ARGS({ "calls_with_properties", "a(oa{sv})" }),
|
||||||
manager_get_calls) },
|
manager_get_calls) },
|
||||||
|
{ GDBUS_ASYNC_METHOD("RegisterVoicecallAgent",
|
||||||
|
GDBUS_ARGS({ "path", "o" }), NULL,
|
||||||
|
voicecall_register_agent) },
|
||||||
|
{ GDBUS_ASYNC_METHOD("UnregisterVoicecallAgent",
|
||||||
|
GDBUS_ARGS({ "path", "o" }), NULL,
|
||||||
|
voicecall_unregister_agent) },
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2744,6 +2824,11 @@ static void voicecall_unregister(struct ofono_atom *atom)
|
|||||||
|
|
||||||
voicecall_close_settings(vc);
|
voicecall_close_settings(vc);
|
||||||
|
|
||||||
|
if (vc->vc_agent) {
|
||||||
|
voicecall_agent_free(vc->vc_agent);
|
||||||
|
vc->vc_agent = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (vc->sim_state_watch) {
|
if (vc->sim_state_watch) {
|
||||||
ofono_sim_remove_state_watch(vc->sim, vc->sim_state_watch);
|
ofono_sim_remove_state_watch(vc->sim, vc->sim_state_watch);
|
||||||
vc->sim_state_watch = 0;
|
vc->sim_state_watch = 0;
|
||||||
|
|||||||
131
ofono/src/voicecallagent.c
Normal file
131
ofono/src/voicecallagent.c
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* oFono - Open Source Telephony
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 Jolla Ltd
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
#include <gdbus.h>
|
||||||
|
|
||||||
|
#include "ofono.h"
|
||||||
|
#include "voicecallagent.h"
|
||||||
|
|
||||||
|
#define OFONO_VOICECALL_AGENT_INTERFACE "org.ofono.VoiceCallAgent"
|
||||||
|
|
||||||
|
struct voicecall_agent {
|
||||||
|
char *path; /* Agent Path */
|
||||||
|
char *bus; /* Agent bus */
|
||||||
|
guint disconnect_watch; /* DBus disconnect watch */
|
||||||
|
ofono_destroy_func removed_cb;
|
||||||
|
void *removed_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
void voicecall_agent_ringback_tone(struct voicecall_agent *agent,
|
||||||
|
const ofono_bool_t playTone)
|
||||||
|
{
|
||||||
|
DBusConnection *conn = ofono_dbus_get_connection();
|
||||||
|
DBusMessage *message = dbus_message_new_method_call(
|
||||||
|
agent->bus, agent->path,
|
||||||
|
OFONO_VOICECALL_AGENT_INTERFACE,
|
||||||
|
"RingbackTone");
|
||||||
|
|
||||||
|
if (message == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!dbus_message_append_args(message, DBUS_TYPE_BOOLEAN, &playTone,
|
||||||
|
DBUS_TYPE_INVALID))
|
||||||
|
return;
|
||||||
|
|
||||||
|
dbus_message_set_no_reply(message, TRUE);
|
||||||
|
g_dbus_send_message(conn, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void voicecall_agent_send_release(struct voicecall_agent *agent)
|
||||||
|
{
|
||||||
|
DBusConnection *conn = ofono_dbus_get_connection();
|
||||||
|
DBusMessage *message = dbus_message_new_method_call(
|
||||||
|
agent->bus, agent->path,
|
||||||
|
OFONO_VOICECALL_AGENT_INTERFACE,
|
||||||
|
"Release");
|
||||||
|
|
||||||
|
if (message == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
dbus_message_set_no_reply(message, TRUE);
|
||||||
|
g_dbus_send_message(conn, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void voicecall_agent_set_removed_notify(struct voicecall_agent *agent,
|
||||||
|
ofono_destroy_func destroy,
|
||||||
|
void *user_data)
|
||||||
|
{
|
||||||
|
agent->removed_cb = destroy;
|
||||||
|
agent->removed_data = user_data; /* voicecall atom (not owned) */
|
||||||
|
}
|
||||||
|
|
||||||
|
void voicecall_agent_free(struct voicecall_agent *agent)
|
||||||
|
{
|
||||||
|
DBusConnection *conn = ofono_dbus_get_connection();
|
||||||
|
|
||||||
|
if (agent->disconnect_watch) {
|
||||||
|
voicecall_agent_send_release(agent);
|
||||||
|
g_dbus_remove_watch(conn, agent->disconnect_watch);
|
||||||
|
agent->disconnect_watch = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (agent->removed_cb)
|
||||||
|
agent->removed_cb(agent->removed_data);
|
||||||
|
|
||||||
|
g_free(agent->path);
|
||||||
|
g_free(agent->bus);
|
||||||
|
g_free(agent);
|
||||||
|
}
|
||||||
|
|
||||||
|
ofono_bool_t voicecall_agent_matches(struct voicecall_agent *agent,
|
||||||
|
const char *path, const char *sender)
|
||||||
|
{
|
||||||
|
return g_str_equal(agent->path, path) &&
|
||||||
|
g_str_equal(agent->bus, sender);
|
||||||
|
}
|
||||||
|
|
||||||
|
void voicecall_agent_disconnect_cb(DBusConnection *conn, void *user_data)
|
||||||
|
{
|
||||||
|
struct voicecall_agent *agent = user_data;
|
||||||
|
|
||||||
|
agent->disconnect_watch = 0;
|
||||||
|
voicecall_agent_free(agent);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct voicecall_agent *voicecall_agent_new(const char *path,
|
||||||
|
const char *sender)
|
||||||
|
{
|
||||||
|
struct voicecall_agent *agent = g_try_new0(struct voicecall_agent, 1);
|
||||||
|
DBusConnection *conn = ofono_dbus_get_connection();
|
||||||
|
|
||||||
|
if (agent == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
agent->path = g_strdup(path);
|
||||||
|
agent->bus = g_strdup(sender);
|
||||||
|
|
||||||
|
agent->disconnect_watch = g_dbus_add_disconnect_watch(conn, sender,
|
||||||
|
voicecall_agent_disconnect_cb,
|
||||||
|
agent, NULL);
|
||||||
|
|
||||||
|
return agent;
|
||||||
|
}
|
||||||
40
ofono/src/voicecallagent.h
Normal file
40
ofono/src/voicecallagent.h
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* oFono - Open Source Telephony
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 Jolla Ltd
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct voicecall_agent;
|
||||||
|
|
||||||
|
void voicecall_agent_ringback_tone(struct voicecall_agent *agent,
|
||||||
|
const ofono_bool_t playTone);
|
||||||
|
|
||||||
|
void voicecall_agent_set_removed_notify(struct voicecall_agent *agent,
|
||||||
|
ofono_destroy_func removed_cb,
|
||||||
|
void *user_data);
|
||||||
|
|
||||||
|
void voicecall_agent_free(struct voicecall_agent *agent);
|
||||||
|
|
||||||
|
ofono_bool_t voicecall_agent_matches(struct voicecall_agent *agent,
|
||||||
|
const char *path, const char *sender);
|
||||||
|
|
||||||
|
struct voicecall_agent *voicecall_agent_new(const char *path,
|
||||||
|
const char *sender);
|
||||||
|
|
||||||
|
void voicecall_agent_disconnect_cb(DBusConnection *conn,
|
||||||
|
void *user_data);
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import dbus
|
import dbus
|
||||||
@@ -20,7 +20,7 @@ for path, properties in modems:
|
|||||||
contexts = connman.GetContexts()
|
contexts = connman.GetContexts()
|
||||||
|
|
||||||
if (len(contexts) == 0):
|
if (len(contexts) == 0):
|
||||||
print "No context available"
|
print("No context available")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
connman.SetProperty("Powered", dbus.Boolean(1))
|
connman.SetProperty("Powered", dbus.Boolean(1))
|
||||||
@@ -35,6 +35,6 @@ for path, properties in modems:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
context.SetProperty("Active", dbus.Boolean(1), timeout = 100)
|
context.SetProperty("Active", dbus.Boolean(1), timeout = 100)
|
||||||
except dbus.DBusException, e:
|
except dbus.DBusException as e:
|
||||||
print "Error activating %s: %s" % (path, str(e))
|
print("Error activating %s: %s" % (path, str(e)))
|
||||||
exit(2)
|
exit(2)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
|
|||||||
modems = manager.GetModems()
|
modems = manager.GetModems()
|
||||||
|
|
||||||
for path, properties in modems:
|
for path, properties in modems:
|
||||||
print "[ %s ]" % (path)
|
print("[ %s ]" % (path))
|
||||||
|
|
||||||
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
|
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
|
||||||
continue
|
continue
|
||||||
@@ -22,7 +22,7 @@ for path, properties in modems:
|
|||||||
|
|
||||||
for path, properties in calls:
|
for path, properties in calls:
|
||||||
state = properties["State"]
|
state = properties["State"]
|
||||||
print "[ %s ] %s" % (path, state)
|
print("[ %s ] %s" % (path, state))
|
||||||
|
|
||||||
if state != "incoming":
|
if state != "incoming":
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import gobject
|
from gi.repository import GLib
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import dbus.mainloop.glib
|
import dbus.mainloop.glib
|
||||||
@@ -12,23 +12,23 @@ def answer_call(path):
|
|||||||
'org.ofono.VoiceCall')
|
'org.ofono.VoiceCall')
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
call.Answer()
|
call.Answer()
|
||||||
print " Voice Call [ %s ] Answered" % (path)
|
print(" Voice Call [ %s ] Answered" % (path))
|
||||||
|
|
||||||
def voicecalls_call_added(path, properties):
|
def voicecalls_call_added(path, properties):
|
||||||
print " Voice Call [ %s ] Added" % (path)
|
print(" Voice Call [ %s ] Added" % (path))
|
||||||
|
|
||||||
for key in properties.keys():
|
for key in properties.keys():
|
||||||
val = str(properties[key])
|
val = str(properties[key])
|
||||||
print " %s = %s" % (key, val)
|
print(" %s = %s" % (key, val))
|
||||||
print
|
print()
|
||||||
|
|
||||||
state = properties["State"]
|
state = properties["State"]
|
||||||
if state == "incoming":
|
if state == "incoming":
|
||||||
answer_call(path)
|
answer_call(path)
|
||||||
|
|
||||||
def voicecalls_call_removed(path):
|
def voicecalls_call_removed(path):
|
||||||
print " Voice Call [ %s ] Removed" % (path)
|
print(" Voice Call [ %s ] Removed" % (path))
|
||||||
print
|
print()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
global vcmanager
|
global vcmanager
|
||||||
@@ -43,7 +43,7 @@ if __name__ == "__main__":
|
|||||||
modems = manager.GetModems()
|
modems = manager.GetModems()
|
||||||
modem = modems[0][0]
|
modem = modems[0][0]
|
||||||
|
|
||||||
print "Using modem %s" % modem
|
print("Using modem %s" % modem)
|
||||||
|
|
||||||
vcmanager = dbus.Interface(bus.get_object('org.ofono', modem),
|
vcmanager = dbus.Interface(bus.get_object('org.ofono', modem),
|
||||||
'org.ofono.VoiceCallManager')
|
'org.ofono.VoiceCallManager')
|
||||||
@@ -52,6 +52,6 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
vcmanager.connect_to_signal("CallRemoved", voicecalls_call_removed)
|
vcmanager.connect_to_signal("CallRemoved", voicecalls_call_removed)
|
||||||
|
|
||||||
mainloop = gobject.MainLoop()
|
mainloop = GLib.MainLoop()
|
||||||
mainloop.run()
|
mainloop.run()
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@@ -6,7 +6,7 @@ import sys
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
if (len(sys.argv) < 3):
|
if (len(sys.argv) < 3):
|
||||||
print "Usage: %s [binary] [log]" % (sys.argv[0])
|
print("Usage: %s [binary] [log]" % (sys.argv[0]))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
binary = sys.argv[1]
|
binary = sys.argv[1]
|
||||||
@@ -50,8 +50,8 @@ child_stdout.close()
|
|||||||
frame_count = len(frames);
|
frame_count = len(frames);
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
print "-------- backtrace --------"
|
print("-------- backtrace --------")
|
||||||
while count < frame_count:
|
while count < frame_count:
|
||||||
print "[%d]: %s() [%s]" % (count/2, frames[count], frames[count + 1])
|
print("[%d]: %s() [%s]" % (count/2, frames[count], frames[count + 1]))
|
||||||
count = count + 2
|
count = count + 2
|
||||||
print "---------------------------"
|
print("---------------------------")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import dbus
|
import dbus
|
||||||
@@ -21,7 +21,7 @@ ussd = dbus.Interface(bus.get_object('org.ofono', path),
|
|||||||
properties = ussd.GetProperties()
|
properties = ussd.GetProperties()
|
||||||
state = properties["State"]
|
state = properties["State"]
|
||||||
|
|
||||||
print "State: %s" % (state)
|
print("State: %s" % (state))
|
||||||
|
|
||||||
if state != "idle":
|
if state != "idle":
|
||||||
ussd.Cancel()
|
ussd.Cancel()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import sys
|
import sys
|
||||||
@@ -13,7 +13,7 @@ else:
|
|||||||
modems = manager.GetModems()
|
modems = manager.GetModems()
|
||||||
path = modems[0][0]
|
path = modems[0][0]
|
||||||
|
|
||||||
print "Disconnecting CDMA Packet Data Service on modem %s..." % path
|
print("Disconnecting CDMA Packet Data Service on modem %s..." % path)
|
||||||
cm = dbus.Interface(bus.get_object('org.ofono', path),
|
cm = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.cdma.ConnectionManager')
|
'org.ofono.cdma.ConnectionManager')
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import sys
|
import sys
|
||||||
@@ -13,7 +13,7 @@ else:
|
|||||||
modems = manager.GetModems()
|
modems = manager.GetModems()
|
||||||
path = modems[0][0]
|
path = modems[0][0]
|
||||||
|
|
||||||
print "Connecting CDMA Packet Data Service on modem %s..." % path
|
print("Connecting CDMA Packet Data Service on modem %s..." % path)
|
||||||
cm = dbus.Interface(bus.get_object('org.ofono', path),
|
cm = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.cdma.ConnectionManager')
|
'org.ofono.cdma.ConnectionManager')
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import dbus
|
import dbus
|
||||||
@@ -16,7 +16,7 @@ else:
|
|||||||
path, properties = modems[0]
|
path, properties = modems[0]
|
||||||
number = sys.argv[1]
|
number = sys.argv[1]
|
||||||
|
|
||||||
print "Using modem %s" % path
|
print("Using modem %s" % path)
|
||||||
|
|
||||||
manager = dbus.Interface(bus.get_object('org.ofono', path),
|
manager = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.cdma.VoiceCallManager')
|
'org.ofono.cdma.VoiceCallManager')
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import dbus
|
import dbus
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
|
|||||||
modems = manager.GetModems()
|
modems = manager.GetModems()
|
||||||
|
|
||||||
for path, properties in modems:
|
for path, properties in modems:
|
||||||
print "[ %s ]" % (path)
|
print("[ %s ]" % (path))
|
||||||
|
|
||||||
if "org.ofono.cdma.VoiceCallManager" not in properties["Interfaces"]:
|
if "org.ofono.cdma.VoiceCallManager" not in properties["Interfaces"]:
|
||||||
continue
|
continue
|
||||||
@@ -22,4 +22,4 @@ for path, properties in modems:
|
|||||||
|
|
||||||
for key in properties.keys():
|
for key in properties.keys():
|
||||||
val = str(properties[key])
|
val = str(properties[key])
|
||||||
print " %s = %s" % (key, val)
|
print(" %s = %s" % (key, val))
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import sys
|
import sys
|
||||||
@@ -17,12 +17,12 @@ for path, properties in modems:
|
|||||||
cm = dbus.Interface(bus.get_object('org.ofono', path),
|
cm = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.cdma.ConnectionManager')
|
'org.ofono.cdma.ConnectionManager')
|
||||||
|
|
||||||
print "Connecting CDMA Packet Data Service on modem %s..." % path
|
print("Connecting CDMA Packet Data Service on modem %s..." % path)
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
cm.SetProperty("Username", (sys.argv[1]))
|
cm.SetProperty("Username", (sys.argv[1]))
|
||||||
print "Setting Username to %s" % (sys.argv[1])
|
print("Setting Username to %s" % (sys.argv[1]))
|
||||||
|
|
||||||
if len(sys.argv) > 2:
|
if len(sys.argv) > 2:
|
||||||
cm.SetProperty("Password", (sys.argv[2]))
|
cm.SetProperty("Password", (sys.argv[2]))
|
||||||
print "Setting Password to %s" % (sys.argv[2])
|
print("Setting Password to %s" % (sys.argv[2]))
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import sys
|
import sys
|
||||||
@@ -19,10 +19,10 @@ elif len(sys.argv) == 3:
|
|||||||
old_pin = sys.argv[2]
|
old_pin = sys.argv[2]
|
||||||
new_pin = sys.argv[3]
|
new_pin = sys.argv[3]
|
||||||
else:
|
else:
|
||||||
print "%s [PATH] pin_type old_pin new_pin" % (sys.argv[0])
|
print("%s [PATH] pin_type old_pin new_pin" % (sys.argv[0]))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
print "Change %s for modem %s..." % (pin_type, path)
|
print("Change %s for modem %s..." % (pin_type, path))
|
||||||
|
|
||||||
simmanager = dbus.Interface(bus.get_object('org.ofono', path),
|
simmanager = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.SimManager')
|
'org.ofono.SimManager')
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import dbus
|
import dbus
|
||||||
@@ -27,21 +27,21 @@ for path, properties in modems:
|
|||||||
|
|
||||||
if path == "":
|
if path == "":
|
||||||
path = connman.AddContext("internet")
|
path = connman.AddContext("internet")
|
||||||
print "Created new context %s" % (path)
|
print("Created new context %s" % (path))
|
||||||
else:
|
else:
|
||||||
print "Found context %s" % (path)
|
print("Found context %s" % (path))
|
||||||
|
|
||||||
context = dbus.Interface(bus.get_object('org.ofono', path),
|
context = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.ConnectionContext')
|
'org.ofono.ConnectionContext')
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
context.SetProperty("AccessPointName", sys.argv[1])
|
context.SetProperty("AccessPointName", sys.argv[1])
|
||||||
print "Setting APN to %s" % (sys.argv[1])
|
print("Setting APN to %s" % (sys.argv[1]))
|
||||||
|
|
||||||
if len(sys.argv) > 2:
|
if len(sys.argv) > 2:
|
||||||
context.SetProperty("Username", sys.argv[2])
|
context.SetProperty("Username", sys.argv[2])
|
||||||
print "Setting username to %s" % (sys.argv[2])
|
print("Setting username to %s" % (sys.argv[2]))
|
||||||
|
|
||||||
if len(sys.argv) > 3:
|
if len(sys.argv) > 3:
|
||||||
context.SetProperty("Password", sys.argv[3])
|
context.SetProperty("Password", sys.argv[3])
|
||||||
print "Setting password to %s" % (sys.argv[3])
|
print("Setting password to %s" % (sys.argv[3]))
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import dbus
|
import dbus
|
||||||
@@ -27,21 +27,21 @@ for path, properties in modems:
|
|||||||
|
|
||||||
if path == "":
|
if path == "":
|
||||||
path = connman.AddContext("mms")
|
path = connman.AddContext("mms")
|
||||||
print "Created new context %s" % (path)
|
print("Created new context %s" % (path))
|
||||||
else:
|
else:
|
||||||
print "Found context %s" % (path)
|
print("Found context %s" % (path))
|
||||||
|
|
||||||
context = dbus.Interface(bus.get_object('org.ofono', path),
|
context = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.ConnectionContext')
|
'org.ofono.ConnectionContext')
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
context.SetProperty("AccessPointName", sys.argv[1])
|
context.SetProperty("AccessPointName", sys.argv[1])
|
||||||
print "Setting APN to %s" % (sys.argv[1])
|
print("Setting APN to %s" % (sys.argv[1]))
|
||||||
|
|
||||||
if len(sys.argv) > 2:
|
if len(sys.argv) > 2:
|
||||||
context.SetProperty("Username", sys.argv[2])
|
context.SetProperty("Username", sys.argv[2])
|
||||||
print "Setting username to %s" % (sys.argv[2])
|
print("Setting username to %s" % (sys.argv[2]))
|
||||||
|
|
||||||
if len(sys.argv) > 3:
|
if len(sys.argv) > 3:
|
||||||
context.SetProperty("Password", sys.argv[3])
|
context.SetProperty("Password", sys.argv[3])
|
||||||
print "Setting password to %s" % (sys.argv[3])
|
print("Setting password to %s" % (sys.argv[3]))
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import dbus
|
import dbus
|
||||||
@@ -21,4 +21,4 @@ manager = dbus.Interface(bus.get_object('org.ofono', path),
|
|||||||
mpty = manager.CreateMultiparty()
|
mpty = manager.CreateMultiparty()
|
||||||
|
|
||||||
for path in mpty:
|
for path in mpty:
|
||||||
print path
|
print(path)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import dbus
|
import dbus
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import dbus
|
import dbus
|
||||||
@@ -20,7 +20,7 @@ for path, properties in modems:
|
|||||||
contexts = connman.GetContexts()
|
contexts = connman.GetContexts()
|
||||||
|
|
||||||
if (len(contexts) == 0):
|
if (len(contexts) == 0):
|
||||||
print "No context available"
|
print("No context available")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
@@ -33,6 +33,6 @@ for path, properties in modems:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
context.SetProperty("Active", dbus.Boolean(0))
|
context.SetProperty("Active", dbus.Boolean(0))
|
||||||
except dbus.DBusException, e:
|
except dbus.DBusException as e:
|
||||||
print "Error activating %s: %s" % (path, str(e))
|
print("Error activating %s: %s" % (path, str(e)))
|
||||||
exit(2)
|
exit(2)
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import dbus
|
import dbus
|
||||||
|
|
||||||
if (len(sys.argv) < 2):
|
if (len(sys.argv) < 2):
|
||||||
print "Usage: %s [modem] <number> [hide_callerid]" % (sys.argv[0])
|
print("Usage: %s [modem] <number> [hide_callerid]" % (sys.argv[0]))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
bus = dbus.SystemBus()
|
bus = dbus.SystemBus()
|
||||||
@@ -32,11 +32,11 @@ else:
|
|||||||
number = sys.argv[2]
|
number = sys.argv[2]
|
||||||
hide_callerid = sys.argv[3]
|
hide_callerid = sys.argv[3]
|
||||||
|
|
||||||
print "Using modem %s" % modem
|
print("Using modem %s" % modem)
|
||||||
|
|
||||||
vcm = dbus.Interface(bus.get_object('org.ofono', modem),
|
vcm = dbus.Interface(bus.get_object('org.ofono', modem),
|
||||||
'org.ofono.VoiceCallManager')
|
'org.ofono.VoiceCallManager')
|
||||||
|
|
||||||
path = vcm.Dial(number, hide_callerid)
|
path = vcm.Dial(number, hide_callerid)
|
||||||
|
|
||||||
print path
|
print(path)
|
||||||
|
|||||||
@@ -1,24 +1,24 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import gobject
|
from gi.repository import GLib
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import dbus.mainloop.glib
|
import dbus.mainloop.glib
|
||||||
|
|
||||||
def property_changed(property, value):
|
def property_changed(property, value):
|
||||||
if len(value.__str__()) > 0:
|
if len(value.__str__()) > 0:
|
||||||
print "CF property %s changed to %s" % (property, value)
|
print("CF property %s changed to %s" % (property, value))
|
||||||
else:
|
else:
|
||||||
print "CF property %s changed to disabled" % (property)
|
print("CF property %s changed to disabled" % (property))
|
||||||
|
|
||||||
if canexit:
|
if canexit:
|
||||||
mainloop.quit();
|
mainloop.quit();
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print "Usage: %s <type>" % (sys.argv[0])
|
print("Usage: %s <type>" % (sys.argv[0]))
|
||||||
print "Type can be: all, conditional"
|
print("Type can be: all, conditional")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
canexit = False
|
canexit = False
|
||||||
@@ -41,13 +41,13 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
cf.DisableAll(type, timeout = 100)
|
cf.DisableAll(type, timeout = 100)
|
||||||
except dbus.DBusException, e:
|
except dbus.DBusException as e:
|
||||||
print "Unable to DisableAll", e
|
print("Unable to DisableAll %s" % e)
|
||||||
sys.exit(1);
|
sys.exit(1);
|
||||||
|
|
||||||
print "DisableAll successful"
|
print("DisableAll successful")
|
||||||
|
|
||||||
canexit = True
|
canexit = True
|
||||||
|
|
||||||
mainloop = gobject.MainLoop()
|
mainloop = GLib.MainLoop()
|
||||||
mainloop.run()
|
mainloop.run()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import sys
|
import sys
|
||||||
@@ -13,7 +13,7 @@ else:
|
|||||||
modems = manager.GetModems()
|
modems = manager.GetModems()
|
||||||
path = modems[0][0]
|
path = modems[0][0]
|
||||||
|
|
||||||
print "Disconnecting GPRS on modem %s..." % path
|
print("Disconnecting GPRS on modem %s..." % path)
|
||||||
cm = dbus.Interface(bus.get_object('org.ofono', path),
|
cm = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.ConnectionManager')
|
'org.ofono.ConnectionManager')
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import sys
|
import sys
|
||||||
@@ -13,7 +13,7 @@ else:
|
|||||||
modems = manager.GetModems()
|
modems = manager.GetModems()
|
||||||
path = modems[0][0]
|
path = modems[0][0]
|
||||||
|
|
||||||
print "Disconnecting modem %s..." % path
|
print("Disconnecting modem %s..." % path)
|
||||||
modem = dbus.Interface(bus.get_object('org.ofono', path),
|
modem = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.Modem')
|
'org.ofono.Modem')
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import dbus
|
import dbus
|
||||||
|
|
||||||
if (len(sys.argv) < 2):
|
if (len(sys.argv) < 2):
|
||||||
print "Usage: %s [modem] icon_id" % (sys.argv[0])
|
print("Usage: %s [modem] icon_id" % (sys.argv[0]))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
bus = dbus.SystemBus()
|
bus = dbus.SystemBus()
|
||||||
@@ -21,7 +21,7 @@ elif (len(sys.argv) == 3):
|
|||||||
modem = sys.argv[1]
|
modem = sys.argv[1]
|
||||||
icon = sys.argv[2]
|
icon = sys.argv[2]
|
||||||
|
|
||||||
print "Using modem %s" % modem
|
print("Using modem %s" % modem)
|
||||||
|
|
||||||
sim = dbus.Interface(bus.get_object('org.ofono', modem),
|
sim = dbus.Interface(bus.get_object('org.ofono', modem),
|
||||||
'org.ofono.SimManager')
|
'org.ofono.SimManager')
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import sys
|
import sys
|
||||||
@@ -13,7 +13,7 @@ else:
|
|||||||
devices = manager.GetDevices()
|
devices = manager.GetDevices()
|
||||||
path = devices[0][0]
|
path = devices[0][0]
|
||||||
|
|
||||||
print "Connect device %s..." % path
|
print("Connect device %s..." % path)
|
||||||
device = dbus.Interface(bus.get_object('org.ofono.dundee', path),
|
device = dbus.Interface(bus.get_object('org.ofono.dundee', path),
|
||||||
'org.ofono.dundee.Device')
|
'org.ofono.dundee.Device')
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import sys
|
import sys
|
||||||
@@ -13,7 +13,7 @@ else:
|
|||||||
devices = manager.GetDevices()
|
devices = manager.GetDevices()
|
||||||
path = devices[0][0]
|
path = devices[0][0]
|
||||||
|
|
||||||
print "Disconnect device %s..." % path
|
print("Disconnect device %s..." % path)
|
||||||
device = dbus.Interface(bus.get_object('org.ofono.dundee', path),
|
device = dbus.Interface(bus.get_object('org.ofono.dundee', path),
|
||||||
'org.ofono.dundee.Device')
|
'org.ofono.dundee.Device')
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import sys
|
import sys
|
||||||
@@ -13,7 +13,7 @@ else:
|
|||||||
modems = manager.GetModems()
|
modems = manager.GetModems()
|
||||||
path = modems[0][0]
|
path = modems[0][0]
|
||||||
|
|
||||||
print "Enabling cell broadcast on modem %s..." % path
|
print("Enabling cell broadcast on modem %s..." % path)
|
||||||
cbs = dbus.Interface(bus.get_object('org.ofono', path),
|
cbs = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.CellBroadcast')
|
'org.ofono.CellBroadcast')
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import sys
|
import sys
|
||||||
@@ -13,7 +13,7 @@ else:
|
|||||||
modems = manager.GetModems()
|
modems = manager.GetModems()
|
||||||
path = modems[0][0]
|
path = modems[0][0]
|
||||||
|
|
||||||
print "Connecting modem %s..." % path
|
print("Connecting modem %s..." % path)
|
||||||
cm = dbus.Interface(bus.get_object('org.ofono', path),
|
cm = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.ConnectionManager')
|
'org.ofono.ConnectionManager')
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import sys
|
import sys
|
||||||
@@ -13,7 +13,7 @@ else:
|
|||||||
modems = manager.GetModems()
|
modems = manager.GetModems()
|
||||||
path = modems[0][0]
|
path = modems[0][0]
|
||||||
|
|
||||||
print "Connecting modem %s..." % path
|
print("Connecting modem %s..." % path)
|
||||||
modem = dbus.Interface(bus.get_object('org.ofono', path),
|
modem = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.Modem')
|
'org.ofono.Modem')
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import sys
|
import sys
|
||||||
@@ -17,10 +17,10 @@ elif len(sys.argv) == 3:
|
|||||||
pin_type = sys.argv[1]
|
pin_type = sys.argv[1]
|
||||||
pin = sys.argv[2]
|
pin = sys.argv[2]
|
||||||
else:
|
else:
|
||||||
print "%s [PATH] pin_type pin" % (sys.argv[0])
|
print("%s [PATH] pin_type pin" % (sys.argv[0]))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
print "Enter Pin for modem %s..." % path
|
print("Enter Pin for modem %s..." % path)
|
||||||
simmanager = dbus.Interface(bus.get_object('org.ofono', path),
|
simmanager = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.SimManager')
|
'org.ofono.SimManager')
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import sys
|
import sys
|
||||||
@@ -8,7 +8,7 @@ bus = dbus.SystemBus()
|
|||||||
if len(sys.argv) == 2:
|
if len(sys.argv) == 2:
|
||||||
id = sys.argv[1]
|
id = sys.argv[1]
|
||||||
else:
|
else:
|
||||||
print "%s <icon id>" % (sys.argv[0])
|
print("%s <icon id>" % (sys.argv[0]))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
manager = dbus.Interface(bus.get_object("org.ofono", "/"),
|
manager = dbus.Interface(bus.get_object("org.ofono", "/"),
|
||||||
@@ -28,4 +28,4 @@ icon = sim.GetIcon(dbus.Byte(int(sys.argv[1])))
|
|||||||
xpm = ""
|
xpm = ""
|
||||||
for byte in icon:
|
for byte in icon:
|
||||||
xpm += str(byte)
|
xpm += str(byte)
|
||||||
print xpm
|
print(xpm)
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import sys
|
import sys
|
||||||
_dbus2py = {
|
_dbus2py = {
|
||||||
dbus.String : unicode,
|
dbus.String : str,
|
||||||
dbus.UInt32 : int,
|
dbus.UInt32 : int,
|
||||||
dbus.Int32 : int,
|
dbus.Int32 : int,
|
||||||
dbus.Int16 : int,
|
dbus.Int16 : int,
|
||||||
@@ -66,4 +66,4 @@ net_time = dbus.Interface(bus.get_object('org.ofono', path),
|
|||||||
|
|
||||||
time = net_time.GetNetworkTime()
|
time = net_time.GetNetworkTime()
|
||||||
|
|
||||||
print pretty(time)
|
print(pretty(time))
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import sys
|
import sys
|
||||||
@@ -22,7 +22,7 @@ for entry in operators:
|
|||||||
path = entry[0]
|
path = entry[0]
|
||||||
properties = entry[1]
|
properties = entry[1]
|
||||||
|
|
||||||
print "[ %s ]" % (path)
|
print("[ %s ]" % (path))
|
||||||
|
|
||||||
for key in properties.keys():
|
for key in properties.keys():
|
||||||
if key in ["Technologies"]:
|
if key in ["Technologies"]:
|
||||||
@@ -31,7 +31,7 @@ for entry in operators:
|
|||||||
val += i + " "
|
val += i + " "
|
||||||
else:
|
else:
|
||||||
val = str(properties[key])
|
val = str(properties[key])
|
||||||
print " %s = %s" % (key, val)
|
print(" %s = %s" % (key, val))
|
||||||
|
|
||||||
print
|
print('')
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus, sys
|
import dbus, sys
|
||||||
|
|
||||||
@@ -17,4 +17,4 @@ radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
|
|||||||
|
|
||||||
properties = radiosettings.GetProperties()
|
properties = radiosettings.GetProperties()
|
||||||
|
|
||||||
print "Technology preference: %s" % (properties["TechnologyPreference"])
|
print("Technology preference: %s" % (properties["TechnologyPreference"]))
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import dbus
|
import dbus
|
||||||
@@ -18,7 +18,7 @@ calls = manager.GetCalls()
|
|||||||
|
|
||||||
for path, properties in calls:
|
for path, properties in calls:
|
||||||
state = properties["State"]
|
state = properties["State"]
|
||||||
print "[ %s ] %s" % (path, state)
|
print("[ %s ] %s" % (path, state))
|
||||||
|
|
||||||
if state != "active":
|
if state != "active":
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import dbus
|
import dbus
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import dbus
|
import dbus
|
||||||
@@ -6,7 +6,7 @@ import dbus
|
|||||||
bus = dbus.SystemBus()
|
bus = dbus.SystemBus()
|
||||||
|
|
||||||
if (len(sys.argv) < 2):
|
if (len(sys.argv) < 2):
|
||||||
print "Usage: %s [ Call Path ]" % (sys.argv[0])
|
print("Usage: %s [ Call Path ]" % (sys.argv[0]))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
call = dbus.Interface(bus.get_object('org.ofono', sys.argv[1]),
|
call = dbus.Interface(bus.get_object('org.ofono', sys.argv[1]),
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import dbus
|
import dbus
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import dbus
|
import dbus
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import dbus
|
import dbus
|
||||||
|
|
||||||
if (len(sys.argv) < 2):
|
if (len(sys.argv) < 2):
|
||||||
print "Usage: %s [modem] <ussd-string>" % (sys.argv[0])
|
print("Usage: %s [modem] <ussd-string>" % (sys.argv[0]))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
bus = dbus.SystemBus()
|
bus = dbus.SystemBus()
|
||||||
@@ -27,7 +27,7 @@ ussd = dbus.Interface(bus.get_object('org.ofono', path),
|
|||||||
properties = ussd.GetProperties()
|
properties = ussd.GetProperties()
|
||||||
state = properties["State"]
|
state = properties["State"]
|
||||||
|
|
||||||
print "State: %s" % (state)
|
print("State: %s" % (state))
|
||||||
|
|
||||||
if state != "idle":
|
if state != "idle":
|
||||||
sys.exit(1);
|
sys.exit(1);
|
||||||
@@ -37,22 +37,22 @@ result = ussd.Initiate(ussdstring, timeout=100)
|
|||||||
properties = ussd.GetProperties()
|
properties = ussd.GetProperties()
|
||||||
state = properties["State"]
|
state = properties["State"]
|
||||||
|
|
||||||
print result[0] + ": " + result[1]
|
print(result[0] + ": " + result[1])
|
||||||
|
|
||||||
if state == "idle":
|
if state == "idle":
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
print "State: %s" % (state)
|
print("State: %s" % (state))
|
||||||
|
|
||||||
while state == "user-response":
|
while state == "user-response":
|
||||||
response = raw_input("Enter response: ")
|
response = input("Enter response: ")
|
||||||
|
|
||||||
result = ussd.Respond(response, timeout=100)
|
result = ussd.Respond(response, timeout=100)
|
||||||
|
|
||||||
properties = ussd.GetProperties()
|
properties = ussd.GetProperties()
|
||||||
state = properties["State"]
|
state = properties["State"]
|
||||||
|
|
||||||
print result
|
print(result)
|
||||||
|
|
||||||
if state != "idle":
|
if state != "idle":
|
||||||
print "State: %s" % (state)
|
print("State: %s" % (state))
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
|
|||||||
modems = manager.GetModems()
|
modems = manager.GetModems()
|
||||||
|
|
||||||
for path, properties in modems:
|
for path, properties in modems:
|
||||||
print "[ %s ]" % (path)
|
print("[ %s ]" % (path))
|
||||||
|
|
||||||
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
|
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
|
||||||
continue
|
continue
|
||||||
@@ -21,11 +21,11 @@ for path, properties in modems:
|
|||||||
calls = mgr.GetCalls()
|
calls = mgr.GetCalls()
|
||||||
|
|
||||||
for path, properties in calls:
|
for path, properties in calls:
|
||||||
print " [ %s ]" % (path)
|
print(" [ %s ]" % (path))
|
||||||
|
|
||||||
for key in properties.keys():
|
for key in properties.keys():
|
||||||
if key == 'Icon':
|
if key == 'Icon':
|
||||||
print " %s = %d" % (key, properties[key])
|
print(" %s = %d" % (key, properties[key]))
|
||||||
else:
|
else:
|
||||||
val = str(properties[key])
|
val = str(properties[key])
|
||||||
print " %s = %s" % (key, val)
|
print(" %s = %s" % (key, val))
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
|
|||||||
modems = manager.GetModems()
|
modems = manager.GetModems()
|
||||||
|
|
||||||
for path, properties in modems:
|
for path, properties in modems:
|
||||||
print "[ %s ]" % (path)
|
print("[ %s ]" % (path))
|
||||||
|
|
||||||
if "org.ofono.ConnectionManager" not in properties["Interfaces"]:
|
if "org.ofono.ConnectionManager" not in properties["Interfaces"]:
|
||||||
continue
|
continue
|
||||||
@@ -21,7 +21,7 @@ for path, properties in modems:
|
|||||||
contexts = connman.GetContexts()
|
contexts = connman.GetContexts()
|
||||||
|
|
||||||
for path, properties in contexts:
|
for path, properties in contexts:
|
||||||
print " [ %s ]" % (path)
|
print(" [ %s ]" % (path))
|
||||||
|
|
||||||
for key in properties.keys():
|
for key in properties.keys():
|
||||||
if key in ["Settings"] or key in ["IPv6.Settings"]:
|
if key in ["Settings"] or key in ["IPv6.Settings"]:
|
||||||
@@ -39,6 +39,6 @@ for path, properties in modems:
|
|||||||
val += " }"
|
val += " }"
|
||||||
else:
|
else:
|
||||||
val = str(properties[key])
|
val = str(properties[key])
|
||||||
print " %s = %s" % (key, val)
|
print(" %s = %s" % (key, val))
|
||||||
|
|
||||||
print
|
print('')
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
|
|||||||
modems = manager.GetModems()
|
modems = manager.GetModems()
|
||||||
|
|
||||||
for path, properties in modems:
|
for path, properties in modems:
|
||||||
print "[ %s ]" % (path)
|
print("[ %s ]" % (path))
|
||||||
|
|
||||||
if "org.ofono.MessageManager" not in properties["Interfaces"]:
|
if "org.ofono.MessageManager" not in properties["Interfaces"]:
|
||||||
continue
|
continue
|
||||||
@@ -21,10 +21,10 @@ for path, properties in modems:
|
|||||||
contexts = connman.GetMessages()
|
contexts = connman.GetMessages()
|
||||||
|
|
||||||
for path, properties in contexts:
|
for path, properties in contexts:
|
||||||
print " [ %s ]" % (path)
|
print(" [ %s ]" % (path))
|
||||||
|
|
||||||
for key in properties.keys():
|
for key in properties.keys():
|
||||||
val = str(properties[key])
|
val = str(properties[key])
|
||||||
print " %s = %s" % (key, val)
|
print(" %s = %s" % (key, val))
|
||||||
|
|
||||||
print
|
print('')
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
|
|||||||
modems = manager.GetModems()
|
modems = manager.GetModems()
|
||||||
|
|
||||||
for path, properties in modems:
|
for path, properties in modems:
|
||||||
print "[ %s ]" % (path)
|
print("[ %s ]" % (path))
|
||||||
|
|
||||||
for key in properties.keys():
|
for key in properties.keys():
|
||||||
if key in ["Interfaces", "Features"]:
|
if key in ["Interfaces", "Features"]:
|
||||||
@@ -19,13 +19,13 @@ for path, properties in modems:
|
|||||||
val += i + " "
|
val += i + " "
|
||||||
else:
|
else:
|
||||||
val = properties[key]
|
val = properties[key]
|
||||||
print " %s = %s" % (key, val)
|
print(" %s = %s" % (key, val))
|
||||||
|
|
||||||
for interface in properties["Interfaces"]:
|
for interface in properties["Interfaces"]:
|
||||||
object = dbus.Interface(bus.get_object('org.ofono', path),
|
object = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
interface)
|
interface)
|
||||||
|
|
||||||
print " [ %s ]" % (interface)
|
print(" [ %s ]" % (interface))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
properties = object.GetProperties()
|
properties = object.GetProperties()
|
||||||
@@ -77,6 +77,6 @@ for path, properties in modems:
|
|||||||
val += " }"
|
val += " }"
|
||||||
else:
|
else:
|
||||||
val = properties[key]
|
val = properties[key]
|
||||||
print " %s = %s" % (key, val)
|
print(" %s = %s" % (key, val))
|
||||||
|
|
||||||
print
|
print('')
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import sys
|
import sys
|
||||||
@@ -11,7 +11,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
|
|||||||
modems = manager.GetModems()
|
modems = manager.GetModems()
|
||||||
|
|
||||||
for path, properties in modems:
|
for path, properties in modems:
|
||||||
print "[ %s ]" % (path)
|
print("[ %s ]" % (path))
|
||||||
|
|
||||||
if "org.ofono.NetworkRegistration" not in properties["Interfaces"]:
|
if "org.ofono.NetworkRegistration" not in properties["Interfaces"]:
|
||||||
continue
|
continue
|
||||||
@@ -25,7 +25,7 @@ for path, properties in modems:
|
|||||||
operators = netreg.GetOperators()
|
operators = netreg.GetOperators()
|
||||||
|
|
||||||
for path, properties in operators:
|
for path, properties in operators:
|
||||||
print " [ %s ]" % (path)
|
print(" [ %s ]" % (path))
|
||||||
|
|
||||||
for key in properties.keys():
|
for key in properties.keys():
|
||||||
if key in ["Technologies"]:
|
if key in ["Technologies"]:
|
||||||
@@ -34,6 +34,6 @@ for path, properties in modems:
|
|||||||
val += i + " "
|
val += i + " "
|
||||||
else:
|
else:
|
||||||
val = str(properties[key])
|
val = str(properties[key])
|
||||||
print " %s = %s" % (key, val)
|
print(" %s = %s" % (key, val))
|
||||||
|
|
||||||
print
|
print('')
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import sys
|
import sys
|
||||||
@@ -17,10 +17,10 @@ elif len(sys.argv) == 3:
|
|||||||
pin_type = sys.argv[1]
|
pin_type = sys.argv[1]
|
||||||
pin = sys.argv[2]
|
pin = sys.argv[2]
|
||||||
else:
|
else:
|
||||||
print "%s [PATH] pin_type pin" % (sys.argv[0])
|
print("%s [PATH] pin_type pin" % (sys.argv[0]))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
print "Lock %s %s for modem %s..." % (pin_type, pin, path)
|
print("Lock %s %s for modem %s..." % (pin_type, pin, path))
|
||||||
|
|
||||||
simmanager = dbus.Interface(bus.get_object('org.ofono', path),
|
simmanager = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.SimManager')
|
'org.ofono.SimManager')
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import sys
|
import sys
|
||||||
@@ -13,13 +13,13 @@ else:
|
|||||||
modems = manager.GetModems()
|
modems = manager.GetModems()
|
||||||
path = modems[0][0]
|
path = modems[0][0]
|
||||||
|
|
||||||
print "Locking and disconnecting modem %s..." % path
|
print("Locking and disconnecting modem %s..." % path)
|
||||||
modem = dbus.Interface(bus.get_object('org.ofono', path),
|
modem = dbus.Interface(bus.get_object('org.ofono', path),
|
||||||
'org.ofono.Modem')
|
'org.ofono.Modem')
|
||||||
|
|
||||||
modem.SetProperty("Lockdown", dbus.Boolean(1))
|
modem.SetProperty("Lockdown", dbus.Boolean(1))
|
||||||
|
|
||||||
print "press ENTER to unlock the modem %s" % path
|
print("press ENTER to unlock the modem %s" % path)
|
||||||
sys.stdin.readline()
|
sys.stdin.readline()
|
||||||
|
|
||||||
modem.SetProperty("Lockdown", dbus.Boolean(0))
|
modem.SetProperty("Lockdown", dbus.Boolean(0))
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import gobject
|
from gi.repository import GLib
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import dbus.mainloop.glib
|
import dbus.mainloop.glib
|
||||||
|
|
||||||
_dbus2py = {
|
_dbus2py = {
|
||||||
dbus.String : unicode,
|
dbus.String : str,
|
||||||
dbus.UInt32 : int,
|
dbus.UInt32 : int,
|
||||||
dbus.Int32 : int,
|
dbus.Int32 : int,
|
||||||
dbus.Int16 : int,
|
dbus.Int16 : int,
|
||||||
@@ -52,32 +52,32 @@ def pretty(d):
|
|||||||
|
|
||||||
def property_changed(name, value, path, interface):
|
def property_changed(name, value, path, interface):
|
||||||
iface = interface[interface.rfind(".") + 1:]
|
iface = interface[interface.rfind(".") + 1:]
|
||||||
print "{%s} [%s] %s = %s" % (iface, path, name, pretty(value))
|
print("{%s} [%s] %s = %s" % (iface, path, name, pretty(value)))
|
||||||
|
|
||||||
def added(name, value, member, path, interface):
|
def added(name, value, member, path, interface):
|
||||||
iface = interface[interface.rfind(".") + 1:]
|
iface = interface[interface.rfind(".") + 1:]
|
||||||
print "{%s} [%s] %s %s" % (iface, member, name, pretty(value))
|
print("{%s} [%s] %s %s" % (iface, member, name, pretty(value)))
|
||||||
|
|
||||||
def removed(name, member, path, interface):
|
def removed(name, member, path, interface):
|
||||||
iface = interface[interface.rfind(".") + 1:]
|
iface = interface[interface.rfind(".") + 1:]
|
||||||
print "{%s} [%s] %s" % (iface, member, name)
|
print("{%s} [%s] %s" % (iface, member, name))
|
||||||
|
|
||||||
def event(member, path, interface):
|
def event(member, path, interface):
|
||||||
iface = interface[interface.rfind(".") + 1:]
|
iface = interface[interface.rfind(".") + 1:]
|
||||||
print "{%s} [%s] %s" % (iface, path, member)
|
print("{%s} [%s] %s" % (iface, path, member))
|
||||||
|
|
||||||
def message(msg, args, member, path, interface):
|
def message(msg, args, member, path, interface):
|
||||||
iface = interface[interface.rfind(".") + 1:]
|
iface = interface[interface.rfind(".") + 1:]
|
||||||
print "{%s} [%s] %s %s (%s)" % (iface, path, member,
|
print("{%s} [%s] %s %s (%s)" % (iface, path, member,
|
||||||
str(msg), pretty(args))
|
str(msg), pretty(args)))
|
||||||
|
|
||||||
def ussd(msg, member, path, interface):
|
def ussd(msg, member, path, interface):
|
||||||
iface = interface[interface.rfind(".") + 1:]
|
iface = interface[interface.rfind(".") + 1:]
|
||||||
print "{%s} [%s] %s %s" % (iface, path, member, str(msg))
|
print("{%s} [%s] %s %s" % (iface, path, member, str(msg)))
|
||||||
|
|
||||||
def value(value, member, path, interface):
|
def value(value, member, path, interface):
|
||||||
iface = interface[interface.rfind(".") + 1:]
|
iface = interface[interface.rfind(".") + 1:]
|
||||||
print "{%s} [%s] %s %s" % (iface, path, member, str(value))
|
print("{%s} [%s] %s %s" % (iface, path, member, str(value)))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
||||||
@@ -105,5 +105,5 @@ if __name__ == '__main__':
|
|||||||
interface_keyword="interface")
|
interface_keyword="interface")
|
||||||
|
|
||||||
|
|
||||||
mainloop = gobject.MainLoop()
|
mainloop = GLib.MainLoop()
|
||||||
mainloop.run()
|
mainloop.run()
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import gobject
|
from gi.repository import GLib
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import dbus.mainloop.glib
|
import dbus.mainloop.glib
|
||||||
|
|
||||||
_dbus2py = {
|
_dbus2py = {
|
||||||
dbus.String : unicode,
|
dbus.String : str,
|
||||||
dbus.UInt32 : int,
|
dbus.UInt32 : int,
|
||||||
dbus.Int32 : int,
|
dbus.Int32 : int,
|
||||||
dbus.Int16 : int,
|
dbus.Int16 : int,
|
||||||
@@ -55,32 +55,32 @@ def pretty(d):
|
|||||||
|
|
||||||
def property_changed(name, value, path, interface):
|
def property_changed(name, value, path, interface):
|
||||||
iface = interface[interface.rfind(".") + 1:]
|
iface = interface[interface.rfind(".") + 1:]
|
||||||
print "{%s} [%s] %s = %s" % (iface, path, name, pretty(value))
|
print("{%s} [%s] %s = %s" % (iface, path, name, pretty(value)))
|
||||||
|
|
||||||
def added(name, value, member, path, interface):
|
def added(name, value, member, path, interface):
|
||||||
iface = interface[interface.rfind(".") + 1:]
|
iface = interface[interface.rfind(".") + 1:]
|
||||||
print "{%s} [%s] %s %s" % (iface, member, name, pretty(value))
|
print("{%s} [%s] %s %s" % (iface, member, name, pretty(value)))
|
||||||
|
|
||||||
def removed(name, member, path, interface):
|
def removed(name, member, path, interface):
|
||||||
iface = interface[interface.rfind(".") + 1:]
|
iface = interface[interface.rfind(".") + 1:]
|
||||||
print "{%s} [%s] %s" % (iface, name, member)
|
print("{%s} [%s] %s" % (iface, name, member))
|
||||||
|
|
||||||
def event(member, path, interface):
|
def event(member, path, interface):
|
||||||
iface = interface[interface.rfind(".") + 1:]
|
iface = interface[interface.rfind(".") + 1:]
|
||||||
print "{%s} [%s] %s" % (iface, path, member)
|
print("{%s} [%s] %s" % (iface, path, member))
|
||||||
|
|
||||||
def message(msg, args, member, path, interface):
|
def message(msg, args, member, path, interface):
|
||||||
iface = interface[interface.rfind(".") + 1:]
|
iface = interface[interface.rfind(".") + 1:]
|
||||||
print "{%s} [%s] %s %s (%s)" % (iface, path, member,
|
print("{%s} [%s] %s %s (%s)" % (iface, path, member,
|
||||||
msg, pretty(args))
|
msg, pretty(args)))
|
||||||
|
|
||||||
def ussd(msg, member, path, interface):
|
def ussd(msg, member, path, interface):
|
||||||
iface = interface[interface.rfind(".") + 1:]
|
iface = interface[interface.rfind(".") + 1:]
|
||||||
print "{%s} [%s] %s %s" % (iface, path, member, msg)
|
print("{%s} [%s] %s %s" % (iface, path, member, msg))
|
||||||
|
|
||||||
def value(value, member, path, interface):
|
def value(value, member, path, interface):
|
||||||
iface = interface[interface.rfind(".") + 1:]
|
iface = interface[interface.rfind(".") + 1:]
|
||||||
print "{%s} [%s] %s %s" % (iface, path, member, str(value))
|
print("{%s} [%s] %s %s" % (iface, path, member, str(value)))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
|
||||||
@@ -150,5 +150,5 @@ if __name__ == '__main__':
|
|||||||
path_keyword="path",
|
path_keyword="path",
|
||||||
interface_keyword="interface")
|
interface_keyword="interface")
|
||||||
|
|
||||||
mainloop = gobject.MainLoop()
|
mainloop = GLib.MainLoop()
|
||||||
mainloop.run()
|
mainloop.run()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus, sys
|
import dbus, sys
|
||||||
|
|
||||||
@@ -12,6 +12,6 @@ else:
|
|||||||
modems = manager.GetModems()
|
modems = manager.GetModems()
|
||||||
path = modems[0][0]
|
path = modems[0][0]
|
||||||
|
|
||||||
print "Setting modem %s offline..." % path
|
print("Setting modem %s offline..." % path)
|
||||||
modem = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.Modem')
|
modem = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.Modem')
|
||||||
modem.SetProperty("Online", dbus.Boolean(0), timeout = 120)
|
modem.SetProperty("Online", dbus.Boolean(0), timeout = 120)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import dbus, sys
|
import dbus, sys
|
||||||
|
|
||||||
@@ -12,6 +12,6 @@ else:
|
|||||||
modems = manager.GetModems()
|
modems = manager.GetModems()
|
||||||
path = modems[0][0]
|
path = modems[0][0]
|
||||||
|
|
||||||
print "Setting modem %s online..." % path
|
print("Setting modem %s online..." % path)
|
||||||
modem = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.Modem')
|
modem = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.Modem')
|
||||||
modem.SetProperty("Online", dbus.Boolean(1), timeout = 120)
|
modem.SetProperty("Online", dbus.Boolean(1), timeout = 120)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import dbus
|
import dbus
|
||||||
@@ -23,4 +23,4 @@ manager = dbus.Interface(bus.get_object('org.ofono', path),
|
|||||||
mpty = manager.PrivateChat(callid, timeout=100)
|
mpty = manager.PrivateChat(callid, timeout=100)
|
||||||
|
|
||||||
for path in mpty:
|
for path in mpty:
|
||||||
print path
|
print(path)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import dbus
|
import dbus
|
||||||
@@ -23,7 +23,7 @@ for path, properties in modems:
|
|||||||
if properties["Active"] == dbus.Boolean(0):
|
if properties["Active"] == dbus.Boolean(0):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print "Configuring %s" % (path)
|
print("Configuring %s" % (path))
|
||||||
|
|
||||||
settings = properties["Settings"]
|
settings = properties["Settings"]
|
||||||
|
|
||||||
@@ -35,20 +35,20 @@ for path, properties in modems:
|
|||||||
gateway = "0.0.0.0";
|
gateway = "0.0.0.0";
|
||||||
|
|
||||||
if settings["Method"] == "dhcp":
|
if settings["Method"] == "dhcp":
|
||||||
print " Run DHCP on interface %s" % (interface)
|
print(" Run DHCP on interface %s" % (interface))
|
||||||
else:
|
else:
|
||||||
print " Interface is %s" % (interface)
|
print(" Interface is %s" % (interface))
|
||||||
print " IP address is %s" % (address)
|
print(" IP address is %s" % (address))
|
||||||
print " Gateway is %s" % (gateway)
|
print(" Gateway is %s" % (gateway))
|
||||||
|
|
||||||
cmd = "ifconfig " + interface + " " + address
|
cmd = "ifconfig " + interface + " " + address
|
||||||
cmd += " netmask 255.255.255.255"
|
cmd += " netmask 255.255.255.255"
|
||||||
os.system(cmd);
|
os.system(cmd);
|
||||||
|
|
||||||
for i in settings["DomainNameServers"]:
|
for i in settings["DomainNameServers"]:
|
||||||
print " Nameserver is %s" % (i)
|
print(" Nameserver is %s" % (i))
|
||||||
|
|
||||||
cmd = "route add -host " + i
|
cmd = "route add -host " + i
|
||||||
cmd +=" dev " + interface
|
cmd +=" dev " + interface
|
||||||
os.system(cmd);
|
os.system(cmd);
|
||||||
print
|
print('')
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user