Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#77 feature request: autoconnect, auto load profile

found_in_0.8
closed-fixed
6
2008-11-28
2008-02-27
Wolfgang Stoeggl
No

A possibility to auto load a profile and connect automatically would be appreciated.
It should be possible to do so from the command line and from gui settings.

Discussion

1 2 > >> (Page 1 of 2)
  • Klaas van Gend
    Klaas van Gend
    2008-03-02

    • assigned_to: nobody --> kvangend
     
  • Klaas van Gend
    Klaas van Gend
    2008-03-02

    Logged In: YES
    user_id=1208561
    Originator: NO

    good one.
    transfer to bugs.

    I think I'll implement this for the 0.9 release.

     
  • Klaas van Gend
    Klaas van Gend
    2008-03-02

    • milestone: --> found_in_0.8
    • labels: --> configuration
     
  • Klaas van Gend
    Klaas van Gend
    2008-03-07

    • summary: autoconnect, auto load profile --> feature request: autoconnect, auto load profile
     
  • Klaas van Gend
    Klaas van Gend
    2008-06-12

    • priority: 5 --> 4
     
  • Klaas van Gend
    Klaas van Gend
    2008-06-12

    Logged In: YES
    user_id=1208561
    Originator: NO

    reduce priority.

     
  • Fredrik
    Fredrik
    2008-09-30

    Seeing as this didn't make it in the 0.9 release I went ahead and implemented this myself. It allows to use the following new command line parameters (haven't added any GUI setting):
    --auto-connect will attempt to automatically connect to network if found on start-up
    -a will attempt to automatically connect to network if found on start-up

    The patch simple initiates a Connect-button press if there is a network connection when the GUI has loaded. You will have to have a default Profile set-up already.

    I have never coded in C before, and haven't run any tests (don't know how), but here is the patch against the 0.9 version (I don't find any file attach method - and about the "Setting up Internet Connection" change - do as you wish with it - I prefer spelling out "Internet" instead of geeky "PPP"...):

    diff -r umtsmon-0.9-org/main.cpp umtsmon-0.9/main.cpp
    177a178,203
    > int autoConnectOnStartup = 0;
    >
    > static bool setAutoConnectOnStartup(char* anArgument)
    > {
    > DEBUG1("setAutoConnectOnStartup: '%s'\n", anArgument);
    >
    > //if no argument is given, we assume auto connect is desired
    > if (anArgument == NULL)
    > {
    > autoConnectOnStartup = 1;
    > return true;
    > }
    >
    > //optional and highly undocumented: if a 0 is given, we keep auto-connect off
    > int myNumber = atoi(anArgument);
    > if (myNumber == 0)
    > {
    > autoConnectOnStartup = 0;
    > } else {
    > autoConnectOnStartup = 1;
    > }
    >
    > return true;
    > }
    >
    > // oops global variable declared here...
    222a249,250
    > printf(" --auto-connect will attempt to automatically connect to network if found on start-up\n");
    > printf(" -a will attempt to automatically connect to network if found on start-up\n");
    236a265
    > { "--auto-connect", "-a", false, setAutoConnectOnStartup, },
    diff -r umtsmon-0.9-org/mainwindow.ui.h umtsmon-0.9/mainwindow.ui.h
    110c110,116
    <
    ---
    >
    > // Auto-connect
    > if (autoConnectOnStartup > 0) {
    > DEBUG5("Attempting auto-connect\n");
    > if (checkRegistered()!=false) emit ConnectPPP();
    > }
    >
    491c497
    < ProgressDialog myProgress(this, tr("Setting up PPP Connection"));
    ---
    > ProgressDialog myProgress(this, tr("Setting up Internet Connection"));
    diff -r umtsmon-0.9-org/umtsmon_global.h umtsmon-0.9/umtsmon_global.h
    39a40
    > extern int autoConnectOnStartup;

     
  • Klaas van Gend
    Klaas van Gend
    2008-10-01

    Thanks for the coding suggestion. If this is the first time you coded C, I'm really amazed at your skills to learn a new language.

    However, I'm actually amazed this patch works for you,
    as you only try to do this once - if you have a network registration at startup.
    In my case, it doesn't work like that - most of my devices take a while to get registered (I'm roaming). So your registration attempt would fire at a time the registration still fails and the connect wouldn't happen.

    Also, but then we're down to coding style: I'm not really fond of adding new global variables.
    In this case, it isn't really needed - we could easily add a setter to the mainwindow class (but that's probably beyond what you want to do).

    However, your code did provide the amount of hints I needed to get this implemented.
    It's your choice: do you want to do a second attempt or should I take over?
    BTW: please use "diff -Nuw" and attach the patch - not inline it. I had to manually edit the patch in order to make it apply (line breaks).

    Klaas

     
  • Fredrik
    Fredrik
    2008-10-01

    > Thanks for the coding suggestion. If this is the first time you coded C,
    > I'm really amazed at your skills to learn a new language.

    PHP isn't too far off. And I was basically copying parts of the original code, but thanks anyway ;) Gotta take the chance to receive some cred as there won't be any more first times in C for me :P

    > However, I'm actually amazed this patch works for you,
    > as you only try to do this once - if you have a network registration at
    > startup.
    > In my case, it doesn't work like that - most of my devices take a while to
    > get registered (I'm roaming). So your registration attempt would fire at a
    > time the registration still fails and the connect wouldn't happen.

    Yeah, I made the patch yesterday after getting home from work - and I guess my card was already in a connected state since I had previously used the original version to connect. This morning I realized that it won't work on a fresh reboot :)

    I guess some notification is needed from the part that connects to networks... Or more hackishly: a sleep() on a couple of seconds (nah don't wanna go there)

    > Also, but then we're down to coding style: I'm not really fond of adding
    > new global variables.

    Yeah sorry, I don't know how to access other class' variables in C. Followed example on the verbosity level int ;)

    > In this case, it isn't really needed - we could easily add a setter to the
    > mainwindow class (but that's probably beyond what you want to do).

    Sounds good :)

    > However, your code did provide the amount of hints I needed to get this
    > implemented.

    Phew...

    > It's your choice: do you want to do a second attempt or should I take
    > over?

    I don't think I'll fix the necessary notifier code + mainwindow setter without delving into C deeper than I can manage the closest weeks, sorry... I'll be very interested in seeing and trying out the finished patch - that would be a great learning experience for me for upcoming contributions.

    > BTW: please use "diff -Nuw" and attach the patch - not inline it. I had to
    > manually edit the patch in order to make it apply (line breaks).

    Aha those diff-params ok. Attaching is what I wanted to do last time. I may be blind - but I can't see any attach feature by this Comment field. Add a comment + Submit. Nothing above nor below... - how do I attach files?

    Cheers,
    Fredrik

     
  • Klaas van Gend
    Klaas van Gend
    2008-10-01

    upload attachment: it's completely at the bottom of the page.

    I'll work on your patch and get it fixed to suit my ideas over the weekend.
    I'll probably also add a config file option.

     
1 2 > >> (Page 1 of 2)