nykytenko / onyx-serial Goto Github PK
View Code? Open in Web Editor NEWThe simple serial port library by D.
License: MIT License
The simple serial port library by D.
License: MIT License
../../.dub/packages/onyx-serial-0.3.4/source/onyx/serial.d(476,19): Error: undefined identifier 'CRTSCTS'
../../.dub/packages/onyx-serial-0.3.4/source/onyx/serial.d(477,61): Error: undefined identifier 'ECHOCTL', did you mean variable 'ECHONL'?
../../.dub/packages/onyx-serial-0.3.4/source/onyx/serial.d(477,71): Error: undefined identifier 'ECHOPRT'
../../.dub/packages/onyx-serial-0.3.4/source/onyx/serial.d(477,81): Error: undefined identifier 'ECHOKE', did you mean variable 'ECHOE'?
dmd failed with exit code 1.
I've been reading the code around and the read method is works nicely unless you are expecting to read something at an unknown time. I feel that it is relevant to allow the code user to block while the method is unable to read anything (I myself am currently in need of that feature).
I have a pretty good idea about the implementation, so I can do it myself. Interested in a pull request to include this in v4.0?
import onyx.serial;
void main()
{
/* Create ports */
auto port1 = OxSerialPort("/dev/ttyS1", 9600, "none", 10);
auto port2 = OxSerialPort("/dev/ttyS2", 9600, "none", 10);
port1.open;
port2.open;
ubyte[] data = [0x22, 0x33, 0xCC];
port1.write(data);
ubyte[] buf = port2.read(3);
assert (buf == data);
port1.close();
}
Hello. I changed main.d like this and when I try to compile program using dub I get linker errors like this.
$ dub
Package onyx-config can be upgraded from 2.0.3 to 2.0.4.
Use "dub upgrade" to perform those changes.
Performing "debug" build using dmd for x86.
onyx-config 2.0.3: target for configuration "library" is up to date.
onyx-serial 0.3.4: target for configuration "test" is up to date.
To force a rebuild of up-to-date targets, run again with --force.
Running ./bin/onyx-serialonyx.serial.SerialPortSetupException@std/stdio.d(3969): Can't setup serial port (Input/output error)
source/onyx/serial.d:503 core.sys.posix.termios.termios onyx.serial.PosixImpl.getTermios() [0x80d01ef]
source/onyx/serial.d:473 void onyx.serial.PosixImpl.setFlags() [0x80d010f]
source/onyx/serial.d:406 void onyx.serial.PosixImpl.setup() [0x80cfed1]
source/onyx/serial.d:196 bool onyx.serial.OxSerialPort.open() [0x80cf8a7]
test/main.d:14 _Dmain [0x80d793f]
??:? D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv [0x80e6f92]
??:? void rt.dmain2.d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x80e6ef5]
??:? void rt.dmain2.d_run_main(int, char**, extern (C) int function(char[][])).runAll() [0x80e6f4e]
??:? void rt.dmain2.d_run_main(int, char, extern (C) int function(char[][])).tryExec(scope void delegate()) [0x80e6ef5]
??:? _d_run_main [0x80e6e7e]
??:? main [0x80d7a53]
??:? __libc_start_main [0x1294d2]
Program exited with code 1
Any ideas? Thanks.
Nice library you made here :)
I was thinking, wouldn't it make much more sense to pass a Parity member instead of a string to specify the parity type? It would be way more typo-proof.
Kind of the same for the BaudRate, since it only makes sense to specify a standard value, accepting an arbitrary integer as a parameter can confuse the code user.
What do you think? Should I do it myself? Any against points?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.