rust-soapysdr icon indicating copy to clipboard operation
rust-soapysdr copied to clipboard

Expose TX and RX flags

Open kevinmehall opened this issue 6 years ago • 12 comments

https://github.com/pothosware/SoapySDR/blob/master/include/SoapySDR/Constants.h

For RX streams, perhaps RxStream::read should return Result<RxStatus, Error> rather than Result<usize, Error>, where RxStatus is a struct with fields:

/// Number of samples read from the stream. May be less than the number of samples requested.
samples: usize,

/// Indicates that the received data ends a burst
end_burst: bool,

/// Indicates that stream terminated prematurely. 
end_abrupt: bool

/// Indicates that the packet was fragmented
more_fragments: bool

/// Timestamp in nanoseconds, if provided by the driver
time: Option<i64>,

end_abrupt could use a better name or better description. pothos-soapy uses it as a generalized "we lost samples and must resync timing" indicator. It is unclear how it differs from an error return, besides that you get some samples this way.

RxStream::activate could gain args burst: Option<u64>, which sets the SOAPY_SDR_END_BURST flag and sets numElems.

For TX streams, the simplest would be to add time: Option<i64>, end_burst: bool args to write. This variant could also be a separate method, but I don't have a good name for it.

Propose to leave unsupported for now, as I don't think they are used by any driver: SOAPY_SDR_ONE_PACKET SOAPY_SDR_WAIT_TRIGGER

These might want to be configured as a stream setting, as you're not likely to need to switch between manual packet management and regular streaming on a per-call basis.

kevinmehall avatar Feb 28 '18 03:02 kevinmehall