netmon: modified api.txt for network monitor agent
PATCH 1/7 netmon: modified api.txt for network monitor agent
added new DBUS methods RegisterAgent and UnregisterAgent to Networkmonitor interface so that any client of ofono can register for serving cell updates. Added new agent interface NetworkMonitorAgent with two methods, ServingCellInformationChanged and Release.
--- doc/networkmonitor-api.txt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
doc/networkmonitor-api.txt +28 -0
@@ -22,6 +22,34 @@ Methods a{sv} GetServingCellInformation() are available, their valid value ranges and applicability to different cell types. + void RegisterAgent(object path) + + Registers an agent which will be called whenever the + modem registers to or moves to a new cell. + + void UnregisterAgent(object path) + + Unregisters an agent. + +NetworkMonitorAgent Hierarchy [experimental] +============================= + +Service unique name +Interface org.ofono.NetworkMonitorAgent +Object path freely definable + +Methods void ServingCellInformationChanged(a{sv}) + + This method is called whenever the serving cell + information has been updated. + + Possible Errors: None + + void Release() [noreply] + + Agent is being released, possibly because of oFono + terminating, NetworkMonitor interface is being torn + down or modem off. No UnregisterAgent call is needed. Network Monitor Property Types ==============================
Signature · 1 line
1.9.1
PATCH 2/7 include: added enable_periodic_update in netmon driver
Defining new method in ofono_netmon_driver, enable_periodic_update useful to get periodic update on serving cell information.
--- include/netmon.h | 4 ++++ 1 file changed, 4 insertions(+)
include/netmon.h +4 -0
@@ -39,6 +39,10 @@ struct ofono_netmon_driver {void (*remove)(struct ofono_netmon *netmon);void (*request_update)(struct ofono_netmon *netmon,ofono_netmon_cb_t cb,void *data); +void (*enable_periodic_update)(struct ofono_netmon *netmon, +unsigned int enable, +unsigned int period, +ofono_netmon_cb_t cb,void *data); };enum ofono_netmon_cell_type {
Signature · 1 line
1.9.1
PATCH 3/7 include: added NetworkMonitorAgent interface
In reply to Nishanth V--- include/dbus.h | 1 + 1 file changed, 1 insertion(+)
include/dbus.h +1 -0
@@ -61,6 +61,7 @@ extern "C" {#define OFONO_HANDSFREE_INTERFACE OFONO_SERVICE ".Handsfree"#define OFONO_SIRI_INTERFACE OFONO_SERVICE ".Siri"#define OFONO_NETMON_INTERFACE OFONO_SERVICE ".NetworkMonitor" +#define OFONO_NETMON_AGENT_INTERFACE OFONO_SERVICE ".NetworkMonitorAgent"#define OFONO_LTE_INTERFACE OFONO_SERVICE ".LongTermEvolution"/* CDMA Interfaces */
Signature · 1 line
1.9.1
PATCH 4/7 netmon: core changes for network monitor agent
In reply to Nishanth VAdded implementation for RegisterAgent and UnregisterAgent in NetworkMonitor interface and added netmonagent source file for agent implemention.
--- Makefile.am | 3 +- src/netmon.c | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- src/netmonagent.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/netmonagent.h | 23 ++++++++++ src/ofono.conf | 1 + 5 files changed, 270 insertions(+), 5 deletions(-) create mode 100644 src/netmonagent.c create mode 100644 src/netmonagent.h
Makefile.am +2 -1
@@ -626,7 +626,8 @@ src_ofonod_SOURCES = $(builtin_sources) $(gatchat_sources) src/ofono.ver \ src/cdma-provision.c src/handsfree.c \ src/handsfree-audio.c src/bluetooth.h \ src/hfp.h src/siri.c \ - src/netmon.c src/lte.c + src/netmon.c src/lte.c \ + src/netmonagent.c src/netmonagent.h src_ofonod_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \ @GLIB_LIBS@ @DBUS_LIBS@ -ldl
src/netmon.c +122 -4
168 lines not on this page · raw message
src/netmonagent.c new file +122 -0
122 lines not on this page · raw message
src/netmonagent.h new file +23 -0
@@ -0,0 +1,23 @@ +struct netmon_agent ; + +struct netmon_agent *netmon_agent_new (const char *path,const char *sender); + +void netmon_agent_free (struct netmon_agent *agent); + +void netmon_agent_set_removed_notify (struct netmon_agent *agent, +ofono_destroy_func removed_cb, +void *user_data); + +ofono_bool_t netmon_agent_matches (struct netmon_agent *agent, +const char *path,const char *sender); + +ofono_bool_t netmon_agent_sender_matches (struct netmon_agent *agent, +const char *sender); + +DBusMessage *netmon_agent_new_method_call (struct netmon_agent *netmon, +const char *method); + +void netmon_agent_send_no_reply (struct netmon_agent *agent, +DBusMessage *message); + +void netmon_agent_test (struct netmon_agent *agent);
src/ofono.conf +1 -0
@@ -15,6 +15,7 @@ <allow send_interface="org.ofono.SmartMessagingAgent"/> <allow send_interface="org.ofono.PositioningRequestAgent"/> <allow send_interface="org.ofono.HandsfreeAudioAgent"/> + <allow send_interface="org.ofono.NetworkMonitorAgent"/> </policy> <policy at_console="true">
Signature · 1 line
1.9.1
PATCH 5/7 gril: added RIL constants for cell info list
In reply to Nishanth Vadded RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE and RIL_UNSOL_CELL_INFO_LIST and corresponding string conversion
--- gril/grilutil.c | 4 ++++ gril/ril_constants.h | 2 ++ 2 files changed, 6 insertions(+)
gril/grilutil.c +4 -0
@@ -338,6 +338,8 @@ const char *ril_request_id_to_string(int req)return "RIL_REQUEST_GET_CELL_INFO_LIST" ;case RIL_REQUEST_SET_INITIAL_ATTACH_APN :return "RIL_REQUEST_SET_INITIAL_ATTACH_APN" ; +case RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE : +return "RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE" ;default :return "<INVALID>" ; }
@@ -416,6 +418,8 @@ const char *ril_unsol_request_to_string(int request)return "UNSOL_EXIT_EMERGENCY_CALLBACK_MODE" ;case RIL_UNSOL_RIL_CONNECTED :return "UNSOL_RIL_CONNECTED" ; +case RIL_UNSOL_CELL_INFO_LIST : +return "RIL_UNSOL_CELL_INFO_LIST" ;default :return "<unknown request>" ; }
gril/ril_constants.h +2 -0
@@ -348,6 +348,7 @@#define RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS 107#define RIL_REQUEST_VOICE_RADIO_TECH 108#define RIL_REQUEST_GET_CELL_INFO_LIST 109 +#define RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE 110#define RIL_REQUEST_SET_INITIAL_ATTACH_APN 111/* RIL Unsolicited Messages */
@@ -388,6 +389,7 @@#define RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE 1033#define RIL_UNSOL_RIL_CONNECTED 1034#define RIL_UNSOL_VOICE_RADIO_TECH_CHANGED 1035 +#define RIL_UNSOL_CELL_INFO_LIST 1036/* Suplementary services Service class*/ #define SERVICE_CLASS_NONE 0
Signature · 1 line
1.9.1
PATCH 6/7 rilmodem: driver changes for netmon agent
In reply to Nishanth VRilmodem driver updated to handle enabling
and disabling periodic serving cell updates
--- drivers/rilmodem/netmon.c | 98 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 87 insertions(+), 11 deletions(-)
drivers/rilmodem/netmon.c +87 -11
@@ -61,6 +61,9 @@/* size of RIL_CellInfoTdscdma */ #define NETMON_RIL_CELLINFO_SIZE_TDSCDMA 24 +#define MSECS_RATE_INVALID (0x7fffffff) +#define SECS_TO_MSECS (x) ((x) * 1000) +struct netmon_data {GRil *ril; };
@@ -96,11 +99,9 @@ static int ril_cell_type_to_size(int cell_type)return 0 ; } -static void ril_netmon_update_cb (struct ril_msg *message,gpointer user_data) +static int process_cellinfo_list (struct ril_msg *message, +struct ofono_netmon *netmon) { -struct cb_data *cbd = user_data; -ofono_netmon_cb_t cb = cbd->cb; -struct ofono_netmon *netmon = cbd->data;struct parcel rilp;int skip_len;int cell_info_cnt;
@@ -114,7 +115,7 @@ static void ril_netmon_update_cb(struct ril_msg *message, gpointer user_data)int i, j;if (message->error !=RIL_E_SUCCESS ) - goto error; +return OFONO_ERROR_TYPE_FAILURE ;g_ril_init_parcel (message, &rilp);
@@ -146,7 +147,7 @@ static void ril_netmon_update_cb(struct ril_msg *message, gpointer user_data) }if (!registered) - goto error; +return OFONO_ERROR_TYPE_FAILURE ;if (cell_type ==NETMON_RIL_CELLINFO_TYPE_GSM ) { mcc =parcel_r_int32 (&rilp);
@@ -216,17 +217,53 @@ static void ril_netmon_update_cb(struct ril_msg *message, gpointer user_data)OFONO_NETMON_INFO_BER , ber, OFONO_NETMON_INFO_INVALID); - }else { - goto error; } -CALLBACK_WITH_SUCCESS (cb, cbd->data); -return ; +return OFONO_ERROR_TYPE_NO_ERROR ; +} + +static void ril_netmon_update_cb (struct ril_msg *message,gpointer user_data) +{ +struct cb_data *cbd = user_data; +ofono_netmon_cb_t cb = cbd->cb; +struct ofono_netmon *netmon = cbd->data; + +if (process_cellinfo_list (message, netmon) == +OFONO_ERROR_TYPE_NO_ERROR ) { +CALLBACK_WITH_SUCCESS (cb, cbd->data); +return ; + } -error:CALLBACK_WITH_FAILURE (cb, cbd->data); } +static void ril_cellinfo_notify (struct ril_msg *message,gpointer user_data) +{ +struct ofono_netmon *netmon = user_data; + +process_cellinfo_list (message, netmon); +} + +static void setup_cell_info_notify (struct ofono_netmon *netmon) +{ +struct netmon_data *nmd =ofono_netmon_get_data (netmon); +struct parcel rilp; + +parcel_init (&rilp); + +parcel_w_int32 (&rilp,1 );/* Number of elements */ + +parcel_w_int32 (&rilp,MSECS_RATE_INVALID ); + +if (g_ril_send (nmd->ril,RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE , + &rilp,NULL ,NULL ,NULL ) ==0 ) +ofono_error ("%s: setup failed\n" , __func__); + +if (g_ril_register (nmd->ril,RIL_UNSOL_CELL_INFO_LIST , + ril_cellinfo_notify, netmon) ==0 ) +ofono_error ("%s: setup failed\n" , __func__); +} +static int ril_netmon_probe (struct ofono_netmon *netmon,unsigned int vendor,void *user) {
@@ -237,6 +274,8 @@ static int ril_netmon_probe(struct ofono_netmon *netmon,ofono_netmon_set_data (netmon, ud); +setup_cell_info_notify (netmon); +g_idle_add (ril_delayed_register, netmon);return 0 ;
@@ -264,11 +303,48 @@ static void ril_netmon_request_update(struct ofono_netmon *netmon,CALLBACK_WITH_FAILURE (cb, data); } +static void periodic_update_cb (struct ril_msg *message,gpointer user_data) +{ +struct cb_data *cbd = user_data; +ofono_netmon_cb_t cb = cbd->cb; + +if (message->error !=RIL_E_SUCCESS ) +CALLBACK_WITH_FAILURE (cb, cbd->data); + +CALLBACK_WITH_SUCCESS (cb, cbd->data); +} + +static void ril_netmon_periodic_update (struct ofono_netmon *netmon, +unsigned int enable,unsigned int period, +ofono_netmon_cb_t cb,void *data) +{ +struct netmon_data *nmd =ofono_netmon_get_data (netmon); +struct cb_data *cbd =cb_data_new (cb, data, nmd); +struct parcel rilp; + +parcel_init (&rilp); + +parcel_w_int32 (&rilp,1 );/* Number of elements */ + +if (enable) +parcel_w_int32 (&rilp,SECS_TO_MSECS (period)); +else +parcel_w_int32 (&rilp,MSECS_RATE_INVALID ); + +if (g_ril_send (nmd->ril,RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE , + &rilp, periodic_update_cb, cbd, g_free) >0 ) +return ; + +g_free (cbd); +CALLBACK_WITH_FAILURE (cb, cbd->data); +} +static struct ofono_netmon_driver driver = { .name =RILMODEM , .probe = ril_netmon_probe, .remove = ril_netmon_remove, .request_update = ril_netmon_request_update, + .enable_periodic_update = ril_netmon_periodic_update, };void ril_netmon_init (void )
Signature · 1 line
1.9.1
PATCH 7/7 test: added script to test serving cell agent
In reply to Nishanth V--- Makefile.am | 4 +- test/test-serving-cell-info | 98 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 test/test-serving-cell-info
Makefile.am +3 -1
@@ -780,7 +780,9 @@ test_scripts = test/backtrace \ test/list-allowed-access-points \ test/enable-throttling \ test/disable-throttling \ - test/set-lte-property + test/set-lte-property \ + test/test-serving-cell-info + if TEST testdir = $(pkglibdir)/test
test/test-serving-cell-info new file +98 -0
98 lines not on this page · raw message
Signature · 1 line
1.9.1
Quoted 4 lines · Nishanth V
added new DBUS methods RegisterAgent and UnregisterAgent to Networkmonitor interface so that any client of ofono can register for serving cell updates. Added new agent interface NetworkMonitorAgent with two methods, ServingCellInformationChanged and Release.
My spontaneous reaction to this is that it feels like the wrong approach. Why not make the properties actual DBus properties and provide PropertiesChanged events for them? That begets you the same functionality for "free".
It's interesting that you posted this now because I've spent the last week grumbling over this API myself as I'm putting support for the NetworkMonitor interface into the QMI modem class. My thoughts:
i) There's duplicate information all over the place. MNC, LAC, etc. are provided in three different interefaces: NetworkRegistration, NetworkMonitor, and NetworkOperator.
ii) The NetworkOperator interface caught me off guard as it appeared out of nowhere! There is no documentation for the interface and the implementation seems to be missing from most device classes. iii) The polled nature of the NetworkMonitor object surprised me. This seems like a natural case for notifications and the patch series in this email thread underscores this fact.
iv) For QMI, at least, the NetworkRegistration atom is monitoring asynchronous events that contain essentially all the information needed by the NetworkMonitor atom. The NetworkRegistration atom could just save these values and provide the NetworkMonitor interface in the same module instead of having an additional netmon module, but:
a) We end up monitoring unnecessary state in case nobody is actually listening to the NetworkMonitor updates. This seems to have a negligible impact on performance so it probably does not matter.
b) ofono does not use this approach anywhere else that I can see... every atom/interface is provided in it's own module.
v) Point iv) applies to the NetworkOperator interface, as well, if we decide to implement it... should we?
vi) I suspect that other device classes (AT, etc.) provide asynchronous network quality updates, as well; if they do not, however, then it seems natural to move the polling of this state into the device class driver.
Sorry for hijacking this for a bit of QMI implementation discussion but it seems relevant in trying to understand what it is that the NetworkMonitor interface is supposed to be.
Thoughts?
/Jonas
Quoted 43 lines
--- doc/networkmonitor-api.txt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)doc/networkmonitor-api.txt +28
-0@@ -22,6 +22,34 @@ Methods a{sv} GetServingCellInformation() are available, their valid value ranges and applicability to different cell types. + void RegisterAgent(object path) + + Registers an agent which will be called whenever the + modem registers to or moves to a new cell. + + void UnregisterAgent(object path) + + Unregisters an agent. + +NetworkMonitorAgent Hierarchy [experimental] +============================= + +Service unique name +Interface org.ofono.NetworkMonitorAgent +Object path freely definable + +Methods void ServingCellInformationChanged(a{sv}) + + This method is called whenever the serving cell + information has been updated. + + Possible Errors: None + + void Release() [noreply] + + Agent is being released, possibly because of oFono + terminating, NetworkMonitor interface is being torn + down or modem off. No UnregisterAgent call is needed. Network Monitor Property Types ==============================
Quoted 10 lines · Jonas Bonn
Quoted 4 lines · Nishanth V
added new DBUS methods RegisterAgent and UnregisterAgent to Networkmonitor interface so that any client of ofono can register for serving cell updates. Added new agent interface NetworkMonitorAgent with two methods, ServingCellInformationChanged and Release.
My spontaneous reaction to this is that it feels like the wrong approach. Why not make the properties actual DBus properties and provide PropertiesChanged events for them? That begets you the same functionality for "free".
The implementation also seems to limit the number of clients receiving those cell change notifications to just one. Why? In real life more than one process may need those.
Cheers,
-Slava
Hi Jonas,
Quoted 10 lines · Jonas Bonn
Quoted 4 lines · Nishanth V
added new DBUS methods RegisterAgent and UnregisterAgent to Networkmonitor interface so that any client of ofono can register for serving cell updates. Added new agent interface NetworkMonitorAgent with two methods, ServingCellInformationChanged and Release.
My spontaneous reaction to this is that it feels like the wrong approach. Why not make the properties actual DBus properties and provide PropertiesChanged events for them? That begets you the same functionality for "free".
Because most clients don't care about these properties, so there's no sense in broadcasting them out to the wide world. Even if nobody actually subscribes to the PropertyChanged signal on this interface we still must send messages to the dbus daemon, and that means extra context switches, extra cpu time, etc.
Besides, this interface will be eventually expanded to cover neighbor cells as well. And that can get quite chatty.
Quoted 8 lines
It's interesting that you posted this now because I've spent the last week grumbling over this API myself as I'm putting support for the NetworkMonitor interface into the QMI modem class. My thoughts:
i) There's duplicate information all over the place. MNC, LAC, etc. are provided in three different interefaces: NetworkRegistration, NetworkMonitor, and NetworkOperator.
Why is this a problem? And strictly speaking NetworkOperator only provides MNC/MCC which can be different from the current serving cell. This can be used by the user to select a particular operator to register with.
Quoted 3 lines
ii) The NetworkOperator interface caught me off guard as it appeared out of nowhere! There is no documentation for the interface and the implementation seems to be missing from most device classes.
You might want to read doc/network-api.txt more carefully then :) It has been documented since 2009. Note that there is no 1:1 correspondence between atoms and interfaces. NetworkOperator does not have an underlying atom and is managed entirely by netreg.
Quoted 3 lines
iii) The polled nature of the NetworkMonitor object surprised me. This seems like a natural case for notifications and the patch series in this email thread underscores this fact.
Polled? The GetServingCellInformation() method call is polled. But it isn't meant to be used often. The agent version leaves it up to the driver on how to implement the periodic update. We looked at a few AT command specifications for this and while some of them support true unsolicited notifications, most don't. For example, XMM 71xx modems only support direct query and periodic mode while others only support direct query.
The interface is quite experimental and the exact semantics of the period parameter need to be figured out. I suspect it is mostly going to be a hint that the application can provide for how often the updates are needed. If true unsolicited notifications are supported then the driver can ignore it.
Quoted 5 lines
iv) For QMI, at least, the NetworkRegistration atom is monitoring asynchronous events that contain essentially all the information needed by the NetworkMonitor atom. The NetworkRegistration atom could just save these values and provide the NetworkMonitor interface in the same module instead of having an additional netmon module, but:
Unfortunately we have more than QMI modems to worry about. All this is generally done via proprietary AT commands, so having it inside the netreg atom will not work.
Also consider that we will not be able to support this for all hardware, either due to lack of support in the firmware or lack of documentation. So having this on a separate atom/interface makes it easy for applications to adjust their behavior. E.g. if the interface is present, then one can count on the functionality being there. If not present, then behave accordingly.
Quoted 4 lines
a) We end up monitoring unnecessary state in case nobody is actually listening to the NetworkMonitor updates. This seems to have a negligible impact on performance so it probably does not matter.
Well, you could enable / register to these notifications only if periodic updates have been enabled...
Quoted 3 lines
b) ofono does not use this approach anywhere else that I can see... every atom/interface is provided in it's own module.
This is preferred. Besides, qmi_service_register can support multiple clients, no?
Quoted 3 lines
v) Point iv) applies to the NetworkOperator interface, as well, if we decide to implement it... should we?
I won't comment until you familiarize yourself with src/netreg.c
Quoted 5 lines
vi) I suspect that other device classes (AT, etc.) provide asynchronous network quality updates, as well; if they do not, however, then it seems natural to move the polling of this state into the device class driver.
See above. Many of them don't.
Quoted 4 lines
Sorry for hijacking this for a bit of QMI implementation discussion but it seems relevant in trying to understand what it is that the NetworkMonitor interface is supposed to be.
Don't be sorry, it is nice that others are looking at this and providing feedback.
Regards,
-Denis
Hi Slava,
Quoted 7 lines · Slava Monich
Quoted 6 lines · Jonas Bonn
Quoted 4 lines · Nishanth V
added new DBUS methods RegisterAgent and UnregisterAgent to Networkmonitor interface so that any client of ofono can register for serving cell updates. Added new agent interface NetworkMonitorAgent with two methods, ServingCellInformationChanged and Release.
Quoted 9 lines
Quoted 4 lines
My spontaneous reaction to this is that it feels like the wrong approach. Why not make the properties actual DBus properties and provide PropertiesChanged events for them? That begets you the same functionality for "free".
The implementation also seems to limit the number of clients receiving those cell change notifications to just one. Why? In real life more than one process may need those.
You keep saying that, but never provide concrete scenarios how this could be 'useful'? I am tempted to simply ignore such feedback in the future.
For now I don't see why we would want to have multiple agents registered and to keep the implementation simple we will only support one.
Regards,
-Denis
Quoted 15 lines · Denis Kenzior
Hi Slava,
Quoted 12 lines · Slava Monich
Quoted 10 lines · Jonas Bonn
Quoted 4 lines · Nishanth V
added new DBUS methods RegisterAgent and UnregisterAgent to Networkmonitor interface so that any client of ofono can register for serving cell updates. Added new agent interface NetworkMonitorAgent with two methods, ServingCellInformationChanged and Release.
My spontaneous reaction to this is that it feels like the wrong approach. Why not make the properties actual DBus properties and provide PropertiesChanged events for them? That begets you the same functionality for "free".
Quoted 9 lines
Quoted 4 lines
The implementation also seems to limit the number of clients receiving those cell change notifications to just one. Why? In real life more than one process may need those.
You keep saying that, but never provide concrete scenarios how this could be 'useful'? I am tempted to simply ignore such feedback in the future.
In the Sailfish OS case, one is the positioning helper, and there's the factory test app. That makes it at least two. The factory test app often plays the role of the second client since it's touching pretty much all the important interfaces in the system. And there are 3rd party apps which we don't control.
Quoted 4 lines
For now I don't see why we would want to have multiple agents registered and to keep the implementation simple we will only support one.
That's fine, we are using a different interface for getting cell information anyway. Go ahead and ignore the feedback.
Cheers,
-Slava
Quoted 2 lines
Regards,
-Denis
Hi Slava,
Quoted 6 lines
In the Sailfish OS case, one is the positioning helper, and there's the factory test app. That makes it at least two. The factory test app often plays the role of the second client since it's touching pretty much all the important interfaces in the system. And there are 3rd party apps which we don't control.
See? This wasn't that hard ;)
How does the factory test app use this info? Does it need actual periodic updates or can it simply obtain this via the method call?
I'm open to the idea of supporting multiple agents. We do have to figure out who dictates the periodic update interval. One approach might be to have a single master agent and multiple observer agents. Feel free to propose something.
Regards,
-Denis
Hi Nishanth,
Quoted 8 lines · Nishanth V
added new DBUS methods RegisterAgent and UnregisterAgent to Networkmonitor interface so that any client of ofono can register for serving cell updates. Added new agent interface NetworkMonitorAgent with two methods, ServingCellInformationChanged and Release.
--- doc/networkmonitor-api.txt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
All patches in this series have been applied, thanks.
Regards,
-Denis
Hi Denis,
Quoted 8 lines
Hi Slava,
Quoted 6 lines
In the Sailfish OS case, one is the positioning helper, and there's the factory test app. That makes it at least two. The factory test app often plays the role of the second client since it's touching pretty much all the important interfaces in the system. And there are 3rd party apps which we don't control.
Quoted 5 lines
See? This wasn't that hard ;)
How does the factory test app use this info? Does it need actual periodic updates or can it simply obtain this via the method call?
Our RIL plugin decides on the update rate internally, based on the device state (limiting the rate when the screen turns off).
Different clients have different needs - some need updates only when the screen is on (if they are just displaying something on the screen) and some may always need updates (a background task collecting some data or whatever). The optimal solution may be quite specific to the environment where ofono is used.
Quoted 4 lines
I'm open to the idea of supporting multiple agents. We do have to figure out who dictates the periodic update interval. One approach might be to have a single master agent and multiple observer agents. Feel free to propose something.
You (correctly) said that the agent approach saves some system resources by not sending unnecessary signals if no one is interested in this information. However, in all other cases the agent (method call) approach is less efficient than signals.
ofono calls dbus-daemon, the daemon calls the agent, each call has a reply, so the total number of D-Bus packets per notification comes to 4*n where n is the number of agents (or 2*n if the caller sets NO_REPLY_EXPECTED flag).
If you are using signals, the number of packets involved is n+1 (one packet from ofono to the daemon and then one to each interested client). Obviously, (n+1) > 2*n (let alone 4*n) if and only if n = 0. Not to mention that signals are significantly easier to use than (especially, multiple) agents.
That said, this NetworkMonitor thing is what it is and you decide how it works. If it doesn't suit our needs (and it doesn't) I just implement my own (and I did). I'm not in the mood to argue whose implementation is better. Everything can be done in so many different ways, so let a hundred flowers bloom.
Cheers,
-Slava
Quoted 4 lines
Regards,
-Denis
Quoted 46 lines · Slava Monich
Hi Denis,
Quoted 8 lines
Hi Slava,
Quoted 6 lines
In the Sailfish OS case, one is the positioning helper, and there's the factory test app. That makes it at least two. The factory test app often plays the role of the second client since it's touching pretty much all the important interfaces in the system. And there are 3rd party apps which we don't control.
Quoted 5 lines
See? This wasn't that hard ;)
How does the factory test app use this info? Does it need actual periodic updates or can it simply obtain this via the method call?
Our RIL plugin decides on the update rate internally, based on the device state (limiting the rate when the screen turns off).
Different clients have different needs - some need updates only when the screen is on (if they are just displaying something on the screen) and some may always need updates (a background task collecting some data or whatever). The optimal solution may be quite specific to the environment where ofono is used.
Quoted 4 lines
I'm open to the idea of supporting multiple agents. We do have to figure out who dictates the periodic update interval. One approach might be to have a single master agent and multiple observer agents. Feel free to propose something.
You (correctly) said that the agent approach saves some system resources by not sending unnecessary signals if no one is interested in this information. However, in all other cases the agent (method call) approach is less efficient than signals.
ofono calls dbus-daemon, the daemon calls the agent, each call has a reply, so the total number of D-Bus packets per notification comes to 4*n where n is the number of agents (or 2*n if the caller sets
NO_REPLY_EXPECTEDflag).If you are using signals, the number of packets involved is n+1 (one packet from ofono to the daemon and then one to each interested client). Obviously, (n+1) > 2*n (let alone 4*n) if and only if n = 0. Not to mention that signals are significantly easier to use than (especially, multiple) agents.
Quoted 5 lines
That said, this NetworkMonitor thing is what it is and you decide how it works. If it doesn't suit our needs (and it doesn't) I just implement my own (and I did). I'm not in the mood to argue whose implementation is better. Everything can be done in so many different ways, so let a hundred flowers bloom.
That last paragraph is a masterpiece! Well said!
Why not create a second interface .AsynchNetworkMonitor that sends PropertyChanged signals. This interface can be disabled by default, but can be requested by setting to org.ofono.Modem.AsynchronousNetworkMonitorEnabled to 'true', at which point the interface is created on the modem object...?
/Jonas
Quoted 13 lines
Cheers,
-SlavaQuoted 4 lines
Regards,
-Denis_______________________________________________
ofono mailing list
ofono(a)ofono.org
https://lists.ofono.org/mailman/listinfo/ofono
Hi Slava,
Quoted 10 lines · Slava Monich
Hi Denis,
Quoted 8 lines
Hi Slava,
Quoted 6 lines
In the Sailfish OS case, one is the positioning helper, and there's the factory test app. That makes it at least two. The factory test app often plays the role of the second client since it's touching pretty much all the important interfaces in the system. And there are 3rd party apps which we don't control.
Quoted 8 lines
Quoted 5 lines
See? This wasn't that hard ;)
How does the factory test app use this info? Does it need actual periodic updates or can it simply obtain this via the method call?
Our RIL plugin decides on the update rate internally, based on the device state (limiting the rate when the screen turns off).
And hopefully you understand why hard-coding the behavior in a plugin is not a solution for upstream? Our solution must be generic enough where any behavior can be implemented, perhaps with a bit more pain on the integrator side. But the advantage is that it works for every piece of hardware that has support for a particular feature.
You have the advantage that you have control or can assume how stuff works on your platform. Hence you can implement such simplistic behavior of turning serving cell updates to every minute with screen off / every 1 second with screen on. Unfortunately upstream cannot make such assumptions, cannot rely on hacks and has to implement proper solutions.
Quoted 6 lines
Different clients have different needs - some need updates only when the screen is on (if they are just displaying something on the screen) and some may always need updates (a background task collecting some data or whatever). The optimal solution may be quite specific to the environment where ofono is used.
Agreed. Upstream will try to provide APIs to enable you to do that. If some API doesn't cover your needs, then feel free to contribute and make things better. Complaining and then taking your ball and going home is not conducive to upstream paying attention to your needs. Only through active contribution can you influence things. Just saying...
Quoted 11 lines
Quoted 5 lines
I'm open to the idea of supporting multiple agents. We do have to figure out who dictates the periodic update interval. One approach might be to have a single master agent and multiple observer agents. Feel free to propose something.
You (correctly) said that the agent approach saves some system resources by not sending unnecessary signals if no one is interested in this information. However, in all other cases the agent (method call) approach is less efficient than signals.
Quoted 5 lines
ofono calls dbus-daemon, the daemon calls the agent, each call has a reply, so the total number of D-Bus packets per notification comes to 4*n where n is the number of agents (or 2*n if the caller sets
NO_REPLY_EXPECTEDflag).
Which we do by the way. The ServingCellInformationChanged method call is already sent as noreply. It was not marked thus in the documentation. It was an oversight that has been now fixed.
Quoted 5 lines
If you are using signals, the number of packets involved is n+1 (one packet from ofono to the daemon and then one to each interested client). Obviously, (n+1) > 2*n (let alone 4*n) if and only if n = 0. Not to mention that signals are significantly easier to use than (especially, multiple) agents.
I don't know what you're arguing here. Yes in an idealized world having n agents is less efficient than having a signal with n observers. Multicast is more efficient. No ****.
But do realize things are never so simple. You do have to pay a cost for this, through complex signal matching data structures, having to set up proper Match rules with dbus-daemon, and unsubscribing from such signals is sometimes not possible. Some clients simply don't do this properly, and a signal ends up being blasted out to way more clients than your idealized model. But I digress as this isn't what was being argued.
Jonas wanted all these to be actual properties. So a PropertyChanged signal would be emitted for each and every one. Given that we have 20 odd properties defined, sending a signal for each one vs a single method call out to the agent is more efficient. Yes we can perform comparisons and only emit properties that changed. But most of these are signal related, and so are extremely variable. The chance that they don't change between updates is tiny.
Which by the way is what your vaunted 'own' implementation does. So its not sending 1 signal per update either, is it? You might want to fix that as it doesn't fit your ideal world view ;)
So regardless of how you look at it, the agent approach is more efficient than having everything as a property. That was my original point.
And by the way, the agent approach lets us figure out when a client has died and updates are no longer needed. So we can intelligently turn off communication with the modem and not waste resources. We can also more easily control access permissions (as in which application can enable updates in the first place) via the security framework. Those are huge design advantages in our view.
Quoted 6 lines
That said, this NetworkMonitor thing is what it is and you decide how it works. If it doesn't suit our needs (and it doesn't) I just implement my own (and I did). I'm not in the mood to argue whose implementation is better. Everything can be done in so many different ways, so let a hundred flowers bloom.
And again I see you taking your ball and going home ;)
Regards,
-Denis
Hi Jonas,
Quoted 6 lines
Why not create a second interface .AsynchNetworkMonitor that sends PropertyChanged signals. This interface can be disabled by default, but can be requested by setting to org.ofono.Modem.AsynchronousNetworkMonitorEnabled to 'true', at which point the interface is created on the modem object...?
You're of course free to do anything you want, but it doesn't mean upstream will take it :) I refer you to our design philosophy document (found in doc/ofono-paper.txt), Section 4.2 and 4.3. What you propose goes fully against that philosophy.
Regards,
-Denis