Merge remote-tracking branch 'martti/merge1.14' into merge1.14part

This commit is contained in:
Tommi Kenakkala
2014-06-26 13:58:35 +03:00
117 changed files with 1295 additions and 906 deletions

View File

@@ -92,3 +92,7 @@ Jesper Larsen <jesper.larsen@ixonos.com>
Slava Monich <slava.monich@jolla.com>
Andrew Earl <andrewx.earl@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>

View File

@@ -45,6 +45,12 @@ Properties array{string} Features [readonly]
"voice-recognition"
"attach-voice-tag"
"echo-canceling-and-noise-reduction"
"three-way-calling"
"release-all-held"
"release-specified-active-call"
"private-chat"
"create-multiparty"
"transfer"
boolean InbandRinging [readonly]
@@ -70,3 +76,7 @@ Properties array{string} Features [readonly]
The current charge level of the battery. The value
can be between 0 and 5 respectively.
array{string} SubscriberNumbers [readonly]
List of subscriber numbers provided by the AG.

View File

@@ -49,6 +49,7 @@ static const char *bvra_prefix[] = { "+BVRA:", NULL };
struct hf_data {
GAtChat *chat;
unsigned int ag_features;
unsigned int ag_chld_features;
int battchg_index;
guint register_source;
};
@@ -124,6 +125,87 @@ static void ciev_notify(GAtResult *result, gpointer user_data)
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)
{
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_ag_features(hf, hd->ag_features);
ofono_handsfree_set_ag_chld_features(hf, hd->ag_chld_features);
ofono_handsfree_register(hf);
return FALSE;
@@ -154,6 +237,7 @@ static int hfp_handsfree_probe(struct ofono_handsfree *hf,
hd = g_new0(struct hf_data, 1);
hd->chat = g_at_chat_clone(info->chat);
hd->ag_features = info->ag_features;
hd->ag_chld_features = info->ag_mpty_features;
ofono_handsfree_set_data(hf, hd);
@@ -280,6 +364,7 @@ static struct ofono_handsfree_driver driver = {
.name = "hfpmodem",
.probe = hfp_handsfree_probe,
.remove = hfp_handsfree_remove,
.cnum_query = hfp_cnum_query,
.request_phone_number = hfp_request_phone_number,
.voice_recognition = hfp_voice_recognition,
.disable_nrec = hfp_disable_nrec,

View File

@@ -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)) {
if (!strcmp(str, "0"))
ag_mpty_feature |= AG_CHLD_0;
ag_mpty_feature |= HFP_AG_CHLD_0;
else if (!strcmp(str, "1"))
ag_mpty_feature |= AG_CHLD_1;
ag_mpty_feature |= HFP_AG_CHLD_1;
else if (!strcmp(str, "1x"))
ag_mpty_feature |= AG_CHLD_1x;
ag_mpty_feature |= HFP_AG_CHLD_1x;
else if (!strcmp(str, "2"))
ag_mpty_feature |= AG_CHLD_2;
ag_mpty_feature |= HFP_AG_CHLD_2;
else if (!strcmp(str, "2x"))
ag_mpty_feature |= AG_CHLD_2x;
ag_mpty_feature |= HFP_AG_CHLD_2x;
else if (!strcmp(str, "3"))
ag_mpty_feature |= AG_CHLD_3;
ag_mpty_feature |= HFP_AG_CHLD_3;
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))

View File

@@ -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 {
HFP_INDICATOR_SERVICE = 0,
HFP_INDICATOR_CALL,

View File

@@ -37,6 +37,7 @@
#include <ofono/voicecall.h>
#include "common.h"
#include "hfp.h"
#include "hfpmodem.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);
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);
return;
}
@@ -461,7 +462,7 @@ static void hfp_release_all_held(struct ofono_voicecall *vc,
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
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,
cb, data);
return;
@@ -476,7 +477,7 @@ static void hfp_set_udub(struct ofono_voicecall *vc,
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
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,
cb, data);
return;
@@ -528,7 +529,7 @@ static void hfp_release_all_active(struct ofono_voicecall *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,
data);
return;
@@ -559,7 +560,7 @@ static void hfp_release_specific(struct ofono_voicecall *vc, int id,
struct release_id_req *req = NULL;
char buf[32];
if (!(vd->ag_mpty_features & AG_CHLD_1x))
if (!(vd->ag_mpty_features & HFP_AG_CHLD_1x))
goto error;
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);
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);
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);
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);
return;
@@ -625,7 +626,7 @@ static void hfp_transfer(struct ofono_voicecall *vc,
*/
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);
return;

View File

@@ -56,6 +56,8 @@ struct GDBusClient {
void *signal_data;
GDBusProxyFunction proxy_added;
GDBusProxyFunction proxy_removed;
GDBusClientFunction ready;
void *ready_data;
GDBusPropertyFunction property_changed;
void *user_data;
GList *proxy_list;
@@ -725,6 +727,93 @@ gboolean g_dbus_proxy_set_property_basic(GDBusProxy *proxy,
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 {
GDBusReturnFunction function;
void *user_data;
@@ -982,6 +1071,9 @@ static void parse_managed_objects(GDBusClient *client, DBusMessage *msg)
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)
@@ -1243,6 +1335,18 @@ gboolean g_dbus_client_set_signal_watch(GDBusClient *client,
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,
GDBusProxyFunction proxy_added,
GDBusProxyFunction proxy_removed,

View File

@@ -329,6 +329,11 @@ gboolean g_dbus_proxy_set_property_basic(GDBusProxy *proxy,
GDBusResultFunction function, void *user_data,
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 (* 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,
GDBusDestroyFunction destroy);
typedef void (* GDBusClientFunction) (GDBusClient *client, void *user_data);
typedef void (* GDBusProxyFunction) (GDBusProxy *proxy, void *user_data);
typedef void (* GDBusPropertyFunction) (GDBusProxy *proxy, const char *name,
DBusMessageIter *iter, void *user_data);
@@ -359,7 +365,8 @@ gboolean g_dbus_client_set_disconnect_watch(GDBusClient *client,
GDBusWatchFunction function, void *user_data);
gboolean g_dbus_client_set_signal_watch(GDBusClient *client,
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,
GDBusProxyFunction proxy_added,
GDBusProxyFunction proxy_removed,

View File

@@ -30,8 +30,6 @@
#include "gdbus.h"
#define DISPATCH_TIMEOUT 0
#define info(fmt...)
#define error(fmt...)
#define debug(fmt...)
@@ -70,8 +68,6 @@ static gboolean message_dispatch(void *data)
{
DBusConnection *conn = data;
dbus_connection_ref(conn);
/* Dispatch messages */
while (dbus_connection_dispatch(conn) == DBUS_DISPATCH_DATA_REMAINS);
@@ -84,7 +80,7 @@ static inline void queue_dispatch(DBusConnection *conn,
DBusDispatchStatus status)
{
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)
@@ -92,9 +88,6 @@ static gboolean watch_func(GIOChannel *chan, GIOCondition cond, gpointer data)
struct watch_info *info = data;
unsigned int flags = 0;
DBusDispatchStatus status;
DBusConnection *conn;
conn = dbus_connection_ref(info->conn);
if (cond & G_IO_IN) flags |= DBUS_WATCH_READABLE;
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);
status = dbus_connection_get_dispatch_status(conn);
queue_dispatch(conn, status);
dbus_connection_unref(conn);
status = dbus_connection_get_dispatch_status(info->conn);
queue_dispatch(info->conn, status);
return TRUE;
}

View File

@@ -1253,6 +1253,8 @@ static struct generic_data *object_path_ref(DBusConnection *connection,
if (!dbus_connection_register_object_path(connection, path,
&generic_table, data)) {
dbus_connection_unref(data->conn);
g_free(data->path);
g_free(data->introspect);
g_free(data);
return NULL;

View File

@@ -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,
const struct ofono_phone_number *number,
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 {
const char *name;
int (*probe)(struct ofono_handsfree *hf, unsigned int vendor,
void *data);
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,
ofono_handsfree_phone_cb_t cb,
void *data);
@@ -54,6 +60,8 @@ struct ofono_handsfree_driver {
void ofono_handsfree_set_ag_features(struct ofono_handsfree *hf,
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,
ofono_bool_t enabled);
void ofono_handsfree_voice_recognition_notify(struct ofono_handsfree *hf,

View File

@@ -59,6 +59,7 @@
#include <drivers/atmodem/vendor.h>
static const char *none_prefix[] = { NULL };
static const char *qss_prefix[] = { "#QSS:", NULL };
struct he910_data {
GAtChat *chat; /* AT chat */
@@ -101,7 +102,7 @@ static GAtChat *open_device(struct ofono_modem *modem,
if (channel == NULL)
return NULL;
syntax = g_at_syntax_new_gsmv1();
syntax = g_at_syntax_new_gsm_permissive();
chat = g_at_chat_new(channel, syntax);
g_at_syntax_unref(syntax);
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);
}
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)
{
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,
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)
@@ -232,13 +267,6 @@ static int he910_enable(struct ofono_modem *modem)
g_at_chat_send(data->chat, "ATE0 +CMEE=1", none_prefix,
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 */
g_at_chat_send(data->chat, "AT+CFUN=1", none_prefix,
cfun_enable_cb, modem, NULL);

View File

@@ -1071,6 +1071,7 @@ done:
static int phonesim_init(void)
{
int err;
char *conf_override = getenv("OFONO_PHONESIM_CONFIG");
err = ofono_modem_driver_register(&phonesim_driver);
if (err < 0)
@@ -1081,7 +1082,10 @@ static int phonesim_init(void)
ofono_gprs_context_driver_register(&context_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;
}

View File

@@ -44,25 +44,34 @@
static GSList *g_drivers = NULL;
#define HANDSFREE_FLAG_CACHED 0x1
struct ofono_handsfree {
ofono_bool_t nrec;
ofono_bool_t inband_ringing;
ofono_bool_t voice_recognition;
ofono_bool_t voice_recognition_pending;
unsigned int ag_features;
unsigned int ag_chld_features;
unsigned char battchg;
GSList *subscriber_numbers;
const struct ofono_handsfree_driver *driver;
void *driver_data;
struct ofono_atom *atom;
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;
if (features & HFP_AG_FEATURE_3WAY)
list[i++] = "three-way-calling";
if (features & HFP_AG_FEATURE_ECNR)
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)
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;
return list;
@@ -125,6 +149,15 @@ void ofono_handsfree_set_ag_features(struct ofono_handsfree *hf,
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,
unsigned char level)
{
@@ -148,10 +181,44 @@ void ofono_handsfree_battchg_notify(struct ofono_handsfree *hf,
&level);
}
static DBusMessage *handsfree_get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
static void append_subscriber_numbers(GSList *subscriber_numbers,
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;
DBusMessageIter iter;
DBusMessageIter dict;
@@ -181,18 +248,90 @@ static DBusMessage *handsfree_get_properties(DBusConnection *conn,
ofono_dbus_dict_append(&dict, "VoiceRecognition", DBUS_TYPE_BOOLEAN,
&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,
&features);
ofono_dbus_dict_append(&dict, "BatteryChargeLevel", DBUS_TYPE_BYTE,
&hf->battchg);
if (hf->subscriber_numbers)
append_subscriber_numbers(hf->subscriber_numbers, &dict);
dbus_message_iter_close_container(&iter, &dict);
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)
{
struct ofono_handsfree *hf = data;
@@ -424,6 +563,10 @@ static void handsfree_unregister(struct ofono_atom *atom)
__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);
g_dbus_unregister_interface(conn, path,
OFONO_HANDSFREE_INTERFACE);

View File

@@ -45,6 +45,17 @@ enum hfp_hf_feature {
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 {
HFP_SDP_HF_FEATURE_ECNR = 0x1,
HFP_SDP_HF_FEATURE_3WAY = 0x2,

View File

@@ -135,7 +135,7 @@ void idmap_put(struct idmap *idmap, unsigned int id)
id %= BITS_PER_LONG;
idmap->bits[offset] &= ~(1 << id);
idmap->bits[offset] &= ~(1UL << id);
}
unsigned int idmap_alloc(struct idmap *idmap)
@@ -149,7 +149,7 @@ unsigned int idmap_alloc(struct idmap *idmap)
return idmap->max + 1;
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;
}
@@ -163,7 +163,7 @@ void idmap_take(struct idmap *idmap, unsigned int id)
return;
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);
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;
}

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -20,7 +20,7 @@ for path, properties in modems:
contexts = connman.GetContexts()
if (len(contexts) == 0):
print "No context available"
print("No context available")
sys.exit(1)
connman.SetProperty("Powered", dbus.Boolean(1))
@@ -35,6 +35,6 @@ for path, properties in modems:
try:
context.SetProperty("Active", dbus.Boolean(1), timeout = 100)
except dbus.DBusException, e:
print "Error activating %s: %s" % (path, str(e))
except dbus.DBusException as e:
print("Error activating %s: %s" % (path, str(e)))
exit(2)

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
continue
@@ -22,7 +22,7 @@ for path, properties in modems:
for path, properties in calls:
state = properties["State"]
print "[ %s ] %s" % (path, state)
print("[ %s ] %s" % (path, state))
if state != "incoming":
continue

View File

@@ -1,6 +1,6 @@
#!/usr/bin/python
#!/usr/bin/python3
import gobject
from gi.repository import GLib
import dbus
import dbus.mainloop.glib
@@ -12,23 +12,23 @@ def answer_call(path):
'org.ofono.VoiceCall')
time.sleep(2)
call.Answer()
print " Voice Call [ %s ] Answered" % (path)
print(" Voice Call [ %s ] Answered" % (path))
def voicecalls_call_added(path, properties):
print " Voice Call [ %s ] Added" % (path)
print(" Voice Call [ %s ] Added" % (path))
for key in properties.keys():
val = str(properties[key])
print " %s = %s" % (key, val)
print
print(" %s = %s" % (key, val))
print()
state = properties["State"]
if state == "incoming":
answer_call(path)
def voicecalls_call_removed(path):
print " Voice Call [ %s ] Removed" % (path)
print
print(" Voice Call [ %s ] Removed" % (path))
print()
if __name__ == "__main__":
global vcmanager
@@ -43,7 +43,7 @@ if __name__ == "__main__":
modems = manager.GetModems()
modem = modems[0][0]
print "Using modem %s" % modem
print("Using modem %s" % modem)
vcmanager = dbus.Interface(bus.get_object('org.ofono', modem),
'org.ofono.VoiceCallManager')
@@ -52,6 +52,6 @@ if __name__ == "__main__":
vcmanager.connect_to_signal("CallRemoved", voicecalls_call_removed)
mainloop = gobject.MainLoop()
mainloop = GLib.MainLoop()
mainloop.run()

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import os
import re
@@ -6,7 +6,7 @@ import sys
import subprocess
if (len(sys.argv) < 3):
print "Usage: %s [binary] [log]" % (sys.argv[0])
print("Usage: %s [binary] [log]" % (sys.argv[0]))
sys.exit(1)
binary = sys.argv[1]
@@ -50,8 +50,8 @@ child_stdout.close()
frame_count = len(frames);
count = 0
print "-------- backtrace --------"
print("-------- backtrace --------")
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
print "---------------------------"
print("---------------------------")

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -21,7 +21,7 @@ ussd = dbus.Interface(bus.get_object('org.ofono', path),
properties = ussd.GetProperties()
state = properties["State"]
print "State: %s" % (state)
print("State: %s" % (state))
if state != "idle":
ussd.Cancel()

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
modems = manager.GetModems()
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),
'org.ofono.cdma.ConnectionManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
modems = manager.GetModems()
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),
'org.ofono.cdma.ConnectionManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -16,7 +16,7 @@ else:
path, properties = modems[0]
number = sys.argv[1]
print "Using modem %s" % path
print("Using modem %s" % path)
manager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.cdma.VoiceCallManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
if "org.ofono.cdma.VoiceCallManager" not in properties["Interfaces"]:
continue
@@ -22,4 +22,4 @@ for path, properties in modems:
for key in properties.keys():
val = str(properties[key])
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -17,12 +17,12 @@ for path, properties in modems:
cm = dbus.Interface(bus.get_object('org.ofono', path),
'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:
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:
cm.SetProperty("Password", (sys.argv[2]))
print "Setting Password to %s" % (sys.argv[2])
print("Setting Password to %s" % (sys.argv[2]))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -19,10 +19,10 @@ elif len(sys.argv) == 3:
old_pin = sys.argv[2]
new_pin = sys.argv[3]
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)
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),
'org.ofono.SimManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -27,21 +27,21 @@ for path, properties in modems:
if path == "":
path = connman.AddContext("internet")
print "Created new context %s" % (path)
print("Created new context %s" % (path))
else:
print "Found context %s" % (path)
print("Found context %s" % (path))
context = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.ConnectionContext')
if len(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:
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:
context.SetProperty("Password", sys.argv[3])
print "Setting password to %s" % (sys.argv[3])
print("Setting password to %s" % (sys.argv[3]))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -27,21 +27,21 @@ for path, properties in modems:
if path == "":
path = connman.AddContext("mms")
print "Created new context %s" % (path)
print("Created new context %s" % (path))
else:
print "Found context %s" % (path)
print("Found context %s" % (path))
context = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.ConnectionContext')
if len(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:
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:
context.SetProperty("Password", sys.argv[3])
print "Setting password to %s" % (sys.argv[3])
print("Setting password to %s" % (sys.argv[3]))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -21,4 +21,4 @@ manager = dbus.Interface(bus.get_object('org.ofono', path),
mpty = manager.CreateMultiparty()
for path in mpty:
print path
print(path)

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -20,7 +20,7 @@ for path, properties in modems:
contexts = connman.GetContexts()
if (len(contexts) == 0):
print "No context available"
print("No context available")
sys.exit(1)
if len(sys.argv) > 1:
@@ -33,6 +33,6 @@ for path, properties in modems:
try:
context.SetProperty("Active", dbus.Boolean(0))
except dbus.DBusException, e:
print "Error activating %s: %s" % (path, str(e))
except dbus.DBusException as e:
print("Error activating %s: %s" % (path, str(e)))
exit(2)

View File

@@ -1,10 +1,10 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
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)
bus = dbus.SystemBus()
@@ -32,11 +32,11 @@ else:
number = sys.argv[2]
hide_callerid = sys.argv[3]
print "Using modem %s" % modem
print("Using modem %s" % modem)
vcm = dbus.Interface(bus.get_object('org.ofono', modem),
'org.ofono.VoiceCallManager')
path = vcm.Dial(number, hide_callerid)
print path
print(path)

View File

@@ -1,24 +1,24 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import gobject
from gi.repository import GLib
import dbus
import dbus.mainloop.glib
def property_changed(property, value):
if len(value.__str__()) > 0:
print "CF property %s changed to %s" % (property, value)
print("CF property %s changed to %s" % (property, value))
else:
print "CF property %s changed to disabled" % (property)
print("CF property %s changed to disabled" % (property))
if canexit:
mainloop.quit();
if __name__ == "__main__":
if len(sys.argv) < 2:
print "Usage: %s <type>" % (sys.argv[0])
print "Type can be: all, conditional"
print("Usage: %s <type>" % (sys.argv[0]))
print("Type can be: all, conditional")
sys.exit(1)
canexit = False
@@ -41,13 +41,13 @@ if __name__ == "__main__":
try:
cf.DisableAll(type, timeout = 100)
except dbus.DBusException, e:
print "Unable to DisableAll", e
except dbus.DBusException as e:
print("Unable to DisableAll %s" % e)
sys.exit(1);
print "DisableAll successful"
print("DisableAll successful")
canexit = True
mainloop = gobject.MainLoop()
mainloop = GLib.MainLoop()
mainloop.run()

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
modems = manager.GetModems()
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),
'org.ofono.ConnectionManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
modems = manager.GetModems()
path = modems[0][0]
print "Disconnecting modem %s..." % path
print("Disconnecting modem %s..." % path)
modem = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.Modem')

View File

@@ -1,10 +1,10 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
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)
bus = dbus.SystemBus()
@@ -21,7 +21,7 @@ elif (len(sys.argv) == 3):
modem = sys.argv[1]
icon = sys.argv[2]
print "Using modem %s" % modem
print("Using modem %s" % modem)
sim = dbus.Interface(bus.get_object('org.ofono', modem),
'org.ofono.SimManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
devices = manager.GetDevices()
path = devices[0][0]
print "Connect device %s..." % path
print("Connect device %s..." % path)
device = dbus.Interface(bus.get_object('org.ofono.dundee', path),
'org.ofono.dundee.Device')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
devices = manager.GetDevices()
path = devices[0][0]
print "Disconnect device %s..." % path
print("Disconnect device %s..." % path)
device = dbus.Interface(bus.get_object('org.ofono.dundee', path),
'org.ofono.dundee.Device')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
modems = manager.GetModems()
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),
'org.ofono.CellBroadcast')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
modems = manager.GetModems()
path = modems[0][0]
print "Connecting modem %s..." % path
print("Connecting modem %s..." % path)
cm = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.ConnectionManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
modems = manager.GetModems()
path = modems[0][0]
print "Connecting modem %s..." % path
print("Connecting modem %s..." % path)
modem = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.Modem')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -17,10 +17,10 @@ elif len(sys.argv) == 3:
pin_type = sys.argv[1]
pin = sys.argv[2]
else:
print "%s [PATH] pin_type pin" % (sys.argv[0])
print("%s [PATH] pin_type pin" % (sys.argv[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),
'org.ofono.SimManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -8,7 +8,7 @@ bus = dbus.SystemBus()
if len(sys.argv) == 2:
id = sys.argv[1]
else:
print "%s <icon id>" % (sys.argv[0])
print("%s <icon id>" % (sys.argv[0]))
sys.exit(0)
manager = dbus.Interface(bus.get_object("org.ofono", "/"),
@@ -28,4 +28,4 @@ icon = sim.GetIcon(dbus.Byte(int(sys.argv[1])))
xpm = ""
for byte in icon:
xpm += str(byte)
print xpm
print(xpm)

View File

@@ -1,9 +1,9 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
_dbus2py = {
dbus.String : unicode,
dbus.String : str,
dbus.UInt32 : int,
dbus.Int32 : int,
dbus.Int16 : int,
@@ -66,4 +66,4 @@ net_time = dbus.Interface(bus.get_object('org.ofono', path),
time = net_time.GetNetworkTime()
print pretty(time)
print(pretty(time))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -22,7 +22,7 @@ for entry in operators:
path = entry[0]
properties = entry[1]
print "[ %s ]" % (path)
print("[ %s ]" % (path))
for key in properties.keys():
if key in ["Technologies"]:
@@ -31,7 +31,7 @@ for entry in operators:
val += i + " "
else:
val = str(properties[key])
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))
print
print('')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus, sys
@@ -17,4 +17,4 @@ radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
properties = radiosettings.GetProperties()
print "Technology preference: %s" % (properties["TechnologyPreference"])
print("Technology preference: %s" % (properties["TechnologyPreference"]))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -18,7 +18,7 @@ calls = manager.GetCalls()
for path, properties in calls:
state = properties["State"]
print "[ %s ] %s" % (path, state)
print("[ %s ] %s" % (path, state))
if state != "active":
continue

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -6,7 +6,7 @@ import dbus
bus = dbus.SystemBus()
if (len(sys.argv) < 2):
print "Usage: %s [ Call Path ]" % (sys.argv[0])
print("Usage: %s [ Call Path ]" % (sys.argv[0]))
sys.exit(1)
call = dbus.Interface(bus.get_object('org.ofono', sys.argv[1]),

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@@ -1,10 +1,10 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
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)
bus = dbus.SystemBus()
@@ -27,7 +27,7 @@ ussd = dbus.Interface(bus.get_object('org.ofono', path),
properties = ussd.GetProperties()
state = properties["State"]
print "State: %s" % (state)
print("State: %s" % (state))
if state != "idle":
sys.exit(1);
@@ -37,22 +37,22 @@ result = ussd.Initiate(ussdstring, timeout=100)
properties = ussd.GetProperties()
state = properties["State"]
print result[0] + ": " + result[1]
print(result[0] + ": " + result[1])
if state == "idle":
sys.exit(0)
print "State: %s" % (state)
print("State: %s" % (state))
while state == "user-response":
response = raw_input("Enter response: ")
response = input("Enter response: ")
result = ussd.Respond(response, timeout=100)
properties = ussd.GetProperties()
state = properties["State"]
print result
print(result)
if state != "idle":
print "State: %s" % (state)
print("State: %s" % (state))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
continue
@@ -21,11 +21,11 @@ for path, properties in modems:
calls = mgr.GetCalls()
for path, properties in calls:
print " [ %s ]" % (path)
print(" [ %s ]" % (path))
for key in properties.keys():
if key == 'Icon':
print " %s = %d" % (key, properties[key])
print(" %s = %d" % (key, properties[key]))
else:
val = str(properties[key])
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
if "org.ofono.ConnectionManager" not in properties["Interfaces"]:
continue
@@ -21,7 +21,7 @@ for path, properties in modems:
contexts = connman.GetContexts()
for path, properties in contexts:
print " [ %s ]" % (path)
print(" [ %s ]" % (path))
for key in properties.keys():
if key in ["Settings"] or key in ["IPv6.Settings"]:
@@ -39,6 +39,6 @@ for path, properties in modems:
val += " }"
else:
val = str(properties[key])
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))
print
print('')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
if "org.ofono.MessageManager" not in properties["Interfaces"]:
continue
@@ -21,10 +21,10 @@ for path, properties in modems:
contexts = connman.GetMessages()
for path, properties in contexts:
print " [ %s ]" % (path)
print(" [ %s ]" % (path))
for key in properties.keys():
val = str(properties[key])
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))
print
print('')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
for key in properties.keys():
if key in ["Interfaces", "Features"]:
@@ -19,13 +19,13 @@ for path, properties in modems:
val += i + " "
else:
val = properties[key]
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))
for interface in properties["Interfaces"]:
object = dbus.Interface(bus.get_object('org.ofono', path),
interface)
print " [ %s ]" % (interface)
print(" [ %s ]" % (interface))
try:
properties = object.GetProperties()
@@ -77,6 +77,6 @@ for path, properties in modems:
val += " }"
else:
val = properties[key]
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))
print
print('')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -11,7 +11,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
if "org.ofono.NetworkRegistration" not in properties["Interfaces"]:
continue
@@ -25,7 +25,7 @@ for path, properties in modems:
operators = netreg.GetOperators()
for path, properties in operators:
print " [ %s ]" % (path)
print(" [ %s ]" % (path))
for key in properties.keys():
if key in ["Technologies"]:
@@ -34,6 +34,6 @@ for path, properties in modems:
val += i + " "
else:
val = str(properties[key])
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))
print
print('')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -17,10 +17,10 @@ elif len(sys.argv) == 3:
pin_type = sys.argv[1]
pin = sys.argv[2]
else:
print "%s [PATH] pin_type pin" % (sys.argv[0])
print("%s [PATH] pin_type pin" % (sys.argv[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),
'org.ofono.SimManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,13 +13,13 @@ else:
modems = manager.GetModems()
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),
'org.ofono.Modem')
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()
modem.SetProperty("Lockdown", dbus.Boolean(0))

