Skip to main content

imsg_session/
lib.rs

1//! Session lifecycle — SDP lookup, RFCOMM connect, OBEX handshake, reconnect, and MNS relay.
2
3pub mod lifecycle;
4pub mod loop_util;
5pub mod mns;
6pub mod reconnect;
7pub mod relay;
8
9// `pub mod` under cfg(test): shared across mns/relay test modules; must be `pub` to escape
10// `redundant_pub_crate`. cfg(test)-gating keeps it out of the real crate API.
11#[cfg(test)]
12pub mod test_support;
13
14pub use map_core::mns_event::{EventType, MnsEvent};
15pub use map_core::MapError;
16pub use pbap_core::PbapError;
17pub use reconnect::SessionState;
18pub use relay::run_mns_relay;
19pub use transport::TransportError;
20
21/// MAP/PBAP/transport layer errors.
22#[derive(Debug, thiserror::Error)]
23pub enum SessionError {
24    /// OBEX MAP layer; either CONNECT failed or a command was rejected.
25    #[error("MAP session error: {0}")]
26    Map(#[from] MapError),
27    /// OBEX PBAP layer; CONNECT failed or command rejected.
28    #[error("PBAP session error: {0}")]
29    Pbap(#[from] PbapError),
30    /// RFCOMM or pre-OBEX I/O failure.
31    #[error("transport error: {0}")]
32    Transport(#[from] TransportError),
33}