Struct TcpTmtcInCobsServer

Source
pub struct TcpTmtcInCobsServer<TmSource: PacketSource<Error = TmError>, TcSender: PacketSenderRaw<Error = SendError>, HandledConnection: HandledConnectionHandler, TmError, SendError: 'static> {
    pub generic_server: TcpTmtcGenericServer<TmSource, TcSender, CobsTmSender, CobsTcParser, HandledConnection, TmError, SendError>,
}
Available on crate feature std only.
Expand description

TCP TMTC server implementation for exchange of generic TMTC packets which are framed with the COBS protocol.

Telemetry will be encoded with the COBS protocol using cobs::encode in addition to being wrapped with the sentinel value 0 as the packet delimiter as well before being sent back to the client. Please note that the server will send as much data as it can retrieve from the PacketSource in its current implementation.

Using a framing protocol like COBS imposes minimal restrictions on the type of TMTC data exchanged while also allowing packets with flexible size and a reliable way to reconstruct full packets even from a data stream which is split up. The server wil use the parse_buffer_for_cobs_encoded_packets function to parse for packets and pass them to a generic TC receiver. The user can use crate::encoding::encode_packet_with_cobs to encode telecommands sent to the server.

§Example

The TCP integration tests test also serves as the example application for this module.

Fields§

§generic_server: TcpTmtcGenericServer<TmSource, TcSender, CobsTmSender, CobsTcParser, HandledConnection, TmError, SendError>

Implementations§

Source§

impl<TmSource: PacketSource<Error = TmError>, TcReceiver: PacketSenderRaw<Error = TcError>, HandledConnection: HandledConnectionHandler, TmError: 'static, TcError: 'static> TcpTmtcInCobsServer<TmSource, TcReceiver, HandledConnection, TmError, TcError>

Source

pub fn new( cfg: ServerConfig, tm_source: TmSource, tc_receiver: TcReceiver, handled_connection: HandledConnection, stop_signal: Option<Arc<AtomicBool>>, ) -> Result<Self, Error>

Create a new TCP TMTC server which exchanges TMTC packets encoded with COBS protocol.

§Parameter
  • cfg - Configuration of the server.
  • tm_source - Generic TM source used by the server to pull telemetry packets which are then sent back to the client.
  • tc_receiver - Any received telecommands which were decoded successfully will be forwarded to this TC receiver.
Source

pub fn listener(&mut self) -> &mut TcpListener

Source

pub fn local_addr(&self) -> Result<SocketAddr>

Can be used to retrieve the local assigned address of the TCP server. This is especially useful if using the port number 0 for OS auto-assignment.

Source

pub fn handle_all_connections( &mut self, poll_duration: Option<Duration>, ) -> Result<ConnectionResult, TcpTmtcError<TmError, TcError>>

Auto Trait Implementations§

§

impl<TmSource, TcSender, HandledConnection, TmError, SendError> !Freeze for TcpTmtcInCobsServer<TmSource, TcSender, HandledConnection, TmError, SendError>

§

impl<TmSource, TcSender, HandledConnection, TmError, SendError> RefUnwindSafe for TcpTmtcInCobsServer<TmSource, TcSender, HandledConnection, TmError, SendError>
where HandledConnection: RefUnwindSafe, TmSource: RefUnwindSafe, TcSender: RefUnwindSafe,

§

impl<TmSource, TcSender, HandledConnection, TmError, SendError> Send for TcpTmtcInCobsServer<TmSource, TcSender, HandledConnection, TmError, SendError>
where HandledConnection: Send,

§

impl<TmSource, TcSender, HandledConnection, TmError, SendError> Sync for TcpTmtcInCobsServer<TmSource, TcSender, HandledConnection, TmError, SendError>
where HandledConnection: Sync, TmSource: Sync, TcSender: Sync,

§

impl<TmSource, TcSender, HandledConnection, TmError, SendError> Unpin for TcpTmtcInCobsServer<TmSource, TcSender, HandledConnection, TmError, SendError>
where HandledConnection: Unpin, TmSource: Unpin, TcSender: Unpin,

§

impl<TmSource, TcSender, HandledConnection, TmError, SendError> UnwindSafe for TcpTmtcInCobsServer<TmSource, TcSender, HandledConnection, TmError, SendError>
where HandledConnection: UnwindSafe, TmSource: UnwindSafe, TcSender: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.