[PATCH 2/2] xmm7modem: changed gprs driver vendor for xmm7modem
by Antara Borwankar
Changed gprs driver vendor from "OFONO_VENDOR_IFX" to
"OFONO_VENDOR_XMM" for xmm7modem specific behavior.
---
plugins/xmm7xxx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/xmm7xxx.c b/plugins/xmm7xxx.c
index a544798..aade18f 100644
--- a/plugins/xmm7xxx.c
+++ b/plugins/xmm7xxx.c
@@ -1243,7 +1243,7 @@ static void xmm7xxx_post_online(struct ofono_modem *modem)
ofono_netreg_create(modem, OFONO_VENDOR_IFX, "atmodem", data->chat);
- gprs = ofono_gprs_create(modem, OFONO_VENDOR_IFX, "atmodem",
+ gprs = ofono_gprs_create(modem, OFONO_VENDOR_XMM, "atmodem",
data->chat);
interface = ofono_modem_get_string(modem, "NetworkInterface");
--
1.9.1
1 year, 7 months
Query related to calling via ofono api's
by swathika kesavan
Hi Team,
I have got few clarification related to ofono and connection manager.
We are using connection manager to bring the cellular interface up and its
successful.
We have got some application to make calls (which uses dbus ofono api's
like Dial).
When the cellular is under enabled state(connmanctl enable cellular) then
upon running ofono in debug mode ,I could see those ATD (dial commands)
been received by ofono and calling is successful.
But we are facing some issues,when I disable the cellular option in
connection manager using (connmanctl disable cellular).I couldn't see any
AT commands been received by ofono used for calling(via dbus)
*Note: *
Upon disabling ,instead of pushing the module to airplane mode (default
behavior),we have modified it in such a way they are not pushed to airplane
mode(instead we tried by disabling gprs alone(AT+CGATT=0)).
Here are my queries,
If Ofono is independent application ,which means disabling cellular in
connection manager shouldn't affect the call related api's which is been
used in my third application correct?
else ofono is dependent application on connman?
Kindly help me ,am stuck at the above case.
1 year, 7 months
[PATCH 3/3] xmm7modem: adding netmon changes for reporting neighbouring cell
by Antara Borwankar
Added netmon changes for xmm7modem driver to fetch neighbouring
cell information.
---
drivers/xmm7modem/netmon.c | 102 ++++++++++++++++++++++++++++++++++++---------
1 file changed, 83 insertions(+), 19 deletions(-)
diff --git a/drivers/xmm7modem/netmon.c b/drivers/xmm7modem/netmon.c
index ba70e2b..0e958ab 100644
--- a/drivers/xmm7modem/netmon.c
+++ b/drivers/xmm7modem/netmon.c
@@ -47,6 +47,7 @@ static const char *xmci_prefix[] = { "+XMCI:", NULL };
struct netmon_driver_data {
GAtChat *chat;
+ int xmci_mode;
};
enum xmci_ofono_type_info {
@@ -85,6 +86,7 @@ static void xmci_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct cb_data *cbd = user_data;
struct ofono_netmon *netmon = cbd->data;
+ struct netmon_driver_data *nmd = ofono_netmon_get_data(netmon);
ofono_netmon_cb_t cb = cbd->cb;
struct ofono_error error;
GAtResultIter iter;
@@ -96,6 +98,11 @@ static void xmci_cb(gboolean ok, GAtResult *result, gpointer user_data)
int ecn0 = -1;
int rsrq = -1;
int tech = -1;
+ int type = -1;
+ int ci = -1;
+ const char *cell_id;
+ char mcc[3];
+ char mnc[3];
DBG("ok %d", ok);
@@ -109,18 +116,23 @@ static void xmci_cb(gboolean ok, GAtResult *result, gpointer user_data)
g_at_result_iter_init(&iter, result);
while (g_at_result_iter_next(&iter, "+XMCI:")) {
- if (!g_at_result_iter_next_number(&iter, &number))
+ if (!g_at_result_iter_next_number(&iter, &type))
break;
- tech = xmm7modem_map_radio_access_technology(number);
+ tech = xmm7modem_map_radio_access_technology(type);
- switch (number) {
+ switch (type) {
+ case XMCI_GSM_NEIGH_CELL:
case XMCI_GSM_SERV_CELL:
- /* skip <MCC>,<MNC>,<LAC>,<CI>,<BSIC> */
- g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
+ /* <MCC>,<MNC>,<LAC>,<CI>,<BSIC> */
+ g_at_result_iter_next_number(&iter, &number);
+ snprintf(mcc, 3, "%d", number);
+ g_at_result_iter_next_number(&iter, &number);
+ snprintf(mnc, 3, "%d", number);
g_at_result_iter_skip_next(&iter);
+ g_at_result_iter_next_string(&iter, &cell_id);
+ sscanf(&cell_id[2], "%x", &number);
+ ci = number != -1 ? number : 0;
g_at_result_iter_skip_next(&iter);
g_at_result_iter_next_number(&iter, &number);
@@ -129,15 +141,20 @@ static void xmci_cb(gboolean ok, GAtResult *result, gpointer user_data)
g_at_result_iter_next_number(&iter, &number);
ber = number != 99 ? number : ber;
break;
+ case XMCI_UMTS_NEIGH_CELL:
case XMCI_UMTS_SERV_CELL:
/*
- * skip <MCC>,<MNC>,<LAC>,<CI><PSC>,<DLUARFNC>,
+ * <MCC>,<MNC>,<LAC>,<CI><PSC>,<DLUARFNC>,
* <ULUARFCN>,<PATHLOSS>,<RSSI>
*/
+ g_at_result_iter_next_number(&iter, &number);
+ snprintf(mcc, 3, "%d", number);
+ g_at_result_iter_next_number(&iter, &number);
+ snprintf(mnc, 3, "%d", number);
g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
+ g_at_result_iter_next_string(&iter, &cell_id);
+ sscanf(&cell_id[2], "%x", &number);
+ ci = number != -1 ? number : 0;
g_at_result_iter_skip_next(&iter);
g_at_result_iter_skip_next(&iter);
g_at_result_iter_skip_next(&iter);
@@ -150,15 +167,20 @@ static void xmci_cb(gboolean ok, GAtResult *result, gpointer user_data)
g_at_result_iter_next_number(&iter, &number);
ecn0 = number != 255 ? number : ecn0;
break;
+ case XMCI_LTE_NEIGH_CELL:
case XMCI_LTE_SERV_CELL:
/*
- * skip <MCC>,<MNC>,<TAC>,<CI>,<PCI>,<DLUARFNC>,
+ * <MCC>,<MNC>,<TAC>,<CI>,<PCI>,<DLUARFNC>,
* <ULUARFCN>,<PATHLOSS_LTE>
*/
+ g_at_result_iter_next_number(&iter, &number);
+ snprintf(mcc, 3, "%d", number);
+ g_at_result_iter_next_number(&iter, &number);
+ snprintf(mnc, 3, "%d", number);
g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
+ g_at_result_iter_next_string(&iter, &cell_id);
+ sscanf(&cell_id[2], "%x", &number);
+ ci = number != -1 ? number : 0;
g_at_result_iter_skip_next(&iter);
g_at_result_iter_skip_next(&iter);
g_at_result_iter_skip_next(&iter);
@@ -174,8 +196,15 @@ static void xmci_cb(gboolean ok, GAtResult *result, gpointer user_data)
break;
}
- ofono_netmon_serving_cell_notify(netmon,
+ if ((nmd->xmci_mode == 0) &&
+ (type == XMCI_GSM_NEIGH_CELL ||
+ type == XMCI_UMTS_NEIGH_CELL ||
+ type == XMCI_LTE_NEIGH_CELL)) {
+ ofono_netmon_neighbouring_cell_notify(netmon,
tech,
+ OFONO_NETMON_INFO_MCC, mcc,
+ OFONO_NETMON_INFO_MNC, mnc,
+ OFONO_NETMON_INFO_CI, ci,
OFONO_NETMON_INFO_RXLEV, rxlev,
OFONO_NETMON_INFO_BER, ber,
OFONO_NETMON_INFO_RSCP, rscp,
@@ -183,10 +212,25 @@ static void xmci_cb(gboolean ok, GAtResult *result, gpointer user_data)
OFONO_NETMON_INFO_RSRQ, rsrq,
OFONO_NETMON_INFO_RSRP, rsrp,
OFONO_NETMON_INFO_INVALID);
-
- CALLBACK_WITH_SUCCESS(cb, cbd->data);
- break;
+ } else if ((nmd->xmci_mode == 1) &&
+ (type == XMCI_GSM_SERV_CELL ||
+ type == XMCI_UMTS_SERV_CELL ||
+ type == XMCI_LTE_SERV_CELL)) {
+ ofono_netmon_serving_cell_notify(netmon,
+ tech,
+ OFONO_NETMON_INFO_RXLEV, rxlev,
+ OFONO_NETMON_INFO_BER, ber,
+ OFONO_NETMON_INFO_RSCP, rscp,
+ OFONO_NETMON_INFO_ECN0, ecn0,
+ OFONO_NETMON_INFO_RSRQ, rsrq,
+ OFONO_NETMON_INFO_RSRP, rsrp,
+ OFONO_NETMON_INFO_INVALID);
+ break;
+ }
}
+
+ CALLBACK_WITH_SUCCESS(cb, cbd->data);
+ nmd->xmci_mode = -1;
}
static void xmm7modem_netmon_request_update(struct ofono_netmon *netmon,
@@ -194,6 +238,7 @@ static void xmm7modem_netmon_request_update(struct ofono_netmon *netmon,
{
struct netmon_driver_data *nmd = ofono_netmon_get_data(netmon);
struct cb_data *cbd = cb_data_new(cb, data);
+ nmd->xmci_mode = 1;
DBG("xmm7modem netmon request update");
@@ -205,6 +250,23 @@ static void xmm7modem_netmon_request_update(struct ofono_netmon *netmon,
CALLBACK_WITH_FAILURE(cb, data);
}
+static void xmm7modem_neighbouring_cell_update(struct ofono_netmon *netmon,
+ ofono_netmon_cb_t cb, void *data)
+{
+ struct netmon_driver_data *nmd = ofono_netmon_get_data(netmon);
+ struct cb_data *cbd = cb_data_new(cb, data);
+ nmd->xmci_mode = 0;
+
+ DBG("xmm7modem netmon request neighbouring cell update");
+
+ if (g_at_chat_send(nmd->chat, "AT+XMCI=0", xmci_prefix,
+ xmci_cb, cbd, g_free) > 0)
+ return;
+
+ g_free(cbd);
+ CALLBACK_WITH_FAILURE(cb, data);
+}
+
static gboolean ril_delayed_register(gpointer user_data)
{
struct ofono_netmon *netmon = user_data;
@@ -224,6 +286,7 @@ static int xmm7modem_netmon_probe(struct ofono_netmon *netmon,
nmd = g_new0(struct netmon_driver_data, 1);
nmd->chat = g_at_chat_clone(chat);
+ nmd->xmci_mode = -1;
ofono_netmon_set_data(netmon, nmd);
@@ -250,6 +313,7 @@ static const struct ofono_netmon_driver driver = {
.probe = xmm7modem_netmon_probe,
.remove = xmm7modem_netmon_remove,
.request_update = xmm7modem_netmon_request_update,
+ .neighbouring_cell_update = xmm7modem_neighbouring_cell_update,
};
void xmm_netmon_init(void)
--
1.9.1
1 year, 7 months
[PATCH 2/3] netmon: adding get functionality for neighbouring cell information
by Antara Borwankar
Handled the get neighbouring cell information function which returns
an array of signal strength of all neighbouring cells.
---
src/netmon.c | 253 +++++++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 184 insertions(+), 69 deletions(-)
diff --git a/src/netmon.c b/src/netmon.c
index 6c19df5..f383911 100644
--- a/src/netmon.c
+++ b/src/netmon.c
@@ -50,6 +50,8 @@ struct ofono_netmon {
const struct ofono_netmon_driver *driver;
DBusMessage *pending;
DBusMessage *reply;
+ DBusMessageIter iter;
+ DBusMessageIter arr;
void *driver_data;
struct ofono_atom *atom;
struct netmon_agent *agent;
@@ -69,174 +71,145 @@ static const char *cell_type_to_tech_name(enum ofono_netmon_cell_type type)
return NULL;
}
-void ofono_netmon_serving_cell_notify(struct ofono_netmon *netmon,
- enum ofono_netmon_cell_type type,
- int info_type, ...)
+static void netmon_cell_info_dict_append(DBusMessageIter *dict,
+ va_list *arglist, int info_type)
{
- va_list arglist;
- DBusMessage *agent_notify = NULL;
- DBusMessageIter iter;
- DBusMessageIter dict;
- enum ofono_netmon_info next_info_type = info_type;
- const char *technology = cell_type_to_tech_name(type);
char *mcc;
char *mnc;
int intval;
-
- if (netmon->pending != NULL) {
- netmon->reply = dbus_message_new_method_return(netmon->pending);
- dbus_message_iter_init_append(netmon->reply, &iter);
- } else if (netmon->agent != NULL) {
- agent_notify = netmon_agent_new_method_call(netmon->agent,
- "ServingCellInformationChanged");
-
- dbus_message_iter_init_append(agent_notify, &iter);
- } else
- return;
-
- dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
- OFONO_PROPERTIES_ARRAY_SIGNATURE,
- &dict);
-
- va_start(arglist, info_type);
-
- if (technology == NULL)
- goto done;
-
- ofono_dbus_dict_append(&dict, "Technology",
- DBUS_TYPE_STRING, &technology);
+ enum ofono_netmon_info next_info_type = info_type;
while (next_info_type != OFONO_NETMON_INFO_INVALID) {
switch (next_info_type) {
case OFONO_NETMON_INFO_MCC:
- mcc = va_arg(arglist, char *);
+ mcc = va_arg(*arglist, char *);
if (mcc && strlen(mcc))
- ofono_dbus_dict_append(&dict,
+ ofono_dbus_dict_append(dict,
"MobileCountryCode",
DBUS_TYPE_STRING, &mcc);
break;
case OFONO_NETMON_INFO_MNC:
- mnc = va_arg(arglist, char *);
+ mnc = va_arg(*arglist, char *);
if (mnc && strlen(mnc))
- ofono_dbus_dict_append(&dict,
+ ofono_dbus_dict_append(dict,
"MobileNetworkCode",
DBUS_TYPE_STRING, &mnc);
break;
case OFONO_NETMON_INFO_LAC:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "LocationAreaCode",
+ CELL_INFO_DICT_APPEND(dict, "LocationAreaCode",
intval, uint16_t, DBUS_TYPE_UINT16);
break;
case OFONO_NETMON_INFO_CI:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "CellId",
+ CELL_INFO_DICT_APPEND(dict, "CellId",
intval, uint32_t, DBUS_TYPE_UINT32);
break;
case OFONO_NETMON_INFO_ARFCN:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "ARFCN",
+ CELL_INFO_DICT_APPEND(dict, "ARFCN",
intval, uint16_t, DBUS_TYPE_UINT16);
break;
case OFONO_NETMON_INFO_BSIC:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "BSIC",
+ CELL_INFO_DICT_APPEND(dict, "BSIC",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RXLEV:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "ReceivedSignalStrength",
+ CELL_INFO_DICT_APPEND(dict, "ReceivedSignalStrength",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_TIMING_ADVANCE:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "TimingAdvance",
+ CELL_INFO_DICT_APPEND(dict, "TimingAdvance",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_PSC:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "PrimaryScramblingCode",
+ CELL_INFO_DICT_APPEND(dict, "PrimaryScramblingCode",
intval, uint16_t, DBUS_TYPE_UINT16);
break;
case OFONO_NETMON_INFO_BER:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "BitErrorRate",
+ CELL_INFO_DICT_APPEND(dict, "BitErrorRate",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RSSI:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "Strength",
+ CELL_INFO_DICT_APPEND(dict, "Strength",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RSCP:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "ReceivedSignalCodePower",
+ CELL_INFO_DICT_APPEND(dict, "ReceivedSignalCodePower",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_ECN0:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "ReceivedEnergyRatio",
+ CELL_INFO_DICT_APPEND(dict, "ReceivedEnergyRatio",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RSRQ:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict,
+ CELL_INFO_DICT_APPEND(dict,
"ReferenceSignalReceivedQuality",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RSRP:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict,
+ CELL_INFO_DICT_APPEND(dict,
"ReferenceSignalReceivedPower",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_EARFCN:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "EARFCN",
+ CELL_INFO_DICT_APPEND(dict, "EARFCN",
intval, uint16_t, DBUS_TYPE_UINT16);
break;
case OFONO_NETMON_INFO_EBAND:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "EBand",
+ CELL_INFO_DICT_APPEND(dict, "EBand",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_CQI:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "ChannelQualityIndicator",
+ CELL_INFO_DICT_APPEND(dict, "ChannelQualityIndicator",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
@@ -244,8 +217,44 @@ void ofono_netmon_serving_cell_notify(struct ofono_netmon *netmon,
break;
}
- next_info_type = va_arg(arglist, int);
+ next_info_type = va_arg(*arglist, int);
}
+}
+
+void ofono_netmon_serving_cell_notify(struct ofono_netmon *netmon,
+ enum ofono_netmon_cell_type type,
+ int info_type, ...)
+{
+ va_list arglist;
+ DBusMessage *agent_notify = NULL;
+ DBusMessageIter iter;
+ DBusMessageIter dict;
+ const char *technology = cell_type_to_tech_name(type);
+
+ if (netmon->pending != NULL) {
+ netmon->reply = dbus_message_new_method_return(netmon->pending);
+ dbus_message_iter_init_append(netmon->reply, &iter);
+ } else if (netmon->agent != NULL) {
+ agent_notify = netmon_agent_new_method_call(netmon->agent,
+ "ServingCellInformationChanged");
+
+ dbus_message_iter_init_append(agent_notify, &iter);
+ } else
+ return;
+
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ OFONO_PROPERTIES_ARRAY_SIGNATURE,
+ &dict);
+
+ va_start(arglist, info_type);
+
+ if (technology == NULL)
+ goto done;
+
+ ofono_dbus_dict_append(&dict, "Technology",
+ DBUS_TYPE_STRING, &technology);
+
+ netmon_cell_info_dict_append(&dict, &arglist, info_type);
done:
va_end(arglist);
@@ -403,6 +412,109 @@ static DBusMessage *netmon_unregister_agent(DBusConnection *conn,
return dbus_message_new_method_return(msg);
}
+
+void ofono_netmon_neighbouring_cell_notify(struct ofono_netmon *netmon,
+ enum ofono_netmon_cell_type type,
+ int info_type, ...)
+{
+ va_list arglist;
+ DBusMessageIter dict;
+ DBusMessageIter strct;
+ const char *tech = cell_type_to_tech_name(type);
+
+ if (netmon->pending == NULL)
+ return;
+
+ if (!netmon->reply) {
+ netmon->reply = dbus_message_new_method_return(netmon->pending);
+ dbus_message_iter_init_append(netmon->reply, &netmon->iter);
+
+ dbus_message_iter_open_container(&netmon->iter, DBUS_TYPE_ARRAY,
+ DBUS_STRUCT_BEGIN_CHAR_AS_STRING
+ DBUS_TYPE_ARRAY_AS_STRING
+ DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+ DBUS_TYPE_STRING_AS_STRING
+ DBUS_TYPE_VARIANT_AS_STRING
+ DBUS_DICT_ENTRY_END_CHAR_AS_STRING
+ DBUS_STRUCT_END_CHAR_AS_STRING,
+ &netmon->arr);
+ }
+
+ tech = cell_type_to_tech_name(type);
+
+ dbus_message_iter_open_container(&netmon->arr, DBUS_TYPE_STRUCT,
+ NULL, &strct);
+ dbus_message_iter_open_container(&strct, DBUS_TYPE_ARRAY,
+ OFONO_PROPERTIES_ARRAY_SIGNATURE,
+ &dict);
+
+ va_start(arglist, info_type);
+
+ if (tech == NULL)
+ goto done;
+
+ ofono_dbus_dict_append(&dict, "Technology",
+ DBUS_TYPE_STRING, &tech);
+
+ netmon_cell_info_dict_append(&dict, &arglist, info_type);
+
+done:
+ va_end(arglist);
+
+ dbus_message_iter_close_container(&strct, &dict);
+ dbus_message_iter_close_container(&netmon->arr, &strct);
+}
+
+static void neighbouring_cell_info_callback(const struct ofono_error *error,
+ void *data)
+{
+ struct ofono_netmon *netmon = data;
+ DBusMessage *reply = netmon->reply;
+
+ DBG("");
+
+ if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+ if (reply)
+ dbus_message_unref(reply);
+
+ reply = __ofono_error_failed(netmon->pending);
+ } else if (!reply) {
+ DBusMessageIter iter;
+ DBusMessageIter dict;
+
+ reply = dbus_message_new_method_return(netmon->pending);
+ dbus_message_iter_init_append(reply, &iter);
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ OFONO_PROPERTIES_ARRAY_SIGNATURE,
+ &dict);
+ dbus_message_iter_close_container(&iter, &dict);
+ } else {
+ dbus_message_iter_close_container(&netmon->iter, &netmon->arr);
+ }
+
+ netmon->reply = NULL;
+ __ofono_dbus_pending_reply(&netmon->pending, reply);
+}
+
+static DBusMessage *netmon_get_neighbouring_cell_info(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct ofono_netmon *netmon = data;
+
+ if (!netmon->driver->neighbouring_cell_update)
+ return __ofono_error_not_implemented(msg);
+
+ if (netmon->pending)
+ return __ofono_error_busy(msg);
+
+ netmon->pending = dbus_message_ref(msg);
+
+ netmon->driver->neighbouring_cell_update(netmon,
+ neighbouring_cell_info_callback, netmon);
+
+ return NULL;
+}
+
static const GDBusMethodTable netmon_methods[] = {
{ GDBUS_ASYNC_METHOD("GetServingCellInformation",
NULL, GDBUS_ARGS({ "cellinfo", "a{sv}" }),
@@ -413,6 +525,9 @@ static const GDBusMethodTable netmon_methods[] = {
{ GDBUS_METHOD("UnregisterAgent",
GDBUS_ARGS({ "agent", "o" }), NULL,
netmon_unregister_agent) },
+ { GDBUS_ASYNC_METHOD("GetNeighbouringCellInformation",
+ NULL, GDBUS_ARGS({ "cellinfo", "a(a{sv})" }),
+ netmon_get_neighbouring_cell_info) },
{ }
};
--
1.9.1
1 year, 7 months
[PATCH 1/3] netmon: adding get function for neighbouring cell information
by Antara Borwankar
Added declaration of functions and structures required for getting
neighbouring cell information.
---
include/netmon.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/netmon.h b/include/netmon.h
index c8fcafa..a99d6ca 100644
--- a/include/netmon.h
+++ b/include/netmon.h
@@ -43,6 +43,8 @@ struct ofono_netmon_driver {
unsigned int enable,
unsigned int period,
ofono_netmon_cb_t cb, void *data);
+ void (*neighbouring_cell_update)(struct ofono_netmon *netmon,
+ ofono_netmon_cb_t cb, void *data);
};
enum ofono_netmon_cell_type {
@@ -104,6 +106,10 @@ void ofono_netmon_set_data(struct ofono_netmon *netmon, void *data);
void *ofono_netmon_get_data(struct ofono_netmon *netmon);
+void ofono_netmon_neighbouring_cell_notify(struct ofono_netmon *netmon,
+ enum ofono_netmon_cell_type type,
+ int info_type, ...);
+
#ifdef __cplusplus
}
#endif
--
1.9.1
1 year, 7 months
[PATCH] netmon: adding get functionality for neighbouring cell information
by Antara Borwankar
Handled the get neighbouring cell information function which returns
an array of signal strength of all neighbouring cells.
---
src/netmon.c | 258 +++++++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 188 insertions(+), 70 deletions(-)
diff --git a/src/netmon.c b/src/netmon.c
index 6c19df5..4596450 100644
--- a/src/netmon.c
+++ b/src/netmon.c
@@ -50,6 +50,8 @@ struct ofono_netmon {
const struct ofono_netmon_driver *driver;
DBusMessage *pending;
DBusMessage *reply;
+ DBusMessageIter iter;
+ DBusMessageIter arr;
void *driver_data;
struct ofono_atom *atom;
struct netmon_agent *agent;
@@ -69,174 +71,148 @@ static const char *cell_type_to_tech_name(enum ofono_netmon_cell_type type)
return NULL;
}
-void ofono_netmon_serving_cell_notify(struct ofono_netmon *netmon,
- enum ofono_netmon_cell_type type,
- int info_type, ...)
+static void netmon_cell_info_dict_append(DBusMessageIter *dict,
+ va_list *arglist, int info_type)
{
- va_list arglist;
- DBusMessage *agent_notify = NULL;
- DBusMessageIter iter;
- DBusMessageIter dict;
- enum ofono_netmon_info next_info_type = info_type;
- const char *technology = cell_type_to_tech_name(type);
char *mcc;
char *mnc;
+ char *cell_id;
int intval;
-
- if (netmon->pending != NULL) {
- netmon->reply = dbus_message_new_method_return(netmon->pending);
- dbus_message_iter_init_append(netmon->reply, &iter);
- } else if (netmon->agent != NULL) {
- agent_notify = netmon_agent_new_method_call(netmon->agent,
- "ServingCellInformationChanged");
-
- dbus_message_iter_init_append(agent_notify, &iter);
- } else
- return;
-
- dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
- OFONO_PROPERTIES_ARRAY_SIGNATURE,
- &dict);
-
- va_start(arglist, info_type);
-
- if (technology == NULL)
- goto done;
-
- ofono_dbus_dict_append(&dict, "Technology",
- DBUS_TYPE_STRING, &technology);
+ enum ofono_netmon_info next_info_type = info_type;
while (next_info_type != OFONO_NETMON_INFO_INVALID) {
switch (next_info_type) {
case OFONO_NETMON_INFO_MCC:
- mcc = va_arg(arglist, char *);
+ mcc = va_arg(*arglist, char *);
if (mcc && strlen(mcc))
- ofono_dbus_dict_append(&dict,
+ ofono_dbus_dict_append(dict,
"MobileCountryCode",
DBUS_TYPE_STRING, &mcc);
break;
case OFONO_NETMON_INFO_MNC:
- mnc = va_arg(arglist, char *);
+ mnc = va_arg(*arglist, char *);
if (mnc && strlen(mnc))
- ofono_dbus_dict_append(&dict,
+ ofono_dbus_dict_append(dict,
"MobileNetworkCode",
DBUS_TYPE_STRING, &mnc);
break;
case OFONO_NETMON_INFO_LAC:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "LocationAreaCode",
+ CELL_INFO_DICT_APPEND(dict, "LocationAreaCode",
intval, uint16_t, DBUS_TYPE_UINT16);
break;
case OFONO_NETMON_INFO_CI:
- intval = va_arg(arglist, int);
+ cell_id = va_arg(*arglist, char *);
- CELL_INFO_DICT_APPEND(&dict, "CellId",
- intval, uint32_t, DBUS_TYPE_UINT32);
+ if (cell_id && strlen(cell_id))
+ ofono_dbus_dict_append(dict,
+ "CellId",
+ DBUS_TYPE_STRING, &cell_id);
break;
case OFONO_NETMON_INFO_ARFCN:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "ARFCN",
+ CELL_INFO_DICT_APPEND(dict, "ARFCN",
intval, uint16_t, DBUS_TYPE_UINT16);
break;
case OFONO_NETMON_INFO_BSIC:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "BSIC",
+ CELL_INFO_DICT_APPEND(dict, "BSIC",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RXLEV:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "ReceivedSignalStrength",
+ CELL_INFO_DICT_APPEND(dict, "ReceivedSignalStrength",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_TIMING_ADVANCE:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "TimingAdvance",
+ CELL_INFO_DICT_APPEND(dict, "TimingAdvance",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_PSC:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "PrimaryScramblingCode",
+ CELL_INFO_DICT_APPEND(dict, "PrimaryScramblingCode",
intval, uint16_t, DBUS_TYPE_UINT16);
break;
case OFONO_NETMON_INFO_BER:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "BitErrorRate",
+ CELL_INFO_DICT_APPEND(dict, "BitErrorRate",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RSSI:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "Strength",
+ CELL_INFO_DICT_APPEND(dict, "Strength",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RSCP:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "ReceivedSignalCodePower",
+ CELL_INFO_DICT_APPEND(dict, "ReceivedSignalCodePower",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_ECN0:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "ReceivedEnergyRatio",
+ CELL_INFO_DICT_APPEND(dict, "ReceivedEnergyRatio",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RSRQ:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict,
+ CELL_INFO_DICT_APPEND(dict,
"ReferenceSignalReceivedQuality",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RSRP:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict,
+ CELL_INFO_DICT_APPEND(dict,
"ReferenceSignalReceivedPower",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_EARFCN:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "EARFCN",
+ CELL_INFO_DICT_APPEND(dict, "EARFCN",
intval, uint16_t, DBUS_TYPE_UINT16);
break;
case OFONO_NETMON_INFO_EBAND:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "EBand",
+ CELL_INFO_DICT_APPEND(dict, "EBand",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_CQI:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "ChannelQualityIndicator",
+ CELL_INFO_DICT_APPEND(dict, "ChannelQualityIndicator",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
@@ -244,8 +220,44 @@ void ofono_netmon_serving_cell_notify(struct ofono_netmon *netmon,
break;
}
- next_info_type = va_arg(arglist, int);
+ next_info_type = va_arg(*arglist, int);
}
+}
+
+void ofono_netmon_serving_cell_notify(struct ofono_netmon *netmon,
+ enum ofono_netmon_cell_type type,
+ int info_type, ...)
+{
+ va_list arglist;
+ DBusMessage *agent_notify = NULL;
+ DBusMessageIter iter;
+ DBusMessageIter dict;
+ const char *technology = cell_type_to_tech_name(type);
+
+ if (netmon->pending != NULL) {
+ netmon->reply = dbus_message_new_method_return(netmon->pending);
+ dbus_message_iter_init_append(netmon->reply, &iter);
+ } else if (netmon->agent != NULL) {
+ agent_notify = netmon_agent_new_method_call(netmon->agent,
+ "ServingCellInformationChanged");
+
+ dbus_message_iter_init_append(agent_notify, &iter);
+ } else
+ return;
+
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ OFONO_PROPERTIES_ARRAY_SIGNATURE,
+ &dict);
+
+ va_start(arglist, info_type);
+
+ if (technology == NULL)
+ goto done;
+
+ ofono_dbus_dict_append(&dict, "Technology",
+ DBUS_TYPE_STRING, &technology);
+
+ netmon_cell_info_dict_append(&dict, &arglist, info_type);
done:
va_end(arglist);
@@ -403,6 +415,109 @@ static DBusMessage *netmon_unregister_agent(DBusConnection *conn,
return dbus_message_new_method_return(msg);
}
+
+void ofono_netmon_neighbouring_cell_notify(struct ofono_netmon *netmon,
+ enum ofono_netmon_cell_type type,
+ int info_type, ...)
+{
+ va_list arglist;
+ DBusMessageIter dict;
+ DBusMessageIter strct;
+ const char *tech = cell_type_to_tech_name(type);
+
+ if (netmon->pending == NULL)
+ return;
+
+ if (!netmon->reply) {
+ netmon->reply = dbus_message_new_method_return(netmon->pending);
+ dbus_message_iter_init_append(netmon->reply, &netmon->iter);
+
+ dbus_message_iter_open_container(&netmon->iter, DBUS_TYPE_ARRAY,
+ DBUS_STRUCT_BEGIN_CHAR_AS_STRING
+ DBUS_TYPE_ARRAY_AS_STRING
+ DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+ DBUS_TYPE_STRING_AS_STRING
+ DBUS_TYPE_VARIANT_AS_STRING
+ DBUS_DICT_ENTRY_END_CHAR_AS_STRING
+ DBUS_STRUCT_END_CHAR_AS_STRING,
+ &netmon->arr);
+ }
+
+ tech = cell_type_to_tech_name(type);
+
+ dbus_message_iter_open_container(&netmon->arr, DBUS_TYPE_STRUCT,
+ NULL, &strct);
+ dbus_message_iter_open_container(&strct, DBUS_TYPE_ARRAY,
+ OFONO_PROPERTIES_ARRAY_SIGNATURE,
+ &dict);
+
+ va_start(arglist, info_type);
+
+ if (tech == NULL)
+ goto done;
+
+ ofono_dbus_dict_append(&dict, "Technology",
+ DBUS_TYPE_STRING, &tech);
+
+ netmon_cell_info_dict_append(&dict, &arglist, info_type);
+
+done:
+ va_end(arglist);
+
+ dbus_message_iter_close_container(&strct, &dict);
+ dbus_message_iter_close_container(&netmon->arr, &strct);
+}
+
+static void neighbouring_cell_info_callback(const struct ofono_error *error,
+ void *data)
+{
+ struct ofono_netmon *netmon = data;
+ DBusMessage *reply = netmon->reply;
+
+ DBG("");
+
+ if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+ if (reply)
+ dbus_message_unref(reply);
+
+ reply = __ofono_error_failed(netmon->pending);
+ } else if (!reply) {
+ DBusMessageIter iter;
+ DBusMessageIter dict;
+
+ reply = dbus_message_new_method_return(netmon->pending);
+ dbus_message_iter_init_append(reply, &iter);
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ OFONO_PROPERTIES_ARRAY_SIGNATURE,
+ &dict);
+ dbus_message_iter_close_container(&iter, &dict);
+ } else {
+ dbus_message_iter_close_container(&netmon->iter, &netmon->arr);
+ }
+
+ netmon->reply = NULL;
+ __ofono_dbus_pending_reply(&netmon->pending, reply);
+}
+
+static DBusMessage *netmon_get_neighbouring_cell_info(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct ofono_netmon *netmon = data;
+
+ if (!netmon->driver->neighbouring_cell_update)
+ return __ofono_error_not_implemented(msg);
+
+ if (netmon->pending)
+ return __ofono_error_busy(msg);
+
+ netmon->pending = dbus_message_ref(msg);
+
+ netmon->driver->neighbouring_cell_update(netmon,
+ neighbouring_cell_info_callback, netmon);
+
+ return NULL;
+}
+
static const GDBusMethodTable netmon_methods[] = {
{ GDBUS_ASYNC_METHOD("GetServingCellInformation",
NULL, GDBUS_ARGS({ "cellinfo", "a{sv}" }),
@@ -413,6 +528,9 @@ static const GDBusMethodTable netmon_methods[] = {
{ GDBUS_METHOD("UnregisterAgent",
GDBUS_ARGS({ "agent", "o" }), NULL,
netmon_unregister_agent) },
+ { GDBUS_ASYNC_METHOD("GetNeighbouringCellInformation",
+ NULL, GDBUS_ARGS({ "cellinfo", "a(a{sv})" }),
+ netmon_get_neighbouring_cell_info) },
{ }
};
--
1.9.1
1 year, 7 months
[PATCH 2/2] xmm7modem: enabling simtoolkit for xmm7modem
by Antara Borwankar
added code to create stk atom in xmm7modem plugin
---
plugins/xmm7xxx.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/plugins/xmm7xxx.c b/plugins/xmm7xxx.c
index 23a7d4e..da6622b 100644
--- a/plugins/xmm7xxx.c
+++ b/plugins/xmm7xxx.c
@@ -1225,6 +1225,7 @@ static void xmm7xxx_pre_sim(struct ofono_modem *modem)
ofono_devinfo_create(modem, OFONO_VENDOR_IFX, "atmodem", data->chat);
data->sim = ofono_sim_create(modem, OFONO_VENDOR_XMM, "atmodem",
data->chat);
+ ofono_stk_create(modem, OFONO_VENDOR_XMM, "atmodem", data->chat);
}
static void set_online_cb(gboolean ok, GAtResult *result, gpointer user_data)
--
1.9.1
1 year, 7 months
[PATCH] netmon: adding get functionality for neighbouring cell information
by Antara Borwankar
Handled the get neighbouring cell information function which returns
an array of signal strength of all neighbouring cells.
---
src/netmon.c | 258 +++++++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 188 insertions(+), 70 deletions(-)
diff --git a/src/netmon.c b/src/netmon.c
index 6c19df5..4596450 100644
--- a/src/netmon.c
+++ b/src/netmon.c
@@ -50,6 +50,8 @@ struct ofono_netmon {
const struct ofono_netmon_driver *driver;
DBusMessage *pending;
DBusMessage *reply;
+ DBusMessageIter iter;
+ DBusMessageIter arr;
void *driver_data;
struct ofono_atom *atom;
struct netmon_agent *agent;
@@ -69,174 +71,148 @@ static const char *cell_type_to_tech_name(enum ofono_netmon_cell_type type)
return NULL;
}
-void ofono_netmon_serving_cell_notify(struct ofono_netmon *netmon,
- enum ofono_netmon_cell_type type,
- int info_type, ...)
+static void netmon_cell_info_dict_append(DBusMessageIter *dict,
+ va_list *arglist, int info_type)
{
- va_list arglist;
- DBusMessage *agent_notify = NULL;
- DBusMessageIter iter;
- DBusMessageIter dict;
- enum ofono_netmon_info next_info_type = info_type;
- const char *technology = cell_type_to_tech_name(type);
char *mcc;
char *mnc;
+ char *cell_id;
int intval;
-
- if (netmon->pending != NULL) {
- netmon->reply = dbus_message_new_method_return(netmon->pending);
- dbus_message_iter_init_append(netmon->reply, &iter);
- } else if (netmon->agent != NULL) {
- agent_notify = netmon_agent_new_method_call(netmon->agent,
- "ServingCellInformationChanged");
-
- dbus_message_iter_init_append(agent_notify, &iter);
- } else
- return;
-
- dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
- OFONO_PROPERTIES_ARRAY_SIGNATURE,
- &dict);
-
- va_start(arglist, info_type);
-
- if (technology == NULL)
- goto done;
-
- ofono_dbus_dict_append(&dict, "Technology",
- DBUS_TYPE_STRING, &technology);
+ enum ofono_netmon_info next_info_type = info_type;
while (next_info_type != OFONO_NETMON_INFO_INVALID) {
switch (next_info_type) {
case OFONO_NETMON_INFO_MCC:
- mcc = va_arg(arglist, char *);
+ mcc = va_arg(*arglist, char *);
if (mcc && strlen(mcc))
- ofono_dbus_dict_append(&dict,
+ ofono_dbus_dict_append(dict,
"MobileCountryCode",
DBUS_TYPE_STRING, &mcc);
break;
case OFONO_NETMON_INFO_MNC:
- mnc = va_arg(arglist, char *);
+ mnc = va_arg(*arglist, char *);
if (mnc && strlen(mnc))
- ofono_dbus_dict_append(&dict,
+ ofono_dbus_dict_append(dict,
"MobileNetworkCode",
DBUS_TYPE_STRING, &mnc);
break;
case OFONO_NETMON_INFO_LAC:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "LocationAreaCode",
+ CELL_INFO_DICT_APPEND(dict, "LocationAreaCode",
intval, uint16_t, DBUS_TYPE_UINT16);
break;
case OFONO_NETMON_INFO_CI:
- intval = va_arg(arglist, int);
+ cell_id = va_arg(*arglist, char *);
- CELL_INFO_DICT_APPEND(&dict, "CellId",
- intval, uint32_t, DBUS_TYPE_UINT32);
+ if (cell_id && strlen(cell_id))
+ ofono_dbus_dict_append(dict,
+ "CellId",
+ DBUS_TYPE_STRING, &cell_id);
break;
case OFONO_NETMON_INFO_ARFCN:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "ARFCN",
+ CELL_INFO_DICT_APPEND(dict, "ARFCN",
intval, uint16_t, DBUS_TYPE_UINT16);
break;
case OFONO_NETMON_INFO_BSIC:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "BSIC",
+ CELL_INFO_DICT_APPEND(dict, "BSIC",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RXLEV:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "ReceivedSignalStrength",
+ CELL_INFO_DICT_APPEND(dict, "ReceivedSignalStrength",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_TIMING_ADVANCE:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "TimingAdvance",
+ CELL_INFO_DICT_APPEND(dict, "TimingAdvance",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_PSC:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "PrimaryScramblingCode",
+ CELL_INFO_DICT_APPEND(dict, "PrimaryScramblingCode",
intval, uint16_t, DBUS_TYPE_UINT16);
break;
case OFONO_NETMON_INFO_BER:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "BitErrorRate",
+ CELL_INFO_DICT_APPEND(dict, "BitErrorRate",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RSSI:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "Strength",
+ CELL_INFO_DICT_APPEND(dict, "Strength",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RSCP:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "ReceivedSignalCodePower",
+ CELL_INFO_DICT_APPEND(dict, "ReceivedSignalCodePower",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_ECN0:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "ReceivedEnergyRatio",
+ CELL_INFO_DICT_APPEND(dict, "ReceivedEnergyRatio",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RSRQ:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict,
+ CELL_INFO_DICT_APPEND(dict,
"ReferenceSignalReceivedQuality",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_RSRP:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict,
+ CELL_INFO_DICT_APPEND(dict,
"ReferenceSignalReceivedPower",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_EARFCN:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "EARFCN",
+ CELL_INFO_DICT_APPEND(dict, "EARFCN",
intval, uint16_t, DBUS_TYPE_UINT16);
break;
case OFONO_NETMON_INFO_EBAND:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "EBand",
+ CELL_INFO_DICT_APPEND(dict, "EBand",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
case OFONO_NETMON_INFO_CQI:
- intval = va_arg(arglist, int);
+ intval = va_arg(*arglist, int);
- CELL_INFO_DICT_APPEND(&dict, "ChannelQualityIndicator",
+ CELL_INFO_DICT_APPEND(dict, "ChannelQualityIndicator",
intval, uint8_t, DBUS_TYPE_BYTE);
break;
@@ -244,8 +220,44 @@ void ofono_netmon_serving_cell_notify(struct ofono_netmon *netmon,
break;
}
- next_info_type = va_arg(arglist, int);
+ next_info_type = va_arg(*arglist, int);
}
+}
+
+void ofono_netmon_serving_cell_notify(struct ofono_netmon *netmon,
+ enum ofono_netmon_cell_type type,
+ int info_type, ...)
+{
+ va_list arglist;
+ DBusMessage *agent_notify = NULL;
+ DBusMessageIter iter;
+ DBusMessageIter dict;
+ const char *technology = cell_type_to_tech_name(type);
+
+ if (netmon->pending != NULL) {
+ netmon->reply = dbus_message_new_method_return(netmon->pending);
+ dbus_message_iter_init_append(netmon->reply, &iter);
+ } else if (netmon->agent != NULL) {
+ agent_notify = netmon_agent_new_method_call(netmon->agent,
+ "ServingCellInformationChanged");
+
+ dbus_message_iter_init_append(agent_notify, &iter);
+ } else
+ return;
+
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ OFONO_PROPERTIES_ARRAY_SIGNATURE,
+ &dict);
+
+ va_start(arglist, info_type);
+
+ if (technology == NULL)
+ goto done;
+
+ ofono_dbus_dict_append(&dict, "Technology",
+ DBUS_TYPE_STRING, &technology);
+
+ netmon_cell_info_dict_append(&dict, &arglist, info_type);
done:
va_end(arglist);
@@ -403,6 +415,109 @@ static DBusMessage *netmon_unregister_agent(DBusConnection *conn,
return dbus_message_new_method_return(msg);
}
+
+void ofono_netmon_neighbouring_cell_notify(struct ofono_netmon *netmon,
+ enum ofono_netmon_cell_type type,
+ int info_type, ...)
+{
+ va_list arglist;
+ DBusMessageIter dict;
+ DBusMessageIter strct;
+ const char *tech = cell_type_to_tech_name(type);
+
+ if (netmon->pending == NULL)
+ return;
+
+ if (!netmon->reply) {
+ netmon->reply = dbus_message_new_method_return(netmon->pending);
+ dbus_message_iter_init_append(netmon->reply, &netmon->iter);
+
+ dbus_message_iter_open_container(&netmon->iter, DBUS_TYPE_ARRAY,
+ DBUS_STRUCT_BEGIN_CHAR_AS_STRING
+ DBUS_TYPE_ARRAY_AS_STRING
+ DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+ DBUS_TYPE_STRING_AS_STRING
+ DBUS_TYPE_VARIANT_AS_STRING
+ DBUS_DICT_ENTRY_END_CHAR_AS_STRING
+ DBUS_STRUCT_END_CHAR_AS_STRING,
+ &netmon->arr);
+ }
+
+ tech = cell_type_to_tech_name(type);
+
+ dbus_message_iter_open_container(&netmon->arr, DBUS_TYPE_STRUCT,
+ NULL, &strct);
+ dbus_message_iter_open_container(&strct, DBUS_TYPE_ARRAY,
+ OFONO_PROPERTIES_ARRAY_SIGNATURE,
+ &dict);
+
+ va_start(arglist, info_type);
+
+ if (tech == NULL)
+ goto done;
+
+ ofono_dbus_dict_append(&dict, "Technology",
+ DBUS_TYPE_STRING, &tech);
+
+ netmon_cell_info_dict_append(&dict, &arglist, info_type);
+
+done:
+ va_end(arglist);
+
+ dbus_message_iter_close_container(&strct, &dict);
+ dbus_message_iter_close_container(&netmon->arr, &strct);
+}
+
+static void neighbouring_cell_info_callback(const struct ofono_error *error,
+ void *data)
+{
+ struct ofono_netmon *netmon = data;
+ DBusMessage *reply = netmon->reply;
+
+ DBG("");
+
+ if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+ if (reply)
+ dbus_message_unref(reply);
+
+ reply = __ofono_error_failed(netmon->pending);
+ } else if (!reply) {
+ DBusMessageIter iter;
+ DBusMessageIter dict;
+
+ reply = dbus_message_new_method_return(netmon->pending);
+ dbus_message_iter_init_append(reply, &iter);
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ OFONO_PROPERTIES_ARRAY_SIGNATURE,
+ &dict);
+ dbus_message_iter_close_container(&iter, &dict);
+ } else {
+ dbus_message_iter_close_container(&netmon->iter, &netmon->arr);
+ }
+
+ netmon->reply = NULL;
+ __ofono_dbus_pending_reply(&netmon->pending, reply);
+}
+
+static DBusMessage *netmon_get_neighbouring_cell_info(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct ofono_netmon *netmon = data;
+
+ if (!netmon->driver->neighbouring_cell_update)
+ return __ofono_error_not_implemented(msg);
+
+ if (netmon->pending)
+ return __ofono_error_busy(msg);
+
+ netmon->pending = dbus_message_ref(msg);
+
+ netmon->driver->neighbouring_cell_update(netmon,
+ neighbouring_cell_info_callback, netmon);
+
+ return NULL;
+}
+
static const GDBusMethodTable netmon_methods[] = {
{ GDBUS_ASYNC_METHOD("GetServingCellInformation",
NULL, GDBUS_ARGS({ "cellinfo", "a{sv}" }),
@@ -413,6 +528,9 @@ static const GDBusMethodTable netmon_methods[] = {
{ GDBUS_METHOD("UnregisterAgent",
GDBUS_ARGS({ "agent", "o" }), NULL,
netmon_unregister_agent) },
+ { GDBUS_ASYNC_METHOD("GetNeighbouringCellInformation",
+ NULL, GDBUS_ARGS({ "cellinfo", "a(a{sv})" }),
+ netmon_get_neighbouring_cell_info) },
{ }
};
--
1.9.1
1 year, 7 months
[PATCH 3/3] xmm7modem: adding netmon changes for reporting neighbouring cell
by Antara Borwankar
Added netmon changes for xmm7modem driver to fetch neighbouring
cell information.
---
drivers/xmm7modem/netmon.c | 95 ++++++++++++++++++++++++++++++++++++----------
1 file changed, 76 insertions(+), 19 deletions(-)
diff --git a/drivers/xmm7modem/netmon.c b/drivers/xmm7modem/netmon.c
index ba70e2b..3ca0936 100644
--- a/drivers/xmm7modem/netmon.c
+++ b/drivers/xmm7modem/netmon.c
@@ -47,6 +47,7 @@ static const char *xmci_prefix[] = { "+XMCI:", NULL };
struct netmon_driver_data {
GAtChat *chat;
+ int xmci_mode;
};
enum xmci_ofono_type_info {
@@ -85,6 +86,7 @@ static void xmci_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct cb_data *cbd = user_data;
struct ofono_netmon *netmon = cbd->data;
+ struct netmon_driver_data *nmd = ofono_netmon_get_data(netmon);
ofono_netmon_cb_t cb = cbd->cb;
struct ofono_error error;
GAtResultIter iter;
@@ -96,6 +98,10 @@ static void xmci_cb(gboolean ok, GAtResult *result, gpointer user_data)
int ecn0 = -1;
int rsrq = -1;
int tech = -1;
+ int type = -1;
+ const char *cell_id;
+ char mcc[3];
+ char mnc[3];
DBG("ok %d", ok);
@@ -109,18 +115,21 @@ static void xmci_cb(gboolean ok, GAtResult *result, gpointer user_data)
g_at_result_iter_init(&iter, result);
while (g_at_result_iter_next(&iter, "+XMCI:")) {
- if (!g_at_result_iter_next_number(&iter, &number))
+ if (!g_at_result_iter_next_number(&iter, &type))
break;
- tech = xmm7modem_map_radio_access_technology(number);
+ tech = xmm7modem_map_radio_access_technology(type);
- switch (number) {
+ switch (type) {
+ case XMCI_GSM_NEIGH_CELL:
case XMCI_GSM_SERV_CELL:
- /* skip <MCC>,<MNC>,<LAC>,<CI>,<BSIC> */
- g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
+ /* <MCC>,<MNC>,<LAC>,<CI>,<BSIC> */
+ g_at_result_iter_next_number(&iter, &number);
+ snprintf(mcc, 3, "%d", number);
+ g_at_result_iter_next_number(&iter, &number);
+ snprintf(mnc, 3, "%d", number);
g_at_result_iter_skip_next(&iter);
+ g_at_result_iter_next_string(&iter, &cell_id);
g_at_result_iter_skip_next(&iter);
g_at_result_iter_next_number(&iter, &number);
@@ -129,15 +138,18 @@ static void xmci_cb(gboolean ok, GAtResult *result, gpointer user_data)
g_at_result_iter_next_number(&iter, &number);
ber = number != 99 ? number : ber;
break;
+ case XMCI_UMTS_NEIGH_CELL:
case XMCI_UMTS_SERV_CELL:
/*
- * skip <MCC>,<MNC>,<LAC>,<CI><PSC>,<DLUARFNC>,
+ * <MCC>,<MNC>,<LAC>,<CI><PSC>,<DLUARFNC>,
* <ULUARFCN>,<PATHLOSS>,<RSSI>
*/
+ g_at_result_iter_next_number(&iter, &number);
+ snprintf(mcc, 3, "%d", number);
+ g_at_result_iter_next_number(&iter, &number);
+ snprintf(mnc, 3, "%d", number);
g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
+ g_at_result_iter_next_string(&iter, &cell_id);
g_at_result_iter_skip_next(&iter);
g_at_result_iter_skip_next(&iter);
g_at_result_iter_skip_next(&iter);
@@ -150,15 +162,18 @@ static void xmci_cb(gboolean ok, GAtResult *result, gpointer user_data)
g_at_result_iter_next_number(&iter, &number);
ecn0 = number != 255 ? number : ecn0;
break;
+ case XMCI_LTE_NEIGH_CELL:
case XMCI_LTE_SERV_CELL:
/*
- * skip <MCC>,<MNC>,<TAC>,<CI>,<PCI>,<DLUARFNC>,
+ * <MCC>,<MNC>,<TAC>,<CI>,<PCI>,<DLUARFNC>,
* <ULUARFCN>,<PATHLOSS_LTE>
*/
+ g_at_result_iter_next_number(&iter, &number);
+ snprintf(mcc, 3, "%d", number);
+ g_at_result_iter_next_number(&iter, &number);
+ snprintf(mnc, 3, "%d", number);
g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
- g_at_result_iter_skip_next(&iter);
+ g_at_result_iter_next_string(&iter, &cell_id);
g_at_result_iter_skip_next(&iter);
g_at_result_iter_skip_next(&iter);
g_at_result_iter_skip_next(&iter);
@@ -174,8 +189,15 @@ static void xmci_cb(gboolean ok, GAtResult *result, gpointer user_data)
break;
}
- ofono_netmon_serving_cell_notify(netmon,
+ if ((nmd->xmci_mode == 0) &&
+ (type == XMCI_GSM_NEIGH_CELL ||
+ type == XMCI_UMTS_NEIGH_CELL ||
+ type == XMCI_LTE_NEIGH_CELL)) {
+ ofono_netmon_neighbouring_cell_notify(netmon,
tech,
+ OFONO_NETMON_INFO_MCC, mcc,
+ OFONO_NETMON_INFO_MNC, mnc,
+ OFONO_NETMON_INFO_CI, cell_id,
OFONO_NETMON_INFO_RXLEV, rxlev,
OFONO_NETMON_INFO_BER, ber,
OFONO_NETMON_INFO_RSCP, rscp,
@@ -183,10 +205,25 @@ static void xmci_cb(gboolean ok, GAtResult *result, gpointer user_data)
OFONO_NETMON_INFO_RSRQ, rsrq,
OFONO_NETMON_INFO_RSRP, rsrp,
OFONO_NETMON_INFO_INVALID);
-
- CALLBACK_WITH_SUCCESS(cb, cbd->data);
- break;
+ } else if ((nmd->xmci_mode == 1) &&
+ (type == XMCI_GSM_SERV_CELL ||
+ type == XMCI_UMTS_SERV_CELL ||
+ type == XMCI_LTE_SERV_CELL)) {
+ ofono_netmon_serving_cell_notify(netmon,
+ tech,
+ OFONO_NETMON_INFO_RXLEV, rxlev,
+ OFONO_NETMON_INFO_BER, ber,
+ OFONO_NETMON_INFO_RSCP, rscp,
+ OFONO_NETMON_INFO_ECN0, ecn0,
+ OFONO_NETMON_INFO_RSRQ, rsrq,
+ OFONO_NETMON_INFO_RSRP, rsrp,
+ OFONO_NETMON_INFO_INVALID);
+ break;
+ }
}
+
+ CALLBACK_WITH_SUCCESS(cb, cbd->data);
+ nmd->xmci_mode = -1;
}
static void xmm7modem_netmon_request_update(struct ofono_netmon *netmon,
@@ -194,6 +231,7 @@ static void xmm7modem_netmon_request_update(struct ofono_netmon *netmon,
{
struct netmon_driver_data *nmd = ofono_netmon_get_data(netmon);
struct cb_data *cbd = cb_data_new(cb, data);
+ nmd->xmci_mode = 1;
DBG("xmm7modem netmon request update");
@@ -205,6 +243,23 @@ static void xmm7modem_netmon_request_update(struct ofono_netmon *netmon,
CALLBACK_WITH_FAILURE(cb, data);
}
+static void xmm7modem_neighbouring_cell_update(struct ofono_netmon *netmon,
+ ofono_netmon_cb_t cb, void *data)
+{
+ struct netmon_driver_data *nmd = ofono_netmon_get_data(netmon);
+ struct cb_data *cbd = cb_data_new(cb, data);
+ nmd->xmci_mode = 0;
+
+ DBG("xmm7modem netmon request neighbouring cell update");
+
+ if (g_at_chat_send(nmd->chat, "AT+XMCI=0", xmci_prefix,
+ xmci_cb, cbd, g_free) > 0)
+ return;
+
+ g_free(cbd);
+ CALLBACK_WITH_FAILURE(cb, data);
+}
+
static gboolean ril_delayed_register(gpointer user_data)
{
struct ofono_netmon *netmon = user_data;
@@ -224,6 +279,7 @@ static int xmm7modem_netmon_probe(struct ofono_netmon *netmon,
nmd = g_new0(struct netmon_driver_data, 1);
nmd->chat = g_at_chat_clone(chat);
+ nmd->xmci_mode = -1;
ofono_netmon_set_data(netmon, nmd);
@@ -250,6 +306,7 @@ static const struct ofono_netmon_driver driver = {
.probe = xmm7modem_netmon_probe,
.remove = xmm7modem_netmon_remove,
.request_update = xmm7modem_netmon_request_update,
+ .neighbouring_cell_update = xmm7modem_neighbouring_cell_update,
};
void xmm_netmon_init(void)
--
1.9.1
1 year, 7 months
[PATCH 1/3] netmon: adding get function for neighbouring cell information
by Antara Borwankar
Added declaration of functions and structures required for getting
neighbouring cell information.
---
include/netmon.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/netmon.h b/include/netmon.h
index c8fcafa..a99d6ca 100644
--- a/include/netmon.h
+++ b/include/netmon.h
@@ -43,6 +43,8 @@ struct ofono_netmon_driver {
unsigned int enable,
unsigned int period,
ofono_netmon_cb_t cb, void *data);
+ void (*neighbouring_cell_update)(struct ofono_netmon *netmon,
+ ofono_netmon_cb_t cb, void *data);
};
enum ofono_netmon_cell_type {
@@ -104,6 +106,10 @@ void ofono_netmon_set_data(struct ofono_netmon *netmon, void *data);
void *ofono_netmon_get_data(struct ofono_netmon *netmon);
+void ofono_netmon_neighbouring_cell_notify(struct ofono_netmon *netmon,
+ enum ofono_netmon_cell_type type,
+ int info_type, ...);
+
#ifdef __cplusplus
}
#endif
--
1.9.1
1 year, 7 months