×

Discussion Board

Results 1 to 15 of 15
  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    13

    Controlling Wlan On/Off from API/Command Line

    Hi

    I have a problem: every time i turn on the wifi i have to go through 5-6 steps (run settings, go to internet connection, switch on internet conection. close settings, then turn off PSM to prevent wlan going to sleep)
    similarly to shut it down.

    So i thought i could make myself a toggle for that, which does both of these two things in a single click.
    But while i know how to toggle PSM (there's Toggle PSM, that's open source), i cannot find anywhere how to toggle wlan.

    I found a dbus event that can be used to switch it off, but it does not turn off the switch on Settings->Internet connection, meaning it will come back on, and in particular this type of event fails to bring it on, if the settings switch is set to off.

    i tried to find a gconf key, or a qtmobility class that let me do it, without success.
    Does anyone have any idea about how to achieve this?

  2. #2
    Registered User
    Join Date
    Sep 2011
    Posts
    449

    Re: Controlling Wlan On/Off from API/Command Line

    Hi,

    Not possible through gconf or qt mobility.

    It was (not now may be) possible to turn on/off all Internet connections (this includes also possible mobile data connection). This setting is accessible via MCE radiostate API (mce-dev package, files /usr/include/mce/dbus-names.h and /usr/include/mce/mode-names.h), which needs also credential "mce:eviceModeControl").

    Internet setting is same as MCE_RADIO_STATE_WLAN mode.

    Unfortunately the MCE token mentioned above doesnt work post PR1.1

  3. #3
    Registered User
    Join Date
    Mar 2012
    Posts
    13

    Re: Controlling Wlan On/Off from API/Command Line

    Ha thanks a lot!
    yes i guess that's what i want (i think the switch "InternetConnection" on settings-> Internet Connection does exactly that, it's not just for wlan)
    but so you mean that the problem, in Pr1.2 is that i cant get aegis credentials to use MCE radiostate API for switching inet on/off?

  4. #4
    Registered User
    Join Date
    Sep 2011
    Posts
    449

    Re: Controlling Wlan On/Off from API/Command Line

    Hi,

    Yes, Some of the tokens are now not working.

    You can see the list here. The striked off ones are now not usable

  5. #5
    Registered User
    Join Date
    Mar 2012
    Posts
    13

    Re: Controlling Wlan On/Off from API/Command Line

    I see.. that is sad.
    I wish developing for N9 wouldn't have such an added pain.
    i wonder why this, in any case. If would nokia only explain these decisions...
    I mean, i assume an inet connection toggle is a totally legit application scenario, i dont see why preventing it.

  6. #6
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: Controlling Wlan On/Off from API/Command Line

    Hi,
    Since you cannot use MCE, you could launch the "internet connection" setting dialog with via DBus.
    dbus-send --print-reply --session --dest=com.nokia.DuiControlPanel / com.nokia.DuiControlPanelIf.appletPage string:"Internet"
    then switching wlan OFF/ON it's just 1 click.
    I know it's not the best solution as it might be using the MCE one, but you can use it without pain.
    I fought a lot to have the token you see striked out in the list... but no way to have them.
    If you are not interested in publishing your app to Nokia store, you can still root the device and use freely mce-dev
    Last edited by gnuton; 2012-03-26 at 11:11.

  7. #7
    Registered User
    Join Date
    Mar 2012
    Posts
    13

    Re: Controlling Wlan On/Off from API/Command Line

    Hi, thanks for the suggestion.
    Yes, i was indeed considering to aegisbreak my N9, but i also wanted to release this toggle publicly, coz i think easy switching of basic functionalities is important (and i personally use all the available toggles for N9, BT, Flight Mode, 2G/3G, psm etc, and i dream of a switchboard android style)

    But well.. probably you are right, maybe it's enough to just make a toggle for myself and publish the code on some own web page

  8. #8
    Registered User
    Join Date
    Nov 2011
    Posts
    48

    Re: Controlling Wlan On/Off from API/Command Line

    Hi,

    I was going to create a new thread for my question, but this seems to be just the right place.

    Is it possible to add WLAN parameters (ssid, type, password) with an application, or at least open the abovementioned Internet applet with parameters already there, so that a user could just click "Connect"?

    Thanks!

  9. #9
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: Controlling Wlan On/Off from API/Command Line

    Hi conxt,
    this question is off-topic! It'a better to open a new thread for it.
    Those info are anyway stored in GConf DB. I will tell u more as soon as a proper thread is opened.

    Back to the original topic of this thread, I'm wondering if it's really worth to break aegis just for a WLAN toggle button.
    If you are going to build apps for OVI, I suggest you to do not break it, so that yo ucan test your apps before sending them to QA.

  10. #10
    Registered User
    Join Date
    Mar 2012
    Posts
    13

    Re: Controlling Wlan On/Off from API/Command Line

    I think you are right here too.. but being this one of the operation i ended up doing most often, it feels really uncomf to use it.
    I assume it would be just 10 lines of python (or c++), if the aegis token could work.
    Which leads me to the next question: would it be asking too much that nokia would provide such a toggle? i assume it would take 15 minutes to write, for a nokia internal ( if (inetActive()) mce::whateverDeactivateInet() ; else mce::whateverActivateInet() ), plus the time for making an icon.

    I could indeed also write it for nokia. then nokia checks it, and publish it as "nokia" stuff. i can do it for free. just give me a wifi toggle
    (i can also survive with a toggle not switching psm too, thus having to press 2 icons to get into the mode i want)

  11. #11
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: Controlling Wlan On/Off from API/Command Line

    At this stage I don't think Nokia is going to add new features to Harmattan anymore. Unfortunately.
    Your hint comes too late! :P

  12. #12
    Registered User
    Join Date
    Mar 2012
    Posts
    13

    Re: Controlling Wlan On/Off from API/Command Line

    well i filed a feature request in bugzilla when it was still open, but it seems it was never assigned.
    Anyway, it would be good if Nokia would support the community offering free work
    But thanks for the hints (and to kusumuk too), i'll post what i will be able to produce

  13. #13
    Registered User
    Join Date
    Mar 2012
    Posts
    13

    Re: Controlling Wlan On/Off from API/Command Line

    Hi Gnuton,
    after having asked around a little, i learnt that there's no way to change that switch in the internet settings panel.
    Apparently not even with mce (even though kusumuk said it is possible, but not how)

    So i thought that your suggestion is actually nice.
    Now question: is there any way to also check whether that toggle is on or off? (e.g., whether internet connection is enabled or not)

  14. #14
    Registered User
    Join Date
    Mar 2012
    Posts
    13

    Re: Controlling Wlan On/Off from API/Command Line

    And one more thing:
    Is there a way to send that dbus message from within a c++ program (with system() i assume) AND then also somehow wait for that application to close?
    meaning that the program should just be waiting for a sort of signal that the spawned application closes..

    Maybe not, hah?
    It would be good for changing the icon at the end

  15. #15
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: Controlling Wlan On/Off from API/Command Line

    Hi,
    to open the control panel from C++ using DBus you can see SettingsApplet:pen() method here [1].
    There is no easy way to track when the setting page is closed. Anyway you are not really interested in this. What you want to know is if the Internet connection has been disabled or not.
    For this check dbus-monitor output when you disable/enable it. For sure you will find an interesting signal which you can listen to in order to update your status icon.

    [1]http://harmattan-dev.nokia.com/docs/library/html/guide/html/Developer_Library_Best_practices_for_application_development_Storing_and_managing_application_settings_Example_of_managing_settings_with_Control_Panel_Applets.html

Similar Threads

  1. Command Line Install
    By gammav in forum Symbian Tools & SDKs
    Replies: 7
    Last Post: 2008-06-11, 09:41
  2. can't build in command line
    By hgyang in forum Symbian Tools & SDKs
    Replies: 6
    Last Post: 2007-06-15, 14:01
  3. Using bmconv without command line
    By silver_man82 in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2006-05-09, 05:57
  4. How can I get the command line in app
    By beta55 in forum Symbian
    Replies: 4
    Last Post: 2006-03-03, 02:22
  5. Important:AT Command KeyPad Controlling
    By santoshgupta in forum General Development Questions
    Replies: 0
    Last Post: 2005-08-24, 08:28

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×