Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't reconnect to device #49

Open
X-Y opened this issue Jan 5, 2017 · 0 comments
Open

Can't reconnect to device #49

X-Y opened this issue Jan 5, 2017 · 0 comments

Comments

@X-Y
Copy link

X-Y commented Jan 5, 2017

System: Ubuntu 16.04 LTS
Browser: Firefox
plugin version: downloaded from bin/Linux_x86_64/npjUART.so at commit 979c040
Test process: Have an Arduino board constantly sending data to serial port connected to computer. With the following code, the data will be displayed to the console. However, if the device is disconnected and reconnected, calling ser.is_open() will return true, but no message can be received anymore

<html>
    <head>
        <title>test page for object fbcontrol</title>
    </head>
    <script type="text/javascript">
        var ser;
        function plugin0()
        {
            return document.getElementById('plugin0');
        }
        plugin = plugin0;
        
        function recv(bytes, size)
        {
            console.log(bytes);
        }
        
        function pluginLoaded() 
        {
            ser = plugin().Serial;// Get a Serial object
			ser.open("/dev/ttyACM0");// Open a port
			ser.set_option(115200,0,8,0,0);// Set port options 
			ser.recv_callback(recv); // Callback function for recieve data
        }

        setInterval(function() {
            if(!plugin().Serial.is_open()){
                console.log("reconnecting");
                pluginLoaded();
            }
        }, 1000);
    </script>
    <body onload="load()">
        <object id="plugin0" type="application/x-juart" width="0" height="0" >
            <param name="onload" value="pluginLoaded"  />
        </object><br />
        <h1>jUART Serial Port Echo Test</h1><br/>
        This test will echo the data you sent through serial port.
    </body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant