Struct sbd::mo::Message[][src]

pub struct Message { /* fields omitted */ }
Expand description

Error returned when there is no A mobile-origined Iridium SBD message.

Messages can be ordered by time of session.

Implementations

Reads in a message from a file path.

Examples
use sbd::mo::Message;
let message = Message::from_path("data/0-mo.sbd").unwrap();

Reads in a message from an object that implements Read.

Per the specification, oversized and undersized messages will result in an error.

Examples
use std::fs::File;
use sbd::mo::Message;
let mut file = File::open("data/0-mo.sbd").unwrap();
let message = Message::read_from(file).unwrap();

Creates a new message from information elements.

Examples
extern crate chrono;
use chrono::{Utc, TimeZone};
use sbd::mo::{InformationElement, Header, SessionStatus, Message};
let header = InformationElement::Header(Header {
    auto_id: 1,
    imei: [0; 15],
    session_status: SessionStatus::Ok,
    momsn: 1,
    mtmsn: 0,
    time_of_session: Utc.ymd(2017, 10, 1).and_hms(0, 0, 0),
});
let payload = InformationElement::Payload(Vec::new());
let message = Message::new(vec![header, payload]);

Returns this message’s auto id.

Examples
use sbd::mo::Message;
let message = Message::from_path("data/0-mo.sbd").unwrap();
let auto_id = message.auto_id();

Returns this message’s imei as a string.

Panics

Panics if the IMEI number is not valid utf8. The specification says that IMEIs should be ascii numbers.

Examples
use sbd::mo::Message;
let message = Message::from_path("data/0-mo.sbd").unwrap();
let imei = message.imei();

Returns this message’s session status.

Examples
use sbd::mo::Message;
let message = Message::from_path("data/0-mo.sbd").unwrap();
let session_status = message.session_status();

Returns this message’s mobile originated message sequence number.

Examples
use sbd::mo::Message;
let message = Message::from_path("data/0-mo.sbd").unwrap();
let momsn = message.momsn();

Returns this message’s mobile terminated message sequence number.

Examples
use sbd::mo::Message;
let message = Message::from_path("data/0-mo.sbd").unwrap();
let mtmsn = message.mtmsn();

Returns this message’s time of session.

Examples
use sbd::mo::Message;
let message = Message::from_path("data/0-mo.sbd").unwrap();
let time_of_session = message.time_of_session();

Returns this message’s payload.

Examples
use sbd::mo::Message;
let message = Message::from_path("data/0-mo.sbd").unwrap();
let payload = message.payload();

Write this message back to a object that can Write.

Examples
use std::io::Cursor;
use sbd::mo::Message;
let message = Message::from_path("data/0-mo.sbd").unwrap();
let mut cursor = Cursor::new(Vec::new());
message.write_to(&mut cursor);

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.