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>
impl<T: AsyncRead + AsyncWrite + Unpin + Send> S7PlusClient<T>
Sourcepub async fn db_read(
&self,
db: u16,
start: u32,
length: u16,
) -> Result<Bytes, Error>
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.
Sourcepub async fn db_write(
&self,
db: u16,
start: u32,
data: &[u8],
) -> Result<(), Error>
pub async fn db_write( &self, db: u16, start: u32, data: &[u8], ) -> Result<(), Error>
Write data to DB db at byte offset start.
Sourcepub async fn read_multi_vars(
&self,
specs: &[DbVarSpec],
) -> Result<Vec<Bytes>, Error>
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.
Sourcepub async fn write_multi_vars(
&self,
specs: &[DbVarSpec],
values: &[Bytes],
) -> Result<(), Error>
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).
Sourcepub async fn send_keepalive(&self) -> Result<(), Error>
pub async fn send_keepalive(&self) -> Result<(), Error>
Send a KeepAlive frame to maintain the S7CommPlus session.
Sourcepub async fn delete_object(&self) -> Result<(), Error>
pub async fn delete_object(&self) -> Result<(), Error>
Send a DeleteObject request to close the session on the PLC.
Source§impl S7PlusClient<TcpTransport>
impl S7PlusClient<TcpTransport>
Sourcepub async fn connect(
addr: SocketAddr,
params: ConnectParams,
) -> Result<Self, Error>
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>
impl S7PlusClient<TlsStream>
Sourcepub async fn connect_tls(
addr: SocketAddr,
server_name: &str,
extra_ca_der: Option<&[u8]>,
_params: ConnectParams,
) -> Result<Self, Error>
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.