Skip to main content

S7PlusClient

Struct S7PlusClient 

Source
pub struct S7PlusClient<T: AsyncRead + AsyncWrite + Unpin + Send> { /* private fields */ }
Expand description

A client for S7CommPlus (S7-1200/1500 “integrity mode”) communication.

Implementations§

Source§

impl<T: AsyncRead + AsyncWrite + Unpin + Send> S7PlusClient<T>

Source

pub async fn db_read( &self, db: u16, start: u32, length: u16, ) -> Result<Bytes, Error>

Read length bytes from DB db at byte offset start.

Source

pub async fn db_write( &self, db: u16, start: u32, data: &[u8], ) -> Result<(), Error>

Write data to DB db at byte offset start.

Source

pub async fn read_multi_vars( &self, specs: &[DbVarSpec], ) -> Result<Vec<Bytes>, Error>

Read multiple DB variables in a single S7CommPlus PDU.

Each DbVarSpec specifies the DB number, byte offset, and read length. Returns one Bytes per input spec in the same order.

Source

pub async fn write_multi_vars( &self, specs: &[DbVarSpec], values: &[Bytes], ) -> Result<(), Error>

Write multiple DB variables in a single S7CommPlus PDU.

specs describes where to write, and values provides the data (one per spec).

Source

pub async fn send_keepalive(&self) -> Result<(), Error>

Send a KeepAlive frame to maintain the S7CommPlus session.

Source

pub async fn delete_object(&self) -> Result<(), Error>

Send a DeleteObject request to close the session on the PLC.

Source§

impl S7PlusClient<TcpTransport>

Source

pub async fn connect( addr: SocketAddr, params: ConnectParams, ) -> Result<Self, Error>

Connect to a PLC at addr using the S7CommPlus CreateObject handshake.

Source§

impl S7PlusClient<TlsStream>

Source

pub async fn connect_tls( addr: SocketAddr, server_name: &str, extra_ca_der: Option<&[u8]>, _params: ConnectParams, ) -> Result<Self, Error>

Connect to a PLC using TLS transport and the S7CommPlus handshake.

server_name is used for TLS SNI. extra_ca_der can be None to use the system root store.

Auto Trait Implementations§

§

impl<T> !Freeze for S7PlusClient<T>

§

impl<T> !RefUnwindSafe for S7PlusClient<T>

§

impl<T> Send for S7PlusClient<T>

§

impl<T> Sync for S7PlusClient<T>

§

impl<T> Unpin for S7PlusClient<T>

§

impl<T> UnsafeUnpin for S7PlusClient<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for S7PlusClient<T>
where T: 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> 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> Same for T

Source§

type Output = T

Should always be Self
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.