All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Provide Local Information
@ 2010-11-18 10:55 Yang Gu
  2010-11-18 10:55 ` [PATCH 1/2] stk: provide access technology info Yang Gu
  2010-11-18 10:55 ` [PATCH 2/2] network: Use bit as size instead of byte Yang Gu
  0 siblings, 2 replies; 7+ messages in thread
From: Yang Gu @ 2010-11-18 10:55 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 939 bytes --]

Currently only the access technology in proactive command "Provide Local Information" is handled. In order not to bloat the patch, I plan to send the left parts in separate patches. Would you please review this part first?
I have some concerns/questions on this command:
1. The definition of access technology got from network is different from the definition in stk, so I did some map here. Please comment if I made something wrong.
2. How about if oFono couldn't provide some information. For example, if oFono couldn't provide the time info, need we ask the application to provide one? Thus we'd need to introduce an agent.

Yang Gu (2):
  stk: provide access technology info
  network: Use bit as size instead of byte

 src/network.c |   18 +++++-
 src/ofono.h   |    1 +
 src/stk.c     |  179 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 196 insertions(+), 2 deletions(-)

-- 
1.7.2.3


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] stk: provide access technology info
  2010-11-18 10:55 [PATCH 0/2] Provide Local Information Yang Gu
@ 2010-11-18 10:55 ` Yang Gu
  2010-11-18 13:36   ` Jeevaka.Badrappan
  2010-11-18 10:55 ` [PATCH 2/2] network: Use bit as size instead of byte Yang Gu
  1 sibling, 1 reply; 7+ messages in thread
From: Yang Gu @ 2010-11-18 10:55 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 6221 bytes --]

---
 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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] network: Use bit as size instead of byte
  2010-11-18 10:55 [PATCH 0/2] Provide Local Information Yang Gu
  2010-11-18 10:55 ` [PATCH 1/2] stk: provide access technology info Yang Gu
@ 2010-11-18 10:55 ` Yang Gu
  1 sibling, 0 replies; 7+ messages in thread
From: Yang Gu @ 2010-11-18 10:55 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 813 bytes --]

---
 src/network.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/network.c b/src/network.c
index 481ece8..5320f8d 100644
--- a/src/network.c
+++ b/src/network.c
@@ -129,7 +129,7 @@ static char **network_operator_technologies(struct network_operator_data *opd)
 	char **techs;
 	unsigned int i;
 
-	for (i = 0; i < sizeof(opd->techs); i++) {
+	for (i = 0; i < sizeof(opd->techs) * 8; i++) {
 		if (opd->techs & (1 << i))
 			ntechs += 1;
 	}
@@ -137,7 +137,7 @@ static char **network_operator_technologies(struct network_operator_data *opd)
 	techs = g_new0(char *, ntechs + 1);
 	ntechs = 0;
 
-	for (i = 0; i < sizeof(opd->techs); i++) {
+	for (i = 0; i < sizeof(opd->techs) * 8; i++) {
 		if (!(opd->techs & (1 << i)))
 			continue;
 
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: [PATCH 1/2] stk: provide access technology info
  2010-11-18 10:55 ` [PATCH 1/2] stk: provide access technology info Yang Gu
@ 2010-11-18 13:36   ` Jeevaka.Badrappan
  2010-11-19  6:04     ` Gu, Yang
  0 siblings, 1 reply; 7+ messages in thread
From: Jeevaka.Badrappan @ 2010-11-18 13:36 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 976 bytes --]

Hi Yang,
 
> +
> +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;
> +}

Is this function intended to get the current access technology?  

As per the ETSI TS 102 223 specification 4.12 section, when the SAT
issues Provide Local Information proactive command with Access
Technology(0x06) as the command qualifier, we should provide the current
access technology . So, as per my understanding we need to use
netreg->technology. 

> void __ofono_netreg_set_base_station_name(struct ofono_netreg *netreg,
> 						const char *name);
> +unsigned int __ofono_netreg_get_tech(struct ofono_netreg *netreg);
 
Empty line needed between __ofono_netreg_set_base_station_name and
__ofono_netreg_get_tech

