View Single Post
Posts: 804 | Thanked: 1,598 times | Joined on Feb 2010 @ Gdynia, Poland
#2
About disconnecting, there is package:
http://maemo.org/packages/view/autodisconnect/
You can configure it via control panel, if you want to have this functionality in your program/script, just look into the sources and copy relevant code.

About auto connecting I'm not sure, but you may try https://garage.maemo.org/projects/auto-connect/ , but I don't know if it does exactly what you want (description says that it just tunes the time interval of network search for automatic internet connection, but you may check which gconf keys it checks, etc., so it may be good starting point). Did you attempt to search in Fremantle documetation? I think I've seen somewhere what should be done to connect to the network... The pseudo-code looked like:
1. get "Internet connection" > "allow phone to connect to nerwork by itself?" value from control panel (it is some gconf value afair)
2. set it to "always allow on any connection" (you may set it to "wlan" if you want to check only when wlan is available)
3. run some maemo command to connect to network (there is a library in Fremantle which you should use, normal call to e.g. "wget" or "ping" will fail, because Maemo needs to know you want to open internet connection, so it can actually connect first, see http://wiki.maemo.org/Documentation/...bConIC_Library for more information)
4. Do some stuff you want to do (so, in your case it would be "set skype account to active", "wait a minute", "set skype account to inactive")
5. Disconnect from the Internet
6. set "Internet connection" > "allow phone to connect to nerwork by itself?" value to the one read in point "1."

In fact, points 1 and 6 are optional, as they just guarantee that you don't change user's settings permamently.