javascript library using serial api's (Chrome or node.js)

wjcroftwjcroft Mount Shasta, CA
edited February 2015 in Software
This discussion was created from comments split from: OpenBCI GUI linux64 needs jssc.jar update.

Comments

  • wjcroftwjcroft Mount Shasta, CA
    edited December 2014
    Wondering if we could start another thread regarding your javascript / Chrome serial api driver / library? Will you be making that available on Github or other means? Could be very useful to other developers.

    Regards, William
  • Yes of course, it was my intention. I'll make my code roughly presentable and do that asap. (At this time it's more a feasibility study, and I did found not a way to stream data to file. Even with the chrome filesystem api, user seems to have to make an action. The only solution I see is to make a simple node.js server, to store to file or database.)
  • Please find my first draft here : https://github.com/Gwym/bci.js

    image
  • wjcroftwjcroft Mount Shasta, CA
    edited December 2014
    Gwym, thanks.  Regarding your December 28 comment:

    > and I did found not a way to stream data to file

    Are these APIs possibly of use?


    ----

    Ah, I see now rereading your post that the Chrome fileSystem API is not cooperating with you, likely having to do with the sandboxing. Did find a couple related links,


    William
  • edited December 2014
    Thanks for the links, but as said, this is what I already explored. I can save to file or save to datastore : in the current version data is buffered in memory and can then be saved to a file, but the user has to click to save the file. In all cases, even with the 'no user action' solutions to datastore, it is a sanboxed access to quota-limited store (typically 50Mo max) that will not fit the needs.

    I started a node.js version using node-serialport and node-ws.
  • wjcroftwjcroft Mount Shasta, CA
    edited December 2014
    Gwym, thanks.

    > In all cases, even with the 'no user action' solutions to datastore, it
    is a sandboxed access to quota-limited store (typically 50Mo max) that
    will not fit the needs.

    Am I reading the http://danml.com/download.html link incorrectly? I had the impression that this is a way out of the sandbox, and possibly the quota as well. Still though looks like it requires some user clicks.

    Your node.js version does sound like it avoids all these limitations.
  • Sorry, my mistake, when the user is prompted for downloading there is of course no limit but the memory for the buffer.
  • wjcroftwjcroft Mount Shasta, CA
    If the javascript program is only doing neurofeedback or neurogaming (without the need to save the entire raw session data) -- then various signal processing libraries may open possibilities,

    https://www.google.com/search?q=javascript+signal+processing

    https://www.google.com/search?q=javascript+ui+framework+comparison+2014


  • Whoa, this is cool!

    I didn't even know that there was a Serial API for Chrome.  

    While I dislike javascript, it is a really cool idea to be able to step away from Processing and do everything in a browser.  Really cool. 

    Chip
  • Scala might be a nice option for this: It compiles to JS and is also Java compatible, so you could reuse the same code for Processing and the browser :)
    I'm admittedly a Scala fanboy ;)
  • Is there any news on the NodeJS SDK? 

    I would love to help testing the SDK and get it up and running quickly.
  • wjcroftwjcroft Mount Shasta, CA
    edited February 2015
    Willem, I merged your question into this existing thread.

    @Gwym , does your https://github.com/Gwym/bci.js contain now both the Chrome and node.js versions?

    William
  • edited February 2015
    Yes I pushed a basis for the node.js version some times ago, I am currently on merging the webapp and the chromeapp to avoid duplicate « client side » code. I wanted to change from current time-based protocol to a parser based one that would allow to decode board state, but I am facing a problem : I got a lot of errors that do not allow the parser to work well, and I currently don't know if these are coming from board, from drivers or from elsewhere.

    For example, I sometimes got in my logs (directly from node-serial output) :

    « updating iWedance detect setings »

    instead of

    « updating impedance detect setings »

    or

    « CH6SET, 0x0A, 0x69, 0, 1, 1, 0, 1, 0, 0, 1
    , 0x0B, 0x69, 0, 1, 1, 0, 1, 0, 0, 1
    CH8SET, 0x0C, 0x69, 0, 1, 1, 0, 1, 0, 0, 1 »

    instead of

    « CH6SET, 0x0A, 0xE0, 1, 1, 1, 0, 0, 0, 0, 0
    CH7SET, 0x0B, 0x68, 0, 1, 1, 0, 1, 0, 0, 0
    CH8SET, 0x0C, 0x68, 0, 1, 1, 0, 1, 0, 0, 0 »

    and so on, so i am investigating further for now.
  • Hi Gwym,

    Thanks.

    I'm trying to get things to work on my Windows Laptop, but the serialport Node module keeps giving me 'Access Denied'. 
    It's a known issue (https://github.com/voodootikigod/node-serialport/issues/333) and I'm looking for a workaround.



  • biomurphbiomurph Brooklyn, NY
    @Gwym, I have sometimes seen the kind of serial drop that you do in the CH7SET above, but have not see the weird substitution error.
    In my experience, the error is happening on the PC's serial buffer side, not the board or radios.
  • @willemmulder ;: I use linux, so I didn't notice this issue. Does it work on Windows with the chrome app serial ? If so, I could modify the app to stream data from chrome app to node server through websocket instead of using serialportnode.

    @biomurph
    In my configuration, the errors are quite reproductible, especially for the iWedance, I plan to compare logs with the chrome app version as soon as the settings management will be implemented.

    (but I save these changes and tests for later, I'm currently making some test with the cloud signal processing and cognitive computing api, and as it's a time limited trial, I shifted my priorities :) )
Sign In or Register to comment.