pub struct Message { /* private fields */ }
Expand description
A Iridium SBD message.
Implementations§
Source§impl Message
impl Message
Sourcepub fn payload(&self) -> &[u8] ⓘ
pub fn payload(&self) -> &[u8] ⓘ
Returns this message’s payload.
§Examples
use sbd_lib::Message;
let message = Message::from_path("data/0-mo.sbd").unwrap();
let payload = message.payload();
pub fn new( header: Header, payload: Vec<u8>, location: Option<LocationInformation>, ie: Vec<InformationElement>, ) -> Self
Sourcepub fn create<I: IntoIterator<Item = InformationElement>>(
iter: I,
) -> Result<Self>
pub fn create<I: IntoIterator<Item = InformationElement>>( iter: I, ) -> Result<Self>
Creates a new message from information elements.
§Examples
use chrono::{Utc, TimeZone};
use sbd_lib::mo;
use sbd_lib::{InformationElement, Header, Message};
let header = InformationElement::Header(mo::Header {
auto_id: 1,
imei: [0; 15],
session_status: mo::SessionStatus::Ok,
momsn: 1,
mtmsn: 0,
time_of_session: Utc.ymd(2017, 10, 1).and_hms(0, 0, 0),
}.into());
let payload = InformationElement::MOPayload(Vec::new());
let message = Message::create(vec![header, payload]);
Sourcepub fn write_to<W: Write>(&self, write: W) -> Result<()>
pub fn write_to<W: Write>(&self, write: W) -> Result<()>
Write this message back to a object that can Write
.
§Examples
use sbd_lib::Message;
let message = Message::from_path("data/0-mo.sbd").unwrap();
let mut buff = vec![];
message.write_to(&mut buff);
Sourcepub fn location(&self) -> &Option<LocationInformation>
pub fn location(&self) -> &Option<LocationInformation>
Returns this message’s location.
Sourcepub fn information_elements(&self) -> &[InformationElement]
pub fn information_elements(&self) -> &[InformationElement]
Returns this message’s information_elements.
Trait Implementations§
impl Eq for Message
impl StructuralPartialEq for Message
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more