---
src/network.c | 14 +++++
src/ofono.h | 1 +
src/stk.c | 179 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 194 insertions(+), 0 deletions(-)
diff --git a/src/network.c b/src/network.c
index f1d7724..481ece8 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1852,3 +1852,17 @@ void *ofono_netreg_get_data(struct ofono_netreg *netreg)
{
return netreg->driver_data;
}
+
+unsigned int __ofono_netreg_get_tech(struct ofono_netreg *netreg)
+{
+ GSList *o;
+ unsigned int techs = 0;
+ struct network_operator_data *opd;
+
+ for (o = netreg->operator_list; o; o = o->next) {
+ opd = o->data;
+ techs |= opd->techs;
+ }
+
+ return techs;
+}
diff --git a/src/ofono.h b/src/ofono.h
index 4d76d20..c9d25ab 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -363,6 +363,7 @@ gboolean __ofono_netreg_remove_status_watch(struct
ofono_netreg *netreg,
void __ofono_netreg_set_base_station_name(struct ofono_netreg *netreg,
const char *name);
+unsigned int __ofono_netreg_get_tech(struct ofono_netreg *netreg);
#include <ofono/history.h>
diff --git a/src/stk.c b/src/stk.c
index 18beee6..eec1ddf 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -1989,6 +1989,180 @@ static gboolean handle_command_refresh(const struct
stk_command *cmd,
return TRUE;
}
+static gboolean get_tech(struct ofono_stk *stk, struct stk_response *rsp,
+ gboolean singleton)
+{
+ struct ofono_atom *atom;
+ struct ofono_netreg *netreg;
+ unsigned int tech;
+ unsigned int tech_stk = 0;
+ unsigned int i;
+ int length = 0;
+ int length_temp = 0;
+ enum stk_access_technology_type *techs;
+ static struct ofono_error error = { .type = OFONO_ERROR_TYPE_FAILURE };
+
+ atom = __ofono_modem_find_atom(__ofono_atom_get_modem(stk->atom),
+ OFONO_ATOM_TYPE_NETREG);
+ if (!atom || !__ofono_atom_get_registered(atom))
+ goto error;
+
+ netreg = __ofono_atom_get_data(atom);
+ tech = __ofono_netreg_get_tech(netreg);
+
+ if (tech == 0)
+ goto error;
+
+ /* Stk has different definition of access technology, so do some map */
+ if (tech & ((1 << ACCESS_TECHNOLOGY_GSM) ||
+ (1 << ACCESS_TECHNOLOGY_GSM_COMPACT) ||
+ (1 << ACCESS_TECHNOLOGY_GSM_EGPRS))) {
+ tech_stk |= 1 << STK_ACCESS_TECHNOLOGY_GSM;
+ length++;
+
+ if (singleton && (length == 1))
+ goto finish;
+ }
+
+ if (tech & ((1 << ACCESS_TECHNOLOGY_UTRAN) ||
+ (1 << ACCESS_TECHNOLOGY_UTRAN_HSDPA) ||
+ (1 << ACCESS_TECHNOLOGY_UTRAN_HSUPA) ||
+ (1 << ACCESS_TECHNOLOGY_UTRAN_HSDPA_HSUPA))) {
+ tech_stk |= 1 << STK_ACCESS_TECHNOLOGY_UTRAN;
+ length++;
+
+ if (singleton && (length == 1))
+ goto finish;
+ }
+
+ if (tech & (1 << ACCESS_TECHNOLOGY_EUTRAN)) {
+ tech_stk |= 1 << STK_ACCESS_TECHNOLOGY_EUTRAN;
+ length++;
+ }
+
+finish:
+ if (length == 0)
+ goto error;
+
+ techs = g_try_malloc(length);
+ if (!techs)
+ goto error;
+
+ for (i = 0; i < sizeof(tech_stk) * 8; i++)
+ if (tech_stk & (1 << i))
+ techs[length_temp++] = i;
+
+ rsp->provide_local_info.access_technologies.techs = techs;
+ rsp->provide_local_info.access_technologies.length = length;
+ rsp->result.type = STK_RESULT_TYPE_SUCCESS;
+
+ if (stk_respond(stk, rsp, stk_command_cb))
+ stk_command_cb(&error, stk);
+
+ g_free(techs);
+ return FALSE;
+
+error:
+ rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+ return TRUE;
+}
+
+static gboolean handle_command_provide_local_info(const struct stk_command
*cmd,
+ struct stk_response *rsp, struct ofono_stk *stk)
+{
+ switch (cmd->qualifier) {
+ case 0:
+ DBG("Location Information");
+ rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+ return TRUE;
+
+ case 1:
+ DBG("IMEI");
+ rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+ return TRUE;
+
+ case 2:
+ DBG("Network Measurement results");
+ rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+ return TRUE;
+
+ case 3:
+ DBG("Date, time and time zone");
+ rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+ return TRUE;
+
+ case 4:
+ DBG("Language setting");
+ rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+ return TRUE;
+
+ case 5:
+ DBG("Timing Advance");
+ rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+ return TRUE;
+
+ case 6:
+ DBG("Access Technology");
+ return get_tech(stk, rsp, TRUE);
+
+ case 7:
+ DBG("ESN");
+ rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+ return TRUE;
+
+ case 8:
+ DBG("IMEISV");
+ rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+ return TRUE;
+
+ case 9:
+ DBG("Search Mode");
+ rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+ return TRUE;
+
+ case 10:
+ DBG("Charge State of the Battery");
+ rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+ return TRUE;
+
+ case 11:
+ DBG("MEID");
+ rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+ return TRUE;
+
+ case 12:
+ DBG("current WSID");
+ rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+ return TRUE;
+
+ case 13:
+ DBG("Broadcast Network information");
+ rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+ return TRUE;
+
+ case 14:
+ DBG("Multiple Access Technologies");
+ return get_tech(stk, rsp, FALSE);
+
+ case 15:
+ DBG("Location Information for multiple access technologies");
+ rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+ return TRUE;
+
+ case 16:
+ DBG("Network Measurement results for "
+ "multiple access technologies");
+ rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+ return TRUE;
+
+ default:
+ ofono_info("Undefined Provide Local Information qualifier: %d",
+ cmd->qualifier);
+ rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
+ return TRUE;
+ }
+}
+
static void send_dtmf_cancel(struct ofono_stk *stk)
{
struct ofono_voicecall *vc = NULL;
@@ -2421,6 +2595,11 @@ void ofono_stk_proactive_command_notify(struct ofono_stk
*stk,
&rsp, stk);
break;
+ case STK_COMMAND_TYPE_PROVIDE_LOCAL_INFO:
+ respond = handle_command_provide_local_info(stk->pending_cmd,
+ &rsp, stk);
+ break;
+
case STK_COMMAND_TYPE_SEND_DTMF:
respond = handle_command_send_dtmf(stk->pending_cmd,
&rsp, stk);
--
1.7.2.3
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono