Skip to main content

imsg_session/
lib.rs

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