Skip to content

OpenThread Rust API #28

@darconeous

Description

@darconeous

Hi.

I wrote a fairly well-thought-out safe async Rust wrapper around the OpenThread API for Fuchsia, and it should in theory port well to other operating systems.

Just wanted to point it out in case there were some useful design patterns.

https://fuchsia-docs.firebaseapp.com/rust/openthread/ot/index.html

What you would do is implement the Platform trait and pass that in when you initialize the ot::Instance. For example, the Fuchsia platform used this crate. You can then create a TaskletStream (src) and handle that however you see best in your async design paradigm. It is written in such a way that you can wrap the ot::Instance either directly in a mutex or in a struct which is protected by a mutex (as long as that class implements AsRef<ot::Instance>).

I spent years working on it. I'd like to think it is well thought-out, but never got around to having a formal release while I was at Google. All of the code is BSD-licensed.

The code that used this on Fuchsia was lowpan-ot-driver. You can see here where we initialize OpenThread with a async sink and stream for Spinel frames.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions