Skip to content

Can't build a streamer with more than 1 channel #9

Description

@mwk088

I have been using this great repository to write my rust code for finding, probing and tasking Ettus radios. I currently have single channel working, but when I try and create a two channel stream I get uhd::runtime error stating it cannot start the stream.

Thank you,
Mark

let args = uhd::StreamArgs::<Complex32>::builder()
            .wire_format("sc16".to_string())
            .channels(chan_len)
            .build();

        // Set up the data type
        let mut receiver = usrp.get_rx_stream(&args).unwrap();
        // Start the Stream
        receiver
            .send_command(&StreamCommand {
                command_type: StreamCommandType::StartContinuous,
                time: StreamTime::Now,
            })
            .into_report()
            .change_context(RadioError::RadioConfigError(format!(
                "Could not Start the Stream"
            )))
            .attach_printable(format!("Could not Start the Stream"))?;
The check_status function flags it as a runtime error.

    /// Sends a stream command to the USRP
    ///
    /// This can be used to start or stop streaming
    pub fn send_command(&mut self, command: &StreamCommand) -> Result<(), Error> {
        let command_c = command.as_c_command();
        check_status(unsafe { uhd_sys::uhd_rx_streamer_issue_stream_cmd(self.handle, &command_c) })
    }

/// Converts a status code into a result
pub(crate) fn check_status(status: uhd_sys::uhd_error::Type) -> Result<()> {
    use uhd_sys::uhd_error;
    use Error::*;
    let iserr = match status {
        uhd_error::UHD_ERROR_NONE => None,
        uhd_error::UHD_ERROR_INVALID_DEVICE => Some(InvalidDevice),
        uhd_error::UHD_ERROR_INDEX => Some(Index),
        uhd_error::UHD_ERROR_KEY => Some(Key),
        uhd_error::UHD_ERROR_NOT_IMPLEMENTED => Some(NotImplemented),
        uhd_error::UHD_ERROR_USB => Some(Usb),
        uhd_error::UHD_ERROR_IO => Some(Io),
        uhd_error::UHD_ERROR_OS => Some(Os),
        uhd_error::UHD_ERROR_ASSERTION => Some(Assertion),
        uhd_error::UHD_ERROR_LOOKUP => Some(Lookup),
        uhd_error::UHD_ERROR_TYPE => Some(Type),
        uhd_error::UHD_ERROR_VALUE => Some(Value),
        uhd_error::UHD_ERROR_RUNTIME => Some(Runtime),
        uhd_error::UHD_ERROR_ENVIRONMENT => Some(Environment),
        uhd_error::UHD_ERROR_SYSTEM => Some(System),
        uhd_error::UHD_ERROR_EXCEPT => Some(Except),
        uhd_error::UHD_ERROR_BOOSTEXCEPT => Some(BoostExcept),
        uhd_error::UHD_ERROR_STDEXCEPT => Some(StdExcept),
        uhd_error::UHD_ERROR_UNKNOWN | _ => Some(Unknown),
    };

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions