Hi Marcel, On 10/17/2011 06:06 PM, Marcel Holtmann wrote: > Hi Daniel, > >>>> Instead of only having Offline and Online, report 4 states >>>> online, offline, connecting and suspended. >>>> --- >>>> doc/session-api.txt | 45 +++++++++++++++++++++++++++++++++++---------- >>>> 1 files changed, 35 insertions(+), 10 deletions(-) >>>> >>>> diff --git a/doc/session-api.txt b/doc/session-api.txt >>>> index 3a0c9ca..600f057 100644 >>>> --- a/doc/session-api.txt >>>> +++ b/doc/session-api.txt >>>> @@ -90,20 +90,45 @@ Settings string Bearer [readonly] >>>> for this session. Or an empty string if no bearer >>>> is available. >>>> >>>> - boolean Online [readonly] >>>> + string State [readonly] >>>> >>>> - This indicates if the connection is online or >>>> - offline. >>>> + This indicates the state of the session. >>>> >>>> - This maps to the online service state. And it is >>>> + Valid states are "offline", "connecting", >>>> + "online" and "suspended". >>>> + >>>> + This maps to the service states. And it is >>>> only valid for the selected bearer configuration. >>>> - Otherwise it will be reported as offline even if >>>> - the global state would be online. >>>> >>>> - In addition the Online settings notification might >>>> - not happen right away. Notifications of online state >>>> - can be delayed based on the speed of the bearer. It >>>> - is done to avoid congestion on bearers like 3G etc. >>>> + The "offline" state indicates that no services for >>>> + a given session are online. "connecting" is indicating >>>> + that the session has called Service.Connect() >>>> + and if this call is successful the next state >>>> + indicated is "online". The application could >>>> + use the "connecting" state for starting to draw an >>>> + animation. >>>> + >>>> + If the Service.Connect() is not successful >>>> + the next state will be "offline". If the >>>> + application has started to draw an animation on >>>> + the "connecting" state it should stop drawing when >>>> + "offline". >>> >>> I have two questions: >>> >>> 1. How to deal with service.State = 'ready', in which state >>> Service.Connect() returns successfully? >>> 2. State here is different than State in ' Session States and Transitions', >>> is it possible to use another name? >> >> As you already pointed out, the Session.State is not the same as >> Service.State. Essentially the session state is one logic layer above >> the service layer. If you look into the session code you see, that we >> already monitor all service states. Changing the setting from 'Online' >> to 'State' allows the session code to notify the application with some >> more state transitions then only 'Online' <-> 'Offline'. > > and why would an application care? Please do not complicate this too > much.
As I tried to explain. The thing my application wants to do is the have some status information towards the user what is happening. So think of this: the user clicks on the connect button and you want to inform him that something is happening (drawing some animation). Of course this could also be done differently like the application starts an animation and stops it with a timeout callback. If the callback fires up it would consequently call Session.Disconnect(). If we get Session.Online == True before the timeout fires we just disarm this one. Implementing the "connecting" status message this way is no problem. The idea to have more than Online as boolean stems from the idea to let the application now of the "suspend" state. Having the "suspend" state, why not having the "connecting" too. > So we have 99% of application that should only be notified when they are > really online. Telling them that we are ready, but not online, just > wakes them up for no real reason. I am 67,6% sure your numbers are not correct. > The only 1% that might care about link local connections are the DLNA > type of application for your home entertainment. Similar to what Apple > does with AirPlay. However we already have Avahi for this stuff. Why > would we need another set of notifications? Okay, let's leave the "connecting" state away, what about the "suspend" one? Would you prefer to model it as new Setting instead of merging this one into Online? cheers, daniel _______________________________________________ connman mailing list [email protected] http://lists.connman.net/listinfo/connman
