Skip to main content

S7Client

Struct S7Client 

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

Implementations§

Source§

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

Source

pub async fn from_transport(transport: T, params: ConnectParams) -> Result<Self>

Source

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

Source

pub async fn read_multi_vars( &self, items: &[MultiReadItem], ) -> Result<Vec<Bytes>>

Read multiple PLC regions in one or more S7 PDU exchanges.

Automatically batches items when the item count would exceed the Siemens hard limit of 20 per PDU, or when the encoded request or response would exceed the negotiated PDU size. Returns one Bytes per item in input order.

Unlike db_read, this accepts any Area and TransportSize.

Source

pub async fn write_multi_vars(&self, items: &[MultiWriteItem]) -> Result<()>

Write multiple PLC regions in one or more S7 PDU exchanges.

Automatically batches items when the count or encoded size would exceed the negotiated PDU size or the Siemens hard limit of 20 items per PDU. Returns Ok(()) only when all items are acknowledged with return code 0xFF.

Source

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

Source

pub async fn read_szl(&self, szl_id: u16, szl_index: u16) -> Result<SzlResponse>

Source

pub async fn read_clock(&self) -> Result<PlcDateTime>

Source§

impl S7Client<TcpTransport>

Source

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

Auto Trait Implementations§

§

impl<T> !Freeze for S7Client<T>

§

impl<T> !RefUnwindSafe for S7Client<T>

§

impl<T> Send for S7Client<T>

§

impl<T> Sync for S7Client<T>

§

impl<T> Unpin for S7Client<T>

§

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

§

impl<T> UnwindSafe for S7Client<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.