├── docs ├── styles │ ├── main.css │ ├── main.js │ └── search-worker.js ├── favicon.ico ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 ├── articles │ ├── toc.html │ └── intro.html ├── utilities │ ├── toc.html │ ├── intro.html │ └── SECSTee.html ├── toc.html ├── api │ ├── toc.html │ ├── TextFormatter │ │ ├── toc.html │ │ └── com.CIMthetics.CSharpSECSTools.TextFormatter.DisplayAsType.html │ └── SECSCommUtils │ │ ├── index.html │ │ ├── toc.html │ │ ├── com.CIMthetics.CSharpSECSTools.SECSCommUtils.TCPState.html │ │ └── com.CIMthetics.CSharpSECSTools.SECSCommUtils.TransientMessageStatus.html ├── logo.svg ├── search-stopwords.json └── index.html ├── DocFx ├── api │ ├── SECSItems │ │ └── .gitignore │ ├── SECSCommUtils │ │ ├── .gitignore │ │ └── index.md │ ├── TextFormatter │ │ └── .gitignore │ ├── .gitignore │ └── index.md ├── articles │ ├── intro.md │ └── toc.yml ├── utilities │ ├── toc.yml │ ├── intro.md │ └── SECSTee.md ├── .gitignore ├── toc.yml ├── filterConfig.yml ├── index.md └── docfx.json ├── SECSItems ├── SECSItems.pidb ├── obj │ ├── Debug │ │ ├── SECSItems.dll.mdb │ │ ├── .NETFramework,Version=v4.5.AssemblyAttribute.cs │ │ └── SECSItems.csproj.FilesWrittenAbsolute.txt │ └── Release │ │ └── .NETFramework,Version=v4.5.AssemblyAttribute.cs ├── SECSItems.csproj ├── SECSItemNumLengthBytes.cs └── SECSItemFormatCode.cs ├── SECSItemTests ├── SECSItemsTests.pidb ├── packages.config ├── SECSItemNumLengthBytesTests.cs └── SECSItemTests.csproj ├── SECSCommUtils ├── bin │ └── Debug │ │ └── SECSItems.dll.mdb ├── obj │ └── Debug │ │ ├── .NETFramework,Version=v4.5.AssemblyAttribute.cs │ │ └── SECSCommUtils.csproj.FilesWrittenAbsolute.txt ├── HSMS │ ├── TransientMessageStatus.cs │ ├── HSMSConnectionState.cs │ ├── HSMSConnectionNetworkFamily.cs │ └── HSMSConnectionMode.cs ├── SECSConnectionType.cs ├── SECSConnectionFactory.cs ├── SECSHeader.cs ├── SECSCommUtils.csproj ├── SECSConnectionConfigInfo.cs ├── ConnectionDefaults.cs └── SECS1 │ └── SECSIConnection.cs ├── EquipmentSimulatorSupportStuff ├── bin │ └── Debug │ │ └── SECSItems.dll.mdb ├── obj │ └── Debug │ │ ├── .NETFramework,Version=v4.5.AssemblyAttribute.cs │ │ └── EquipmentSimulatorSupportStuff.csproj.FilesWrittenAbsolute.txt ├── SVID.cs ├── LoadPort.cs ├── AccessModeEnumeration.cs ├── FixedBufferLoadPort.cs ├── ASECSItem.cs ├── SVIDMap.cs ├── DuplicateSVIDException.cs ├── PortID_SV.cs ├── CarrierID_SV.cs ├── AccessMode_SV.cs └── EquipmentSimulatorSupportStuff.csproj ├── SECSTee ├── NetworkFamily.cs ├── ConnectionInfo.cs ├── SECSIConnectionInfo.cs ├── TeeConnectionInfo.cs ├── appsettings.json ├── HSMSConnectionInfo.cs ├── SECSTee.csproj └── SECSMessageProcessor.cs ├── SECSCommUtilsTests ├── packages.config ├── SECSCommUtilsTests.csproj └── HSMSHeaderTests.cs ├── SECSStateMachinesTests ├── packages.config ├── SECSStateMachineTests.cs └── SECSStateMachinesTests.csproj ├── FixedBufferSimulatorConsole ├── Program.cs └── FixedBufferSimulatorConsole.csproj ├── .gitignore ├── TextFormatter ├── config │ ├── DisplayAsType.cs │ ├── SMLOutputConfig.cs │ └── XMLOutputConfig.cs ├── SECSFormatterFactory.cs └── TextFormatter.csproj ├── SECSStateMachines ├── StateEntryOrExit.cs ├── HSMSConnectionSM │ ├── HSMSConnectionSMStates.cs │ ├── HSMSConnectionSMTranstions.cs │ ├── Selected.cs │ ├── NotConnected.cs │ ├── Connected.cs │ ├── HSMSConnectionSM.cs │ ├── NotSelected.cs │ └── NoState.cs ├── RootState.cs └── SECSStateMachines.csproj ├── SECSSpy ├── ConfigConnectionInfo.cs ├── ConfigConnectionPair.cs ├── ConfigHSMSConnectionInfo.cs ├── SECSSpy.csproj ├── appsettings.json └── MessageProcessor.cs ├── .github └── workflows │ └── static.yml ├── CHANGELOG.md └── README.md /docs/styles/main.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /DocFx/api/SECSItems/.gitignore: -------------------------------------------------------------------------------- 1 | *.yml 2 | -------------------------------------------------------------------------------- /DocFx/api/SECSCommUtils/.gitignore: -------------------------------------------------------------------------------- 1 | *.yml 2 | -------------------------------------------------------------------------------- /DocFx/api/TextFormatter/.gitignore: -------------------------------------------------------------------------------- 1 | *.yml 2 | -------------------------------------------------------------------------------- /DocFx/articles/intro.md: -------------------------------------------------------------------------------- 1 | # Add your introductions here! 2 | -------------------------------------------------------------------------------- /DocFx/articles/toc.yml: -------------------------------------------------------------------------------- 1 | - name: Introduction 2 | href: intro.md 3 | -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkaip/CSharpSECSTools/HEAD/docs/favicon.ico -------------------------------------------------------------------------------- /SECSItems/SECSItems.pidb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkaip/CSharpSECSTools/HEAD/SECSItems/SECSItems.pidb -------------------------------------------------------------------------------- /DocFx/api/.gitignore: -------------------------------------------------------------------------------- 1 | ############### 2 | # temp file # 3 | ############### 4 | *.yml 5 | .manifest 6 | -------------------------------------------------------------------------------- /SECSItemTests/SECSItemsTests.pidb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkaip/CSharpSECSTools/HEAD/SECSItemTests/SECSItemsTests.pidb -------------------------------------------------------------------------------- /SECSItems/obj/Debug/SECSItems.dll.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkaip/CSharpSECSTools/HEAD/SECSItems/obj/Debug/SECSItems.dll.mdb -------------------------------------------------------------------------------- /SECSCommUtils/bin/Debug/SECSItems.dll.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkaip/CSharpSECSTools/HEAD/SECSCommUtils/bin/Debug/SECSItems.dll.mdb -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkaip/CSharpSECSTools/HEAD/docs/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkaip/CSharpSECSTools/HEAD/docs/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkaip/CSharpSECSTools/HEAD/docs/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /docs/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkaip/CSharpSECSTools/HEAD/docs/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /DocFx/utilities/toc.yml: -------------------------------------------------------------------------------- 1 | - name: Introduction 2 | href: intro.md 3 | - name: SECSSpy 4 | href: SECSSpy.md 5 | - name: SECSTee 6 | href: SECSTee.md 7 | -------------------------------------------------------------------------------- /EquipmentSimulatorSupportStuff/bin/Debug/SECSItems.dll.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkaip/CSharpSECSTools/HEAD/EquipmentSimulatorSupportStuff/bin/Debug/SECSItems.dll.mdb -------------------------------------------------------------------------------- /docs/styles/main.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information. 2 | -------------------------------------------------------------------------------- /DocFx/.gitignore: -------------------------------------------------------------------------------- 1 | ############### 2 | # folder # 3 | ############### 4 | /**/DROP/ 5 | /**/TEMP/ 6 | /**/packages/ 7 | /**/bin/ 8 | /**/obj/ 9 | _site 10 | -------------------------------------------------------------------------------- /SECSTee/NetworkFamily.cs: -------------------------------------------------------------------------------- 1 | namespace com.CIMthetics.CSharpSECSTools.SECSTee 2 | { 3 | internal enum NetworkFamily 4 | { 5 | IPV4, 6 | IPV6 7 | } 8 | } -------------------------------------------------------------------------------- /DocFx/toc.yml: -------------------------------------------------------------------------------- 1 | - name: Articles 2 | href: articles/ 3 | - name: API Libraries Documentation 4 | href: api/ 5 | homepage: api/index.md 6 | - name: Utilities 7 | href: utilities/ 8 | -------------------------------------------------------------------------------- /SECSCommUtils/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5", FrameworkDisplayName = "")] 3 | -------------------------------------------------------------------------------- /SECSItems/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5", FrameworkDisplayName = "")] 3 | -------------------------------------------------------------------------------- /SECSItems/obj/Release/.NETFramework,Version=v4.5.AssemblyAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5", FrameworkDisplayName = "")] 3 | -------------------------------------------------------------------------------- /SECSItemTests/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /EquipmentSimulatorSupportStuff/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs: -------------------------------------------------------------------------------- 1 | // 2 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5", FrameworkDisplayName = "")] 3 | -------------------------------------------------------------------------------- /SECSCommUtilsTests/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /SECSStateMachinesTests/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /SECSCommUtils/HSMS/TransientMessageStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace com.CIMthetics.CSharpSECSTools.SECSCommUtils 3 | { 4 | public enum TransientMessageStatus 5 | { 6 | NoConnection, 7 | IncommingMessage 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /FixedBufferSimulatorConsole/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace FixedBufferSimulatorConsole 4 | { 5 | class MainClass 6 | { 7 | public static void Main (string[] args) 8 | { 9 | Console.WriteLine ("Hello World!"); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DocFx/utilities/intro.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | In this section you will find documentation for the Utility programs that are 4 | provided by the `CSharpSECSTools` project. Currently there are two utility programs 5 | available. Click on the links to the left to learn more about them. 6 | -------------------------------------------------------------------------------- /DocFx/api/SECSCommUtils/index.md: -------------------------------------------------------------------------------- 1 | # SECSCommUtils 2 | 3 | This API is a collection of objects that provide functionality enabling a user to establish a 4 | communication connection between two endpoints and be able to send to and receive messages from 5 | an endpoint. 6 | 7 | ## Creating a Communications Connection 8 | 9 | ## Creating a SECMessage 10 | 11 | ## Sending a SECSMessage 12 | 13 | ## Receiving a SECSMessage 14 | -------------------------------------------------------------------------------- /SECSCommUtils/obj/Debug/SECSCommUtils.csproj.FilesWrittenAbsolute.txt: -------------------------------------------------------------------------------- 1 | /home/dkaip/CSharpWorkspaces/CIMthetics/CSharpSECSStuff/SECSCommUtils/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs 2 | /home/dkaip/CSharpWorkspaces/CIMthetics/CSharpSECSStuff/SECSCommUtils/bin/Debug/SECSItems.dll 3 | /home/dkaip/CSharpWorkspaces/CIMthetics/CSharpSECSStuff/SECSCommUtils/bin/Debug/SECSItems.dll.mdb 4 | /home/dkaip/CSharpWorkspaces/CIMthetics/CSharpSECSStuff/SECSCommUtils/bin/Debug/SECSItems.xml 5 | -------------------------------------------------------------------------------- /DocFx/filterConfig.yml: -------------------------------------------------------------------------------- 1 | apiRules: 2 | - exclude: 3 | # inherited members from Form 4 | uidRegex: ^System\.Windows\.Forms\.Form\..*$ 5 | type: Member 6 | - exclude: 7 | # inherited members from Control 8 | uidRegex: ^System\.Windows\.Forms\.Control\..*$ 9 | type: Member 10 | - exclude: 11 | # mentioning types from System.* namespace 12 | uidRegex: ^System\..*$ 13 | type: Type 14 | - exclude: 15 | # mentioning types from Microsoft.* namespace 16 | uidRegex: ^Microsoft\..*$ 17 | type: Type -------------------------------------------------------------------------------- /SECSItems/obj/Debug/SECSItems.csproj.FilesWrittenAbsolute.txt: -------------------------------------------------------------------------------- 1 | /home/dkaip/CSharpWorkspaces/CIMthetics/CSharpSECSStuff/SECSItems/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs 2 | /home/dkaip/CSharpWorkspaces/CIMthetics/CSharpSECSStuff/SECSItems/bin/Debug/SECSItems.dll.mdb 3 | /home/dkaip/CSharpWorkspaces/CIMthetics/CSharpSECSStuff/SECSItems/bin/Debug/SECSItems.dll 4 | /home/dkaip/CSharpWorkspaces/CIMthetics/CSharpSECSStuff/SECSItems/obj/Debug/SECSItems.dll 5 | /home/dkaip/CSharpWorkspaces/CIMthetics/CSharpSECSStuff/SECSItems/obj/Debug/SECSItems.dll.mdb 6 | -------------------------------------------------------------------------------- /EquipmentSimulatorSupportStuff/obj/Debug/EquipmentSimulatorSupportStuff.csproj.FilesWrittenAbsolute.txt: -------------------------------------------------------------------------------- 1 | /home/dkaip/CSharpWorkspaces/CIMthetics/CSharpSECSStuff/EquipmentSimulatorSupportStuff/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs 2 | /home/dkaip/CSharpWorkspaces/CIMthetics/CSharpSECSStuff/EquipmentSimulatorSupportStuff/bin/Debug/SECSItems.dll 3 | /home/dkaip/CSharpWorkspaces/CIMthetics/CSharpSECSStuff/EquipmentSimulatorSupportStuff/bin/Debug/SECSItems.dll.mdb 4 | /home/dkaip/CSharpWorkspaces/CIMthetics/CSharpSECSStuff/EquipmentSimulatorSupportStuff/bin/Debug/SECSItems.xml 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | SECSItems/bin 2 | SECSItems/obj 3 | SECSItemTests/bin 4 | SECSItemTests/obj 5 | SECSCommUtils/bin 6 | SECSCommUtils/obj 7 | SECSCommUtilsTests/bin 8 | SECSCommUtilsTests/obj 9 | TextFormatter/bin 10 | TextFormatter/obj 11 | SECSSpy/bin 12 | SECSSpy/obj 13 | SECSSpy/Logs 14 | SECSTee/bin 15 | SECSTee/obj 16 | SECSTee/Logs 17 | SECSStateMachines/bin 18 | SECSStateMachines/obj 19 | SECSStateMachinesTests/bin 20 | SECSStateMachinesTests/obj 21 | EquipmentSimulatorSupportStuff/bin 22 | EquipmentSimulatorSupportStuff/obj 23 | FixedBufferSimulatorConsole/bin 24 | FixedBufferSimulatorConsole/obj 25 | .vscode/ 26 | *~ 27 | -------------------------------------------------------------------------------- /SECSTee/ConnectionInfo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | namespace com.CIMthetics.CSharpSECSTools.SECSTee 19 | { 20 | internal abstract class ConnectionInfo {} 21 | } -------------------------------------------------------------------------------- /docs/articles/toc.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |
6 | 7 | 8 | 9 |
10 |
11 |
12 |
13 | 14 | 19 |
20 |
21 |
22 |
-------------------------------------------------------------------------------- /EquipmentSimulatorSupportStuff/SVID.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | using System; 17 | 18 | namespace EquipmentSimulatorSupportStuff 19 | { 20 | public interface SVID 21 | { 22 | UInt32 getSVID(); 23 | } 24 | 25 | } 26 | 27 | -------------------------------------------------------------------------------- /TextFormatter/config/DisplayAsType.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | namespace com.CIMthetics.CSharpSECSTools.TextFormatter 18 | { 19 | public enum DisplayAsType 20 | { 21 | Elements, 22 | Attributes 23 | } 24 | } -------------------------------------------------------------------------------- /EquipmentSimulatorSupportStuff/LoadPort.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | using System; 18 | 19 | namespace EquipmentSimulatorSupportStuff.E87 20 | { 21 | public class LoadPort 22 | { 23 | public LoadPort () 24 | { 25 | } 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /EquipmentSimulatorSupportStuff/AccessModeEnumeration.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | using System; 17 | 18 | namespace EquipmentSimulatorSupportStuff 19 | { 20 | public enum AccessModeEnumeration:byte 21 | { 22 | MANUAL = 0, 23 | AUTO = 1 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /SECSStateMachines/StateEntryOrExit.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governingprivate permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #nullable enable 18 | 19 | namespace com.CIMthetics.CSharpSECSTools.SECSStateMachines 20 | { 21 | public enum StateEntryOrExit 22 | { 23 | Entry, 24 | Exit 25 | } 26 | } -------------------------------------------------------------------------------- /EquipmentSimulatorSupportStuff/FixedBufferLoadPort.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | using System; 17 | 18 | namespace EquipmentSimulatorSupportStuff 19 | { 20 | public class FixedBufferLoadPort 21 | { 22 | public FixedBufferLoadPort () 23 | { 24 | } 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /EquipmentSimulatorSupportStuff/ASECSItem.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | using System; 17 | using com.CIMthetics.CSharpSECSTools.SECSItems; 18 | 19 | namespace EquipmentSimulatorSupportStuff 20 | { 21 | public interface ASECSItem 22 | { 23 | //SECSItem getAsSECSItem(); 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /SECSCommUtils/HSMS/HSMSConnectionState.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | using System; 17 | 18 | namespace com.CIMthetics.CSharpSECSTools.SECSCommUtils 19 | { 20 | public enum HSMSConnectionState 21 | { 22 | NotConnected, 23 | ConnectedNotSelected, 24 | ConnectedSelected 25 | } 26 | 27 | } 28 | 29 | -------------------------------------------------------------------------------- /DocFx/index.md: -------------------------------------------------------------------------------- 1 | # **CSharpSECSTools** 2 | This project provides some APIs and Utility programs that may be useful for those working in the problem domain of Semiconductor Manufacturing. More specifically, the automation thereof using computers to control the manufacturing process potentially including integration with Automated Material Handling Systems(AMHS). As you might infer these APIs and Utilities are written in the C# programming language and thus appropriate for those working in those software development environments. 3 | 4 | If you are not familiar with the [Semi® Standards](https://www.semi.org/en/standards) like **E4**, **E5**, **E30**, **E37**, et al, this project is probably not for you. 5 | 6 | 7 | Refer to [Markdown](http://daringfireball.net/projects/markdown/) for how to write markdown files. 8 | ## Quick Start Notes: 9 | 1. Add images to the *images* folder if the file is referencing an image. 10 | -------------------------------------------------------------------------------- /EquipmentSimulatorSupportStuff/SVIDMap.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | using System; 17 | using System.Collections.Concurrent; 18 | 19 | namespace EquipmentSimulatorSupportStuff 20 | { 21 | //public class SVIDMap : ConcurrentDictionary 22 | //{ 23 | // public SVIDMap () 24 | // { 25 | // } 26 | //} 27 | } 28 | 29 | -------------------------------------------------------------------------------- /SECSSpy/ConfigConnectionInfo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | namespace com.CIMthetics.CSharpSECSTools.SECSSpy 18 | { 19 | public class ConfigConnectionInfo 20 | { 21 | public string Name { get; } 22 | 23 | internal ConfigConnectionInfo(string name) 24 | { 25 | Name = name; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /SECSTee/SECSIConnectionInfo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | namespace com.CIMthetics.CSharpSECSTools.SECSTee 18 | { 19 | internal class SECSIConnectionInfo : ConnectionInfo 20 | { 21 | public string SerialPort { get; private set; } 22 | internal SECSIConnectionInfo(string serialPort) 23 | { 24 | this.SerialPort = serialPort; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /EquipmentSimulatorSupportStuff/DuplicateSVIDException.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | using System; 17 | 18 | namespace EquipmentSimulatorSupportStuff.Exceptions 19 | { 20 | public class DuplicateSVIDException : Exception 21 | { 22 | public DuplicateSVIDException () {} 23 | 24 | //public DuplicateSVIDException(string nessage) : base(Message) {} 25 | 26 | public DuplicateSVIDException(string message, Exception inner) : base(message, inner) {} 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /docs/utilities/toc.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |
6 | 7 | 8 | 9 |
10 |
11 |
12 |
13 | 14 | 25 |
26 |
27 |
28 |
-------------------------------------------------------------------------------- /SECSCommUtils/HSMS/HSMSConnectionNetworkFamily.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | namespace com.CIMthetics.CSharpSECSTools.SECSCommUtils 18 | { 19 | public enum HSMSConnectionNetworkFamily 20 | { 21 | /// 22 | /// Indicates that the underlying TCP/IP connection should be (or is) IPV4. 23 | /// 24 | IPV4, 25 | 26 | /// 27 | /// Indicates that the underlying TCP/IP connection should be (or is) IPV6. 28 | /// 29 | IPV6 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /docs/toc.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |
6 | 7 | 8 | 9 |
10 |
11 |
12 |
13 | 14 | 25 |
26 |
27 |
28 |
-------------------------------------------------------------------------------- /SECSTee/TeeConnectionInfo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | namespace com.CIMthetics.CSharpSECSTools.SECSTee 18 | { 19 | internal class TeeConnectionInfo 20 | { 21 | internal ConnectionInfo ConnectionInfo { get; } 22 | internal string[] ConnectionsToForward { get; } 23 | 24 | internal TeeConnectionInfo(ConnectionInfo connectionInfo, string[] connectionsToForward) 25 | { 26 | this.ConnectionInfo = connectionInfo; 27 | this.ConnectionsToForward = connectionsToForward; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /SECSCommUtils/SECSConnectionType.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | using System; 17 | 18 | namespace com.CIMthetics.CSharpSECSTools.SECSCommUtils 19 | { 20 | /// 21 | /// This `enum` is used to indicate whether a SECSConnection uses 22 | /// SECS-I or HSMS as its transport layer. 23 | /// 24 | public enum SECSConnectionType 25 | { 26 | /// 27 | /// The transport layer is SECS-I. 28 | /// 29 | SECSI, 30 | 31 | /// 32 | /// The transport layer is HSMS. 33 | /// 34 | HSMS 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /TextFormatter/config/SMLOutputConfig.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | namespace com.CIMthetics.CSharpSECSTools.TextFormatter 18 | { 19 | /// 20 | /// This class is effectively a copy of the class XMLOutputConfig. Its 21 | /// only purpose is to facilitate the "automatic" reading of the 22 | /// TextFormatterConfig section of a appsettings.json file. 23 | /// Refer to the documentation for the class XMLOutputConfig for 24 | /// more information. 25 | /// 26 | public class SMLOutputConfig : XMLOutputConfig {} 27 | } 28 | -------------------------------------------------------------------------------- /docs/api/toc.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |
6 | 7 | 8 | 9 |
10 |
11 |
12 |
13 | 14 | 25 |
26 |
27 |
28 |
-------------------------------------------------------------------------------- /SECSSpy/ConfigConnectionPair.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | using com.CIMthetics.CSharpSECSTools.SECSCommUtils; 18 | 19 | #nullable enable 20 | 21 | namespace com.CIMthetics.CSharpSECSTools.SECSSpy 22 | { 23 | public class ConfigConnectionPair 24 | { 25 | public SECSConnectionConfigInfo Endpoint1 { get; } 26 | public SECSConnectionConfigInfo Endpoint2 { get; } 27 | 28 | public ConfigConnectionPair(SECSConnectionConfigInfo Endpoint1, SECSConnectionConfigInfo Endpoint2) 29 | { 30 | this.Endpoint1 = Endpoint1; 31 | this.Endpoint2 = Endpoint2; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /SECSStateMachines/HSMSConnectionSM/HSMSConnectionSMStates.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governingprivate permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #nullable enable 18 | 19 | namespace com.CIMthetics.CSharpSECSTools.SECSStateMachines.HSMSConnectionSM 20 | { 21 | /// 22 | /// This enum contains all of the states for the HSMSConnectionSM 23 | /// state machine. Refer to the SEMI E-37 standard for more information. 24 | /// 25 | public enum HSMSConnectionSMStates 26 | { 27 | NoState = 0, 28 | NotConnected = 1, 29 | Connected = 2, 30 | NotSelected = 3, 31 | Selected = 4 32 | } 33 | } -------------------------------------------------------------------------------- /.github/workflows/static.yml: -------------------------------------------------------------------------------- 1 | # Simple workflow for deploying static content to GitHub Pages 2 | name: Deploy static content to Pages 3 | 4 | on: 5 | # Runs on pushes targeting the default branch 6 | push: 7 | branches: ["master"] 8 | 9 | # Allows you to run this workflow manually from the Actions tab 10 | workflow_dispatch: 11 | 12 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages 13 | permissions: 14 | contents: read 15 | pages: write 16 | id-token: write 17 | 18 | # Allow one concurrent deployment 19 | concurrency: 20 | group: "pages" 21 | cancel-in-progress: true 22 | 23 | jobs: 24 | # Single deploy job since we're just deploying 25 | deploy: 26 | environment: 27 | name: github-pages 28 | url: ${{ steps.deployment.outputs.page_url }} 29 | runs-on: ubuntu-latest 30 | steps: 31 | - name: Checkout 32 | uses: actions/checkout@v3 33 | - name: Setup Pages 34 | uses: actions/configure-pages@v3 35 | - name: Upload artifact 36 | uses: actions/upload-pages-artifact@v1 37 | with: 38 | # Upload entire repository 39 | path: './docs' 40 | - name: Deploy to GitHub Pages 41 | id: deployment 42 | uses: actions/deploy-pages@v1 43 | -------------------------------------------------------------------------------- /SECSStateMachines/HSMSConnectionSM/HSMSConnectionSMTranstions.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governingprivate permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #nullable enable 18 | 19 | namespace com.CIMthetics.CSharpSECSTools.SECSStateMachines.HSMSConnectionSM 20 | { 21 | /// 22 | /// This enum contains all of the state transitions for the HSMSConnectionSM 23 | /// state machine. Refer to the SEMI E-37 standard for more information. 24 | /// 25 | public enum HSMSConnectionSMTransitions 26 | { 27 | Transition1 = 1, 28 | Transition2 = 2, 29 | Transition3 = 3, 30 | Transition4 = 4, 31 | Transition5 = 5, 32 | Transition6 = 6 33 | } 34 | } -------------------------------------------------------------------------------- /SECSStateMachinesTests/SECSStateMachineTests.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | using NUnit.Framework; 17 | using com.CIMthetics.CSharpSECSTools.SECSStateMachines; 18 | 19 | namespace com.CIMthetics.CSharpSECSTools.SECSStateMachinesTests; 20 | [TestFixture ()] 21 | public class SECSStateMachinesTests 22 | { 23 | [Test ()] 24 | public void Test01 () 25 | { 26 | // var exception = Assert.Catch (() => new SECSItemTest (SECSItemFormatCode.U1, -1)); 27 | 28 | // Assert.IsInstanceOf (exception); 29 | 30 | // Assert.IsTrue (exception.Message.Contains ("The value for the length argument must be between 0 and 16777215 inclusive.")); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /DocFx/utilities/SECSTee.md: -------------------------------------------------------------------------------- 1 | # SECSTee 2 | 3 | This utility has been created to allow for the insertion of the equivalent of a plumbing "T" into a "pipe". The "pipe" in this case is actually an HSMS connection between two endpoints. When configured and used it will pass messages between the intended endpoints of the "pipe" that is formed by the HSMS connections, however, it will also send the same messages to one or more third parties. 4 | 5 | The messages sent to the third party (or parties) may be configured to be all of the messages that travel through the "pipe" or they may be restricted to only those messages originating from one end or the other. Keep in mind, there is no meta data added to the messages by this utility so whatever receives and processes these messages may need some means to figure out which end of the "pipe" originated the message. 6 | 7 | The source and the destination should not notice there is a "middle man" in between them. However, messages originated by any third parties, other than HSMS control messages, will be ignored by `SECSTee`. In other words, third parties will only be able to receive "copies" of the messages sent between the two ends of the original "pipe", but, they will not be able to interfere with or modify the communication between them. 8 | -------------------------------------------------------------------------------- /docs/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | Created by Docfx 9 | 10 | 12 | 15 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /SECSCommUtils/HSMS/HSMSConnectionMode.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2023 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | using System; 17 | 18 | namespace com.CIMthetics.CSharpSECSTools.SECSCommUtils 19 | { 20 | /// 21 | /// This `enum` is used to indicate whether an HSMSConnection is to 22 | /// operate in an Active or Passive manner. 23 | /// 24 | public enum HSMSConnectionMode 25 | { 26 | /// 27 | /// If a connection is Passive it will perform the necessary 28 | /// setup and await a connection request from elsewhere. 29 | /// 30 | Passive, 31 | 32 | /// 33 | /// If a connection is Active it will perform the necessary 34 | /// setup and actively attempt to establish a connection. 35 | /// 36 | Active 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /SECSStateMachines/RootState.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governingprivate permissions and 14 | * limitations under the License. 15 | */ 16 | using System.Data; 17 | 18 | #nullable enable 19 | 20 | namespace com.CIMthetics.CSharpSECSTools.SECSStateMachines 21 | { 22 | /// 23 | /// This is the root state of a state machine. All other states will 24 | /// be a sub-state of this one. 25 | /// 26 | internal class RootState : State 27 | { 28 | internal RootState(StateMachine stateMachine) : base(stateMachine, -1, "RootState") 29 | { 30 | // The root state is always active. 31 | IsActive = true; 32 | } 33 | 34 | public override void PerformTransition(int transitionNumber) 35 | { 36 | throw new ConstraintException($"State RootState has not been implemented to handle PerformTransition for transition {transitionNumber}"); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /EquipmentSimulatorSupportStuff/PortID_SV.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | using System; 17 | using System.Collections.Concurrent; 18 | using EquipmentSimulatorSupportStuff; 19 | using com.CIMthetics.CSharpSECSTools.SECSItems; 20 | 21 | namespace EquipmentSimulatorSupportStuff.E87 22 | { 23 | public class PortID_SV : SVID, ASECSItem 24 | { 25 | UInt32 svid; 26 | string portID; 27 | 28 | public PortID_SV(string portID, UInt32 svid, ConcurrentDictionary svidMap) 29 | { 30 | this.portID = portID; 31 | this.svid = svid; 32 | } 33 | 34 | public string getPortID() 35 | { 36 | return portID; 37 | } 38 | 39 | //public SECSItem getAsSECSItem() 40 | //{ 41 | // //return new ASCIISECSItem(PortID_SV); 42 | //} 43 | 44 | public UInt32 getSVID() 45 | { 46 | return svid; 47 | } 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /EquipmentSimulatorSupportStuff/CarrierID_SV.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | using System; 17 | 18 | namespace EquipmentSimulatorSupportStuff.E87 19 | { 20 | public class CarrierID_SV : SVID, ASECSItem 21 | { 22 | //UInt32 svid; 23 | //string carrierID; 24 | 25 | public uint getSVID() 26 | { 27 | throw new NotImplementedException(); 28 | } 29 | 30 | //public CarrierID_SV (string carrierID, UInt32 svid, ConcurrentDictionary svidMap) 31 | //{ 32 | // this.carrierID = carrierID; 33 | // this.svid = svid; 34 | //} 35 | 36 | //public string getPortID() 37 | //{ 38 | // return portID; 39 | //} 40 | 41 | //public SECSItem getAsSECSItem() 42 | //{ 43 | // return new ASCIISECSItem(PortID_SV); 44 | //} 45 | 46 | //public UInt32 getSVID() 47 | //{ 48 | // return svid; 49 | //} 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /SECSTee/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Serilog": { 3 | "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ], 4 | "MinimumLevel": "Verbose", 5 | "WriteTo": [ 6 | { "Name": "Console" }, 7 | { "Name": "File", "Args": { "path": "SECSTee/Logs/log.txt" } } 8 | ] 9 | }, 10 | "SECSTeeConfig": 11 | { 12 | "Connection1": 13 | { 14 | "Type" : "HSMS", 15 | "Address" : "titan", 16 | "AddressFamily" : "IPV4", 17 | "Port" : 50001, 18 | "ActiveOrPassive": "passive" 19 | }, 20 | "Connection2": 21 | { 22 | "Type" : "HSMS", 23 | "Address" : "titan.home.arpa", 24 | "AddressFamily" : "IPV4", 25 | "Port" : 50000, 26 | "ActiveOrPassive": "active" 27 | }, 28 | "TeeConnections": 29 | [ 30 | { 31 | "TeeConnection": 32 | { 33 | "Type" : "HSMS", 34 | "Address" : "Tee1", 35 | "AddressFamily" : "IPV4", 36 | "Port" : 50002, 37 | "ActiveOrPassive": "passive", 38 | "ConnectionsToForward": ["Connection1", "Connection2"] 39 | } 40 | }, 41 | { 42 | "TeeConnection": 43 | { 44 | "Type" : "HSMS", 45 | "Address" : "Tee2", 46 | "AddressFamily" : "IPV6", 47 | "Port" : 50003, 48 | "ActiveOrPassive": "passive", 49 | "ConnectionsToForward": ["Connection1", "Connection2"] 50 | } 51 | } 52 | ] 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /SECSStateMachines/HSMSConnectionSM/Selected.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governingprivate permissions and 14 | * limitations under the License. 15 | */ 16 | using Serilog; 17 | 18 | #nullable enable 19 | 20 | namespace com.CIMthetics.CSharpSECSTools.SECSStateMachines.HSMSConnectionSM 21 | { 22 | public class Selected : State 23 | { 24 | public Selected(StateMachine stateMachine) : base(stateMachine, (int)HSMSConnectionSMStates.Selected, HSMSConnectionSMStates.Selected.ToString()) {} 25 | 26 | public override void PerformTransition(int transitionNumber) 27 | { 28 | if (transitionNumber == (int)HSMSConnectionSMTransitions.Transition5) 29 | { 30 | Log.Verbose("State Selected performing transition {0}.", HSMSConnectionSMTransitions.Transition5.ToString()); 31 | StateMachine.SetState((int)HSMSConnectionSMStates.NotSelected); 32 | } 33 | else 34 | { 35 | string transitionNumberString = ((HSMSConnectionSMTransitions)transitionNumber).ToString(); 36 | throw new InvalidOperationException($"State Selected cannot perform transistion {transitionNumberString}."); 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /SECSStateMachines/HSMSConnectionSM/NotConnected.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governingprivate permissions and 14 | * limitations under the License. 15 | */ 16 | using Serilog; 17 | 18 | #nullable enable 19 | 20 | namespace com.CIMthetics.CSharpSECSTools.SECSStateMachines.HSMSConnectionSM 21 | { 22 | public class NotConnected : State 23 | { 24 | public NotConnected(StateMachine stateMachine) : base(stateMachine, (int)HSMSConnectionSMStates.NotConnected, HSMSConnectionSMStates.NotConnected.ToString()) {} 25 | 26 | public override void PerformTransition(int transitionNumber) 27 | { 28 | if (transitionNumber == (int)HSMSConnectionSMTransitions.Transition2) 29 | { 30 | Log.Verbose("State NotConnection performing transition {0}.", HSMSConnectionSMTransitions.Transition2.ToString()); 31 | StateMachine.SetState((int)HSMSConnectionSMStates.Connected); 32 | } 33 | else 34 | { 35 | string transitionNumberString = ((HSMSConnectionSMTransitions)transitionNumber).ToString(); 36 | throw new InvalidOperationException($"State NotConnected cannot perform transistion {transitionNumberString}."); 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /TextFormatter/config/XMLOutputConfig.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | using System.Text; 18 | 19 | namespace com.CIMthetics.CSharpSECSTools.TextFormatter 20 | { 21 | /// 22 | /// This class contains the information for a formatter to use when producing 23 | /// output. 24 | /// 25 | public class XMLOutputConfig 26 | { 27 | /// 28 | /// This property contains the information a formatter needs to generate output 29 | /// when producing output for a SECSHeader class. 30 | /// 31 | public HeaderOutputConfig HeaderOutputConfig { get; set; } 32 | 33 | /// 34 | /// This property contains the information a formatter needs to generate output 35 | /// when producing output for a SECSItem class. 36 | /// 37 | public BodyOutputConfig BodyOutputConfig { get; set; } 38 | 39 | public override string ToString() 40 | { 41 | StringBuilder sb = new StringBuilder(); 42 | 43 | sb.AppendLine(HeaderOutputConfig.ToString()); 44 | sb.AppendLine(BodyOutputConfig.ToString()); 45 | 46 | return sb.ToString(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /FixedBufferSimulatorConsole/FixedBufferSimulatorConsole.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {022A2D27-EB8B-452B-90A4-4ECEB3527752} 5 | Exe 6 | FixedBufferSimulatorConsole 7 | FixedBufferSimulatorConsole 8 | net6.0 9 | 10 10 | enable 11 | AnyCPU 12 | Debug 13 | Debug 14 | Release 15 | true 16 | false 17 | full 18 | none 19 | false 20 | true 21 | 0 22 | bin\Debug 23 | bin\Release 24 | 25 | 26 | 27 | {5FE19A00-496E-4142-A5FF-1814A6F273DD} 28 | SECSItems 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /EquipmentSimulatorSupportStuff/AccessMode_SV.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | using System; 17 | using System.Collections.Concurrent; 18 | using EquipmentSimulatorSupportStuff.Exceptions; 19 | using com.CIMthetics.CSharpSECSTools.SECSItems; 20 | 21 | namespace EquipmentSimulatorSupportStuff.E87 22 | { 23 | public class AccessMode_SV : SVID, ASECSItem 24 | { 25 | UInt32 svid = 0; 26 | byte accessMode = 0; 27 | 28 | //public AccessMode_SV (A accessMode, UInt32 svid, ConcurrentDictionary svidMap) 29 | //{ 30 | // bool result = svidMap.TryAdd(svid, this); 31 | // if (result == false) 32 | // { 33 | // throw new DuplicateSVIDException("Duplicate SVID addition attemped to svidMap. The offender is SVID " 34 | // + svid + " for AccessMode_SV for " + portID + "."); 35 | // } 36 | 37 | // this.accessMode = acccessMode; 38 | // this.svid = svid; 39 | //} 40 | 41 | public byte getAccessMode() 42 | { 43 | return accessMode; 44 | } 45 | 46 | public void setAccessMode(byte accessMode) 47 | { 48 | this.accessMode = accessMode; 49 | } 50 | 51 | public SECSItem getAsSECSItem() 52 | { 53 | return new U1SECSItem(accessMode); 54 | } 55 | 56 | public UInt32 getSVID() 57 | { 58 | return svid; 59 | } 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /EquipmentSimulatorSupportStuff/EquipmentSimulatorSupportStuff.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {DC790961-6CBF-4917-A321-A4D4685692CF} 5 | Library 6 | EquipmentSimulatorSupportStuff 7 | EquipmentSimulatorSupportStuff 8 | net6.0 9 | 10 10 | enable 11 | AnyCPU 12 | Debug 13 | Debug 14 | Release 15 | true 16 | false 17 | full 18 | none 19 | false 20 | true 21 | 4 22 | bin\Debug 23 | bin\Release 24 | 25 | 26 | 27 | {5FE19A00-496E-4142-A5FF-1814A6F273DD} 28 | SECSItems 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /SECSItems/SECSItems.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {5FE19A00-496E-4142-A5FF-1814A6F273DD} 5 | Library 6 | com.CIMthetics.CSharpSECSTools.SECSItems 7 | SECSItems 8 | net6.0 9 | 10 10 | enable 11 | true 12 | AnyCPU 13 | Debug 14 | Debug 15 | Release 16 | true 17 | false 18 | full 19 | none 20 | false 21 | true 22 | 4 23 | bin\Debug 24 | bin\Release 25 | bin\Debug\SECSItems.xml 26 | bin\Release\SECSItems.xml 27 | 28 | 29 | -------------------------------------------------------------------------------- /docs/search-stopwords.json: -------------------------------------------------------------------------------- 1 | [ 2 | "a", 3 | "able", 4 | "about", 5 | "across", 6 | "after", 7 | "all", 8 | "almost", 9 | "also", 10 | "am", 11 | "among", 12 | "an", 13 | "and", 14 | "any", 15 | "are", 16 | "as", 17 | "at", 18 | "be", 19 | "because", 20 | "been", 21 | "but", 22 | "by", 23 | "can", 24 | "cannot", 25 | "could", 26 | "dear", 27 | "did", 28 | "do", 29 | "does", 30 | "either", 31 | "else", 32 | "ever", 33 | "every", 34 | "for", 35 | "from", 36 | "get", 37 | "got", 38 | "had", 39 | "has", 40 | "have", 41 | "he", 42 | "her", 43 | "hers", 44 | "him", 45 | "his", 46 | "how", 47 | "however", 48 | "i", 49 | "if", 50 | "in", 51 | "into", 52 | "is", 53 | "it", 54 | "its", 55 | "just", 56 | "least", 57 | "let", 58 | "like", 59 | "likely", 60 | "may", 61 | "me", 62 | "might", 63 | "most", 64 | "must", 65 | "my", 66 | "neither", 67 | "no", 68 | "nor", 69 | "not", 70 | "of", 71 | "off", 72 | "often", 73 | "on", 74 | "only", 75 | "or", 76 | "other", 77 | "our", 78 | "own", 79 | "rather", 80 | "said", 81 | "say", 82 | "says", 83 | "she", 84 | "should", 85 | "since", 86 | "so", 87 | "some", 88 | "than", 89 | "that", 90 | "the", 91 | "their", 92 | "them", 93 | "then", 94 | "there", 95 | "these", 96 | "they", 97 | "this", 98 | "tis", 99 | "to", 100 | "too", 101 | "twas", 102 | "us", 103 | "wants", 104 | "was", 105 | "we", 106 | "were", 107 | "what", 108 | "when", 109 | "where", 110 | "which", 111 | "while", 112 | "who", 113 | "whom", 114 | "why", 115 | "will", 116 | "with", 117 | "would", 118 | "yet", 119 | "you", 120 | "your" 121 | ] 122 | -------------------------------------------------------------------------------- /SECSTee/HSMSConnectionInfo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | using System.Text; 18 | using com.CIMthetics.CSharpSECSTools.SECSCommUtils; 19 | 20 | namespace com.CIMthetics.CSharpSECSTools.SECSTee 21 | { 22 | internal class HSMSConnectionInfo : ConnectionInfo 23 | { 24 | internal NetworkFamily NetworkFamily { get; } 25 | internal string IPAddress { get; } 26 | internal UInt16 Port { get; } 27 | internal HSMSConnectionMode ConnectionMode { get; } 28 | 29 | internal HSMSConnectionInfo(NetworkFamily networkFamily, string address, UInt16 port, HSMSConnectionMode connectionMode) 30 | { 31 | this.NetworkFamily = networkFamily; 32 | this.IPAddress = address; 33 | this.Port = port; 34 | this.ConnectionMode = connectionMode; 35 | } 36 | 37 | override public string ToString() 38 | { 39 | StringBuilder sb = new StringBuilder(); 40 | 41 | sb.Append("ConnectionConfig" + Environment.NewLine); 42 | sb.Append(" NetworkFamily:" + NetworkFamily.ToString() + Environment.NewLine); 43 | sb.Append(" Address:" + IPAddress + Environment.NewLine); 44 | sb.Append(" Port:" + Port + Environment.NewLine); 45 | sb.Append(" ConnetionMode:" + ConnectionMode.ToString() + Environment.NewLine); 46 | 47 | return sb.ToString(); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /SECSCommUtils/SECSConnectionFactory.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing private permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | using System.Collections.Concurrent; 18 | 19 | namespace com.CIMthetics.CSharpSECSTools.SECSCommUtils 20 | { 21 | public static class SECSConnectionFactory 22 | { 23 | /// 24 | /// Create an appropriate SECSConnection based on the information 25 | /// contained in the configuration argument. 26 | /// 27 | /// 28 | /// Either an 29 | /// HSMSConnection 30 | /// or a 31 | /// SECSIConnection 32 | /// depending 33 | /// on the information contained in the configuration argument. 34 | /// 35 | /// 36 | /// The SECSConnectionConfigInfo object the contains the information 37 | /// necessary to configure the created SECSConnection. 38 | /// 39 | public static SECSConnection CreateConnection(SECSConnectionConfigInfo configuration) 40 | { 41 | if (String.Equals(configuration.Type, "HSMS")) 42 | { 43 | return new HSMSConnection(configuration); 44 | } 45 | 46 | return new SECSIConnection(configuration); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /SECSItemTests/SECSItemNumLengthBytesTests.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2023 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | using NUnit.Framework; 18 | 19 | using com.CIMthetics.CSharpSECSTools.SECSItems; 20 | 21 | namespace com.CIMthetics.CSharpSECSTools.SECSItemTests 22 | { 23 | [TestFixture()] 24 | public class SECSItemNumLengthBytesTests 25 | { 26 | /* 27 | [Test()] 28 | public void testHowManyValues() 29 | { 30 | SECSItemNumLengthBytes [] values = (SECSItemNumLengthBytes[])Enum.GetValues (typeof (SECSItemNumLengthBytes)); 31 | Assert.IsTrue(values.Length == 4); 32 | } 33 | */ 34 | 35 | [Test()] 36 | public void testEnumValues() 37 | { 38 | Assert.IsTrue(SECSItemNumLengthBytes.ONE.ValueOf() == 1); 39 | Assert.IsTrue(SECSItemNumLengthBytes.TWO.ValueOf() == 2); 40 | Assert.IsTrue(SECSItemNumLengthBytes.THREE.ValueOf() == 3); 41 | Assert.IsTrue(SECSItemNumLengthBytes.NOT_INITIALIZED.ValueOf() == -1); 42 | } 43 | 44 | [Test()] 45 | public void testEnumValueStrings() 46 | { 47 | Assert.IsTrue(string.Equals(SECSItemNumLengthBytes.ONE.ToString(), "ONE")); 48 | Assert.IsTrue(string.Equals(SECSItemNumLengthBytes.TWO.ToString(), "TWO")); 49 | Assert.IsTrue(string.Equals(SECSItemNumLengthBytes.THREE.ToString(), "THREE")); 50 | Assert.IsTrue(string.Equals(SECSItemNumLengthBytes.NOT_INITIALIZED.ToString(), "NOT_INITIALIZED")); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /TextFormatter/SECSFormatterFactory.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | namespace com.CIMthetics.CSharpSECSTools.TextFormatter 19 | { 20 | /// 21 | /// A factory class used to create a SECSFormatter of the appropriate 22 | /// type. 23 | /// 24 | public static class SECSFormatterFactory 25 | { 26 | /// 27 | /// Create an appropriate SECSFormatter based on the information 28 | /// contained in the configuration argument. 29 | /// 30 | /// 31 | /// Either an 32 | /// SMLFormatter 33 | /// or an 34 | /// XMLFormatter 35 | /// depending 36 | /// on the information contained in the configuration argument. 37 | /// 38 | /// 39 | /// The TextFormatterConfig object the contains the information 40 | /// necessary to configure the created SECSFormatter. 41 | /// 42 | public static SECSFormatter CreateFormatter(TextFormatterConfig configuration) 43 | { 44 | if (String.Equals(configuration.LoggingOutputFormat, "SML")) 45 | { 46 | return new SMLFormatter(configuration); 47 | } 48 | 49 | return new XMLFormatter(configuration); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /SECSItemTests/SECSItemTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {BC171C6E-3844-4601-9405-63C9A0A8C7CD} 6 | Library 7 | SECSItemTests 8 | SECSItemTests 9 | net6.0 10 | 10 11 | enable 12 | AnyCPU 13 | Debug 14 | Debug 15 | Release 16 | true 17 | false 18 | full 19 | none 20 | false 21 | true 22 | 4 23 | bin\Debug 24 | bin\Release 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | {5FE19A00-496E-4142-A5FF-1814A6F273DD} 34 | SECSItems 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /SECSStateMachinesTests/SECSStateMachinesTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {a43272fb-5f5b-4c91-975d-c81654ced52a} 6 | Library 7 | SECSStateMachinesTests 8 | SECSStateMachinesTests 9 | net6.0 10 | 10 11 | enable 12 | AnyCPU 13 | Debug 14 | Debug 15 | Release 16 | true 17 | false 18 | full 19 | none 20 | false 21 | true 22 | 4 23 | bin\Debug 24 | bin\Release 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | {7d95975e-064f-4a62-b546-48c2ecc2fca9} 34 | SECSStateMachines 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /SECSStateMachines/HSMSConnectionSM/Connected.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governingprivate permissions and 14 | * limitations under the License. 15 | */ 16 | using Serilog; 17 | 18 | #nullable enable 19 | 20 | namespace com.CIMthetics.CSharpSECSTools.SECSStateMachines.HSMSConnectionSM 21 | { 22 | public class Connected : State 23 | { 24 | public Connected(StateMachine stateMachine) : base(stateMachine, (int)HSMSConnectionSMStates.Connected, HSMSConnectionSMStates.Connected.ToString()) 25 | { 26 | StateChangeCallback = StateChangedCallbackHandler; 27 | } 28 | 29 | private void StateChangedCallbackHandler(State state, StateEntryOrExit entryOrExit) 30 | { 31 | if (entryOrExit == StateEntryOrExit.Entry) 32 | { 33 | StateMachine.SetState((int)HSMSConnectionSMStates.NotSelected); 34 | } 35 | else 36 | { 37 | Log.Debug("State {0}:{1} has no action for deactivation.", state.StateName, state.StateID); 38 | } 39 | } 40 | 41 | public override void PerformTransition(int transitionNumber) 42 | { 43 | if (transitionNumber == (int)HSMSConnectionSMTransitions.Transition3) 44 | { 45 | Log.Verbose("State Connected performing transition {0}.", HSMSConnectionSMTransitions.Transition5.ToString()); 46 | StateMachine.SetState((int)HSMSConnectionSMStates.NotSelected); 47 | } 48 | else 49 | { 50 | string transitionNumberString = ((HSMSConnectionSMTransitions)transitionNumber).ToString(); 51 | throw new InvalidOperationException($"State Connected cannot perform transistion {transitionNumberString}."); 52 | } 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /SECSStateMachines/HSMSConnectionSM/HSMSConnectionSM.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governingprivate permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #nullable enable 18 | 19 | namespace com.CIMthetics.CSharpSECSTools.SECSStateMachines.HSMSConnectionSM 20 | { 21 | /// 22 | /// This class provides and implementation of the SEMI E37 HSMS Connection 23 | /// State machine. 24 | /// 25 | /// 26 | /// The initial state of this state machine will be set to HSMSConnectionSMStates.NoState. 27 | /// 28 | public class HSMSConnectionSM : StateMachine 29 | { 30 | /// 31 | /// Creates the state machine. 32 | /// 33 | /// 34 | /// The initial state will be HSMSConnectionSMStates.NoState. 35 | /// 36 | public HSMSConnectionSM() 37 | { 38 | /* 39 | Create the states that are to be part of this state machine. 40 | In addition, create any sub-states that may be needed for 41 | those states. 42 | */ 43 | NoState noState = new NoState(this); 44 | 45 | NotConnected notConnected = new NotConnected(this); 46 | 47 | Connected connected = new Connected(this); 48 | connected.AddSubState(new NotSelected(this)); 49 | connected.AddSubState(new Selected(this)); 50 | 51 | // Add the states to the root state. 52 | _rootState.AddSubState(noState); 53 | _rootState.AddSubState(notConnected); 54 | _rootState.AddSubState(connected); 55 | 56 | // Set the "starting state" of the state machine. 57 | SetState((int)HSMSConnectionSMStates.NoState); 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /SECSStateMachines/SECSStateMachines.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {7d95975e-064f-4a62-b546-48c2ecc2fca9} 5 | Library 6 | com.CIMthetics.CSharpSECSTools.SECSStateMachines 7 | SECSStateMachines 8 | net6.0 9 | 10 10 | enable 11 | true 12 | AnyCPU 13 | Debug 14 | Debug 15 | Release 16 | true 17 | false 18 | full 19 | none 20 | false 21 | true 22 | 4 23 | 1591 24 | bin\Debug 25 | bin\Release 26 | bin\Debug\SECSStateMachines.xml 27 | bin\Release\SECSStateMachines.xml 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /SECSCommUtilsTests/SECSCommUtilsTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {70ea8ec6-d32a-4cf5-8255-760f76a1a55b} 6 | Library 7 | com.CIMthetics.CSharpSECSTools.SECSCommUtils 8 | SECSCommUtilsTests 9 | net6.0 10 | 10 11 | enable 12 | AnyCPU 13 | Debug 14 | Debug 15 | Release 16 | true 17 | false 18 | full 19 | none 20 | false 21 | true 22 | 4 23 | bin\Debug 24 | bin\Release 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | {5FE19A00-496E-4142-A5FF-1814A6F273DD} 34 | SECSItems 35 | 36 | 37 | {4F722F74-D152-4671-B8DB-DD3E22CFFA78} 38 | SECSCommUtils 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /TextFormatter/TextFormatter.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {80D87AE3-3F12-49C1-BF5D-0E037E8D47D6} 5 | Library 6 | TextFormatter 7 | TextFormatter 8 | net6.0 9 | 10 10 | enable 11 | true 12 | AnyCPU 13 | Debug 14 | Debug 15 | Release 16 | true 17 | false 18 | full 19 | none 20 | false 21 | true 22 | 4 23 | 1591 24 | bin\Debug 25 | bin\Release 26 | bin\Debug\SECSFormatter.xml 27 | bin\Release\SECSFormatter.xml 28 | 29 | 30 | 31 | 32 | 33 | 34 | {5FE19A00-496E-4142-A5FF-1814A6F273DD} 35 | SECSItems 36 | 37 | 38 | {4F722F74-D152-4671-B8DB-DD3E22CFFA78} 39 | SECSItems 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /docs/styles/search-worker.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | importScripts('lunr.min.js'); 3 | 4 | var lunrIndex; 5 | 6 | var stopWords = null; 7 | var searchData = {}; 8 | 9 | lunr.tokenizer.separator = /[\s\-\.\(\)]+/; 10 | 11 | var stopWordsRequest = new XMLHttpRequest(); 12 | stopWordsRequest.open('GET', '../search-stopwords.json'); 13 | stopWordsRequest.onload = function () { 14 | if (this.status != 200) { 15 | return; 16 | } 17 | stopWords = JSON.parse(this.responseText); 18 | buildIndex(); 19 | } 20 | stopWordsRequest.send(); 21 | 22 | var searchDataRequest = new XMLHttpRequest(); 23 | 24 | searchDataRequest.open('GET', '../index.json'); 25 | searchDataRequest.onload = function () { 26 | if (this.status != 200) { 27 | return; 28 | } 29 | searchData = JSON.parse(this.responseText); 30 | 31 | buildIndex(); 32 | 33 | postMessage({ e: 'index-ready' }); 34 | } 35 | searchDataRequest.send(); 36 | 37 | onmessage = function (oEvent) { 38 | var q = oEvent.data.q; 39 | var hits = lunrIndex.search(q); 40 | var results = []; 41 | hits.forEach(function (hit) { 42 | var item = searchData[hit.ref]; 43 | results.push({ 'href': item.href, 'title': item.title, 'keywords': item.keywords }); 44 | }); 45 | postMessage({ e: 'query-ready', q: q, d: results }); 46 | } 47 | 48 | function buildIndex() { 49 | if (stopWords !== null && !isEmpty(searchData)) { 50 | lunrIndex = lunr(function () { 51 | this.pipeline.remove(lunr.stopWordFilter); 52 | this.ref('href'); 53 | this.field('title', { boost: 50 }); 54 | this.field('keywords', { boost: 20 }); 55 | 56 | for (var prop in searchData) { 57 | if (searchData.hasOwnProperty(prop)) { 58 | this.add(searchData[prop]); 59 | } 60 | } 61 | 62 | var docfxStopWordFilter = lunr.generateStopWordFilter(stopWords); 63 | lunr.Pipeline.registerFunction(docfxStopWordFilter, 'docfxStopWordFilter'); 64 | this.pipeline.add(docfxStopWordFilter); 65 | this.searchPipeline.add(docfxStopWordFilter); 66 | }); 67 | } 68 | } 69 | 70 | function isEmpty(obj) { 71 | if(!obj) return true; 72 | 73 | for (var prop in obj) { 74 | if (obj.hasOwnProperty(prop)) 75 | return false; 76 | } 77 | 78 | return true; 79 | } 80 | })(); 81 | -------------------------------------------------------------------------------- /SECSStateMachines/HSMSConnectionSM/NotSelected.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governingprivate permissions and 14 | * limitations under the License. 15 | */ 16 | using Serilog; 17 | 18 | #nullable enable 19 | 20 | namespace com.CIMthetics.CSharpSECSTools.SECSStateMachines.HSMSConnectionSM 21 | { 22 | public class NotSelected : State 23 | { 24 | public NotSelected(StateMachine stateMachine) : base(stateMachine, (int)HSMSConnectionSMStates.NotSelected, HSMSConnectionSMStates.NotSelected.ToString()) {} 25 | 26 | public override void PerformTransition(int transitionNumber) 27 | { 28 | if (transitionNumber == (int)HSMSConnectionSMTransitions.Transition3) 29 | { 30 | Log.Verbose("State NotSelected performing transition {0}.", HSMSConnectionSMTransitions.Transition3.ToString()); 31 | StateMachine.SetState((int)HSMSConnectionSMStates.NotConnected); 32 | } 33 | else if (transitionNumber == (int)HSMSConnectionSMTransitions.Transition4) 34 | { 35 | Log.Verbose("State NotSelected performing transition {0}.", HSMSConnectionSMTransitions.Transition4.ToString()); 36 | StateMachine.SetState((int)HSMSConnectionSMStates.Selected); 37 | } 38 | else if (transitionNumber == (int)HSMSConnectionSMTransitions.Transition6) 39 | { 40 | Log.Verbose("State NotSelected performing transition {0}.", HSMSConnectionSMTransitions.Transition6.ToString()); 41 | StateMachine.SetState((int)HSMSConnectionSMStates.NotConnected); 42 | } 43 | else 44 | { 45 | string transitionNumberString = ((HSMSConnectionSMTransitions)transitionNumber).ToString(); 46 | throw new InvalidOperationException($"State NotSelected cannot perform transistion {transitionNumberString}."); 47 | } 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /SECSCommUtils/SECSHeader.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2023 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | namespace com.CIMthetics.CSharpSECSTools.SECSCommUtils 18 | { 19 | /// 20 | /// This is an abstract base class for a SECS message header. 21 | /// 22 | abstract public class SECSHeader 23 | { 24 | /// 25 | /// System Bytes - The system bytes in the header of each message 26 | /// for a given device ID must satisfy the following requirements. 27 | /// 28 | /// Distinction - The system bytes of a primary message must be 29 | /// distinct from those of all currently open transactions 30 | /// initiated from the same end of the communications link. 31 | /// 32 | /// They must also be distinct from those of the most recently 33 | /// completed transaction. They must also be distinct from any 34 | /// system bytes of blocks that were not successfully sent since 35 | /// the last successful block send. 36 | /// 37 | /// Reply Message - The system bytes of the reply message are 38 | /// required to be the same as the system bytes of the corresponding 39 | /// primary message. 40 | /// 41 | /// Multi-Block Messages - When using SECS-I as a transport layer the 42 | /// system bytes of all blocks of a multi-block message must be the same. 43 | /// 44 | public UInt32 SystemBytes { get; set; } = 0; 45 | 46 | /// 47 | /// This method encodes the header (this object) into its "transmission" form. 48 | /// 49 | /// 50 | /// A byte[] that is this object's "value" in a transmittable form. 51 | /// 52 | abstract public byte[] EncodeForTransport(); 53 | 54 | } // End abstract public class SECSHeader 55 | } 56 | -------------------------------------------------------------------------------- /SECSStateMachines/HSMSConnectionSM/NoState.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governingprivate permissions and 14 | * limitations under the License. 15 | */ 16 | using Serilog; 17 | 18 | #nullable enable 19 | 20 | namespace com.CIMthetics.CSharpSECSTools.SECSStateMachines.HSMSConnectionSM 21 | { 22 | /// 23 | /// This is the NoState class. It is the state that the 24 | /// HSMSConnectionSM state machine will be set to once initialization 25 | /// is complete. Once this State is entered it will automatically 26 | /// transition to the NotConnected state. 27 | /// 28 | public class NoState : State 29 | { 30 | public NoState(StateMachine stateMachine) : base(stateMachine, (int)HSMSConnectionSMStates.NoState, HSMSConnectionSMStates.NoState.ToString()) 31 | { 32 | StateChangeCallback = StateChangedCallbackHandler; 33 | } 34 | 35 | 36 | private void StateChangedCallbackHandler(State state, StateEntryOrExit entryOrExit) 37 | { 38 | if (entryOrExit == StateEntryOrExit.Entry) 39 | { 40 | StateMachine.SetState((int)HSMSConnectionSMStates.NotConnected); 41 | } 42 | else 43 | { 44 | Log.Debug("State {0}:{1} has no action for deactivation.", state.StateName, state.StateID); 45 | } 46 | } 47 | 48 | public override void PerformTransition(int transitionNumber) 49 | { 50 | if (transitionNumber == (int)HSMSConnectionSMTransitions.Transition1) 51 | { 52 | Log.Verbose("State NoState performing transition {0}.", HSMSConnectionSMTransitions.Transition1.ToString()); 53 | StateMachine.SetState((int)HSMSConnectionSMStates.NotConnected); 54 | } 55 | else 56 | { 57 | string transitionNumberString = ((HSMSConnectionSMTransitions)transitionNumber).ToString(); 58 | throw new InvalidOperationException($"State NoState cannot perform transistion {transitionNumberString}."); 59 | } 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /SECSTee/SECSTee.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {457964a5-7385-4152-989c-ce9d26e84da9} 5 | Exe 6 | com.CIMthetics.CSharpSECSTools.SECSTee 7 | SECSTee 8 | net6.0 9 | 10 10 | enable 11 | AnyCPU 12 | Debug 13 | Debug 14 | Release 15 | true 16 | false 17 | full 18 | none 19 | false 20 | true 21 | 4 22 | bin\Debug 23 | bin\Release 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | PreserveNewest 36 | 37 | 38 | 39 | 40 | {4F722F74-D152-4671-B8DB-DD3E22CFFA78} 41 | SECSItems 42 | 43 | 44 | {7d95975e-064f-4a62-b546-48c2ecc2fca9} 45 | SECSStateMachines 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /SECSCommUtils/SECSCommUtils.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {4F722F74-D152-4671-B8DB-DD3E22CFFA78} 5 | Library 6 | com.CIMthetics.CSharpSECSTools.SECSCommUtils 7 | SECSCommUtils 8 | net6.0 9 | 10 10 | enable 11 | true 12 | AnyCPU 13 | Debug 14 | Debug 15 | Release 16 | true 17 | false 18 | full 19 | none 20 | false 21 | true 22 | 4 23 | 1591 24 | bin\Debug 25 | bin\Release 26 | bin\Debug\SECSCommUtils.xml 27 | bin\Release\SECSCommUtils.xml 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | {5FE19A00-496E-4142-A5FF-1814A6F273DD} 42 | SECSItems 43 | 44 | 45 | {7d95975e-064f-4a62-b546-48c2ecc2fca9} 46 | SECSStateMachines 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /SECSSpy/ConfigHSMSConnectionInfo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | using com.CIMthetics.CSharpSECSTools.SECSCommUtils; 18 | 19 | namespace com.CIMthetics.CSharpSECSTools.SECSSpy 20 | { 21 | public class ConfigHSMSConnectionInfo : ConfigConnectionInfo 22 | { 23 | private string Type { get; } 24 | private string Address { get; } 25 | private HSMSConnectionNetworkFamily AddressFamily { get; } 26 | private UInt16 Port { get; } 27 | private HSMSConnectionMode ConnectionMode { get; } 28 | 29 | /// 30 | /// Create a config file version of HSMS connection information. 31 | /// Note: If the addressFamily argument is not "IPV6" 32 | /// it will be set to IPV4. In addition if the activeOrPassive argument 33 | /// is not a case insensitive version of "Active" the connectionMode 34 | /// attribute will be set to Passive. 35 | /// 36 | internal ConfigHSMSConnectionInfo( string name, 37 | string type, 38 | string address, 39 | string addressFamily, 40 | UInt16 port, 41 | string activeOrPassive) : base( name ) 42 | { 43 | Type = type; 44 | Address = address; 45 | 46 | if (activeOrPassive.Equals("IPV6", StringComparison.OrdinalIgnoreCase)) 47 | AddressFamily = HSMSConnectionNetworkFamily.IPV6; 48 | else 49 | AddressFamily = HSMSConnectionNetworkFamily.IPV4; 50 | 51 | Port = port; 52 | 53 | if (activeOrPassive.Equals("ACTIVE", StringComparison.OrdinalIgnoreCase)) 54 | ConnectionMode = HSMSConnectionMode.Active; 55 | else 56 | ConnectionMode = HSMSConnectionMode.Passive; 57 | } 58 | 59 | public override string ToString() 60 | { 61 | return "name:" + Name + " Type:" + Type + " Address:" + Address + " AddressFamily:" + AddressFamily + " Port:" + Port + " Mode:" + ConnectionMode; 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /DocFx/docfx.json: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": [ 3 | { 4 | "src": [ 5 | { 6 | "src": "..", 7 | "files": ["SECSItems/SECSItems.csproj"], 8 | "exclude": [ "**/obj/**", "**/bin/**" ] 9 | } 10 | ], 11 | "dest": "api/SECSItems", 12 | "disableGitFeatures": false, 13 | "disableDefaultFilter": false, 14 | "filter": "filterConfig.yml" 15 | }, 16 | { 17 | "src": [ 18 | { 19 | "src": "..", 20 | "files": ["SECSCommUtils/SECSCommUtils.csproj"], 21 | "exclude": [ "**/obj/**", "**/bin/**" ] 22 | } 23 | ], 24 | "dest": "api/SECSCommUtils", 25 | "disableGitFeatures": false, 26 | "disableDefaultFilter": false, 27 | "filter": "filterConfig.yml" 28 | }, 29 | { 30 | "src": [ 31 | { 32 | "src": "..", 33 | "files": ["TextFormatter/TextFormatter.csproj"], 34 | "exclude": [ "**/obj/**", "**/bin/**" ] 35 | } 36 | ], 37 | "dest": "api/TextFormatter", 38 | "disableGitFeatures": false, 39 | "disableDefaultFilter": false, 40 | "filter": "filterConfig.yml" 41 | } 42 | ], 43 | "build": { 44 | "content": [ 45 | { 46 | "files": [ 47 | "api/**.yml", 48 | "api/index.md" 49 | ] 50 | }, 51 | { 52 | "files": [ 53 | "api/SECSItems/**.yml", 54 | "api/SECSItems/index.md" 55 | ] 56 | }, 57 | { 58 | "files": [ 59 | "api/SECSCommUtils/**.yml", 60 | "api/SECSCommUtils/index.md" 61 | ] 62 | }, 63 | { 64 | "files": [ 65 | "api/TextFormatter/**.yml", 66 | "api/TextFormatter/index.md" 67 | ] 68 | }, 69 | { 70 | "files": [ 71 | "utilities/**.md", 72 | "utilities/**/toc.yml", 73 | "toc.yml", 74 | "*.md" 75 | ] 76 | }, 77 | { 78 | "files": [ 79 | "articles/**.md", 80 | "articles/**/toc.yml", 81 | "toc.yml", 82 | "*.md" 83 | ] 84 | } 85 | ], 86 | "resource": [ 87 | { 88 | "files": [ 89 | "images/**" 90 | ] 91 | } 92 | ], 93 | "overwrite": [ 94 | { 95 | "files": [ 96 | "apidoc/**.md" 97 | ], 98 | "exclude": [ 99 | "obj/**", 100 | "_site/**" 101 | ] 102 | } 103 | ], 104 | "dest": "../docs", 105 | "globalMetadataFiles": [], 106 | "fileMetadataFiles": [], 107 | "template": [ "default" ], 108 | "postProcessors": [], 109 | "markdownEngineName": "markdig", 110 | "noLangKeyword": false, 111 | "keepFileLink": false, 112 | "cleanupCacheHistory": false, 113 | "disableGitFeatures": false 114 | } 115 | } -------------------------------------------------------------------------------- /SECSSpy/SECSSpy.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {f4aaf2f1-eb93-4f43-8c9d-94a4f6d56e15} 5 | Exe 6 | com.CIMthetics.CSharpSECSTools.SECSSpy 7 | SECSSpy 8 | net6.0 9 | 10 10 | enable 11 | AnyCPU 12 | Debug 13 | Debug 14 | Release 15 | true 16 | false 17 | full 18 | none 19 | false 20 | true 21 | 0 22 | bin\Debug 23 | bin\Release 24 | 25 | 26 | 27 | {5FE19A00-496E-4142-A5FF-1814A6F273DD} 28 | SECSItems 29 | 30 | 31 | {4F722F74-D152-4671-B8DB-DD3E22CFFA78} 32 | SECSItems 33 | 34 | 35 | {80d87ae3-3f12-49c1-bf5d-0e037e8d47d6} 36 | SECSFormatter 37 | 38 | 39 | {7d95975e-064f-4a62-b546-48c2ecc2fca9} 40 | SECSStateMachines 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | PreserveNewest 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /DocFx/api/index.md: -------------------------------------------------------------------------------- 1 | # API Libraries Overview 2 | This page contains overview level information for the API libraries available 3 | in this project. For more specific and complete information please click on 4 | the section headers below. This will take you to the detailed documentation 5 | for each API. 6 | 7 | If you just want to see the documentation for the methods, properties, etc., 8 | that are available for a specific API click on the links to the left. 9 | 10 | ## [SECSItems](SECSItems/index.md) 11 | 12 | This API library allows a user to create and manipulate `SECSItem`s in the 13 | programming language of C#. A `SECSItem` is a base class for a collection 14 | of classes that represent individual SECS-II data items. Examples of these 15 | classes include `ASCIISECSItem`, `BinarySECSItem`, `U4SECSItem`, etc. 16 | 17 | Normally in the course of life SECS-II message are sent between communication 18 | endpoints in a binary or "transmission format". This 19 | "transmission format" while good for sending information between 20 | the endpoints is not conducive for easy retrieval / manipulation in a 21 | programming language without some form of helper API. This API was created 22 | to provide that help. 23 | 24 | ## [SECSCommUtils](SECSCommUtils/index.md) 25 | 26 | The ability to send and receive messages using the SECS-II protocol is a requirement for 27 | automating the shop floor of semiconductor manufacturing facilities. This API library provides 28 | objects that will allow the user to build "communication links" and to be able to 29 | send message to and receive messages from an endpoint of those links. 30 | 31 | ## [TextFormatter](TextFormatter/index.md) 32 | 33 | This API library allows a user to convert `SECSMessage`s, `SECSHeader`s, and 34 | `SECSItem`s into a `string` that is in either [SML](#sml-output) or [XML](#xml-output). 35 | The produced `string`(s) are suitable for output to a terminal and / or a file. 36 | 37 | The `SECSMessage` and `SECSHeader` classes are located in the 38 | [SECSCommUtils](#secscommutils) API library. The `SECSItem` classes are 39 | located in the [SECSItems](#secsitems) API library. 40 | 41 | A primary use for features provided by this API are to generate output 42 | for logging. 43 | 44 | ### SML Output 45 | 46 | SML, or **S**ECS **M**essage **L**anguage, is a somewhat compact display 47 | notation that many people who have been 48 | in the industry for a while will be familiar with. Humans can read SML 49 | fairly well. However, it can be a real pain to parse programmatically in 50 | cases where the contents of a log file need to be used as input to another 51 | program. i.e. Equipment or Host simulator scripts, data mining scripts, etc. 52 | 53 | For more information on SML see 54 | [SECS Message Language (SML)](https://www.peergroup.com/resources/secs-message-language/). 55 | 56 | ### XML Output 57 | 58 | XML(eXtensible Markup Language) was designed to be a language for the 59 | storage and transport of data. This API is able to produce output in 60 | this format. XML can be quite human readable and it is much easier 61 | to parse programmatically in the event that output in this format needs 62 | to be used as input to another program. i.e. Equipment or Host simulator 63 | scripts, data mining scripts, etc. 64 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | 23-Feb-2023 6 | 7 | ## Added 8 | 9 | More documentation. Primarily for `SECSSpy`. 10 | 11 | 22-Feb-2023 12 | 13 | ## Changed 14 | 15 | I modified `ListSECSItem` so that it now implements the `IList` interface. This 16 | will make working with it and its element much more natural in `C#`. 17 | 18 | As part of getting `SECSSpy` operational. I performed a number of changes to the 19 | `SECSCommUtils` API. It is not finished, but, it should be in good enough shape 20 | to experiment with...at least for communication using HSMS connections. 21 | 22 | I modified the `SMLFormatter` so that header logging options now include adding 23 | DisplayDeviceId, DisplaySystemBytes, and / or DisplayControlMessages. 24 | 25 | ## Added 26 | 27 | Added an `AsDictionary` method to `ListSECSItem`. This will return the list's 28 | contents as a `Dictionary`. The `SECSItem`s within the `Dictionary` that may 29 | be accessed via their "address" Refer to the documentation for more 30 | information. 31 | 32 | More documentation. 33 | 34 | The utility `SECSSpy` now works. It is not finished, but, it should be good enough 35 | to experiment with (and hopefully provide some feedback on). 36 | 37 | ## Fixed 38 | 39 | Some bugs. 40 | 41 | 8-Feb-2023 42 | 43 | For the most part just added documentation. The few minor changes I 44 | did make will not break anything. 45 | 46 | ## Fixed 47 | 48 | I fixed some display bugs in `SMLFormatter.cs`. Since the API library containing 49 | this file is not really released yet it should not create issues. 50 | 51 | 7-Feb-2023 52 | 53 | The short answer is I recommend you to stay with the Baseline(v1.0.0) 54 | for the moment. I have made some changes to the `SECSItems` API which 55 | will cause some rework. If you do change to the latest at this point 56 | you will have some rework, but, I am not expecting it to change too 57 | much more other than adding more documentation. 58 | 59 | ## Deprecated 60 | 61 | The `GetValue()` methods have been deprecated. Please use the property 62 | `Value` instead. 63 | 64 | The `GetSECSItemFormatCode()` methods have been deprecated. Please use 65 | the property `ItemFormatCode` instead. 66 | 67 | ## Changed 68 | 69 | `SECSItems` has been changed a bit and will cause some rework. 70 | 71 | `SECSItemTests` have changed to handle the rework to `SECSItems`. 72 | 73 | `SECSCommUtils` have changed a little due to functionality being 74 | filled in. 75 | 76 | ## Added 77 | 78 | `SECSSpy` application project. This is for logging and is not suitable 79 | for working with yet. 80 | 81 | `SECSTee` application project. 82 | 83 | `TextFormatter` API project. This is used by `SECSSpy` in order to 84 | generate text version of `SECSMessage`s, `SECSHeader`s, and`SECSItems` 85 | that are suitable for logging. It can produce output in SML and XML. 86 | 87 | A `DocFx` folder was added to contain the source for much of the documentation 88 | that is being generated. To generate the documentation as it currently exists 89 | `cd` to the `DocFx` folder and enter the following `docfx docfx.json`. This 90 | will create the documentation and place it in the `docs` folder. 91 | 92 | A `docs` folder has been added. It contains the documentation generated by 93 | `docfx`. 94 | 95 | -------------------------------------------------------------------------------- /docs/api/TextFormatter/toc.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |
6 | 7 | 8 | 9 |
10 |
11 |
12 |
13 | 14 | 53 |
54 |
55 |
56 |
-------------------------------------------------------------------------------- /SECSItems/SECSItemNumLengthBytes.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | using System; 17 | 18 | namespace com.CIMthetics.CSharpSECSTools.SECSItems 19 | { 20 | /// 21 | /// This class represents the valid values for the number of length bytes for a SECSItem. 22 | /// This needed to be implemented in this manner instead of an enum because C# will automatically 23 | /// cast an enum to an int when used as a method argument. This may cause the compiler 24 | /// to use the wrong method if the signatures will match because of this. 25 | /// 26 | public class SECSItemNumLengthBytes : IComparable 27 | { 28 | private int _value; 29 | private string _name; 30 | 31 | /// 32 | /// One length byte used. 33 | /// 34 | public static readonly SECSItemNumLengthBytes ONE = 35 | new SECSItemNumLengthBytes(1, "ONE"); 36 | 37 | /// 38 | /// Two length bytes used. 39 | /// 40 | public static readonly SECSItemNumLengthBytes TWO = 41 | new SECSItemNumLengthBytes(2, "TWO"); 42 | 43 | /// 44 | /// Three length bytes used. 45 | /// 46 | public static readonly SECSItemNumLengthBytes THREE = 47 | new SECSItemNumLengthBytes(3, "THREE"); 48 | 49 | /// 50 | /// This class instance has not been initialized yet. 51 | /// 52 | public static readonly SECSItemNumLengthBytes NOT_INITIALIZED = 53 | new SECSItemNumLengthBytes(-1, "NOT_INITIALIZED"); 54 | 55 | private SECSItemNumLengthBytes(int value, string name) 56 | { 57 | _value = value; 58 | _name = name; 59 | } 60 | 61 | /// 62 | /// Gets the value of this SECSItemNumLengthBytes. 63 | /// 64 | /// the value of the SECSItemNumLengthBytes. 65 | public int ValueOf () 66 | { 67 | return _value; 68 | } 69 | 70 | /// 71 | /// Gets the value of this SECSItemNumLengthBytes as a string. 72 | /// 73 | /// the value of the SECSItemNumLengthBytes as a string. 74 | public override string ToString () 75 | { 76 | return _name; 77 | } 78 | 79 | /// 80 | /// Compare two SECSItemNumLengthBytes objects to each other. 81 | /// 82 | /// The SECSItemNumLengthBytes that is to be compared with this one. 83 | /// 0 if the SECSItemNumLengthBytes items have the same value, -1 if this SECSItemNumLengthBytes 84 | /// is less than the one specified, and +1 if this SECSItemNumLengthBytes 85 | /// is greater than the one specified 86 | public int CompareTo (object obj) 87 | { 88 | return _value.CompareTo (((SECSItemNumLengthBytes)obj)._value); 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CSharpSECSTools 2 | 3 | **CSharpSECSTools** is a project for those that are working primarily in the realm of shop floor automation in the semiconductor industry. 4 | If you do not work in that industry or you are not familiar with the [SEMI Standards](www.semi.org/en/standards) 5 | **E4**, **E5**, **E30**, **E37**, el al, this project is probably not for you. 6 | 7 | This project provides some tools / API libraries that will help 8 | in writing software for equipment interfaces and / or equipment simulators. 9 | 10 | ## Get the code 11 | 12 | Use the `git clone` command to get the code. 13 | 14 | `git clone https://github.com/dkaip/CSharpSECSTools CSharpSECSTools` 15 | 16 | This will create a `CSharpSECSTools` directory in your current directory 17 | 18 | ## Building 19 | 20 | Currently, this project may be built using `dotnet` version 6.0.108. The unit tests are run using NUnit.3.13.3. I expect that any more recent NUnit (i.e. NUnit.3.13.3+) will work as well. 21 | 22 | `dotnet build --configuration Debug` may be used to build debug versions of the files. 23 | 24 | `dotnet build --configuration Release` may be used to build release versions of the files. 25 | 26 | `dotnet clean --configuration Debug` may be used to clean debug versions of the files. 27 | 28 | `dotnet clean --configuration Release` may be used to clean release versions of the files. 29 | 30 | `dotnet test --configuration Debug` may be used to run the unit tests on debug versions of the files. 31 | 32 | `dotnet test --configuration Release` may be used to run the unit tests on release versions of the files. 33 | 34 | `dotnet build` or `dotnet clean` or `dotnet test` will produce, clean, or test debug versions. 35 | 36 | ## Documentation 37 | 38 | Find the documentation WEB site here [CSharpSECSTools](https://dkaip.github.io/CSharpSECSTools). 39 | 40 | There is documentation in the source files 41 | so that IntelliSense capable editors/IDEs will be able to provide support for method completion, etc. 42 | In addition there is documentation in the `DocFx` folder. 43 | 44 | The documentation in this folder can be processed with `docfx` to produce a WEB site that will 45 | be generated in the `docs` folder. The command to do this is `docfx docfx.json` which should 46 | be executed within the `DocFx` folder. 47 | 48 | As stated the resulting output documentation will end up in the `docs` folder. Running the command 49 | `docfx serve` in the `docs` folder will serve the WEB site at localhost:8080 unless something 50 | else is already using that port. 51 | 52 | Please refer to the documentation available for DocFx for more information. 53 | 54 | ## Usage Notes 55 | 56 | At the moment the SECSItems and SECSItemTests should work properly. I have modified code 57 | in FixedBufferSimulatorConsole, SECSCommUtils, and EquipmentSimulatorSupportStuff so that 58 | the project should at least compile (with some warnings) until I have the time to implement 59 | and test those items. 60 | 61 | ## Miscellaneous 62 | 63 | This version of this repository should be functionally the same as the Baseline version. Since MonoDevelop seems to no longer be available for my platform I have switched to using Visual Studio Code for the editor and using the `dotnet` command from the command line. I have also done modifications so that the build environment is for .NET 6. As for code differences, I had to fix a couple of unit tests since `dotnet` seems to allow a little more precision for floating point numbers. I removed the visibility of some "internal" classes and methods that should not have been public. Some documentation was added as well. 64 | 65 | ## Contributing 66 | 67 | Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. 68 | 69 | ## License 70 | 71 | [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0) 72 | -------------------------------------------------------------------------------- /SECSSpy/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Serilog": 3 | { 4 | "Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ], 5 | "MinimumLevel": "Information", 6 | "WriteTo": 7 | [ 8 | { 9 | "Name": "Console", 10 | "Args": 11 | { 12 | "outputTemplate": "{Message}{NewLine}" 13 | } 14 | }, 15 | { "Name": "File", "Args": { "path": "SECSSpy/Logs/log.txt" } } 16 | ] 17 | }, 18 | "ConnectionPairs": 19 | [ 20 | { 21 | "ConnectionPair": 22 | [ 23 | { 24 | "SECSConnectionConfigInfo": 25 | { 26 | "Name": "TheHost", 27 | "Type" : "HSMS", 28 | "Address" : "titan", 29 | "AddressFamily" : "IPV4", 30 | "Port" : 50000, 31 | "ConnectionMode": "passive" 32 | } 33 | }, 34 | { 35 | "SECSConnectionConfigInfo": 36 | { 37 | "Name": "TheEquipment", 38 | "Type" : "HSMS", 39 | "Address" : "titan.home.arpa", 40 | "AddressFamily" : "IPV4", 41 | "Port" : 50001, 42 | "ConnectionMode": "active" 43 | } 44 | } 45 | ] 46 | }, 47 | { 48 | "ConnectionPair": 49 | [ 50 | { 51 | "SECSConnectionConfigInfo": 52 | { 53 | "Name": "TheHost2", 54 | "Type" : "HSMS", 55 | "Address" : "titan", 56 | "AddressFamily" : "IPV4", 57 | "Port" : 50002, 58 | "ConnectionMode": "passive" 59 | } 60 | }, 61 | { 62 | "SECSConnectionConfigInfo": 63 | { 64 | "Name": "TheEquipmen2", 65 | "Type" : "HSMS", 66 | "Address" : "titan.home.arpa", 67 | "AddressFamily" : "IPV4", 68 | "Port" : 50003, 69 | "ConnectionMode": "active" 70 | } 71 | } 72 | ] 73 | } 74 | ], 75 | "TextFormatterConfig": 76 | { 77 | "AddTimestamp": true, 78 | "TimestampFormat": "yyyy-MM-ddTHH:mm:ss.fff", 79 | "AddDirection": true, 80 | "IndentAmount": 2, 81 | "MaxIndentionSpaces": 50, 82 | "LoggingOutputFormat": "SML", 83 | "XMLOutputConfig": 84 | { 85 | "HeaderOutputConfig": 86 | { 87 | "DisplayAsElementsOrAttributes": "Attributes", 88 | "DisplayMessageIdAsSxFy": false, 89 | "DisplayDeviceId": true, 90 | "DisplaySystemBytes": true, 91 | "DisplayWBit": true, 92 | "DisplayControlMessages": true 93 | }, 94 | "BodyOutputConfig": 95 | { 96 | "DisplayAsElementsOrAttributes": "Attributes", 97 | "DisplayNumberOfLengthBytes": false, 98 | "DisplayLengthByteValue": false, 99 | "MaxOutputLineLength": 80 100 | } 101 | }, 102 | "SMLOutputConfig": 103 | { 104 | "HeaderOutputConfig": 105 | { 106 | "DisplayWBit": true, 107 | "DisplayDeviceId": false, 108 | "DisplaySystemBytes": false, 109 | "DisplayControlMessages": true 110 | }, 111 | "BodyOutputConfig": 112 | { 113 | "DisplayCount": true, 114 | "MaxOutputLineLength": 80 115 | } 116 | } 117 | } 118 | } -------------------------------------------------------------------------------- /docs/articles/intro.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Add your introductions here! 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |
25 | 26 | 49 | 50 | 57 |
58 | 88 | 89 |
90 |
91 | 100 |
101 |
102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /SECSCommUtils/SECSConnectionConfigInfo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #nullable enable 18 | 19 | namespace com.CIMthetics.CSharpSECSTools.SECSCommUtils 20 | { 21 | public class SECSConnectionConfigInfo 22 | { 23 | public UInt32 T1 { get; set; } = ConnectionDefaults.T1; 24 | public UInt32 T2 { get; set; } = ConnectionDefaults.T2; 25 | public UInt32 T3 { get; set; } = ConnectionDefaults.T3; 26 | public UInt32 T4 { get; set; } = ConnectionDefaults.T4; 27 | public UInt32 T5 { get; set; } = ConnectionDefaults.T5; 28 | public UInt32 T6 { get; set; } = ConnectionDefaults.T6; 29 | public UInt32 T7 { get; set; } = ConnectionDefaults.T7; 30 | public UInt32 T8 { get; set; } = ConnectionDefaults.T8; 31 | 32 | public UInt32 RetryCount { get; set; } = ConnectionDefaults.RetryCount; 33 | 34 | public UInt16 Port { get; set; } = ConnectionDefaults.Port; 35 | public string TTYPort { get; set; } = ""; 36 | 37 | public UInt32 BaudRate = ConnectionDefaults.BaudRate; 38 | public byte Bits = ConnectionDefaults.Bits; 39 | public byte StopBits = ConnectionDefaults.StopBits; 40 | public string Parity = ConnectionDefaults.Parity; 41 | 42 | public string Name { get; set; } = "Not Set"; 43 | private SECSConnectionType ConnectionType = SECSConnectionType.HSMS; 44 | public string Type 45 | { 46 | get 47 | { 48 | return ConnectionType.ToString(); 49 | } 50 | set 51 | { 52 | if (string.Compare(value, "HSMS", true) == 0) 53 | { 54 | ConnectionType = SECSConnectionType.HSMS; 55 | } 56 | else if (string.Compare(value, "SECSI", true) == 0) 57 | { 58 | ConnectionType = SECSConnectionType.SECSI; 59 | } 60 | else 61 | { 62 | throw new ArgumentException("The connection Type may only have a value of either \"HSMS\" or \"SECSI\""); 63 | } 64 | } 65 | } 66 | 67 | public string Address { get; set; } = "Not Set"; 68 | 69 | private string _addressFamily = "IPV4"; 70 | public string AddressFamily 71 | { 72 | get 73 | { 74 | return _addressFamily; 75 | } 76 | set 77 | { 78 | if (string.Compare(value, "IPV4", true) == 0) 79 | { 80 | _addressFamily = "IPV4"; 81 | } 82 | else if (string.Compare(value, "IPV6", true) == 0) 83 | { 84 | _addressFamily = "IPV6"; 85 | } 86 | else 87 | { 88 | throw new ArgumentException("The Address Family may only have a value of either \"IPV4\" or \"IPV6\""); 89 | } 90 | } 91 | } 92 | 93 | 94 | public HSMSConnectionMode HSMSConnectionMode = HSMSConnectionMode.Active; 95 | public string ConnectionMode 96 | { 97 | get 98 | { 99 | return HSMSConnectionMode.ToString(); 100 | } 101 | set 102 | { 103 | if (string.Compare(value, "active", true) == 0) 104 | { 105 | HSMSConnectionMode = HSMSConnectionMode.Active; 106 | } 107 | else if (string.Compare(value, "passive", true) == 0) 108 | { 109 | HSMSConnectionMode = HSMSConnectionMode.Passive; 110 | } 111 | else 112 | { 113 | throw new ArgumentException("The Connection Mode may only have a value of either \"active\" or \"passive\""); 114 | } 115 | } 116 | } 117 | 118 | public override string ToString() 119 | { 120 | return ConnectionMode; 121 | } 122 | } 123 | } -------------------------------------------------------------------------------- /SECSTee/SECSMessageProcessor.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governingprivate permissions and 14 | * limitations under the License. 15 | */ 16 | using Serilog; 17 | using System.Collections.Concurrent; 18 | 19 | namespace com.CIMthetics.CSharpSECSTools.SECSCommUtils 20 | { 21 | /// 22 | /// This class' purpose is simple. It takes SECSMessages received 23 | /// from the source connection and causes them to be sent via the destination 24 | /// connection. 25 | /// 26 | /// 27 | /// This class is intended to run as an independent Thread. Following 28 | /// is a code snippet showing its use. 29 | /// 30 | /// CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); 31 | /// CancellationToken cancellationToken = cancellationTokenSource.Token; 32 | /// 33 | /// SECSMessageProcessor connection1ToConnection2 = 34 | /// new SECSMessageProcessor("Connection1", 35 | /// "Connection2", 36 | /// ReceivedMessagesQueue, 37 | /// MessagesToSendQueue, 38 | /// cancellationToken); 39 | /// 40 | /// Thread cp1Thread = new Thread(connection1ToConnection2.Run); 41 | /// 42 | /// cp1Thread.Start(); 43 | /// 44 | /// // Terminate cp1Thread 45 | /// cancellationTokenSource.Cancel(); 46 | /// 47 | /// 48 | /// 49 | internal class SECSMessageProcessor 50 | { 51 | private string _sourceName; 52 | private string _destinationName; 53 | private BlockingCollection _inboundQueue; 54 | private BlockingCollection _outboundQueue; 55 | 56 | private CancellationToken _cancellationToken; 57 | 58 | /// 59 | /// The constructor for an instance of this class. 60 | /// a name for the source connection for logging purposes 61 | /// a name for the destination connection for logging purposes 62 | /// a queue associated with the source connection that will be waited upon for messages that should be forwarded to the outboundMessageQueue> 63 | /// a queue associated with the destination connection where the messages from the inboundMessageQueue will be placed 64 | /// a CancellationToken that may be used to shut 65 | /// 66 | internal SECSMessageProcessor(string sourceName, 67 | string destinationName, 68 | BlockingCollection inboundMessageQueue, 69 | BlockingCollection outboundMessageQueue, 70 | CancellationToken cancellationToken) 71 | { 72 | _sourceName = sourceName; 73 | _destinationName = destinationName; 74 | _inboundQueue = inboundMessageQueue; 75 | _outboundQueue = outboundMessageQueue; 76 | _cancellationToken = cancellationToken; 77 | } 78 | 79 | internal void Run() 80 | { 81 | Log.Debug("SECS message processor {0} to {1} started", _sourceName, _destinationName); 82 | 83 | while(true) 84 | { 85 | try 86 | { 87 | SECSMessage secsMessage = _inboundQueue.Take(_cancellationToken); 88 | Log.Verbose("SECS message processor {0} to {1} received a message", _sourceName, _destinationName); 89 | _outboundQueue.Add(secsMessage); 90 | Log.Verbose("SECS message processor {0} to {1} forwarded a message", _sourceName, _destinationName); 91 | } 92 | catch(OperationCanceledException) 93 | { 94 | Log.Verbose("SECS message processor {0} to {1} cancelled", _sourceName, _destinationName); 95 | break; 96 | } 97 | } 98 | 99 | Log.Debug("SECS message processor {0} to {1} terminating", _sourceName, _destinationName); 100 | } 101 | } 102 | } -------------------------------------------------------------------------------- /docs/utilities/intro.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Introduction 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |
25 | 26 | 49 | 50 | 57 |
58 | 91 | 92 |
93 |
94 | 103 |
104 |
105 | 106 | 107 | 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /SECSCommUtils/ConnectionDefaults.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2023 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | namespace com.CIMthetics.CSharpSECSTools.SECSCommUtils 18 | { 19 | /// 20 | /// This class provides default values for various parameters related to 21 | /// SECS-I and HSMS connections. 22 | /// 23 | public class ConnectionDefaults 24 | { 25 | /// 26 | /// Inter-Character Timeout 27 | /// 28 | /// 29 | /// The Inter-Character timeout in milliseconds. 30 | /// 31 | /// 32 | ///
    33 | ///
  • Default: 0.5 seconds (500 milliseconds)
  • 34 | ///
  • Range: 0.1 - 10.0 seconds
  • 35 | ///
  • Resolution: 0.1 second (100 milliseconds)
  • 36 | ///
37 | ///
38 | public const UInt32 T1 = 500; 39 | 40 | /// 41 | /// Protocol Timeout 42 | /// 43 | /// 44 | /// The Protocol timeout in milliseconds. 45 | /// 46 | /// 47 | ///
    48 | ///
  • Default: 10 seconds (10000 milliseconds)
  • 49 | ///
  • Range: 0.2 - 25.0 seconds
  • 50 | ///
  • Resolution: 0.2 second (200 milliseconds)
  • 51 | ///
52 | ///
53 | public const UInt32 T2 = 10000; 54 | 55 | /// 56 | /// Transaction Reply Timeout 57 | /// 58 | /// 59 | /// The transaction reply timeout in seconds. 60 | /// 61 | /// 62 | ///
    63 | ///
  • Default: 45 seconds
  • 64 | ///
  • Range: 1 - 120 seconds
  • 65 | ///
  • Resolution: 1 second
  • 66 | ///
67 | ///
68 | public const UInt32 T3 = 45; 69 | 70 | /// 71 | /// Inter-Block Timeout 72 | /// 73 | /// 74 | /// The Inter-Block timeout in seconds. 75 | /// 76 | /// 77 | ///
    78 | ///
  • Default: 45 seconds
  • 79 | ///
  • Range: 1 - 120 seconds
  • 80 | ///
  • Resolution: 1 second
  • 81 | ///
82 | ///
83 | public const UInt32 T4 = 45; 84 | 85 | /// 86 | /// Connection Separation Timeout 87 | /// 88 | /// 89 | /// The Connection Separation timeout in seconds. 90 | /// 91 | /// 92 | ///
    93 | ///
  • Default: 10 seconds
  • 94 | ///
  • Range: 1 - 240 seconds
  • 95 | ///
  • Resolution: 1 second
  • 96 | ///
97 | ///
98 | public const UInt32 T5 = 10; 99 | 100 | /// 101 | /// Control Transaction Timeout 102 | /// 103 | /// 104 | /// The Control Transaction timeout in seconds. 105 | /// 106 | /// 107 | ///
    108 | ///
  • Default: 5 seconds
  • 109 | ///
  • Range: 1 - 240 seconds
  • 110 | ///
  • Resolution: 1 second
  • 111 | ///
112 | ///
113 | public const UInt32 T6 = 5; 114 | 115 | /// 116 | /// NOT SELECTED Timeout 117 | /// 118 | /// 119 | /// The NOT SELECTED timeout in seconds. 120 | /// 121 | /// 122 | ///
    123 | ///
  • Default: 10 seconds
  • 124 | ///
  • Range: 1 - 240 seconds
  • 125 | ///
  • Resolution: 1 second
  • 126 | ///
127 | ///
128 | public const UInt32 T7 = 10; 129 | 130 | /// 131 | /// Network Inter-Character Timeout 132 | /// 133 | /// 134 | /// The Network Inter-Character timeout in seconds. 135 | /// 136 | /// 137 | ///
    138 | ///
  • Default: 5 seconds
  • 139 | ///
  • Range: 1 - 120 seconds
  • 140 | ///
  • Resolution: 1 second
  • 141 | ///
142 | ///
143 | public const UInt32 T8 = 5; 144 | 145 | public const UInt32 RetryCount = 3; 146 | 147 | public const UInt16 Port = 5000; 148 | 149 | public const UInt32 BaudRate = 19200; 150 | public const byte Bits = 8; 151 | public const byte StopBits = 1; 152 | public const string Parity = "none"; 153 | } 154 | 155 | } 156 | 157 | -------------------------------------------------------------------------------- /SECSItems/SECSItemFormatCode.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | using System; 17 | 18 | namespace com.CIMthetics.CSharpSECSTools.SECSItems 19 | { 20 | /// 21 | /// This enum contains the valid values for the format code of a SECSItem. 22 | /// 23 | public enum SECSItemFormatCode 24 | { 25 | /* 26 | * Don't change this list without performing the appropriate 27 | * corrections in the RawSECSItemFormatCodeSingleton Class. 28 | */ 29 | /// 30 | /// List 31 | /// 32 | L, 33 | /// 34 | /// Binary 35 | /// 36 | B, 37 | /// 38 | /// Boolean 39 | /// 40 | BO, 41 | /// 42 | /// ASCII 43 | /// 44 | A, 45 | /// 46 | /// JIS-8 - Japanese Industrial Standard 8 47 | /// 48 | J8, 49 | /// 50 | /// 2 Byte Character format 51 | /// 52 | C2, 53 | /// 54 | /// 8 Byte Signed Integer 55 | /// 56 | I8, 57 | /// 58 | /// 1 Byte Signed Integer 59 | /// 60 | I1, 61 | /// 62 | /// 2 Byte Signed Integer 63 | /// 64 | I2, 65 | /// 66 | /// 4 Byte Signed Integer 67 | /// 68 | I4, 69 | /// 70 | /// 8 Byte Floating Point 71 | /// 72 | F8, 73 | /// 74 | /// 4 Byte Floating Point 75 | /// 76 | F4, 77 | /// 78 | /// 8 Byte Unsigned Integer 79 | /// 80 | U8, 81 | /// 82 | /// 1 Byte Unsigned Integer 83 | /// 84 | U1, 85 | /// 86 | /// 2 Byte Unsigned Integer 87 | /// 88 | U2, 89 | /// 90 | /// 4 Byte Unsigned Integer 91 | /// 92 | U4, 93 | /// 94 | /// UNDEFINED - not typically used by the developer. 95 | /// 96 | UNDEFINED, 97 | /// 98 | /// HeaderOnly - not typically used by the developer 99 | /// 100 | HeaderOnly 101 | } 102 | 103 | /// 104 | /// A class containing a couple of helper methods useful when converting a 105 | /// SECSItem's format code to and from "wire / transmission" format. 106 | /// 107 | public static class SECSItemFormatCodeFunctions 108 | { 109 | /// 110 | /// This method is typically only used the retrieve the proper numeric value 111 | /// of an Item Format Code during the conversion of a SECSItem into its 112 | /// "wire/transmission format". 113 | /// 114 | /// The number value of the specified SECSItemFormatCode. 115 | /// Item format code. 116 | public static int GetNumberFromSECSItemFormatCode(SECSItemFormatCode formatCode) 117 | { 118 | return RawSECSItemFormatCode.mapFormatCodeToNumber(formatCode); 119 | } 120 | 121 | /// 122 | /// This method is typically only used when converting an Item Format Code 123 | /// from its "wire/transmission format" into the format used 124 | /// (a type of SECSItem) in the C# environment. 125 | /// 126 | /// The SECSI tem format code from number. 127 | /// Number. 128 | public static SECSItemFormatCode GetSECSItemFormatCodeFromNumber(byte number) 129 | { 130 | return RawSECSItemFormatCode.mapNumberToFormatCode(number); 131 | } 132 | } 133 | } 134 | 135 | -------------------------------------------------------------------------------- /SECSSpy/MessageProcessor.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing private permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | using Serilog; 18 | 19 | using System.Collections.Concurrent; 20 | 21 | using com.CIMthetics.CSharpSECSTools.TextFormatter; 22 | 23 | namespace com.CIMthetics.CSharpSECSTools.SECSCommUtils 24 | { 25 | /// 26 | /// This class' purpose is simple. It takes SECSMessages received 27 | /// from the source connection and causes them to be sent via the destination 28 | /// connection. 29 | /// 30 | /// 31 | /// This class is intended to run as an independent Thread. Following 32 | /// is a code snippet showing its use. 33 | /// 34 | /// CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); 35 | /// CancellationToken cancellationToken = cancellationTokenSource.Token; 36 | /// 37 | /// MessageProcessor connection1ToConnection2 = 38 | /// new MessageProcessor("Connection1", 39 | /// "Connection2", 40 | /// ReceivedMessagesQueue, 41 | /// MessagesToSendQueue, 42 | /// cancellationToken); 43 | /// 44 | /// Thread cp1Thread = new Thread(connection1ToConnection2.Run); 45 | /// 46 | /// cp1Thread.Start(); 47 | /// 48 | /// // Terminate cp1Thread 49 | /// cancellationTokenSource.Cancel(); 50 | /// 51 | /// 52 | /// 53 | internal class MessageProcessor 54 | { 55 | private string _sourceName; 56 | private string _destinationName; 57 | private BlockingCollection _inboundQueue; 58 | private BlockingCollection _outboundQueue; 59 | 60 | private CancellationToken _cancellationToken; 61 | private SECSFormatter _secsFormatter; 62 | 63 | /// 64 | /// The constructor for an instance of this class. 65 | /// a name for the source connection for logging purposes 66 | /// a name for the destination connection for logging purposes 67 | /// a queue associated with the source connection that will be waited upon for messages that should be forwarded to the outboundMessageQueue> 68 | /// a queue associated with the destination connection where the messages from the inboundMessageQueue will be placed 69 | /// a CancellationToken that may be used to shut 70 | /// 71 | internal MessageProcessor(string sourceName, 72 | string destinationName, 73 | BlockingCollection inboundMessageQueue, 74 | BlockingCollection outboundMessageQueue, 75 | CancellationToken cancellationToken, 76 | SECSFormatter secsFormatter) 77 | { 78 | _sourceName = sourceName; 79 | _destinationName = destinationName; 80 | _inboundQueue = inboundMessageQueue; 81 | _outboundQueue = outboundMessageQueue; 82 | _cancellationToken = cancellationToken; 83 | _secsFormatter = secsFormatter; 84 | } 85 | 86 | internal void Run() 87 | { 88 | Log.Debug("Message processor {0}->{1} started", _sourceName, _destinationName); 89 | 90 | while(true) 91 | { 92 | try 93 | { 94 | SECSMessage secsMessage = _inboundQueue.Take(_cancellationToken); 95 | Log.Verbose("Message processor {0}->{1} received a message", _sourceName, _destinationName); 96 | _outboundQueue.Add(secsMessage); 97 | Log.Verbose("Message processor {0}->{1} forwarded a message", _sourceName, _destinationName); 98 | 99 | Log.Information(_secsFormatter.GetSECSMessageAsText(_sourceName, _destinationName, secsMessage)); 100 | Log.Information(""); 101 | } 102 | catch(OperationCanceledException) 103 | { 104 | Log.Verbose("Message processor {0}->{1} cancelled", _sourceName, _destinationName); 105 | break; 106 | } 107 | } 108 | 109 | Log.Debug("Message processor {0}->{1} terminating", _sourceName, _destinationName); 110 | } 111 | } 112 | } -------------------------------------------------------------------------------- /docs/api/SECSCommUtils/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | SECSCommUtils 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |
25 | 26 | 49 | 50 | 57 |
58 | 95 | 96 |
97 |
98 | 107 |
108 |
109 | 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | CSharpSECSTools 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |
25 | 26 | 49 | 50 | 57 |
58 | 88 | 89 |
90 |
91 | 100 |
101 |
102 | 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /docs/api/SECSCommUtils/toc.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |
6 | 7 | 8 | 9 |
10 |
11 |
12 |
13 | 14 | 74 |
75 |
76 |
77 |
-------------------------------------------------------------------------------- /docs/utilities/SECSTee.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | SECSTee 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |
25 | 26 | 49 | 50 | 57 |
58 | 91 | 92 |
93 |
94 | 103 |
104 |
105 | 106 | 107 | 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /SECSCommUtilsTests/HSMSHeaderTests.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | using NUnit.Framework; 17 | 18 | namespace com.CIMthetics.CSharpSECSTools.SECSCommUtils 19 | { 20 | [TestFixture()] 21 | public class HSMSHeaderTests 22 | { 23 | [Test()] 24 | public void Test01() 25 | { 26 | HSMSHeader hsmsHeader = new HSMSHeader(); 27 | Assert.IsTrue(hsmsHeader.SessionID == 0); 28 | Assert.IsTrue(hsmsHeader.HeaderByte2 == 0); 29 | Assert.IsTrue(hsmsHeader.HeaderByte3 == 0); 30 | Assert.IsTrue(hsmsHeader.PType == 0); 31 | Assert.IsTrue(hsmsHeader.SType == 0); 32 | Assert.IsTrue(hsmsHeader.SystemBytes == 0); 33 | } 34 | 35 | [Test()] 36 | public void Test02() 37 | { 38 | HSMSHeader hsmsHeader = new HSMSHeader(); 39 | hsmsHeader.SessionID = UInt16.MaxValue; 40 | hsmsHeader.HeaderByte2 = byte.MaxValue; 41 | hsmsHeader.HeaderByte3 = byte.MaxValue; 42 | hsmsHeader.PType = PTypeValues.ReservedNotUsed255; 43 | hsmsHeader.SType = STypeValues.ReservedNotUsed255; 44 | hsmsHeader.SystemBytes = UInt32.MaxValue; 45 | 46 | Assert.IsTrue(hsmsHeader.SessionID == UInt16.MaxValue); 47 | Assert.IsTrue(hsmsHeader.HeaderByte2 == byte.MaxValue); 48 | Assert.IsTrue(hsmsHeader.HeaderByte3 == byte.MaxValue); 49 | Assert.IsTrue(hsmsHeader.PType == PTypeValues.ReservedNotUsed255); 50 | Assert.IsTrue(hsmsHeader.SType == STypeValues.ReservedNotUsed255); 51 | Assert.IsTrue(hsmsHeader.SystemBytes == UInt32.MaxValue); 52 | } 53 | 54 | [Test()] 55 | public void Test03() 56 | { 57 | HSMSHeader hsmsHeader = new HSMSHeader(); 58 | Assert.IsTrue(hsmsHeader.Wbit == false); 59 | Assert.IsTrue(hsmsHeader.Stream == 0); 60 | Assert.IsTrue(hsmsHeader.Function == 0); 61 | } 62 | 63 | [Test()] 64 | public void Test04() 65 | { 66 | var exception = Assert.Catch(() => new HSMSHeader((HSMSHeader)null)); 67 | 68 | Assert.IsInstanceOf(exception); 69 | 70 | Assert.IsTrue(exception.Message.Contains ("Argument \"header\" may not be null.")); 71 | } 72 | 73 | [Test()] 74 | public void Test05() 75 | { 76 | var exception = Assert.Catch(() => new HSMSHeader((SECSIHeader)null)); 77 | 78 | Assert.IsInstanceOf(exception); 79 | 80 | Assert.IsTrue(exception.Message.Contains ("Argument \"header\" may not be null.")); 81 | } 82 | 83 | [Test()] 84 | public void Test100() 85 | { 86 | var exception = Assert.Catch(() => new HSMSHeader((byte[])null)); 87 | 88 | Assert.IsInstanceOf(exception); 89 | 90 | Assert.IsTrue(exception.Message.Contains ("Argument \"header\" may not be null.")); 91 | } 92 | 93 | [Test()] 94 | public void Test101() 95 | { 96 | byte[] input = new byte[9]; 97 | 98 | var exception = Assert.Catch(() => new HSMSHeader(input)); 99 | 100 | Assert.IsInstanceOf(exception); 101 | 102 | Assert.IsTrue(exception.Message.Contains ("The length of argument \"header\" must be >= 10.")); 103 | } 104 | 105 | [Test()] 106 | public void Test102() 107 | { 108 | byte[] input = new byte[10] { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}; 109 | HSMSHeader hsmsHeader = new HSMSHeader(input); 110 | 111 | Assert.IsTrue(hsmsHeader.SessionID == UInt16.MaxValue); 112 | Assert.IsTrue(hsmsHeader.HeaderByte2 == byte.MaxValue); 113 | Assert.IsTrue(hsmsHeader.HeaderByte3 == byte.MaxValue); 114 | Assert.IsTrue(hsmsHeader.PType == PTypeValues.ReservedNotUsed255); 115 | Assert.IsTrue(hsmsHeader.SType == STypeValues.ReservedNotUsed255); 116 | Assert.IsTrue(hsmsHeader.SystemBytes == UInt32.MaxValue); 117 | } 118 | 119 | [Test()] 120 | public void Test103() 121 | { 122 | byte[] input = new byte[10] { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}; 123 | 124 | HSMSHeader hsmsHeader = new HSMSHeader(input); 125 | 126 | byte[] output = hsmsHeader.EncodeForTransport(); 127 | 128 | Assert.AreEqual(input, output); 129 | } 130 | 131 | [Test()] 132 | public void Test104() 133 | { 134 | byte[] input = new byte[10] { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}; 135 | HSMSHeader hsmsHeader = new HSMSHeader(input); 136 | 137 | Assert.IsTrue(hsmsHeader.Wbit == true); 138 | Assert.IsTrue(hsmsHeader.Stream == 127); 139 | Assert.IsTrue(hsmsHeader.Function == byte.MaxValue); 140 | } 141 | 142 | } 143 | } 144 | 145 | -------------------------------------------------------------------------------- /docs/api/SECSCommUtils/com.CIMthetics.CSharpSECSTools.SECSCommUtils.TCPState.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Enum TCPState 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 |
27 | 28 | 51 | 52 | 59 |
60 | 120 | 121 |
122 |
123 | 132 |
133 |
134 | 135 | 136 | 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /docs/api/TextFormatter/com.CIMthetics.CSharpSECSTools.TextFormatter.DisplayAsType.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Enum DisplayAsType 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 |
27 | 28 | 51 | 52 | 59 |
60 | 120 | 121 |
122 |
123 | 132 |
133 |
134 | 135 | 136 | 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /SECSCommUtils/SECS1/SECSIConnection.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019-2022 Douglas Kaip 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | using Serilog; 18 | 19 | using System.Collections.Concurrent; 20 | 21 | namespace com.CIMthetics.CSharpSECSTools.SECSCommUtils 22 | { 23 | /// 24 | /// This class implements a SECSConnection that uses SECS-I for 25 | /// its transport layer. 26 | /// 27 | public class SECSIConnection : SECSConnection 28 | { 29 | /// 30 | /// Inter-Character Timeout 31 | /// 32 | /// 33 | /// The Inter-Character timeout in milliseconds. 34 | /// 35 | /// 36 | ///
    37 | ///
  • Default: 0.5 seconds (500 milliseconds)
  • 38 | ///
  • Range: 0.1 - 10.0 seconds
  • 39 | ///
  • Resolution: 0.1 second (100 milliseconds)
  • 40 | ///
41 | ///
42 | public new UInt32 T1 43 | { 44 | get 45 | { 46 | return base.T1; 47 | } 48 | set 49 | { 50 | if (value < 100) 51 | base.T1 = 100; 52 | else if (value > 10000) 53 | base.T1 = 10000; 54 | else 55 | { 56 | // Strip off anything less that 0.1 seconds 57 | UInt32 temp = value/100; 58 | temp *= 100; 59 | base.T1 = temp; 60 | } 61 | } 62 | } 63 | 64 | /// 65 | /// Protocol Timeout 66 | /// 67 | /// 68 | /// The Protocol timeout in milliseconds. 69 | /// 70 | /// 71 | ///
    72 | ///
  • Default: 10 seconds (10000 milliseconds)
  • 73 | ///
  • Range: 0.2 - 25.0 seconds
  • 74 | ///
  • Resolution: 0.1 second (100 milliseconds)
  • 75 | ///
76 | ///
77 | public new UInt32 T2 78 | { 79 | get 80 | { 81 | return base.T2; 82 | } 83 | set 84 | { 85 | if (value < 100) 86 | base.T2 = 100; 87 | else if (value > 25000) 88 | base.T2 = 25000; 89 | else 90 | { 91 | // Strip off anything less that 0.1 seconds 92 | UInt32 temp = value/100; 93 | temp *= 100; 94 | base.T2 = temp; 95 | } 96 | } 97 | } 98 | 99 | /// 100 | /// Transaction Reply Timeout 101 | /// 102 | /// 103 | /// The transaction reply timeout in seconds. 104 | /// 105 | /// 106 | ///
    107 | ///
  • Default: 45 seconds
  • 108 | ///
  • Range: 1 - 120 seconds
  • 109 | ///
  • Resolution: 1 second
  • 110 | ///
111 | ///
112 | public new UInt32 T3 113 | { 114 | get 115 | { 116 | return base.T3; 117 | } 118 | set 119 | { 120 | if (value < 1) 121 | base.T3 = 1; 122 | else if (value > 120) 123 | base.T3 = 120; 124 | else 125 | base.T3 = value; 126 | } 127 | } 128 | 129 | /// 130 | /// Inter-Block Timeout 131 | /// 132 | /// 133 | /// The Inter-Block timeout in seconds. 134 | /// 135 | /// 136 | ///
    137 | ///
  • Default: 45 seconds
  • 138 | ///
  • Range: 1 - 120 seconds
  • 139 | ///
  • Resolution: 1 second
  • 140 | ///
141 | ///
142 | public new UInt32 T4 143 | { 144 | get 145 | { 146 | return base.T4; 147 | } 148 | set 149 | { 150 | if (value < 1) 151 | base.T4 = 1; 152 | else if (value > 120) 153 | base.T4 = 120; 154 | else 155 | base.T4 = value; 156 | } 157 | } 158 | 159 | public uint RetryCount { get; set; } 160 | public bool Master { get; set; } 161 | public string TTYPort { get; set; } 162 | 163 | /// 164 | /// Create an connection object that will use SECS-I as its transport layer. 165 | /// 166 | /// 167 | /// Use this form of the constructor in the event that the required configuration 168 | /// information is contained in a SECSConnectionConfigInfo object. 169 | /// 170 | public SECSIConnection(SECSConnectionConfigInfo configuration) : base(configuration.Name) { } 171 | 172 | public SECSIConnection(string ConnectionName, string TTYPort, bool Master) : base(ConnectionName) 173 | { 174 | T1 = ConnectionDefaults.T1; 175 | T2 = ConnectionDefaults.T2; 176 | T3 = ConnectionDefaults.T3; 177 | T4 = ConnectionDefaults.T4; 178 | RetryCount = ConnectionDefaults.RetryCount; 179 | 180 | this.TTYPort = TTYPort; 181 | this.Master = Master; 182 | 183 | } 184 | 185 | override public void Start() 186 | { 187 | Log.Verbose("connection \"{0}\" starting supervisor", ConnectionName); 188 | 189 | SupervisorThread = new Thread(Supervisor); 190 | SupervisorThread.Name = ConnectionName + ":Supervisor"; 191 | SupervisorThread.Start(); 192 | } 193 | 194 | override public void Stop() 195 | { 196 | Log.Error("Not implemented yet."); 197 | } 198 | 199 | override internal void Supervisor() 200 | { 201 | Log.Error("Not implemented yet."); 202 | } 203 | 204 | override internal void ConnectionReader() 205 | { 206 | // Log.Debug("thread {0} started", Thread.CurrentThread.Name); 207 | Log.Error("Not implemented yet."); 208 | } 209 | 210 | override internal void ConnectionWriter() 211 | { 212 | // Log.Debug("thread {0} started", Thread.CurrentThread.Name); 213 | Log.Error("Not implemented yet."); 214 | } 215 | } // End class SECSIConnection 216 | 217 | } // End namespace CIMthetics.SECSUtilities 218 | -------------------------------------------------------------------------------- /docs/api/SECSCommUtils/com.CIMthetics.CSharpSECSTools.SECSCommUtils.TransientMessageStatus.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Enum TransientMessageStatus 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 |
27 | 28 | 51 | 52 | 59 |
60 | 120 | 121 |
122 |
123 | 132 |
133 |
134 | 135 | 136 | 137 | 138 | 139 | 140 | --------------------------------------------------------------------------------