Commit Graph

277 Commits

Author SHA1 Message Date
Michael Croes
8becc562a8 refactor: Cleanup inline math in BuildHeaderPackage
- Remove unnecessary parentheses
- Use constant value first in multiplication
2023-07-19 23:32:00 +02:00
Michael Croes
296ead69c7 refactor: Use Word.ToByteArray in WriteTpktHeader 2023-07-19 23:30:02 +02:00
Michael Croes
ebf3da6280 refactor: Extract WriteS7Header 2023-07-19 23:29:11 +02:00
Michael Croes
42194aa788 refactor: Extract WriteDataHeader 2023-07-19 23:19:32 +02:00
Michael Croes
9c8b453326 refactor: Extract WriteTpktHeader 2023-07-19 23:18:26 +02:00
DRUSH12
14053e342a Made all exceptions public 2023-06-19 06:14:14 -04:00
Günther Foidl
209148ab02 Use System.Memory for < .NET 5 and avoid (some) unnecessary allocations 2023-05-30 17:25:25 +02:00
ArgusMagnus
e277cf6e6c add Read/WriteBytes(Async) overloads accepting Span<byte>/Memory<byte> for .NET5 or greater 2023-05-30 10:47:38 +02:00
Michael Croes
868e719b78 Merge remote-tracking branch 's7netplus/develop' into fb-fixClassUint32
# Conflicts:
#	S7.Net/Types/Class.cs
2022-12-10 21:09:29 +01:00
Mike Cremer
142f1ba90e Added support string/wstring for class type 2022-12-10 18:59:25 +01:00
Michael Croes
ea1140314b Merge branch 'develop' into openasync_cancellation 2022-11-08 11:13:25 +01:00
diego
ec554ddb59 Better stringEncoding initialization, as per code review comments 2022-06-17 11:23:58 +02:00
diego
2ecd2c6b49 Changes following code review 2022-06-17 11:08:09 +02:00
diego
d808ea5eb6 Give the option of changing the Encoding used to serialize and deserialize S7String, instead of always using Encoding.ASCII 2022-06-16 17:21:23 +02:00
Günther Foidl
9c3f95ce73 Flowed cancellation token to TcpClient.ConnectAsync in .NET 5.0 target 2021-12-26 19:26:04 +01:00
Serge Camille
12281ec802 Fix ReadClass for Uint32
Use consistent DWord conversion for both Int32 and UInt32. Unfortunately there is no Span or even a FromByteArray function accepting a offset, so just use the same Array.Copy falls used for double.
2021-10-04 18:59:05 +02:00
Michael Croes
36c4564f5e Default ReadTimeout and WriteTimeout to 10 seconds 2021-06-07 22:19:23 +02:00
Michael Croes
36b59a2926 Cleanup whitespace, usings 2021-06-06 23:20:19 +02:00
Michael Croes
8d081859da Remove unused sync methods 2021-06-06 23:19:56 +02:00
Michael Croes
d65b83660f Merge branch 'develop' into closeConnectionIOException 2021-06-06 22:56:17 +02:00
Michael Croes
b0a6a2375f Merge branch 'develop' into multipleVarsAlignment 2021-06-06 22:49:33 +02:00
Serge Camille
53045c5952 Close connection on IOExceptions.
The idea behind this is that if we receive a response which does not conform to the underlying protocol specification (with all the TCP checks in place!), we are in a weird/corrupt state and it is better to just close the connection.
2021-06-06 22:40:04 +02:00
Michael Croes
677d2941e1 Apply S7 200 TSAP change to relocated code 2021-06-06 22:33:12 +02:00
Serge Camille
a4b6a360fe ParseDataIntoDataItems needs to always align the response address to a even value after each data item. 2021-06-06 22:16:59 +02:00
Michael Croes
2fae2c01d5 Add TsapPair support to PLC
Add support for custom addressing by supplying a TsapPair to the PLC.
CPU, Rack and Slot properties are still present to preserve backwards
compatibility and to support alternate functionality based on the PLC
type.
2021-06-04 22:25:05 +02:00
Michael Croes
6465e3c8c7 Move GetDefaultTsapPair to TsapPair class 2021-06-04 22:01:40 +02:00
Michael Croes
fcd61c1236 Add CpuType.S7200Smart 2021-06-04 21:46:42 +02:00
Michael Croes
616dc1094c Refactor TSAP related code 2021-06-04 21:45:51 +02:00
Michael Croes
f67b1e773f Add missing ConfigureAwait in OpenAsync 2021-06-01 20:59:20 +02:00
Michael Croes
e93a656312 Fix locking for OpenAsync 2021-06-01 20:28:34 +02:00
Michael Croes
8035f71a16 Apply synchronization to stream actions 2021-05-31 22:57:13 +02:00
Michael Croes
df4f258290 Move GetStreamIfAvailable to PLC.cs 2021-05-31 21:23:32 +02:00
Michael Croes
5636b93a53 PlcSynchronous: Remove unused usings 2021-05-31 21:17:42 +02:00
Michael Croes
8ed1b840bc PlcSynchronous: Clenaup trailing whitespace 2021-05-31 21:17:23 +02:00
Michael Croes
2afed88231 Consolidate sync stream calls 2021-05-31 21:17:03 +02:00
Michael Croes
1ded47971b Consolidate async stream calls 2021-05-31 21:07:16 +02:00
Michael Croes
aa50280233 Boolean: Add SetBit and ClearBit by reference 2021-05-10 21:14:43 +02:00
Michael Croes
3a794e8a46 Cleanup trailing whitespace in PLC and PLCHelpers 2021-05-10 21:05:02 +02:00
Michael Croes
0b8bd66bf7 Fix bitwise operator in Boolean.ClearBit
Fixes #249
2021-05-10 20:50:46 +02:00
Michael Croes
a1b4694ef6 Fix calculation of byte length for VarType.Bit
Fixes #389
2021-05-10 20:25:38 +02:00
Michael Croes
aa03400350 Document IsConnected, shorten implementation 2021-03-29 21:43:24 +02:00
Michael Croes
2b4ec6d9dd Remove IsAvailable
Addresses #275, #252, #208, #154.
2021-03-29 21:43:24 +02:00
diego
e63d92c61c Fix ByteLength calculation for S7Strings when reserved is odd 2021-03-29 20:51:11 +02:00
diego
b4b94e1777 Fix wrong calculation for S7WString byte length 2021-03-29 20:51:11 +02:00
Serge Camille
82e29837a2 Sprinkle more .ConfigureAwait(false) into async library.
This helps to avoid deadlocks when using synchronous API which references the async one in applications with a synchronization context, like a GUI.
Should fix #344
2021-03-16 08:08:39 +01:00
Michael Croes
478c1aed52 Merge branch 'develop' into StructStringSupport 2021-03-13 13:30:31 +01:00
Mike Cremer
924eb9c48f Minor changes + removed default length in S7StringAttribute 2021-03-13 12:00:32 +01:00
Serge Camille
37384d2a92 Fix PLC parse for type "Z"/"C" 2021-03-12 08:17:37 +01:00
Mike Cremer
fdd4519f64 Minor changes 2021-01-29 21:13:38 +01:00
Mike Cremer
926d74f1d2 Fixed length check and corresponding message for S7String 2021-01-27 17:55:16 +01:00