Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async friendly HciConnection trait + async friendly HciConnector implementation #21

Closed
brandonros opened this issue Aug 23, 2023 · 1 comment

Comments

@brandonros
Copy link
Contributor

No description provided.

@brandonros
Copy link
Contributor Author

I'm not sure this is needed?

struct AsyncBleConnector {}

impl AsyncBleConnector {
    pub fn new() -> AsyncBleConnector {
        return AsyncBleConnector {};
    }
}

#[derive(Debug)]
pub enum BleConnectorError {
    Unknown,
}

impl embedded_io_async::Error for BleConnectorError {
    fn kind(&self) -> embedded_io_async::ErrorKind {
        embedded_io_async::ErrorKind::Other
    }
}

impl embedded_io_async::ErrorType for AsyncBleConnector {
    type Error = BleConnectorError;
}

impl embedded_io_async::Read for AsyncBleConnector {
    async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
        Ok(0)
    }
}

impl embedded_io_async::Write for AsyncBleConnector {
    async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error> {
        Ok(0)
    }
}

I have this in my own crate and it seems to plug into bleps::asynch::Ble without issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant