Announcement

Collapse
No announcement yet.

Accessing serial port from JavaScript

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

  • Accessing serial port from JavaScript

    I have an XPort Universal Demo board that I'm using as both an interface to a device with a serial port and as a webserver. I need the JavaScript in a web page to access a method in the Java applet that handles the serial port, allowing it to read and write data to the serial port. Do you have an example Jave applet and JavaScript that uses the XPort in this fashion?

  • #2
    Originally posted by jpetrucc View Post
    I have an XPort Universal Demo board that I'm using as both an interface to a device with a serial port and as a webserver. I need the JavaScript in a web page to access a method in the Java applet that handles the serial port, allowing it to read and write data to the serial port. Do you have an example Jave applet and JavaScript that uses the XPort in this fashion?
    Standard firmware on the XPort doesn't support access from Javascript, as the only way to access the serial port is via the Tunnel, and Javascript doesn't allow that.

    To use Javascript with the XPort, you need to run custom code compiled with the CPK. The CPK requires a license agreement. If you're interested in pursuing this path, please contact your Lantronix sales contact or FAE to get a copy of the license agreement to sign.

    Mariano

    Comment


    • #3
      Xpico

      Hi Mariano

      I have one xpico wired module and i need to develop a web server, so tell me if this module have java suport.

      Comment


      • #4
        The xPico Ethernet device runs the same software as the XPort (CoBOS), and the serial port can be accessed with a Java applet. You can see this App Note to see how to web enable your CoBOS device:

        https://ltxfaq.custhelp.com/ci/fatta...b_ServerV4.pdf

        Comment


        • #5
          Hello Mariano thanks for the quick replay, i followed the documentation and it works in parts, but when open in the browser the java security stop the process, i add the IP address in the java control panel and it still doesn't work. Is it possible to fix it?

          Comment


          • #6
            Originally posted by py2maw View Post
            Hello Mariano thanks for the quick replay, i followed the documentation and it works in parts, but when open in the browser the java security stop the process, i add the IP address in the java control panel and it still doesn't work. Is it possible to fix it?
            That's going to have to be fixed at the browser level. Many browsers are going away from supporting Java applets, so it'll be a problem.

            I'll send you an email with some Alpha firmware that could support access to the serial port through Javascript (similar to the xPico Wi-Fi's WebAPI).

            Mariano

            Comment


            • #7
              Hi all,

              Please forgive my inexperience - I have only written html pages that communicate with basic javascript in the past.

              I have the same issue as py2maw above. I have compiled the example js code as per steps in:
              https://ltxfaq.custhelp.com/ci/fatta...b_ServerV4.pdf

              It runs ok from DOS (page 15 - C:> java Test xxx.xxx.xxx.xxx 10001) but does not show inside my html page as the plugin to enable Java Applets is no longer supported.

              Does Lantronix have an alternate method / workaround for this? Is there an example html app or code I can download?

              We require a simple serial terminal on a html page. I have the Xport PRO (XPP1002000-02R).

              Thanks in advance!

              Alex

              Comment


              • #8
                The XPort Pro doesn't support WebAPI to allow access to the serial port from an HTTP transaction (which is required for Javascript).

                I recommend that you look at the XPort Edge, which does have the WebAPI:
                https://www.lantronix.com/products/xport-edge/

                I'll send you an email with contact information for the Lantronix sales person in your region so that you can get more information on the XPort Edge.

                Mariano

                Comment

                Working...
                X