TsuITOAR / visa-rs

High-level Rust bindings to VISA(Virtual Instrument Software Architecture)
Apache License 2.0
18 stars 4 forks source link

two questions regarding the sample code in the MD file #25

Open oz-piita opened 1 month ago

oz-piita commented 1 month ago

・Did you write visa-rs wrong about Cargo.toml? I'm getting an error because of visars ( is wrong, - is correct).

・Using the read_line() method, but is there any way to explicitly change the ReadTermination? I always read with read_until(b'\n',&mut buf) instead of read_line() but I want to check best practices.

TsuITOAR commented 4 weeks ago

Yes I wrotevisa-rs wrong XD, thanks. The read_line() method is from the std library, so I can't change it. The visa does have the VI_ATTR_TERMCHAR attribute, but it only affects the low-level read/write IO functions, not the behavior of read_line() because it does not change the message sent or received. If you want to change this attribute, use the HasAttribute::set_attr method.

Whether the message ends with a \n or not, to my knowledge, is decided by the instrument driver, VISA only handles the communication between your computer and the instrument driver. But the SCPI standard requires all messages end with \<newline>, <^END> or \<newline><^END>