Comments (8)
Hi. Arduino is normally embedded. Is there a specific use case you feel should be supported?
from wails.
Hi Lea, thanks for considering this.
In general browser technologies do not allow access to the local machine, which in practice mostly means that files and ports are not accessible. Besides files, which are essential to almost all applications, access to serial ports in particular is essential to almost all "maker projects".
As most people are familiar with the Arduino, I used that term. I have programmed many Delphi desktop applications, none have ever used any ports other than the serial.
I think it is sufficient to provide access to the data-stream, and to I/Os like DTR. No other functionality would be required (I know some libs allow for parsing the data-stream).
Hope this answers your question. But maybe it didn't. In short I think the maker space is the use case that should be supported. A solution in this space is johny-five+firmata, but it imposes an odd protocol over the serial connection (frontend example: http://johnny-five.io/examples/motor/).
Note that my suggestion gravitates development towards the frontend, because with access to files and serial ports, Go development becomes unnecessary. But I could imagine a system where the emphasis would be on the backend. The frontend would consist of (rather simple) dialogs and visualizations (in a simple vertical stack of elements, all horizontally centered). The backend would process most clicks, update the model in response, and provoke screen updates. The frontend would consist mainly of render functions. This might be even simpler to use, as Go has primitives to easily handle several devices concurrently.
from wails.
If you can create a list of specific things you feel would help this aim, I'm sure we can look into it!
from wails.
The best project with similar code I've seen is:
https://github.com/johnlauer/serial-port-json-server
In this project all serial port events are packed into JSON, in Wails they need to become a Wails event. The "serial*.go" files in particular are relevant, clarifying all events.
In a Vue example one would be able to:
- list all ports
- select a port,
- assign a baudrate/bitrate,
- connect to the port,
- send data and
- have any data received displayed (including binary)
- sending/receiving could be interrupted by disconnected/connected events, as the port may have been (temporarily) removed, or the remote device may have been (temporarily) removed
- serial ports have pins that can control the flow of data, these may need setting and/or reading (the indicated project above lists them in detail). These days hardware control flow is rarely used, and the pins are used as I/O's instead, so it suffices to expose them.
The data is binary (raw bytes), no encoding. Whenever any of the inputs changes (may need polling), an event must be triggered, notifying the new state (of all pins). No need for individual pin updates (because that's easy to do on the frontend itself).
So I see this API:
- list() => list of ports, and their properties (see project above)
- connect(port: string, baudrate: int [, parity: enum, stopbits: enum]) => channel | error
- channel.connected(), notifies of an established connection
- channel.disconnect() => ok | error
- channel.disconnected(), notifies of a broken connection, data in serial output buffers has been cleared
- channel.incoming(string), passing a string of bytes
- channel.outgoing(string), passing a string of bytes
- channel.inputs_changed(inputs: u8)
- channel.outputs_changed(outputs: u8)
A channel.disconnected() can come at any time. If auto-reconnect is supported, disconnected() and connected() events can alternate. Auto-reconnects are desirable as the connection can be suspended by the device, or by the user unplugging a serial port. These events may pass the motive of the break: port unplugged or device disconnected.
Additionally a log data to file feature would be useful (also for debugging), but that's probably better solved by access to the local file-system.
from wails.
I believe everything you need is supported right now - simply write the Go and use it :-) Arduino would be running Linux right?
from wails.
Arduino would be running Linux right?
No. Arduino is a placeholder for any device attached to a serial port, typically an Arduino, and Arduinos do not run Linux. Could even be a keyboard, or a MIDI device, anything that complies with the hardware of a serial port interface.
But given you're in the dark about serial ports, I guess you're not the right person to do this. Given time I could do this, I would have to figure out how to create Wails events in Go, for the frontend to consume. Doesn't seem difficult, would be my first Go ever though :)
Thanks.
from wails.
Hi. Eventing is pretty easy. I recommend you have a look at the Todo tutorial. That's similar to what you want to do: most of the logic is in Go and when system events happen, they trigger application events. Once you get a runtime object, you can emit and listen to any events.
from wails.
@freedaun Is there anything we need to do to close this now? Thanks.
from wails.
Related Issues (20)
- Error: flag provided but not defined: -nopackage HOT 2
- Wails app crash when Frameless attribute is use in two apps in a row on Linux HOT 2
- Cannot pass a string to createFrom on field with type "any"
- Wails 2.8.1 dev error on browser
- Wails build creating invalid folders based on embed file selections. Then failing. HOT 7
- Removing my templates
- Wails Dev Fails with option -r not recognized HOT 2
- Slice of array causes `wails generate module` to fail
- build arm64 in linux error HOT 2
- atomicgo.dev is not reach anymore, so can´t install wails HOT 2
- Broken link found at docs/guides/obfuscated/ HOT 1
- title wrong in zh : WindowHide not WindowShow
- Wails3 Maximise/Minimise Button can't be disable HOT 1
- [V3]在32位系统上编译失败 HOT 2
- Bindings: Field that starts with special characters generates wrong binding HOT 1
- Frontend is unable to access mediaDevices HOT 2
- Error when running on localhost HOT 4
- CSS Transparency Effect Causes Ghosting HOT 2
- Add devcontainers support HOT 4
- Getting and setting window position on MacOS changes window position HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wails.