Commit Graph

43 Commits

Author SHA1 Message Date
Michael Croes
4ae905ffd5 Set PDU size to 960
Allows communication with Siemens Logo 0BA8, currently no Siemens PLC
is known to support >960 PDU size.
2019-03-14 23:04:26 +01:00
Adam Oleksy
de084394a6 Fix writing nested classes 2018-10-04 18:14:44 +02:00
Adam Oleksy
370fd6b3d9 Fix reading nested classes 2018-09-26 14:43:49 +02:00
Michael Croes
96efb9d56a Add tests for String.ToByteArray(...) 2018-07-11 22:07:34 +02:00
Raphael Schlameuß
214a7a73c8 Read many bytes 1500 (develop branch) (#160)
* ReadBytesWithSingleRequest cannot read >491 Bytes on S7-1500
2018-07-11 10:15:08 +02:00
Michael Croes
2204ab360c Fix write stringex (#162)
* Add StringEx.ToByteArray(...)

* Add Serialization.SerializeDataItem(DataItem)

Supports StringEx VarType or offloads to SerializeValue method.

* Use SerializeDataItem in S7WriteMultiple

* Assume string length without header in StringEx.ToByteArray

VarTypeToByteLength already assumed that StringEx declared count for
the number of characters without the header, this now matches that
behavior.

* Add unit tests for StringEx conversions

* Fix incorrect value passed to Encoding.GetBytes

The length must actually be within string limits.
2018-07-11 09:47:43 +02:00
Michael Croes
1538de148b Replace LastErrorCode and LastErrorString with exceptions 2018-07-09 20:07:47 +02:00
Raphael
b8b144d7ae Add support for datatype float (Single) and obsolete double (Double) usage 2018-07-02 10:20:02 +02:00
Michael Croes
3409e52fef Add message for ReadWriteBytesMany assertion 2018-06-27 21:51:37 +02:00
Michael Croes
0f151e4947 Add tests for ConnectionRequest 2018-06-27 21:24:23 +02:00
Michael Croes
5f220cd31f Fix default namespace in S7.Net.UnitTest 2018-06-27 21:09:11 +02:00
Michael Croes
2083ab1501 Remove obsolete attribute and comments
References #124.
2018-06-21 20:28:22 +02:00
Raphael
1b22badea1 Fixed ErrorCode.ReadData for specific methods 2018-06-08 10:26:52 +02:00
Thomas Jäger
64e485c54a Revert "Use socket instead of TcpClient and stream."
Revert back to using Stream/TcpClient. High performance stuff is moved
to highperformancesockets branch. I think this is interesting, but i also
feel that this is premature optimization. I doubth that this will be a
performance bottleneck ofr the forseeable future.

This reverts commit 1b34716a30.
2018-05-18 08:52:19 +02:00
Thomas Jäger
00e22ee214 Incorporate fixes from #117 (moved to helpers)
fix array naming.
2018-05-16 15:50:00 +02:00
Thomas Jäger
8ac96162f9 Merge remote-tracking branch 'upstream/master' into tcpclient 2018-05-16 11:33:46 +02:00
Thomas Jäger
1b34716a30 Use socket instead of TcpClient and stream.
Async implemented with wrapper.
2018-05-16 11:24:21 +02:00
Raphael
642cf8169e Fixed bug for reading VarType.Bit and VarType.Byte on odd number of bytes in ReadMultipleVars() 2018-05-07 11:47:52 +02:00
Raphael
cbaa8921df import killnine master 2018-05-07 09:47:20 +02:00
Raphael
0d1bc472c8 Added BitAdr to DataItem and fixed bug in ReadMultipleVars on VarType.Bit 2018-04-27 16:00:41 +02:00
Thomas Jäger
e6f1114bc1 Add COTP.ReadTSDU test 2018-04-19 15:39:41 +02:00
Thomas Jäger
74af1c0da7 Change project to allow testing internal classes.
Add protocol tests
Simplify async tests
2018-04-19 15:08:52 +02:00
Thomas Jäger
c80b0dd55d Add signing key to S7.Net.UnitTest for testing internal classes 2018-04-19 15:07:06 +02:00
Thomas Jäger
f53a3bd320 Use TcpClient and implemnt async methods
Note: This keeps the old methods to be backward compatible.
Note: Unforntunatly a lot of whitespace fixes, refactoring and other trivial stuff is
included. It was to hard to split of in a seperate commit.

Note: Async methods does not use exactly the same structure/signature as the
existing methods. "Out" parameters like ReadClass and ReadStruct instead
returns the struct in tuple. Async methods also rely on exceptions
instead of ErrorCodes to communicate exception states to calling client.

* Use TcpClient and use Async methods (ReadAsync/WriteAsync)
* Implemnt async methods for all existing methods
* Implemnt existing methods using tcpclient.
* Split Plc.cs in more files. (Common, Async, Sync, Helpers)
* Mark old methods as Obsolete
* Split tests in two files
* Implement Async tests
2018-04-19 13:13:08 +02:00
Thomas Jäger
3a18d13805 Add test for Read/Write Double and PDUSize Test 2018-04-19 00:34:10 +02:00
Michele Cattafesta
ad98783888 Added one more test 2017-09-14 18:20:06 +01:00
Michele Cattafesta
cddb826053 Fix V0.1.6 bit write to DB don't work #91 2017-09-14 18:16:35 +01:00
Thomas.Bargetz
ac19f913af fixed #87
IsAvailable is not using the Ping class anymore.
2017-08-11 11:09:35 +02:00
Thomas Bargetz
6d7edc9f86 Types.Class.ToBytes doesn't need a type information, because the object is passed as parameter anyway 2017-08-07 12:06:03 +02:00
Thomas Bargetz
07fe703b3d Classes with arrays can now be read/written from/to the plc 2017-08-07 11:51:58 +02:00
Michele Cattafesta
89415e79b5 Merge branch 'master' into generic-class-and-struct-reading 2017-07-11 22:15:39 +01:00
Thomas Bargetz
6328efbc5b Ignoring properties without a public setter or no setter at all 2017-07-07 10:57:12 +02:00
Thomas Bargetz
4130504a94 Added generic methods for ReadStruct and ReadClass. ReadClass returns the number of read bytes to check if something was read from the plc. 2017-07-07 10:25:12 +02:00
Michele Cattafesta
8c65632d7a Added unit tests to consolidate boolean read/write.
Signed-off-by: Michele Cattafesta <michele.cattafesta@mesta-automation.com>
2017-05-23 22:29:43 +01:00
Michele Cattafesta
9108dbde51 documentation, cleanup and unit tests.
Signed-off-by: Michele Cattafesta <michele.cattafesta@mesta-automation.com>
2016-05-02 21:58:09 +02:00
Michele Cattafesta
63bd361e76 cleanup and documentation.
Signed-off-by: Michele Cattafesta <michele.cattafesta@mesta-automation.com>
2016-05-02 00:31:17 +02:00
Dirk-Jan
6ddcc37294 Added basic reading of multiple vars
Could use some enhancement in splitting a read in multiple requests if it
exceeds the limit
2016-05-01 20:37:58 +02:00
Michele Cattafesta
9a790376ff fix Issue #38: now read and write bytes handles address overflow correctly.
Signed-off-by: Michele Cattafesta <michele.cattafesta@mesta-automation.com>
2016-02-13 12:26:50 +01:00
Michele Cattafesta
287fd667ea unit tests: bug fix that prevented test to run after installation of VS 2015.
Signed-off-by: Michele Cattafesta <michele.cattafesta@mesta-automation.com>
2016-02-09 00:14:40 +01:00
Michele Cattafesta
9aa01a4aad Read/Write class and structs now handle more than 200 bytes with multiple requests (Issue #30 and Issue #27).
Signed-off-by: Michele Cattafesta <michele.cattafesta@mesta-automation.com>
2015-10-05 23:44:49 +02:00
Johnnyxy
533a18e2cc o changed target .NET framework to v3.5 (higher .NET versions can load and execute lower versions code)
x fixes compatibility to support .NET 3.5 (removed unused usings/imports and changed method calls to .NET equivalents)
2015-06-17 17:04:12 +02:00
Michele Cattafesta
34f304179f Fixes a problem that prevented to run unit tests on a pc without Step7 installed.
Signed-off-by: Michele Cattafesta <michele.cattafesta@mesta-automation.com>
2015-02-02 22:44:05 +01:00
Michele Cattafesta
73437f9ea3 Added Unit Tests.
Signed-off-by: Michele Cattafesta <michele.cattafesta@mesta-automation.com>
2014-12-22 14:31:52 +01:00