Transport-independent Android Open Accessory protocol support for MoonBit.
| Path | Purpose |
|---|---|
| protocol.mbt, session.mbt | portable AOA protocol state machine |
| transport/ | transport interfaces and shared transfer types |
| sim/ | deterministic simulator and tests |
| libusb/ | native libusb adapter |
| examples/native/aoa_probe/ | native libusb probe for physical AOA checks |
| wit/ | WASI host capability contract |
| examples/android/ | Android-side test fixture |
| docs/ | protocol and integration-boundary notes |
moon fmt --check
moon check --target native --deny-warn
moon test --target native --deny-warn
moon check --target all --deny-warnmoon check examples/native/aoa_probe --target native --deny-warn
moon run examples/native/aoa_probe --target native -- --helpcd examples/android
gradle :app:assembleDebug --no-daemonmoon run examples/native/aoa_probe --target native -- --vid 0x18d1 --pid <normal-pid>moon run examples/native/aoa_probe --target native -- --accessory./examples/android/deploy-wireless.ps1 -Device "<device-ip>:<debug-port>" -Build -ClearLog -DumpLogpub(all) suberror AoaError {
InvalidState(String)
InvalidIdentityField(Int)
UnsupportedProtocol(Int)
DeviceNotInAccessoryMode(Int)
MissingBulkEndpoints
ShortTransfer(Int, Int)
UnsupportedFeature(AoaFeature)
InvalidHidId(Int)
HidAlreadyRegistered(Int)
UnknownHid(Int)
InvalidHidDescriptorLength(Int, Int)
HidDescriptorNotReady(Int)
Transport(TransportError)
} derive(Eq, Debug)fn AoaIdentity::minimal(manufacturer~ : String, model~ : String, version~ : String) -> AoaIdentity raise AoaErrorfn AoaIdentity::new(manufacturer~ : String, model~ : String, description~ : String, version~ : String, uri~ : String, serial~ : String) -> AoaIdentity raise AoaErrorpub struct AoaSession {
// private fields
}fn AoaSession::configure(self : AoaSession, identity : AoaIdentity, audio_mode? : AudioMode) -> Unit raise AoaErrorfn AoaSession::read_bulk(self : AoaSession, max_length : Int, timeout_ms : Int) -> Bytes raise AoaErrorfn AoaSession::read_bulk_exact(self : AoaSession, length : Int, timeout_ms : Int) -> Bytes raise AoaErrorfn AoaSession::register_hid(self : AoaSession, identifier~ : Int, descriptor_length~ : Int) -> HidDevice raise AoaErrorfn AoaSession::send_hid_event(self : AoaSession, device : HidDevice, report : Bytes) -> Unit raise AoaErrorfn AoaSession::send_hid_report_descriptor(self : AoaSession, device : HidDevice, descriptor : Bytes, packet_size? : Int) -> Unit raise AoaErrorfn AoaSession::write_bulk(self : AoaSession, payload : Bytes, timeout_ms : Int) -> Unit raise AoaErrorpub(all) enum AoaState {
Detected
Probed(AoaProtocolVersion)
Configured
Started
BulkReady
Closed
} derive(Eq, Debug)Install
Download zipTransport-independent Android Open Accessory protocol support for MoonBit.