Hi, Padovan > > If we defer the reply of SetProperity(OfflineMode) until > everything is off, then: > > > > 1. Do you mean that upper layer app will always block and > wait until > > the dbus reply returns? If not, it seems it can not resolve > this issue. > > 2. Even if that the upper layer app will block and wait > until the dbus > > reply returns, in the function of SetProperity, when set > "OfflineMode" > > properity, it also needs to check whether the dbus message > is pending or not, right? > > Not really, you can run your app asynchronously as well. You > just set up a reply callback and put your app to do any other task. > > > 3. I found that it is not easy to implement pending the > dbus message > > reply in SetProperity(OfflineMode), when all the devices > > enable/disable operations are done, how to check it in > manager.c and > > then send the dbus reply? If we create a while loop to continuous > > check the device status in manager.c, it will block the > main loop, so how to implment it? > > Callback? Each device handler replies saying that they are > off. When all of them are done, you reply the SetProperity > call. A timeout is also needed in the case things goes wrong. > Thanks for your instructions, you mean that in connman we defer the dbus reply until all the devices operations are done, and in app layer, if the SetProperity(OfflineMode) dbus call is asynchronously, use a callback to handle the call result, right?
But I think in connman it should have a protect mechanism to make sure that even app layer call is not right, the connman status should not be conflict. For example, if app call SetProperity(OfflineMode) asynchronously, before the dbus reply returns, which means the device powering on/off operations are not done, it can call this dbus interface again and again to set OfflineMode properity, or other applications can call the dbus interface to do this, which may lead to this issue, too. I think that the logic process should be in connman instead of app layer, right? > -- > Gustavo F. Padovan > http://profusion.mobi > _______________________________________________ connman mailing list [email protected] http://lists.connman.net/listinfo/connman
