Add ModemAccessTechnology property handling
Hi,
This patch will add modem access technology property and its handling.
BR,
Rajesh
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
@@ -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
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@@ -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
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
-0c48375e..f5a3026 100644
doc/modem-api.txt +0
-0@@ -43,6 +43,15 @@ Properties boolean Powered [readwrite] modem. The Emergency is true if anemergency call or
doc/modem-api.txt Properties boolean Powered [readwrite]
Quoted 5 lines
doc/modem-api.txt +3
-0related operation is currently active. + string ModemAccessTechnology [readonly] + + Contains current access techonology ofthe 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 accesstechnology 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 accesstechnology 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
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
@@ -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
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
@@ -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
@@ -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
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
@@ -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
@@ -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
@@ -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