Skip to contentSkip to conversation

Add ModemAccessTechnology property handling

PATCH In review Rajesh Kadhiravan Nagaiah 2 participants 7 messages Oct 28, 2010

lore
Share & tools
lore
#1 lore raw

PATCH 1/4 doc: Add ModemAccessTechnology property

---
 doc/modem-api.txt |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
doc/modem-api.txt +9 -0
index c48375e..f5a3026 100644
@@ -43,6 +43,15 @@ Properties	boolean Powered [readwrite]
 			modem. The Emergency is true if an emergency call or
 			related operation is currently active.
 
+		string ModemAccessTechnology [readonly]
+
+			Contains current access techonology of the modem.
+			Possible values are:
+			"gsm" - the current modem access technology is GSM
+			"cdma" - the current modem access technology is CDMA
+
+			By default oFono uses "gsm" setting.
+
 		string Name [readonly, optional]
 
 			Friendly name of the modem device.
Signature · 1 line
1.7.0.4
#2 lore raw

Re: [PATCH 1/4] doc: Add ModemAccessTechnology property

Hi Rajesh,

Quoted 10 lines
 doc/modem-api.txt |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
doc/modem-api.txt +0 -0
index c48375e..f5a3026 100644
@@ -43,6 +43,15 @@ Properties	boolean Powered [readwrite]
 			modem. The Emergency is true if an emergency call or
 			related operation is currently active.

doc/modem-api.txt Properties boolean Powered [readwrite] · line 54

Quoted 10 lines
doc/modem-api.txt +9 -0
 
+		string ModemAccessTechnology [readonly]
+
+			Contains current access techonology of the modem.
+			Possible values are:
+			"gsm" - the current modem access technology is GSM
+			"cdma" - the current modem access technology is CDMA
+
+			By default oFono uses "gsm" setting.
+

so you are in the org.ofono.Modem interface and its properties and you wanna prefix the property with "Modem". That is rather pointless duplication of information. So just strip that.

The obvious question we have to discuss, if we really wanna do it this way. What are the pros and what are the cons?

Regards

Marcel

#3 lore raw

RE: [PATCH 1/4] doc: Add ModemAccessTechnology property

Hi Marcel,

Quoted 23 lines

Hi Rajesh,

doc/modem-api.txt Properties boolean Powered [readwrite] · line 43

Quoted 9 lines
 doc/modem-api.txt |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
doc/modem-api.txt index renamed from doc/modem-api.txt +0 -0

c48375e..f5a3026 100644

doc/modem-api.txt +0 -0
@@ -43,6 +43,15 @@ Properties	boolean Powered [readwrite]
 			modem. The Emergency is true if an 

emergency call or

doc/modem-api.txt Properties boolean Powered [readwrite]

Quoted 5 lines
doc/modem-api.txt +3 -0
 			related operation is currently active.
 
+		string ModemAccessTechnology [readonly]
+
+			Contains current access techonology of 

the modem.

doc/modem-api.txt Properties boolean Powered [readwrite] · line 50

Quoted 2 lines
doc/modem-api.txt +2 -0
+			Possible values are:
+			"gsm" - the current modem access 

technology is GSM

doc/modem-api.txt Properties boolean Powered [readwrite] · line 51

Quoted 1 line
doc/modem-api.txt +1 -0
+			"cdma" - the current modem access 

technology is CDMA

Quoted 8 lines

doc/modem-api.txt Properties boolean Powered [readwrite] · line 54

Quoted 3 lines
doc/modem-api.txt +3 -0
+
+			By default oFono uses "gsm" setting.
+

so you are in the org.ofono.Modem interface and its properties and you wanna prefix the property with "Modem". That is rather pointless duplication of information. So just strip that.

I prefix it with Modem just not to mix with the Network Access Technology. From the property name prespective I agree with you, its an redundant info as we are in org.ofono.Modem interface

Quoted 2 lines

The obvious question we have to discuss, if we really wanna do it this way. What are the pros and what are the cons?

I quite didnt get this query, pros and cons about this property usage or ?

BR,
Rajesh

#4 lore raw

PATCH 2/4 types: Add modem access technology enumeration

In reply to Rajesh Kadhiravan Nagaiah
---
 include/types.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
include/types.h +5 -0
index ba2481f..72bc896 100644
@@ -71,6 +71,11 @@ enum ofono_disconnect_reason {
 	OFONO_DISCONNECT_REASON_ERROR,
 };
 