View File

@@ -1,12 +1,12 @@
#!/usr/bin/python
#!/usr/bin/python3
import gobject
from gi.repository import GLib
import dbus
import dbus.mainloop.glib
_dbus2py = {
dbus.String : unicode,
dbus.String : str,
dbus.UInt32 : int,
dbus.Int32 : int,
dbus.Int16 : int,
@@ -52,32 +52,32 @@ def pretty(d):
def property_changed(name, value, path, interface):
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):
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):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s" % (iface, member, name)
print("{%s} [%s] %s" % (iface, member, name))
def event(member, path, interface):
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):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s (%s)" % (iface, path, member,
str(msg), pretty(args))
print("{%s} [%s] %s %s (%s)" % (iface, path, member,
str(msg), pretty(args)))
def ussd(msg, member, path, interface):
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):
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__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@@ -105,5 +105,5 @@ if __name__ == '__main__':
interface_keyword="interface")
mainloop = gobject.MainLoop()
mainloop = GLib.MainLoop()
mainloop.run()

View File

@@ -1,12 +1,12 @@
#!/usr/bin/python
#!/usr/bin/python3
import gobject
from gi.repository import GLib
import dbus
import dbus.mainloop.glib
_dbus2py = {
dbus.String : unicode,
dbus.String : str,
dbus.UInt32 : int,
dbus.Int32 : int,
dbus.Int16 : int,
@@ -55,32 +55,32 @@ def pretty(d):
def property_changed(name, value, path, interface):
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):
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):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s" % (iface, name, member)
print("{%s} [%s] %s" % (iface, name, member))
def event(member, path, interface):
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):
iface = interface[interface.rfind(".") + 1:]
print "{%s} [%s] %s %s (%s)" % (iface, path, member,
msg, pretty(args))
print("{%s} [%s] %s %s (%s)" % (iface, path, member,
msg, pretty(args)))
def ussd(msg, member, path, interface):
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):
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__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@@ -150,5 +150,5 @@ if __name__ == '__main__':
path_keyword="path",
interface_keyword="interface")
mainloop = gobject.MainLoop()
mainloop = GLib.MainLoop()
mainloop.run()

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus, sys
@@ -12,6 +12,6 @@ else:
modems = manager.GetModems()
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.SetProperty("Online", dbus.Boolean(0), timeout = 120)

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus, sys
@@ -12,6 +12,6 @@ else:
modems = manager.GetModems()
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.SetProperty("Online", dbus.Boolean(1), timeout = 120)

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -23,4 +23,4 @@ manager = dbus.Interface(bus.get_object('org.ofono', path),
mpty = manager.PrivateChat(callid, timeout=100)
for path in mpty:
print path
print(path)

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import os
import dbus
@@ -23,7 +23,7 @@ for path, properties in modems:
if properties["Active"] == dbus.Boolean(0):
continue
print "Configuring %s" % (path)
print("Configuring %s" % (path))
settings = properties["Settings"]
@@ -35,20 +35,20 @@ for path, properties in modems:
gateway = "0.0.0.0";
if settings["Method"] == "dhcp":
print " Run DHCP on interface %s" % (interface)
print(" Run DHCP on interface %s" % (interface))
else:
print " Interface is %s" % (interface)
print " IP address is %s" % (address)
print " Gateway is %s" % (gateway)
print(" Interface is %s" % (interface))
print(" IP address is %s" % (address))
print(" Gateway is %s" % (gateway))
cmd = "ifconfig " + interface + " " + address
cmd += " netmask 255.255.255.255"
os.system(cmd);
for i in settings["DomainNameServers"]:
print " Nameserver is %s" % (i)
print(" Nameserver is %s" % (i))
cmd = "route add -host " + i
cmd +=" dev " + interface
os.system(cmd);
print
print('')

View File

@@ -1,16 +1,16 @@
#!/usr/bin/python
#!/usr/bin/python3
import gobject
from gi.repository import GLib
import dbus
import dbus.mainloop.glib
def incoming_message(message, details, path, interface):
print "%s" % (message)
print("%s" % (message))
for key in details:
val = details[key]
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))
if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@@ -29,5 +29,5 @@ if __name__ == '__main__':
path_keyword="path",
interface_keyword="interface")
mainloop = gobject.MainLoop()
mainloop = GLib.MainLoop()
mainloop.run()

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
continue
@@ -22,7 +22,7 @@ for path, properties in modems:
for path, properties in calls:
state = properties["State"]
print "[ %s ] %s" % (path, state)
print("[ %s ] %s" % (path, state))
if state != "incoming":
continue

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
continue

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -10,7 +10,7 @@ manager = dbus.Interface(bus.get_object('org.ofono', '/'),
modems = manager.GetModems()
for path, properties in modems:
print "[ %s ]" % (path)
print("[ %s ]" % (path))
if "org.ofono.VoiceCallManager" not in properties["Interfaces"]:
continue

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
@@ -20,4 +20,4 @@ for path, properties in modems:
for path, properties in contexts:
connman.RemoveContext(path)
print"Removed: [ %s ]" % (path)
print("Removed: [ %s ]" % (path))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -14,9 +14,9 @@ elif len(sys.argv) == 4:
path = modems[0][0]
puk_type, puk, pin = sys.argv[1:]
else:
print "%s [PATH] puk_type puk pin" % (sys.argv[0])
print("%s [PATH] puk_type puk pin" % (sys.argv[0]))
print "Reset pin for modem %s..." % path
print("Reset pin for modem %s..." % path)
simmanager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.SimManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -13,7 +13,7 @@ else:
modems = manager.GetModems()
path = modems[0][0]
print "Scanning operators on modem %s..." % path
print("Scanning operators on modem %s..." % path)
netreg = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.NetworkRegistration')
@@ -23,7 +23,7 @@ for entry in operators:
path = entry[0]
properties = entry[1]
print "[ %s ]" % (path)
print("[ %s ]" % (path))
for key in properties.keys():
if key in ["Technologies"]:
@@ -32,7 +32,7 @@ for entry in operators:
val += i + " "
else:
val = str(properties[key])
print " %s = %s" % (key, val)
print(" %s = %s" % (key, val))
print
print('')

View File

@@ -1,11 +1,11 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
if len(sys.argv) < 4:
print "Usage: %s [modem] <to> <message> <delivery report>" %\
(sys.argv[0])
print("Usage: %s [modem] <to> <message> <delivery report>" %\
(sys.argv[0]))
sys.exit(1)
bus = dbus.SystemBus()
@@ -18,7 +18,7 @@ else:
modems = manager.GetModems()
path = modems[0][0]
print "Send message using modem %s ..." % path
print("Send message using modem %s ..." % path)
mm = dbus.Interface(bus.get_object('org.ofono', path),
@@ -31,4 +31,4 @@ else:
mm.SetProperty("UseDeliveryReports", dbus.Boolean(int(sys.argv[3])))
path = mm.SendMessage(sys.argv[1], sys.argv[2])
print path
print(path)

View File

@@ -1,10 +1,10 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
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)
bus = dbus.SystemBus()
@@ -27,13 +27,13 @@ ussd = dbus.Interface(bus.get_object('org.ofono', path),
properties = ussd.GetProperties()
state = properties["State"]
print "State: %s" % (state)
print("State: %s" % (state))
if state == "idle":
result = ussd.Initiate(ussdstring, timeout=100)
print result[0] + ": " + result[1]
print(result[0] + ": " + result[1])
elif state == "user-response":
print ussd.Respond(ussdstring, timeout=100)
print(ussd.Respond(ussdstring, timeout=100))
else:
sys.exit(1);
@@ -43,15 +43,15 @@ state = properties["State"]
if state == "idle":
sys.exit(0)
print "State: %s" % (state)
print("State: %s" % (state))
while state == "user-response":
response = raw_input("Enter response: ")
response = input("Enter response: ")
print ussd.Respond(response, timeout=100)
print(ussd.Respond(response, timeout=100))
properties = ussd.GetProperties()
state = properties["State"]
if state != "idle":
print "State: %s" % (state)
print("State: %s" % (state))

View File

@@ -1,10 +1,10 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
if len(sys.argv) < 3:
print "Usage: %s [modem] <to> <vcal file>" % (sys.argv[0])
print("Usage: %s [modem] <to> <vcal file>" % (sys.argv[0]))
sys.exit(1)
bus = dbus.SystemBus()
@@ -17,7 +17,7 @@ else:
modems = manager.GetModems()
path = modems[0][0]
print "Send vcal using modem %s ..." % path
print("Send vcal using modem %s ..." % path)
sm = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.SmartMessaging')
@@ -29,4 +29,4 @@ else:
vcal = file(sys.argv[2]).read()
path = sm.SendAppointment(sys.argv[1], vcal)
print path
print(path)

View File

@@ -1,10 +1,10 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
if len(sys.argv) < 3:
print "Usage: %s [modem] <to> <vcard file>" % (sys.argv[0])
print("Usage: %s [modem] <to> <vcard file>" % (sys.argv[0]))
sys.exit(1)
bus = dbus.SystemBus()
@@ -17,7 +17,7 @@ else:
modems = manager.GetModems()
path = modems[0][0]
print "Send vcard using modem %s ..." % path
print("Send vcard using modem %s ..." % path)
sm = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.SmartMessaging')
@@ -29,4 +29,4 @@ else:
vcard = file(sys.argv[2]).read()
path = sm.SendBusinessCard(sys.argv[1], vcard)
print path
print(path)

View File

@@ -1,26 +1,26 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import gobject
from gi.repository import GLib
import dbus
import dbus.mainloop.glib
def property_changed(property, value):
if len(value.__str__()) > 0:
print "CF property %s changed to %s" % (property, value)
print("CF property %s changed to %s" % (property, value))
else:
print "CF property %s changed to disabled" % (property)
print("CF property %s changed to disabled" % (property))
if canexit:
mainloop.quit();
if __name__ == "__main__":
if len(sys.argv) < 3:
print "Usage: %s <property> <value>" % (sys.argv[0])
print "Properties can be: VoiceUnconditional, VoiceBusy,"
print " VoiceNoReply, VoiceNoReplyTimeout, VoiceNotReachable"
print "Value: number to or the timeout"
print("Usage: %s <property> <value>" % (sys.argv[0]))
print("Properties can be: VoiceUnconditional, VoiceBusy,")
print(" VoiceNoReply, VoiceNoReplyTimeout, VoiceNotReachable")
print("Value: number to or the timeout")
sys.exit(1)
property = sys.argv[1]
@@ -46,19 +46,19 @@ if __name__ == "__main__":
try:
cf.SetProperty(property, dbus.UInt16(value),
timeout = 100)
except dbus.DBusException, e:
print "Unable SetProperty", e
except dbus.DBusException as e:
print("Unable SetProperty %s" % e)
sys.exit(1);
else:
try:
cf.SetProperty(property, value, timeout = 100)
except dbus.DBusException, e:
print "Unable SetProperty", e
except dbus.DBusException as e:
print("Unable SetProperty %s" % e)
sys.exit(1);
print "Set Property successful"
print("Set Property successful")
canexit = True
mainloop = gobject.MainLoop()
mainloop = GLib.MainLoop()
mainloop.run()

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -15,9 +15,9 @@ elif len(sys.argv) == 2:
path = modems[0][0]
topics = sys.argv[1]
else:
print "%s [PATH] topics" % (sys.argv[0])
print("%s [PATH] topics" % (sys.argv[0]))
print "Setting cell broadcast topics for modem %s..." % path
print("Setting cell broadcast topics for modem %s..." % path)
cbs = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.CellBroadcast')

View File

@@ -1,10 +1,10 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
if len(sys.argv) < 4:
print "Usage: set-context-property <context> <name> <value>"
print("Usage: set-context-property <context> <name> <value>")
sys.exit(1)
bus = dbus.SystemBus()
@@ -24,7 +24,7 @@ for path, properties in modems:
contexts = connman.GetContexts()
if (len(contexts) == 0):
print "No context available"
print("No context available")
sys.exit(1)
path = contexts[int(sys.argv[1])][0]
@@ -33,7 +33,7 @@ for path, properties in modems:
try:
context.SetProperty(sys.argv[2], sys.argv[3])
except dbus.DBusException, e:
print "Error setting context %s property %s: %s" %\
(path, sys.argv[2], str(e))
except dbus.DBusException as e:
print("Error setting context %s property %s: %s" %\
(path, sys.argv[2], str(e)))
exit(2)

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -15,10 +15,10 @@ elif len(sys.argv) == 2:
path = modems[0][0]
enable = int(sys.argv[1])
else:
print "%s [PATH] {0|1}" % (sys.argv[0])
print("%s [PATH] {0|1}" % (sys.argv[0]))
exit(1)
print "Setting fast dormancy for modem %s..." % path
print("Setting fast dormancy for modem %s..." % path)
radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.RadioSettings')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -15,10 +15,10 @@ elif len(sys.argv) == 2:
path = modems[0][0]
band = sys.argv[1]
else:
print "%s [PATH] band" % (sys.argv[0])
print("%s [PATH] band" % (sys.argv[0]))
exit(1)
print "Setting gsm band for modem %s..." % path
print("Setting gsm band for modem %s..." % path)
radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.RadioSettings')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -26,18 +26,18 @@ for path, properties in modems:
break
if path == "":
print "No MMS context"
print("No MMS context")
exit(1)
context = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.ConnectionContext')
if len(sys.argv) < 3:
print "Usage: %s <proxy> <center>" % (sys.argv[0])
print("Usage: %s <proxy> <center>" % (sys.argv[0]))
exit(1)
context.SetProperty("MessageProxy", sys.argv[1])
print "Setting MMS Proxy to %s" % (sys.argv[1])
print("Setting MMS Proxy to %s" % (sys.argv[1]))
context.SetProperty("MessageCenter", sys.argv[2])
print "Setting MMSC to %s" % (sys.argv[2])
print("Setting MMSC to %s" % (sys.argv[2]))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -15,10 +15,10 @@ elif len(sys.argv) == 2:
path = modems[0][0]
number = sys.argv[1]
else:
print "%s [PATH] <number>" % (sys.argv[0])
print("%s [PATH] <number>" % (sys.argv[0]))
exit(1)
print "Setting MSISDN for modem %s..." % path
print("Setting MSISDN for modem %s..." % path)
sim = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.SimManager')
sim.SetProperty("SubscriberNumbers", [number]);

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -15,7 +15,7 @@ cv = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.CallVolume')
muted = int(sys.argv[1])
print "Set Muted to " , muted
print("Set Muted to " , muted)
cv.SetProperty("Muted", dbus.Boolean(muted))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -24,4 +24,4 @@ for path, properties in modems:
connman.SetProperty("RoamingAllowed", allowed)
print "Setting %s to RoamingAllowed=%d" % (path, allowed)
print("Setting %s to RoamingAllowed=%d" % (path, allowed))

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -15,9 +15,9 @@ elif len(sys.argv) == 2:
path = modems[0][0]
tech = sys.argv[1]
else:
print "%s [PATH] technology" % (sys.argv[0])
print("%s [PATH] technology" % (sys.argv[0]))
print "Setting technology preference for modem %s..." % path
print("Setting technology preference for modem %s..." % path)
radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.RadioSettings')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -15,10 +15,10 @@ elif len(sys.argv) == 2:
path = modems[0][0]
enable = int(sys.argv[1])
else:
print "%s [PATH] {0|1}" % (sys.argv[0])
print("%s [PATH] {0|1}" % (sys.argv[0]))
exit(1)
print "Setting TTY for modem %s..." % path
print("Setting TTY for modem %s..." % path)
texttelephony = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.TextTelephony')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -15,10 +15,10 @@ elif len(sys.argv) == 2:
path = modems[0][0]
band = sys.argv[1]
else:
print "%s [PATH] band" % (sys.argv[0])
print("%s [PATH] band" % (sys.argv[0]))
exit(1)
print "Setting umts band for modem %s..." % path
print("Setting umts band for modem %s..." % path)
radiosettings = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.RadioSettings')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys
@@ -19,10 +19,10 @@ elif len(sys.argv) == 2:
if sys.argv[1] == "off":
enabled = 0
else:
print "%s [PATH] on/off" % (sys.argv[0])
print("%s [PATH] on/off" % (sys.argv[0]))
sys.exit(1)
print "Setting delivery report use for modem %s..." % path
print("Setting delivery report use for modem %s..." % path)
sms = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.MessageManager')

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@@ -1,22 +1,22 @@
#!/usr/bin/python
#!/usr/bin/python3
import gobject
from gi.repository import GLib
import sys
import dbus
import dbus.mainloop.glib
def cm_property_changed(name, value):
print "CallMeter property: '%s' changed to '%s'" % (name, str(value))
print("CallMeter property: '%s' changed to '%s'" % (name, str(value)))
if canexit:
mainloop.quit()
def cm_maximum_reached():
print "Only 30 seconds call time remains, recharge."
print("Only 30 seconds call time remains, recharge.")
def print_useage(s):
print "Usage: %s <property> <newvalue> <password>" % (s)
print "Usage: %s reset <password>" % (s)
print("Usage: %s <property> <newvalue> <password>" % (s))
print("Usage: %s reset <password>" % (s))
sys.exit(1);
if __name__ == "__main__":
@@ -51,24 +51,24 @@ if __name__ == "__main__":
properties = cm.GetProperties()
print "Currency: %s" % (properties['Currency'])
print "PricePerUnit %s" % (properties['PricePerUnit'])
print "Call meter for the current call: %s" % (properties['CallMeter'])
print "Call meter for current and previous calls: %s" %\
properties['AccumulatedCallMeter']
print "Call meter maximum, once reached calls are not possible: %s" %\
properties['AccumulatedCallMeterMaximum']
print("Currency: %s" % (properties['Currency']))
print("PricePerUnit %s" % (properties['PricePerUnit']))
print("Call meter for the current call: %s" % (properties['CallMeter']))
print("Call meter for current and previous calls: %s" %\
properties['AccumulatedCallMeter'])
print("Call meter maximum, once reached calls are not possible: %s" %\
properties['AccumulatedCallMeterMaximum'])
total = properties['PricePerUnit'] * properties['AccumulatedCallMeter']
print "Accumulated Meter in Currency: %s %s" %\
(total, properties['Currency'])
print("Accumulated Meter in Currency: %s %s" %\
(total, properties['Currency']))
if (sys.argv[1] == 'reset'):
print "Resetting Accumulated Call Meter"
print("Resetting Accumulated Call Meter")
try:
cm.Reset(pin)
except dbus.DBusException, e:
print "Unable to reset ACM: ", e
except dbus.DBusException as e:
print("Unable to reset ACM: %s" % e)
sys.exit(1)
else:
try:
@@ -77,11 +77,11 @@ if __name__ == "__main__":
elif property == 'PricePerUnit':
newvalue = float(newvalue)
cm.SetProperty(property, newvalue, pin)
except dbus.DBusException, e:
print "Unable to set property: ", e
except dbus.DBusException as e:
print("Unable to set property: %s" % e)
sys.exit(1)
canexit = True
mainloop = gobject.MainLoop()
mainloop = GLib.MainLoop()
mainloop.run()

View File

@@ -1,20 +1,20 @@
#!/usr/bin/python
#!/usr/bin/python3
import gobject
from gi.repository import GLib
import sys
import dbus
import dbus.mainloop.glib
def property_changed(name, value):
print "CallBarring property: '%s' changed to '%s'" % (name, str(value))
print("CallBarring property: '%s' changed to '%s'" % (name, str(value)))
if canexit:
mainloop.quit()
def print_useage(s):
print "Usage: %s <property> <newvalue> <password>" % (s)
print "Usage: %s disableall <password>" % (s)
print "Usage: %s passwd <old_password> <new_password>" % (s)
print("Usage: %s <property> <newvalue> <password>" % (s))
print("Usage: %s disableall <password>" % (s))
print("Usage: %s passwd <old_password> <new_password>" % (s))
sys.exit(1);
if __name__ == "__main__":
@@ -51,38 +51,38 @@ if __name__ == "__main__":
properties = cb.GetProperties()
print "Barring settings for Incoming Voice calls: %s" %\
(properties['VoiceIncoming'])
print "Barring settings for Outgoing Calls: %s" %\
(properties['VoiceOutgoing'])
print("Barring settings for Incoming Voice calls: %s" %\
(properties['VoiceIncoming']))
print("Barring settings for Outgoing Calls: %s" %\
(properties['VoiceOutgoing']))
if (sys.argv[1] == 'disableall'):
print "Disabling all barrings"
print("Disabling all barrings")
try:
cb.DisableAll(pin)
except dbus.DBusException, e:
print "Unable to Disable All barrings: ", e
except dbus.DBusException as e:
print("Unable to Disable All barrings: ", e)
sys.exit(1)
print "Disabled all call barrings"
sys.exit(0)
elif (sys.argv[1] == 'passwd'):
try:
cb.ChangePassword(old_password, new_password)
except dbus.DBusException, e:
print "Unable to change password: ", e
except dbus.DBusException as e:
print("Unable to change password: ", e)
sys.exit(1)
print "Password changed"
print("Password changed")
sys.exit(0)
else:
try:
cb.SetProperty(property, newvalue, pin)
except dbus.DBusException, e:
print "Unable to set property: ", e
except dbus.DBusException as e:
print("Unable to set property: ", e)
sys.exit(1)
print "Property set completed", property
sys.exit(0)
canexit = True
mainloop = gobject.MainLoop()
mainloop = GLib.MainLoop()
mainloop.run()

View File

@@ -1,21 +1,21 @@
#!/usr/bin/python
#!/usr/bin/python3
import gobject
from gi.repository import GLib
import dbus
import dbus.mainloop.glib
def property_changed(property, value):
print "CallForwarding property %s changed to %s" % (property, value)
print("CallForwarding property %s changed to %s" % (property, value))
def print_properties(cf):
properties = cf.GetProperties()
for p in properties:
if len(properties[p].__str__()) > 0:
print "%s call forwarding rule is: %s" % (p, properties[p])
print("%s call forwarding rule is: %s" % (p, properties[p]))
else:
print "%s call forwarding rule disabled" % (p)
print("%s call forwarding rule disabled" % (p))
if __name__ == "__main__":
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@@ -36,84 +36,84 @@ if __name__ == "__main__":
try:
cf.SetProperty("FoobarNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException, e:
print "Unable to set timeout - Good"
except dbus.DBusException as e:
print("Unable to set timeout - Good")
try:
cf.SetProperty("VoiceNotReachableTimeout", dbus.UInt16(19))
except dbus.DBusException, e:
print "Unable to set timeout - Good"
except dbus.DBusException as e:
print("Unable to set timeout - Good")
try:
cf.SetProperty("VoiceNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException, e:
print "Unable to set timeout - Good"
except dbus.DBusException as e:
print("Unable to set timeout - Good")
try:
cf.SetProperty("DataNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException, e:
print "Unable to set timeout - Good"
except dbus.DBusException as e:
print("Unable to set timeout - Good")
try:
cf.SetProperty("FaxNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException, e:
print "Unable to set timeout - Good"
except dbus.DBusException as e:
print("Unable to set timeout - Good")
try:
cf.SetProperty("SmsNoReplyTimeout", dbus.UInt16(19))
except dbus.DBusException, e:
print "Unable to set timeout - Good"
except dbus.DBusException as e:
print("Unable to set timeout - Good")
try:
cf.SetProperty("VoiceNoReply", "")
except dbus.DBusException, e:
print "Unable to erase voice no reply rule - Bad"
except dbus.DBusException as e:
print("Unable to erase voice no reply rule - Bad")
try:
cf.SetProperty("VoiceNoReply", "+134444")
except dbus.DBusException, e:
print "Unable to register voice no reply rule - Bad"
except dbus.DBusException as e:
print("Unable to register voice no reply rule - Bad")
try:
cf.SetProperty("VoiceNoReplyTimeout", dbus.UInt16(30))
except dbus.DBusException, e:
print "Unable to set voice no reply timeout - Bad"
except dbus.DBusException as e:
print("Unable to set voice no reply timeout - Bad")
properties = cf.GetProperties()
print properties["VoiceNoReply"]
print properties["VoiceNoReplyTimeout"]
print(properties["VoiceNoReply"])
print(properties["VoiceNoReplyTimeout"])
try:
cf.SetProperty("VoiceUnconditional", "+155555")
except dbus.DBusException, e:
print "Unable to set Voice Unconditional - Bad"
except dbus.DBusException as e:
print("Unable to set Voice Unconditional - Bad")
properties = cf.GetProperties()
print properties["VoiceUnconditional"]
print(properties["VoiceUnconditional"])
try:
cf.DisableAll("foobar")
except dbus.DBusException, e:
print "Unable to delete invalids - Good"
except dbus.DBusException as e:
print("Unable to delete invalids - Good")
try:
cf.DisableAll("conditional")
except dbus.DBusException, e:
print "Unable to delete all conditional - Bad"
except dbus.DBusException as e:
print("Unable to delete all conditional - Bad")
properties = cf.GetProperties()
print properties["VoiceNoReply"]
print properties["VoiceNoReplyTimeout"]
print(properties["VoiceNoReply"])
print(properties["VoiceNoReplyTimeout"])
try:
cf.DisableAll("all")
except dbus.DBusException, e:
print "Unable to delete all conditional - Bad"
except dbus.DBusException as e:
print("Unable to delete all conditional - Bad")
print properties["VoiceUnconditional"]
print(properties["VoiceUnconditional"])
mainloop = gobject.MainLoop()
mainloop = GLib.MainLoop()
mainloop.run()

View File

@@ -1,24 +1,24 @@
#!/usr/bin/python
#!/usr/bin/python3
import gobject
from gi.repository import GLib
import dbus
import dbus.mainloop.glib
import sys
def property_changed(name, value):
print "CallSettings property: '%s' changed to '%s'" % (name, value)
print("CallSettings property: '%s' changed to '%s'" % (name, value))
if canexit:
mainloop.quit();
if __name__ == "__main__":
if len(sys.argv) < 3:
print "Usage: %s [modem] <property> <newvalue>" % (sys.argv[0])
print "Properties can be: VoiceCallWaiting,"
print " ConnectedLineRestriction, CallingLineRestriction,"
print " CallingLinePresentation, CalledLinePresentation,"
print " ConnectedLinePresentation, HideCallerId"
print("Usage: %s [modem] <property> <newvalue>" % (sys.argv[0]))
print("Properties can be: VoiceCallWaiting,")
print(" ConnectedLineRestriction, CallingLineRestriction,")
print(" CallingLinePresentation, CalledLinePresentation,")
print(" ConnectedLinePresentation, HideCallerId")
sys.exit(1)
canexit = False
@@ -41,7 +41,7 @@ if __name__ == "__main__":
property = sys.argv[1]
newvalue = sys.argv[2]
print "Using modem %s" % modem
print("Using modem %s" % modem)
cs = dbus.Interface(bus.get_object('org.ofono', modem),
'org.ofono.CallSettings')
@@ -50,34 +50,34 @@ if __name__ == "__main__":
properties = cs.GetProperties()
print "Current Property values:"
print "Network Status of Call Waiting - Voice: %s" %\
(properties['VoiceCallWaiting'])
print "Network Status of Connected Line Restriction: %s" %\
(properties['ConnectedLineRestriction'])
print "Network Status of Calling Line Restriction: %s" %\
(properties['CallingLineRestriction'])
print "Network Status of Calling Line Presentation: %s" %\
(properties['CallingLinePresentation'])
print "Network Status of Called Line Presentation: %s" %\
(properties['CalledLinePresentation'])
print "Network Status of Connected Line Presentation: %s" %\
(properties['ConnectedLinePresentation'])
print "Hide my Caller Id: %s" % (properties['HideCallerId'])
print("Current Property values:")
print("Network Status of Call Waiting - Voice: %s" %\
(properties['VoiceCallWaiting']))
print("Network Status of Connected Line Restriction: %s" %\
(properties['ConnectedLineRestriction']))
print("Network Status of Calling Line Restriction: %s" %\
(properties['CallingLineRestriction']))
print("Network Status of Calling Line Presentation: %s" %\
(properties['CallingLinePresentation']))
print("Network Status of Called Line Presentation: %s" %\
(properties['CalledLinePresentation']))
print("Network Status of Connected Line Presentation: %s" %\
(properties['ConnectedLinePresentation']))
print("Hide my Caller Id: %s" % (properties['HideCallerId']))
try:
cs.SetProperty(property, newvalue)
except dbus.DBusException, e:
print "Unable to set property: ", e
except dbus.DBusException as e:
print("Unable to set property: %s" % e)
sys.exit(1);
print "Setting successful"
print("Setting successful")
if (properties[property] == newvalue):
print "Setting was already set to this value"
print("Setting was already set to this value")
sys.exit(1);
canexit = True
mainloop = gobject.MainLoop()
mainloop = GLib.MainLoop()
mainloop.run()

View File

@@ -1,75 +1,75 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import dbus.mainloop.glib
import sys
import gobject
from gi.repository import GLib
import os
def print_menu():
print "Select test case"
print "----------------------------------------------------------------"
print "[0] Activate cbs"
print "[1] Deactivate cbs"
print "[2] Get cbs properties"
print "[3] Set/Register topics"
print " If several - give topics separated with comma. \
\n E.g. 20,50-51,60"
print "[4] Clear/Unregister topics"
print "[5] NetReg Base Station - Get current serving cell"
print "[x] Exit"
print "----------------------------------------------------------------"
print("Select test case")
print("----------------------------------------------------------------")
print("[0] Activate cbs")
print("[1] Deactivate cbs")
print("[2] Get cbs properties")
print("[3] Set/Register topics")
print(" If several - give topics separated with comma. \
\n E.g. 20,50-51,60")
print("[4] Clear/Unregister topics")
print("[5] NetReg Base Station - Get current serving cell")
print("[x] Exit")
print("----------------------------------------------------------------")
def property_changed(property, value):
if value == "" and property == "Topics":
print "User selected Topics have been cleared. \
\nRegistered for emergency topics only."
print("User selected Topics have been cleared. \
\nRegistered for emergency topics only.")
else:
print "Cell Broadcast property %s is changed to %s" % (property, value)
print "\nPress ENTER to continue"
print("Cell Broadcast property %s is changed to %s" % (property, value))
print("\nPress ENTER to continue")
def incoming_broadcast(text, topic):
print "Broadcast msg: %s \n Topic channel: %s" % (text, topic)
print "\nPress ENTER to continue"
print("Broadcast msg: %s \n Topic channel: %s" % (text, topic))
print("\nPress ENTER to continue")
def emergency_broadcast(text, properties):
emergType = properties["EmergencyType"]
emergAlert = properties["EmergencyAlert"]
print "Broadcast msg: %s \n\t Type: %s \n\t Alert: %s \n\t Popup: %s" \
% (text, emergType, emergAlert, popup)
print("Broadcast msg: %s \n\t Type: %s \n\t Alert: %s \n\t Popup: %s" \
% (text, emergType, emergAlert, popup))
if properties["Popup"] == True:
print "Popup required."
print("Popup required.")
print "\nPress ENTER to continue"
print("\nPress ENTER to continue")
def set_cbs_state(cbs, state):
if state == True:
print "Activating cell broadcast..."
print("Activating cell broadcast...")
cbs.SetProperty("Powered", dbus.Boolean(1))
else:
print "Deactivating cell broadcast..."
print("Deactivating cell broadcast...")
cbs.SetProperty("Powered", dbus.Boolean(0))
print "-----------------------------------------------------------"
print("-----------------------------------------------------------")
def print_cbs_properties(cbs):
properties = cbs.GetProperties()
print "---------------------PROPERTIES----------------------------"
print("---------------------PROPERTIES----------------------------")
for p in properties:
if len(properties[p].__str__()) > 0:
if p == "Powered":
if properties[p] == True:
print "Cell Broadcast is Activated."
print("Cell Broadcast is Activated.")
else:
print "Cell Broadcast is Deactivated."
print("Cell Broadcast is Deactivated.")
elif p == "Topics":
print "Currently set CBS %s are: %s" \
% (p, properties[p])
print("Currently set CBS %s are: %s" \
% (p, properties[p]))
topics_available = True
else:
print "Cell Broadcast %s value empty" % (p)
print "-----------------------------------------------------------"
print("Cell Broadcast %s value empty" % (p))
print("-----------------------------------------------------------")
def set_topics(cbs):
print_cbs_properties(cbs)
@@ -78,7 +78,7 @@ def set_topics(cbs):
invalidData = False;
index = 0
topics = raw_input('Enter the topic ID(s) you want to register to: ')
topics = input('Enter the topic ID(s) you want to register to: ')
while index < len(topics):
if topics[index] == ',' or topics[index] == '-':
@@ -86,27 +86,27 @@ def set_topics(cbs):
elif topics[index] >= '0' and topics[index] <= '9':
topicTemp = topicTemp + topics[index]
else:
print "Invalid char. \"%s\" entered. Topic not set." \
% (topics[index])
print("Invalid char. \"%s\" entered. Topic not set." \
% (topics[index]))
invalidData = True
break
if topicTemp:
if int(topicTemp) > 999:
invalidData = True
print "Invalid Topic ID %s (range 0-999). \
\nCould not register." % topicTemp
print("Invalid Topic ID %s (range 0-999). \
\nCould not register." % topicTemp)
index = index + 1
if invalidData == False:
try:
print "Setting Cell Broadcast topics..."
print("Setting Cell Broadcast topics...")
cbs.SetProperty("Topics", topics);
except dbus.DBusException, e:
print "Unable to set topic: ", e
except dbus.DBusException as e:
print("Unable to set topic: %s" % e)
print "-----------------------------------------------------------"
print("-----------------------------------------------------------")
def get_serving_cell_name(netReg):
wasFound = False;
@@ -115,20 +115,20 @@ def get_serving_cell_name(netReg):
for p in properties:
if p == "BaseStation":
if len(properties[p].__str__()) > 0:
print "Current serving cell name: %s" \
% (properties["BaseStation"])
print("Current serving cell name: %s" \
% (properties["BaseStation"]))
wasFound = True;
else:
print "Current Serving cell name empty. \
Base Station CBS not available."
print("Current Serving cell name empty. \
Base Station CBS not available.")
if wasFound == False:
print "Base Station parameter not found. \
\nBase Station CBS not available."
print "-----------------------------------------------------------"
print("Base Station parameter not found. \
\nBase Station CBS not available.")
print("-----------------------------------------------------------")
def stdin_handler(fd, condition, cbs, netReg):
in_key = os.read(fd.fileno(), 160).rstrip()
def stdin_handler(channel, condition, cbs, netReg):
in_key = os.read(channel.unix_get_fd(), 160).rstrip().decode('UTF-8')
if in_key == '0':
set_cbs_state(cbs, True)
@@ -151,7 +151,7 @@ def stdin_handler(fd, condition, cbs, netReg):
elif in_key == 'x':
sys.exit(1)
print '\n' * 2
print('\n' * 2)
print_menu()
return True
@@ -177,12 +177,13 @@ if __name__ == "__main__":
cbs.connect_to_signal("IncomingBroadcast", incoming_broadcast)
cbs.connect_to_signal("EmergencyBroadcast", emergency_broadcast)
print '\n' * 2
print('\n' * 2)
print_menu()
gobject.io_add_watch(sys.stdin, gobject.IO_IN, stdin_handler, cbs, \
netReg)
GLib.io_add_watch(GLib.IOChannel(filedes=sys.stdin.fileno()),
GLib.PRIORITY_DEFAULT, GLib.IO_IN, stdin_handler, cbs, \
netReg)
mainloop = gobject.MainLoop()
mainloop = GLib.MainLoop()
mainloop.run()

View File

@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@@ -18,12 +18,12 @@ if (len(sys.argv) == 2):
manager = dbus.Interface(bus.get_object('org.ofono', modem),
'org.ofono.VoiceCallManager')
print "Play single tones from 0 to 9"
print("Play single tones from 0 to 9")
zeroAscii = ord('0')
for x in range(0, 9):
manager.SendTones(chr(zeroAscii + x))
print "Play longer strings"
print("Play longer strings")
manager.SendTones("123")
manager.SendTones("1234567890*#p987")
manager.SendTones("123")

Some files were not shown because too many files have changed in this diff Show More