Struct prust_core::sp::SpacePacket[][src]

pub struct SpacePacket<T: SpacePacketDataField> { /* fields omitted */ }

Send packet will be represented in this struct. Storing operations will be done in Big Endian byte order.

Implementations

impl SpacePacket<TmPacket<ServiceFail>>[src]

pub fn new_service_1_2<T: Request>(
    request: &T,
    destination_id: u16,
    packet_name: u16,
    err_code: u8,
    err_data: Vec<u8>
) -> Result<Self, Error>
[src]

Wrapper for “new” function specific to TM[1,2].

pub fn new_service_1_4<T: Request>(
    request: &T,
    destination_id: u16,
    packet_name: u16,
    err_code: u8,
    err_data: Vec<u8>
) -> Result<Self, Error>
[src]

Wrapper for “new” function specific to TM[1,4].

pub fn new_service_1_8<T: Request>(
    request: &T,
    destination_id: u16,
    packet_name: u16,
    err_code: u8,
    err_data: Vec<u8>
) -> Result<Self, Error>
[src]

Wrapper for “new” function specific to TM[1,8]. TM[1,8] failed completion of execution verification report

pub fn new_service_1_10<T: Request>(
    request: &T,
    destination_id: u16,
    packet_name: u16,
    err_code: u8,
    err_data: Vec<u8>
) -> Result<Self, Error>
[src]

Wrapper for “new” function specific to TM[1,10].

pub fn new<T: Request>(
    request: &T,
    message_subtype: u8,
    destination_id: u16,
    packet_name: u16,
    err_code: u8,
    err_data: Vec<u8>
) -> Result<Self, Error>
[src]

Creates a the packet data structures with the given parameters

Errors

Returns error if Primary or Secondary Headers are invalid

pub fn from_bytes(buffer: &[u8]) -> Result<Self, Error>[src]

Creates the struct from a byte array slice

Errors

if buffer.len() < PH_LEN (6) + TM_HEADER_LEN (9) + REQUEST_ID_LEN (4) + PEC_LEN(2) or if the byte array is not compliant to TM[1,2], TM[1,4], TM[1,8], TM[1,10].

pub fn to_bytes(&self) -> Vec<u8>[src]

Encodes the object to a byte vector

pub fn get_err(&self) -> (u8, Vec<u8>)[src]

impl SpacePacket<TmPacket<ServiceFailStep>>[src]

pub fn new_service_1_6<T: Request>(
    request: &T,
    destination_id: u16,
    packet_name: u16,
    err_code: u8,
    err_data: Vec<u8>,
    step_id: u16
) -> Result<Self, Error>
[src]

Wrapper for “new” function specific to TM[1,6].

pub fn new<T: Request>(
    request: &T,
    destination_id: u16,
    packet_name: u16,
    err_code: u8,
    err_data: Vec<u8>,
    step_id: u16
) -> Result<Self, Error>
[src]

Creates a the packet data structures with the given parameters

Errors

Returns error if Primary or Secondary Headers are invalid

pub fn from_bytes(buffer: &[u8]) -> Result<Self, Error>[src]

Creates the struct from a byte array slice

Errors

if the byte array is not compliant to TM[1,6]

pub fn to_bytes(&self) -> Vec<u8>[src]

Encodes the object to a byte vector

impl SpacePacket<TmPacket<ServiceSuccess>>[src]

pub fn new_service_1_1<T: Request>(
    request: &T,
    destination_id: u16,
    packet_name: u16
) -> Result<Self, Error>
[src]

Wrapper for “new” function specific to TM[1,1].

pub fn new_service_1_3<T: Request>(
    request: &T,
    destination_id: u16,
    packet_name: u16
) -> Result<Self, Error>
[src]

Wrapper for “new” function specific to TM[1,3].

pub fn new_service_1_7<T: Request>(
    request: &T,
    destination_id: u16,
    packet_name: u16
) -> Result<Self, Error>
[src]

Wrapper for “new” function specific to TM[1,7]. TM[1,7] successful completion of execution verification report

pub fn new<T: Request>(
    request: &T,
    message_subtype: u8,
    destination_id: u16,
    packet_name: u16
) -> Result<Self, Error>
[src]

Creates a the packet data structures with the given parameters

Errors

Returns error if Primary or Secondary Headers are invalid

pub fn from_bytes(buffer: &[u8]) -> Result<Self, Error>[src]

Creates the struct from a byte array slice

Errors

if buffer.len() != PH_LEN (6) + TM_HEADER_LEN (9) + PEC_LEN (2) +REQUEST_ID_LEN (4) or not compliant to message subtype is not 1,3 or 7

pub fn to_bytes(&self) -> Vec<u8>[src]

Encodes the object to a byte vector

impl SpacePacket<TmPacket<ServiceSuccessStep>>[src]

pub fn new_service_1_5<T: Request>(
    request: &T,
    destination_id: u16,
    packet_name: u16,
    step_id: u16
) -> Result<Self, Error>
[src]

A different name for “new” function specific to TM[1,5] to comply to the function naming convention.

pub fn new<T: Request>(
    request: &T,
    destination_id: u16,
    packet_name: u16,
    step_id: u16
) -> Result<Self, Error>
[src]

Creates a the packet data structures with the given parameters

Errors

Returns error if Primary or Secondary Headers are invalid

pub fn from_bytes(buffer: &[u8]) -> Result<Self, Error>[src]

Creates the struct from a byte array slice

Errors

if buffer.len() != PH_LEN (6) + TM_HEADER_LEN (9) + REQUEST_ID_LEN (4) + PEC_LEN (2) + STEP_ID_LEN (2) /// or if the byte array is not compliant to TM[1,5].

pub fn to_bytes(&self) -> Vec<u8>[src]

Encodes the object to a byte vector

impl SpacePacket<TcPacket<Service3_1>>[src]

Implementations of SpacePacket specific to PUS and TC[3,1]

Errors

If not a valid CCSDS 133. 0-B-1 packet for TC[3,1]. See page 483 of ECSS-E-ST-70-41C.

pub fn new_service_3_1(
    apid: u16,
    packet_name: u16,
    housekeeping_report_id: u8,
    collection_interval: u8,
    n1: u8,
    parameter_ids: Vec<u8>
) -> Result<Self, Error>
[src]

pub fn new(
    apid: u16,
    packet_name: u16,
    housekeeping_report_id: u8,
    collection_interval: u8,
    n1: u8,
    parameter_ids: Vec<u8>
) -> Result<Self, Error>
[src]

For creating a TC[3,1] packet data structure TODO: IMPORTANT ID’S ARE NOT CHECKED

pub fn to_bytes(&self) -> Vec<u8>[src]

Encodes the object to a byte vector

pub fn from_bytes(buffer: &[u8]) -> Result<Self, Error>[src]

pub fn hk_id(&self) -> u8[src]

pub fn get_params(&self) -> &Vec<u8>[src]

impl SpacePacket<TmPacket<Service3_25>>[src]

Implementations of SpacePacket specific to PUS and TM[3,25]

Errors

If not a valid CCSDS 133. 0-B-1 packet for TM[3,25]. See page 483 of ECSS-E-ST-70-41C.

pub fn new_service_3_25(
    destination_id: u16,
    packet_name: u16,
    housekeeping_id: u8,
    parameter_value: Vec<u8>
) -> Result<Self, Error>
[src]

pub fn new(
    destination_id: u16,
    packet_name: u16,
    housekeeping_id: u8,
    parameter_value: Vec<u8>
) -> Result<Self, Error>
[src]

For creating a TM[3,25] packet data structure TODO: IMPORTANT ID’S ARE NOT CHECKED

pub fn to_bytes(&self) -> Vec<u8>[src]

Encodes the object to a byte vector

pub fn from_bytes(buffer: &[u8]) -> Result<Self, Error>[src]

pub fn get_parameter_values(&self) -> Vec<u8>[src]

impl SpacePacket<TcPacket<Service3_27>>[src]

Implementations of SpacePacket specific to PUS and TC[3,27]

Errors

If not a valid CCSDS 133. 0-B-1 packet for TC[3,27]. See page 483 of ECSS-E-ST-70-41C.

pub fn new_service_3_27(
    apid: u16,
    packet_name: u16,
    n: u8,
    report_ids: Vec<u8>
) -> Result<Self, Error>
[src]

pub fn new(
    apid: u16,
    packet_name: u16,
    n: u8,
    report_ids: Vec<u8>
) -> Result<Self, Error>
[src]

For creating a TC[3,27] packet data structure TODO: IMPORTANT ID’S ARE NOT CHECKED

pub fn to_bytes(&self) -> Vec<u8>[src]

Encodes the object to a byte vector

pub fn from_bytes(buffer: &[u8]) -> Result<Self, Error>[src]

pub fn get_hk_report_struct_ids(&self) -> &Vec<u8>[src]

impl SpacePacket<TcPacket<Service3_5x6>>[src]

Implementations of SpacePacket specific to PUS and TC[3,5]

Errors

If not a valid CCSDS 133. 0-B-1 packet for TC[3,5]. See page 483 of ECSS-E-ST-70-41C.

pub fn new_service_3_5(
    apid: u16,
    packet_name: u16,
    n: u8,
    report_ids: Vec<u8>
) -> Result<Self, Error>
[src]

Wrapper for creating a TC[3,5] packet

pub fn from_bytes_service_3_5(buffer: &[u8]) -> Result<Self, Error>[src]

Wrapper for converting a TC[3,5] packet from bytes

impl SpacePacket<TcPacket<Service3_5x6>>[src]

Implementations of SpacePacket specific to PUS and TC[3,5]

Errors

If not a valid CCSDS 133. 0-B-1 packet for TC[3,5]. See page 483 of ECSS-E-ST-70-41C.

pub fn to_bytes(&self) -> Vec<u8>[src]

Encodes the object to a byte vector

pub fn from_bytes_service_3_5x6(buffer: &[u8]) -> Result<Self, Error>[src]

pub fn get_report_parameter_ids(&self) -> Vec<u8>[src]

impl SpacePacket<TcPacket<Service3_5x6>>[src]

Implementations of SpacePacket specific to PUS and TC[3,6]

Errors

If not a valid CCSDS 133. 0-B-1 packet for TC[3,6]. See page 483 of ECSS-E-ST-70-41C.

pub fn new_service_3_6(
    apid: u16,
    packet_name: u16,
    n: u8,
    report_ids: Vec<u8>
) -> Result<Self, Error>
[src]

Wrapper for creating a TC[3,6] packet

pub fn from_bytes_service_3_6(buffer: &[u8]) -> Result<Self, Error>[src]

Wrapper for converting a TC[3,6] packet from bytes

impl SpacePacket<TcPacket<Service8_1>>[src]

Implementations of SpacePacket specific to PUS and TC[8,1]

Errors

If not a valid CCSDS 133. 0-B-1 packet for TC[8,1]. See page 483 of ECSS-E-ST-70-41C.

pub fn from_bytes(buffer: &[u8]) -> Result<Self, Error>[src]

pub fn new_service_8_1(
    apid: u16,
    packet_name: u16,
    func_id: String,
    n: u8,
    args_field: Vec<u8>
) -> Result<Self, Error>
[src]

pub fn new(
    apid: u16,
    packet_name: u16,
    func_id: String,
    n: u8,
    args_field: Vec<u8>
) -> Result<Self, Error>
[src]

Errors

returns error if func_id.len() > FUNC_ID_LEN or returns error if Primary or Secondary Headers are invalid

pub fn to_bytes(&self) -> Vec<u8>[src]

Encodes the object to a byte vector

pub fn exec_func(
    &self,
    func_map: &HashMap<FuncId, fn(_: &Vec<u8>) -> Result<(), Error>>
) -> Result<(), Error>
[src]

impl<T: SpacePacketDataField> SpacePacket<T>[src]

Generic SpacePacket method implementations

pub fn set_ver_no(&mut self, ver_no: u8) -> Result<(), Error>[src]

Sets the packet version number of the CCSDS space packet.

Errors

Returns an error if ver_no is bigger than 8. Because ver_no is used in its least significant 3 bits.

pub fn get_ver_no(&self) -> u8[src]

Gets the packet version number of the CCSDS space packet.

pub fn set_type_flag(&mut self, type_flag: bool)[src]

Sets the packet type of the CCSDS space packet.

pub fn get_type_flag(&self) -> bool[src]

Gets the packet type of the CCSDS space packet.

pub fn set_sec_header_flag(&mut self, sec_header_flag: bool)[src]

Sets the secondary header flag of the CCSDS space packet.

pub fn get_sec_header_flag(&self) -> bool[src]

Gets the secondary header flag of the CCSDS space packet.

pub fn set_apid(&mut self, apid: u16) -> Result<(), Error>[src]

Sets the packet version number of the CCSDS space packet.

Errors

Returns an error if apid is bigger than 2^11 = 2048. Because apid is used in its least significant 11 bits.

pub fn get_apid(&self) -> u16[src]

Gets the apid of the CCSDS space packet.

pub fn set_seq_flags(&mut self, seq_1: bool, seq_2: bool)[src]

Sets the sequence flags of the CCSDS space packet.

pub fn get_seq_flags(&self) -> (bool, bool)[src]

Gets the sequence flags of the CCSDS space packet.

pub fn set_packet_name(&mut self, packet_name: u16) -> Result<(), Error>[src]

Sets the packet sequence count or packet name of the CCSDS space packet.

Errors

Returns an error if packet_name is bigger than 2^14 = 16384. Because packet_name is used in its least significant 14 bits.

pub fn get_packet_name(&self) -> u16[src]

Gets the packet sequence count or packet name of the CCSDS space packet.

pub fn get_data_len(&self) -> u16[src]

Gets the packet data length of the CCSDS space packet.

impl SpacePacket<Vec<u8>>[src]

pub fn from_bytes(packet: &[u8]) -> Result<Self, Error>[src]

Create a SpacePacket struct from a given byte array

Errors

Returns InvalidData error if given byte array is not longer than 6 bytes.

pub fn new(
    ver_no: u8,
    type_flag: bool,
    sec_header_flag: bool,
    apid: u16,
    seq_flags: (bool, bool),
    packet_name: u16,
    data: Vec<u8>
) -> Result<Self, Error>
[src]

Creates a packet data structure with each field given

Errors

Gives an error if ver_no > 8 or apid > 2^11 or packet_name > 2^14 or if data.len() == 0

Trait Implementations

impl<T: Debug + SpacePacketDataField> Debug for SpacePacket<T>[src]

impl Display for SpacePacket<Vec<u8>>[src]

impl<T: SpacePacketDataField> Request for SpacePacket<T>[src]

Trait implementation that will create RequestId from generic SpacePacket

Auto Trait Implementations

impl<T> Send for SpacePacket<T> where
    T: Send

impl<T> Sync for SpacePacket<T> where
    T: Sync

impl<T> Unpin for SpacePacket<T> where
    T: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.