Regards,
Jeevaka

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH 1/2] stk: provide access technology info
  2010-11-18 13:36   ` Jeevaka.Badrappan
@ 2010-11-19  6:04     ` Gu, Yang
  2010-11-19  7:17       ` Rajesh.Nagaiah
  0 siblings, 1 reply; 7+ messages in thread
From: Gu, Yang @ 2010-11-19  6:04 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1103 bytes --]

Hi Jeevaka,

>
>As per the ETSI TS 102 223 specification 4.12 section, when the SAT
>issues Provide Local Information proactive command with Access
>Technology(0x06) as the command qualifier, we should provide the current
>access technology . So, as per my understanding we need to use
>netreg->technology.
>
>> void __ofono_netreg_set_base_station_name(struct ofono_netreg *netreg,
>> 						const char *name);
>> +unsigned int __ofono_netreg_get_tech(struct ofono_netreg *netreg);
>
>Empty line needed between __ofono_netreg_set_base_station_name and
>__ofono_netreg_get_tech

I think you're right. I'm not quite clear about the difference. Could you help me clarify several questions? 
Does it mean COPS only returns current available access technology, while CREG returns current connected access technology? 
And if netreg->technology is used, what should be returned once the multiple access technologies are requested? It seems oFono only supports one connected technology.
In which situation we can connect to multiple access technologies simultaneously?


Regards,
-Yang

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH 1/2] stk: provide access technology info
  2010-11-19  6:04     ` Gu, Yang
@ 2010-11-19  7:17       ` Rajesh.Nagaiah
  2010-11-19  7:27         ` Gu, Yang
  0 siblings, 1 reply; 7+ messages in thread
From: Rajesh.Nagaiah @ 2010-11-19  7:17 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1440 bytes --]


Hi Yang,
 
> I think you're right. I'm not quite clear about the 
> difference. Could you help me clarify several questions? 
> Does it mean COPS only returns current available access 
> technology, while CREG returns current connected access technology?

COPS returns the currently available operators and its
corresponding access technologies. CREG returns the currently
registered operator's access techonology. In provide local
information as Jeeva mentioned we have to include only the current
registered access technology.

So the logic used in 
+static gboolean get_tech(struct ofono_stk *stk, struct stk_response
*rsp,
+							gboolean
singleton)
should also be changed apart from the
+unsigned int __ofono_netreg_get_tech(struct ofono_netreg *netreg)
change.
 
> And if netreg->technology is used, what should be returned 
> once the multiple access technologies are requested? 

As said above, in this case only the current registered access 
technology should be returned and so irrespective of a platform
supporting multiple technologies, the currently registered access
technology will be only one type in a Single mode active case.

> It seems oFono only supports one connected technology.

Yes, currently only Single mode active case is supported.

> In which situation we can connect to multiple access 
> technologies simultaneously?

In Dual Mode Dual standby case. 

BR,
Rajesh

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH 1/2] stk: provide access technology info
  2010-11-19  7:17       ` Rajesh.Nagaiah
@ 2010-11-19  7:27         ` Gu, Yang
  0 siblings, 0 replies; 7+ messages in thread
From: Gu, Yang @ 2010-11-19  7:27 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1612 bytes --]

Hi Rajesh & Jeevaka

>> I think you're right. I'm not quite clear about the
>> difference. Could you help me clarify several questions?
>> Does it mean COPS only returns current available access
>> technology, while CREG returns current connected access technology?
>
>COPS returns the currently available operators and its
>corresponding access technologies. CREG returns the currently
>registered operator's access techonology. In provide local
>information as Jeeva mentioned we have to include only the current
>registered access technology.
>
>So the logic used in
>+static gboolean get_tech(struct ofono_stk *stk, struct stk_response
>*rsp,
>+							gboolean
>singleton)
>should also be changed apart from the
>+unsigned int __ofono_netreg_get_tech(struct ofono_netreg *netreg)
>change.
>
>> And if netreg->technology is used, what should be returned
>> once the multiple access technologies are requested?
>
>As said above, in this case only the current registered access
>technology should be returned and so irrespective of a platform
>supporting multiple technologies, the currently registered access
>technology will be only one type in a Single mode active case.
>
>> It seems oFono only supports one connected technology.
>
>Yes, currently only Single mode active case is supported.
>
>> In which situation we can connect to multiple access
>> technologies simultaneously?
>
>In Dual Mode Dual standby case.

Thank you both for the comments and answers to help me clarify the problems, also make the code simpler than what I thought ;)


Regards,
-Yang


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-11-19  7:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-18 10:55 [PATCH 0/2] Provide Local Information Yang Gu
2010-11-18 10:55 ` [PATCH 1/2] stk: provide access technology info Yang Gu
2010-11-18 13:36   ` Jeevaka.Badrappan
2010-11-19  6:04     ` Gu, Yang
2010-11-19  7:17       ` Rajesh.Nagaiah
2010-11-19  7:27         ` Gu, Yang
2010-11-18 10:55 ` [PATCH 2/2] network: Use bit as size instead of byte Yang Gu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.