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>,
}
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>
impl<TmSource: PacketSource<Error = TmError>, TcReceiver: PacketSenderRaw<Error = TcError>, HandledConnection: HandledConnectionHandler, TmError: 'static, TcError: 'static> TcpTmtcInCobsServer<TmSource, TcReceiver, HandledConnection, TmError, TcError>
Sourcepub fn new(
cfg: ServerConfig,
tm_source: TmSource,
tc_receiver: TcReceiver,
handled_connection: HandledConnection,
stop_signal: Option<Arc<AtomicBool>>,
) -> Result<Self, Error>
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.
pub fn listener(&mut self) -> &mut TcpListener
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
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.
Sourcepub fn handle_all_connections(
&mut self,
poll_duration: Option<Duration>,
) -> Result<ConnectionResult, TcpTmtcError<TmError, TcError>>
pub fn handle_all_connections( &mut self, poll_duration: Option<Duration>, ) -> Result<ConnectionResult, TcpTmtcError<TmError, TcError>>
Delegation to the TcpTmtcGenericServer::handle_all_connections call.
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>
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>
impl<TmSource, TcSender, HandledConnection, TmError, SendError> Unpin for TcpTmtcInCobsServer<TmSource, TcSender, HandledConnection, TmError, SendError>
impl<TmSource, TcSender, HandledConnection, TmError, SendError> UnwindSafe for TcpTmtcInCobsServer<TmSource, TcSender, HandledConnection, TmError, SendError>
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.