Hi,
Here is a patchset that fixes and introduces new properties/behaviors into the
Session API.
First change is the move from Online property to a State property which shows
different states: disconnected, connected or online.
This maps the service's state: ready -> connected, online -> online, all other:
disconnected.
Due to that, I propose in patch 2, 3, 4, 5, 6 several changes in notifications:
- session does not notify anything about Name/Bearer/Interface/Ipv4/Ipv6 until
it reaches a relevant state: connected and/or online.
It is imho, useless to notify those informations when state is still
disconnected. Since they rely on underlying service, we notifify
only when this service gets connected.
- the patch 3 refactor the code to decide "when" is it needed to notify
changes. This simplifies and adds more flexibility in taking decision
on relevant notification while centralizing this decision in one unique place.
- patch 4 follows patch 2, we don't advertize the ipconfig changes if the
session is not yet in a relevant state.
- patch 5 and 6 are a bit different, to save "space" in notified content: it
does not provide ipconfig (ipv4 and/or ipv6) info if its info are not
relevant ( = in a connected state). This follows actually what service API
does, when requesting its settings. It just pushes the idea a bit more: we
don't
add a empty Ipv4/6 key in the dict if not relevant.
Next comes the introduction of a new property, giving the possibility to
"filter" out which connection we want from the session: local (we don't care to
be
connected to internet), internet (we absolutely want that) or any: we want to
get local or internet connection (session's state will change as usual and we
will be notified every time).
One question however: in local type, it means that if underlying service gets
"online", session won't be "connected". It will only switch to connected is
service hangs at "ready".
It's a mistake right? I would rather change that so ready/online service state
on local type will set session state to connected.
Patch 7 introduces the property (getter/setter).
Patch 8 affect the state and, therefore, the notification behavior according to
that connection type.
Patch 9, 10 and 11 are trivial.
I tested it as much as I could, through test-session and some custom client
app, and it seems to work. I still have things to fix and improve in Session
though,
but getting this patchset reviewed would help a lot before proceeding with next
steps.
Please review,
Tomasz Bursztyka (11):
session: changing online property to a state property
session: do not notify about service info if there is none
session: refactor and optimize how notification are raised and when
session: do not notify an ipconfig change if the session is not
connected
service: adding a function to know the connected state of an ipconfig
session: do not notify ipconfig content if it's not in a connected
state
session: introducing a property to select a type on which the state
gets up on
session: filtering session state update according to connection type
doc: updated session api documentation
test: fixing type conversion bug in test-session
test: modify test-session to handle a new property
doc/session-api.txt | 81 ++++++++++----
src/connman.h | 2 +
src/service.c | 18 +++
src/session.c | 303 +++++++++++++++++++++++++++++++++++----------------
test/test-session | 5 +-
5 files changed, 292 insertions(+), 117 deletions(-)
--
1.7.8.3
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman