<h2>Name</h2>

<b>snap7</b> - Tcl interface to the Snap7 library

<h2>Synopsis</h2>

<tt>package require Tcl 8.6</tt><br>
<tt>package require snap7</tt><br>
<tt>snap7::new
<tt><i>cmd</i> destroy</tt><br>
<tt><i>cmd</i> connect <i>addr port rack
<tt><i>cmd</i> disconnect</tt><br>
<tt><i>cmd</i> conntype
<tt><i>cmd</i> param <i>?name?
<tt><i>cmd</i> isconnected</tt><br>
<tt><i>cmd</i> pdulength</tt><br>
<tt><i>cmd</i> dbread <i>db start
<tt><i>cmd</i> dbreada <i>db start
<tt><i>cmd</i> dbwrite <i>db start data
<tt><i>cmd</i> dbwritea <i>db start

<h2>Description</h2>

This  package provides a Tcl interface to the Snap7 library (see <a using Ffidl and TclOO.

<h2>Commands</h2>

<tt>snap7::new

    Creates a new command which implements a Snap7 connection object. Further operations on  that object are carried out by invoking methods on

<tt><i>cmd</i> destroy</tt>

    Destroys the connection object releases resources and closes communications links.

<tt><i>cmd</i> connect <i>addr port rack

    Connects the connection object to its peer using the IP address the TCP port number and further address information and numbers).

<tt><i>cmd</i> disconnect</tt>

    Closes the connection of the connection object

<tt><i>cmd</i> conntype

    Sets the connection type of the connection object Must be called before a connection is made using the <tt>connect</tt> method. Valid values for are 1 (PG), 2 (OP), and 3 (basic).

<tt><i>cmd</i> param <i>?name?

    If invoked without arguments, returns a list of parameter names which can be queried or set on the connection object If is provided, a query of this named parameter is performed. If both, and are provided, the named parameter is set to the value given.

<tt><i>cmd</i> isconnected</tt>

    Returns true or false depending on connection state of the connection object

<tt><i>cmd</i>

    Returns a two element list made up of requested and negotiated PDU length of the connection object

<tt><i>cmd</i> dbread <i>db start

    Reads bytes beginning at from the data block using the connection object Data is returned as a list of integer numbers.

<tt><i>cmd</i> dbreada <i>db start

    Reads bytes beginning at from the data block using the connection object Data is returned as a byte array.

<tt><i>cmd</i> dbwrite <i>db start data

    Writes the numbers specified by and following arguments as bytes beginning at into the data block using the connection object

<tt><i>cmd</i> dbwritea <i>db start

    Writes the byte array beginning at into the data block using the connection object