+enum ofono_modem_access_technology {
+	OFONO_MODEM_ACCESS_TECHNOLOGY_GSM,
+	OFONO_MODEM_ACCESS_TECHNOLOGY_CDMA,
+};
+
 struct ofono_error {
 	enum ofono_error_type type;
 	int error;
Signature · 1 line
1.7.0.4
#5 lore raw

PATCH 3/4 common: Add modem access tech to string function

In reply to Rajesh Kadhiravan Nagaiah
---
 src/common.c |   12 ++++++++++++
 src/common.h |    2 ++
 2 files changed, 14 insertions(+), 0 deletions(-)
src/common.c +12 -0
index b5b9a6f..9b57b98 100644
@@ -673,6 +673,18 @@ const char *registration_tech_to_string(int tech)
 	}
 }
 
+const char *modem_access_tech_to_string(int access_tech)
+{
+	switch (access_tech) {
+	case OFONO_MODEM_ACCESS_TECHNOLOGY_GSM:
+		return "gsm";
+	case OFONO_MODEM_ACCESS_TECHNOLOGY_CDMA:
+		return "cdma";
+	default:
+		return "";
+	}
+}
+
 gboolean is_valid_apn(const char *apn)
 {
 	int i;
src/common.h +2 -0
index 8b5798a..f58ed68 100644
@@ -146,4 +146,6 @@ gboolean is_valid_pin(const char *pin, enum pin_type type);
 const char *registration_status_to_string(int status);
 const char *registration_tech_to_string(int tech);
 
+const char *modem_access_tech_to_string(int access_tech);
+
 gboolean is_valid_apn(const char *apn);
Signature · 1 line
1.7.0.4
#6 lore raw

PATCH 4/4 modem: Add modem access tech set/get functions

In reply to Rajesh Kadhiravan Nagaiah
---
 include/modem.h |    4 ++++
 src/modem.c     |   30 ++++++++++++++++++++++++++++++
 src/ofono.h     |    2 ++
 3 files changed, 36 insertions(+), 0 deletions(-)
include/modem.h +4 -0
index 7b13ee0..de941a9 100644
@@ -69,6 +69,10 @@ ofono_bool_t ofono_modem_get_boolean(struct ofono_modem *modem,
 typedef void (*ofono_modem_online_cb_t)(const struct ofono_error *error,
 					void *data);
 
+void ofono_modem_set_access_tech(struct ofono_modem *modem,
+					int access_tech);
+int ofono_modem_get_access_tech(struct ofono_modem *modem);
+
 struct ofono_modem_driver {
 	const char *name;
 
src/modem.c +30 -0
index 3776461..cec6dd8 100644
@@ -61,6 +61,7 @@ enum modem_state {
 struct ofono_modem {
 	char			*path;
 	enum modem_state	modem_state;
+	guint8			access_tech;
 	GSList			*atoms;
 	struct ofono_watchlist	*atom_watches;
 	GSList			*interface_list;
@@ -1268,6 +1269,35 @@ ofono_bool_t ofono_modem_get_boolean(struct ofono_modem *modem, const char *key)
 	return value;
 }
 
+void ofono_modem_set_access_tech(struct ofono_modem *modem, int access_tech)
+{
+	const char *tech = modem_access_tech_to_string(access_tech);
+	DBusConnection *conn = ofono_dbus_get_connection();
+
+	modem->access_tech = access_tech;
+	ofono_dbus_signal_property_changed(conn, modem->path,
+					OFONO_MODEM_INTERFACE,
+					"ModemAccessTechnology",
+					DBUS_TYPE_STRING,
+					&tech);
+}
+
+int ofono_modem_get_access_tech(struct ofono_modem *modem)
+{
+	if (modem == NULL)
+		return -1;
+
+	return modem->access_tech;
+}
+
+int __ofono_modem_get_access_tech(struct ofono_modem *modem)
+{
+	if (modem == NULL)
+		return -1;
+
+	return modem->access_tech;
+}
+
 void ofono_modem_set_name(struct ofono_modem *modem, const char *name)
 {
 	if (modem->name)
src/ofono.h +2 -0
index bd7f33c..b4974a3 100644
@@ -99,6 +99,8 @@ void __ofono_modem_callid_release(struct ofono_modem *modem, int id);
 void __ofono_modem_append_properties(struct ofono_modem *modem,
 						DBusMessageIter *dict);
 
+int __ofono_modem_get_access_tech(struct ofono_modem *modem);
+
 struct ofono_atom;
 
 enum ofono_atom_type {
Signature · 1 line
1.7.0.4