Announcement

Collapse
No announcement yet.

How to tell xPico to connect to a given visible WiFI

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to tell xPico to connect to a given visible WiFI

    THe manual references Apply and Submit but I cant see how those two comands refer to the xml commands.

    I am able to add/delete WLAN profiles via XML, list visible wifi and currently connected wifi - but dont see where/how I can tell the xPico to connect to a specific access point either by sending the data or by telling it to connect to visible WLAN?

  • #2
    (1) You can do it using curl to upload an XML file using something like this in a command line:
    Code:
    curl -u admin:PASSWORD http://192.168.0.1/import/config -X POST --form configrecord=@c:\xml_setup\wlan0.xml
    Check out the guide for that: http://wiki.lantronix.com/developer/...gConfiguration

    In your case, the XML file will contain information for enabling wlan0, with correct router information, including a password, etc. Additionally, the XML file can perform a software restart to the xPico, which is needed to apply certain settings, particularly when messing around with the ap0 and wlan0 configurations. Particularly, look into the XML Import Control specific tags.

    Initially I had troubles creating a correct wlan0 configuration to do this, but this was solved by fixing some parts of the XML. It's been covered in this thread (it includes a sample XML file, except for the erroneous parts in red):
    http://forums.lantronix.com/showthread.php?t=1306

    (2) You can do it using the SDK to "set" an XML file programmatically. For example, if you want to send an UDP packet to the device with configuration information, or some other signal, upon which the XML with data will be set. I've had success using the ltrx_xml_import_from_stream function. Something like this:
    Code:
    char xmlData[XML_STRING_FULL_LENGTH];
    strcpy(xmlData, "<!-- Put your XML file here -->";
    struct input_stream_from_const_char ifs;
    ltrx_input_stream_init_from_const_char(&ifs,xmlData);
    bool res_xml = ltrx_xml_import_from_stream(&ifs.inStream, NULL);
    Last edited by ed4096; 04-10-2017, 03:13 PM.

    Comment


    • #3
      Thanks for the response.

      Im not seeing the solution to the problem in the code you XML in the other thread.

      We have no problem sending and receiving data via POST and XML its that I dont see a section in the config/status groups that allows us to tell the xpico to connect to a given visible wifi.

      Im hoping to be able to send the SSID and Password in this manner and the device will auto connect and I am not seeing that functionality in this group. We can create new WLAN profiles no problem but that doesnt solve the problem either.

      The outline of what we are doing is that we have an xPico in a device that is connected to an app via a socket and the app pulls the visible wifi to the xpico and allows the user to select which one the xpico connects to. This is all done via POST and XML.

      We have everything working except dont see a way to "select" the visible wifi and have the xpico connect - the same manner in which you would choose the wifi on your phone for example. We also dont want to force the user to save a given selected wifi to the limited 4 profiles, just connect.

      Comment


      • #4
        There is currently no way, via the WebAPI, to tell the xPico Wi-Fi to connect to a network, but not save that network as a WLAN Profile.

        One option would be to save the WLAN Profile always with the same instance name (instead of using the SSID as the instance), so that every time that the you upload a new network to connect to, it modifies the existing WLAN Profile.

        Mariano

        Comment


        • #5
          You could use serial line to access CLI -> wlan scan and then save its SSID and password as WLAN profiles (XML/POST). You could always delete one profiles if xPico wifi connects another one. Or, always use the same profile name like Mariano said.

          Brooke

          Comment


          • #6
            Originally posted by mariano View Post
            One option would be to save the WLAN Profile always with the same instance name (instead of using the SSID as the instance), so that every time that the you upload a new network to connect to, it modifies the existing WLAN Profile.

            Mariano
            It works quite well in our software package too, i.e. we have only one profile and the software modifies it whenever the user wishes to connect to a different network.

            By the way, we're gathering the nearby SSIDs (visible by xPico) through the serial CLI using the "wlan scan" command (to subsequently pass the list to the SDK software, and to the external device(s)), since we couldn't get the direct CLI wrapper in the SDK to work.

            Comment


            • #7
              Originally posted by ed4096 View Post
              It works quite well in our software package too, i.e. we have only one profile and the software modifies it whenever the user wishes to connect to a different network.

              By the way, we're gathering the nearby SSIDs (visible by xPico) through the serial CLI using the "wlan scan" command (to subsequently pass the list to the SDK software, and to the external device(s)), since we couldn't get the direct CLI wrapper in the SDK to work.
              The programmatic_scan example in the SDK does what you're looking for: utilize the CLI to do a "wlan scan" in the CLI loop, and parse the results. Did you try to start from that example?

              Comment


              • #8
                Originally posted by mariano View Post
                The programmatic_scan example in the SDK does what you're looking for: utilize the CLI to do a "wlan scan" in the CLI loop, and parse the results. Did you try to start from that example?
                We did start from the programmatic_scan example, but we weren't sure whether the newly created thread works correctly. It was hard to debug the software indirectly, the program kept freezing (couldn't pinpoint directly why at that time; thread stack size was OK), and there wasn't enough time anyway to dig deeper, so we went with the solution that worked. This serial implementation was needed anyway (by the way, both serial ports are running well at 921,600 baud). Perhaps there is some kind of an advanced SDK where you can use a debugging toolkit with breakpoints and such? So far, we've used only indirect methods to test the software by writing relevant debugging data into either serial or UDP packets.

                In any case, the current solution works; it takes a couple of seconds to gather the SSIDs, which isn't that bad from the UX perspective, since it's typically done only once during a session lasting a couple of hours. It takes a couple of seconds more to associate with a new network (change the single existing profile) or create an AP (user's choice). Perhaps if we get the CLI in the SDK to work just as well as through serial, we'll change the behavior in a later software bundle version.
                Last edited by ed4096; 04-21-2017, 12:03 PM.

                Comment

                Working...
                X