├── .dockerignore ├── .github ├── dependabot.yml └── workflows │ ├── codeql-analysis.yml │ ├── docker-image.yml │ └── dotnet.yml ├── .gitignore ├── .gitmodules ├── BuildEngineeringUnits.bat ├── BuildStandardTypes.bat ├── CompileNodeSets.bat ├── Dockerfile ├── ModelCompiler Solution Debug.sln ├── ModelCompiler Solution.sln ├── NuGet.config ├── Opc.Ua.ModelCompiler ├── BaseSchemaExporter.cs ├── BuildSchema.bat ├── CSVs │ ├── AggregateExamples.csv │ ├── Attributes.csv │ ├── DemoModel.csv │ ├── OpcUaAdiModel.csv │ ├── OpcUaDiModel.csv │ ├── OpcUaGdsModel.csv │ ├── OpcUaOnboardingModel.csv │ ├── OpcUaPLCopenModel.csv │ ├── OpcUaSchedulerModel.csv │ ├── SercosModel.csv │ ├── ServerCapabilities.csv │ ├── StandardTypes.csv │ ├── Status Codes.csv │ ├── TestModel.csv │ ├── UNECE_to_OPCUA.csv │ ├── WotConnection.csv │ ├── rec20_Rev17e-2021.xlsx │ ├── rec20_latest_a1.csv │ └── rec20_latest_a2-3.csv ├── Design.v103 │ ├── BuiltInTypes.xml │ ├── OpcUaAdiModel.xml │ ├── OpcUaGdsModel.csv │ ├── OpcUaGdsModel.xml │ ├── OpcUaPLCopenModel.xml │ ├── SercosModel.xml │ ├── StandardTypes.csv │ ├── StandardTypes.xml │ ├── UA Attributes.csv │ ├── UA Attributes.xml │ ├── UA Core Services.xml │ ├── UA ServerCapabilities.csv │ ├── UA Status Codes.csv │ └── UA Status Codes.xml ├── Design.v104 │ ├── BuiltInTypes.xml │ ├── DemoModel.xml │ ├── OpcUaAdiModel.xml │ ├── OpcUaGdsModel.xml │ ├── OpcUaPLCopenModel.xml │ ├── SercosModel.xml │ ├── StandardTypes.xml │ ├── UA Attributes.xml │ ├── UA Core Services.xml │ └── UA Status Codes.xml ├── Design.v105 │ ├── BuiltInTypes.xml │ ├── DemoModel.xml │ ├── OpcUaDiModel.xml │ ├── OpcUaGdsModel.xml │ ├── OpcUaNodeSetModel.xml │ ├── OpcUaOnboardingModel.xml │ ├── OpcUaSchedulerModel.xml │ ├── StandardTypes.xml │ ├── TestModel.xml │ ├── UA Attributes.xml │ ├── UA Core Services.xml │ ├── UA Status Codes.xml │ ├── WotConnection.csv │ └── WotConnection.xml ├── HeaderUpdateTool.cs ├── HelpFile.txt ├── JsonSchemaExporter.cs ├── License │ ├── FLC.txt │ ├── NONE.txt │ ├── UA_MIT.txt │ ├── UA_MIT_XML.txt │ └── logo.jpg ├── MeasurementUnits.cs ├── ModelCompilerApplication.cs ├── ModelDesign.cs ├── ModelDesignerValidator.cs ├── ModelGenerator2.cs ├── NodeDocumentationReader.cs ├── NodeSetToModelDesign.cs ├── Opc.Ua.ModelCompiler.Debug.csproj ├── Opc.Ua.ModelCompiler.csproj ├── OpenApiExporter.cs ├── Program.cs ├── Schemas │ └── XmlSchemaValidator.cs ├── SemanticVersion.cs ├── StackGenerator.cs ├── StackGenerator │ ├── AnsiC │ │ ├── AnsiCGenerator.cs │ │ └── Templates │ │ │ ├── ClientApi │ │ │ ├── File.c │ │ │ ├── File.h │ │ │ ├── Service.c │ │ │ ├── Service.h │ │ │ ├── ServiceExtendedAsync.c │ │ │ └── ServiceExtendedAsync.h │ │ │ ├── ServerApi │ │ │ ├── File.c │ │ │ ├── File.h │ │ │ ├── Service.c │ │ │ └── Service.h │ │ │ └── Types │ │ │ ├── ComplexType.c │ │ │ ├── ComplexType.h │ │ │ ├── EnumeratedType.c │ │ │ ├── EnumeratedType.h │ │ │ ├── EnumeratedValue.c │ │ │ ├── File.c │ │ │ ├── File.h │ │ │ ├── ServiceType.c │ │ │ └── ServiceType.h │ ├── CodeGenerator.cs │ ├── DataTypes │ │ ├── BinarySchemaGenerator.cs │ │ ├── ConstantsGenerator.cs │ │ ├── SchemaGenerator.cs │ │ ├── Templates │ │ │ ├── BinarySchema │ │ │ │ ├── BuiltInTypes.bsd │ │ │ │ ├── ComplexType.xml │ │ │ │ ├── EnumeratedType.xml │ │ │ │ ├── File.xml │ │ │ │ ├── OpaqueType.xml │ │ │ │ └── ServiceType.xml │ │ │ ├── Constants │ │ │ │ ├── CSharp │ │ │ │ │ ├── Constant.cs │ │ │ │ │ ├── File.cs │ │ │ │ │ └── StatusCode.cs │ │ │ │ ├── Constant.cs │ │ │ │ ├── Constant.csv │ │ │ │ ├── Constant.h │ │ │ │ ├── DataTypes.cs │ │ │ │ ├── DataTypes.h │ │ │ │ ├── File.cs │ │ │ │ ├── File.csv │ │ │ │ ├── File.h │ │ │ │ ├── JavaScript │ │ │ │ │ ├── Constant.js │ │ │ │ │ ├── File.js │ │ │ │ │ └── StatusCode.js │ │ │ │ ├── Python │ │ │ │ │ ├── Constant.py │ │ │ │ │ ├── File.py │ │ │ │ │ └── StatusCode.py │ │ │ │ └── TypeScript │ │ │ │ │ ├── Constant.ts │ │ │ │ │ ├── File.ts │ │ │ │ │ └── StatusCode.ts │ │ │ ├── Nodes │ │ │ │ ├── DataType.xml │ │ │ │ ├── File.xml │ │ │ │ ├── Service.xml │ │ │ │ ├── ServiceType.xml │ │ │ │ └── TypeDeclaration.xml │ │ │ └── XmlSchema │ │ │ │ ├── Array.xml │ │ │ │ ├── Binding.wsdl │ │ │ │ ├── BuiltInTypes.xsd │ │ │ │ ├── BuiltInTypes.xsx │ │ │ │ ├── ComplexType.xml │ │ │ │ ├── DerivedType.xml │ │ │ │ ├── Endpoint.wsdl │ │ │ │ ├── EnumeratedType.xml │ │ │ │ ├── File.xml │ │ │ │ ├── Message.wsdl │ │ │ │ ├── PortType.wsdl │ │ │ │ ├── ServiceType.xml │ │ │ │ └── Services.wsdl │ │ └── XmlSchemaGenerator.cs │ ├── DotNet │ │ ├── DotNetGenerator.cs │ │ └── Templates │ │ │ ├── Channels │ │ │ ├── BinaryMethodAsync.cs │ │ │ ├── File.cs │ │ │ ├── ServiceSet.cs │ │ │ └── XmlMethodAsync.cs │ │ │ ├── Classes │ │ │ ├── Class.cs │ │ │ ├── ClassCollection.cs │ │ │ ├── Enumeration.cs │ │ │ ├── EnumerationCollection.cs │ │ │ ├── EnumerationValue.cs │ │ │ ├── EventType.cs │ │ │ ├── FieldValue.cs │ │ │ ├── File.cs │ │ │ ├── Property.cs │ │ │ ├── PropertyArray.cs │ │ │ └── Service.cs │ │ │ ├── ClientApi │ │ │ ├── File.cs │ │ │ ├── Interface.cs │ │ │ ├── Method.cs │ │ │ └── ServiceSet.cs │ │ │ ├── Endpoints │ │ │ ├── File.cs │ │ │ ├── Method.cs │ │ │ └── ServiceSet.cs │ │ │ ├── Interfaces │ │ │ ├── File.cs │ │ │ ├── Operation.cs │ │ │ ├── OperationAsync.cs │ │ │ ├── OperationAsyncEndpoint.cs │ │ │ └── ServiceSet.cs │ │ │ └── ServerApi │ │ │ ├── File.cs │ │ │ ├── InterfaceMethod.cs │ │ │ ├── Method.cs │ │ │ └── ServiceSet.cs │ ├── Namespaces.cs │ ├── Shared │ │ ├── Context.cs │ │ └── Template.cs │ ├── Validators │ │ ├── BuiltInTypes.xml │ │ ├── TypeDictionary.cs │ │ ├── TypeDictionaryValidator.cs │ │ ├── UA Type Dictionary.cs │ │ ├── UA Type Dictionary.xsd │ │ ├── Xml │ │ │ ├── BuiltInTypes.xsd │ │ │ └── XmlSchemaValidator.cs │ │ └── temp.txt │ └── Wireshark │ │ ├── Template │ │ ├── complexparserfunction.c │ │ ├── enumparser.c │ │ ├── enumregisterinfo.c │ │ ├── hfentries.c │ │ ├── hfentries.h │ │ ├── opcua_identifiers.h │ │ ├── serviceparserfunction.c │ │ └── servicetable.c │ │ └── Wireshark.cs ├── Templates │ ├── BinarySchema │ │ ├── BuiltInTypes.bsd │ │ ├── ComplexType.xml │ │ ├── EnumeratedType.xml │ │ ├── File.xml │ │ └── OpaqueType.xml │ ├── Types │ │ ├── Identifiers.cs │ │ ├── Identifiers.h │ │ ├── Name.cs │ │ ├── Names.cs │ │ ├── NamespaceUri.cs │ │ └── Namespaces.cs │ ├── Version2 │ │ ├── BrowseName.cs │ │ ├── CSharp │ │ │ ├── BrowseName.cs │ │ │ ├── BuiltInTypes.cs │ │ │ ├── ConstantsFile.cs │ │ │ ├── Identifier.cs │ │ │ ├── Identifier_NoNamespace.cs │ │ │ └── NodeIdClass.cs │ │ ├── ConstantsFile.cs │ │ ├── DataTypes │ │ │ ├── ArrayProperty.cs │ │ │ ├── Class.cs │ │ │ ├── ClassWithOptionalFields.cs │ │ │ ├── CollectionClass.cs │ │ │ ├── DerivedClass.cs │ │ │ ├── DerivedClassWithOptionalFields.cs │ │ │ ├── Enumeration.cs │ │ │ ├── EnumerationValue.cs │ │ │ ├── Property.cs │ │ │ └── Union.cs │ │ ├── File.cs │ │ ├── FindChildCase.cs │ │ ├── FindChildMethods.cs │ │ ├── FindChildren.cs │ │ ├── IdClass.cs │ │ ├── IdDeclaration.cs │ │ ├── InitializeOptionalChild.cs │ │ ├── JavaScript │ │ │ ├── BrowseName.js │ │ │ ├── BuiltInTypes.js │ │ │ ├── ConstantsFile.js │ │ │ ├── Identifier.js │ │ │ ├── Identifier_NoNamespace.js │ │ │ └── NodeIdClass.js │ │ ├── MethodType.cs │ │ ├── NamespaceUri.cs │ │ ├── NodeIdClass.cs │ │ ├── NodeIdDeclaration.cs │ │ ├── NodeIdDeclarationAbsolute.cs │ │ ├── ObjectType.cs │ │ ├── Property.cs │ │ ├── PropertyOverride.cs │ │ ├── Python │ │ │ ├── BrowseName.py │ │ │ ├── BuiltInTypes.py │ │ │ ├── ConstantsFile.py │ │ │ ├── Identifier.py │ │ │ ├── Identifier_NoNamespace.py │ │ │ └── NodeIdClass.py │ │ ├── TypeScript │ │ │ ├── BrowseName.ts │ │ │ ├── BuiltInTypes.ts │ │ │ ├── ConstantsFile.ts │ │ │ ├── Identifier.ts │ │ │ ├── Identifier_NoNamespace.ts │ │ │ └── NodeIdClass.ts │ │ ├── TypedVariableType.cs │ │ ├── TypesFile.cs │ │ ├── VariableType.cs │ │ ├── VariableTypeValue.cs │ │ └── VariableTypeValueField.cs │ └── XmlSchema │ │ ├── Array.xml │ │ ├── BuiltInTypes.xsd │ │ ├── CollectionType.xml │ │ ├── ComplexType.xml │ │ ├── DerivedType.xml │ │ ├── Documentation.xml │ │ ├── EnumeratedType.xml │ │ ├── File.xml │ │ ├── SimpleType.xml │ │ └── Union.xml ├── UA Model Design.cs ├── UA Model Design.xsd ├── UANodeSet.xsd ├── app.config ├── packages.Opc.Ua.ModelCompiler.Debug.config └── packages.Opc.Ua.ModelCompiler.config ├── PublishModel.bat ├── PublishModel.sh ├── PublishNodeSet.bat ├── README.md ├── Schemas ├── OPCBinarySchema.xsd ├── SecuredApplication.xsd ├── ServerCapabilities.csv └── UANodeSet.xsd ├── TestNodeSets.bat ├── Tests └── DemoModel │ ├── BuildModel.bat │ ├── DemoModel.Debug.csproj │ ├── DemoModel.csproj │ ├── DemoModel │ ├── Constants │ │ ├── CSharp │ │ │ └── demomodel_constants.cs │ │ ├── JavaScript │ │ │ └── demomodel_constants.js │ │ ├── Python │ │ │ └── demomodel_constants.py │ │ └── TypeScript │ │ │ └── demomodel_constants.ts │ ├── DemoModel.Classes.cs │ ├── DemoModel.Constants.cs │ ├── DemoModel.DataTypes.cs │ ├── DemoModel.NodeIds.csv │ ├── DemoModel.NodeIds.permissions.csv │ ├── DemoModel.NodeSet.xml │ ├── DemoModel.NodeSet2.xml │ ├── DemoModel.PredefinedNodes.uanodes │ ├── DemoModel.PredefinedNodes.xml │ ├── DemoModel.Types.bsd │ ├── DemoModel.Types.xsd │ ├── DemoModel.csv │ ├── DemoModel.xml │ └── demomodel-constants.ts │ ├── Onboarding │ ├── Opc.Ua.Onboarding.Classes.cs │ ├── Opc.Ua.Onboarding.Constants.cs │ ├── Opc.Ua.Onboarding.DataTypes.cs │ ├── Opc.Ua.Onboarding.NodeIds.csv │ ├── Opc.Ua.Onboarding.NodeIds.permissions.csv │ ├── Opc.Ua.Onboarding.NodeSet2.documentation.csv │ ├── Opc.Ua.Onboarding.NodeSet2.xml │ ├── Opc.Ua.Onboarding.PredefinedNodes.uanodes │ ├── Opc.Ua.Onboarding.PredefinedNodes.xml │ ├── Opc.Ua.Onboarding.Types.bsd │ ├── Opc.Ua.Onboarding.Types.xsd │ ├── OpcUaOnboardingModel.csv │ ├── OpcUaOnboardingModel.xml │ └── opcuaonboarding-constants.ts │ ├── Program.cs │ ├── Quickstarts.ReferenceServer.Config.xml │ ├── ReferenceNodeManager.cs │ ├── ReferenceServer.cs │ ├── Scheduler │ ├── Opc.Ua.Scheduler.Classes.cs │ ├── Opc.Ua.Scheduler.Constants.cs │ ├── Opc.Ua.Scheduler.DataTypes.cs │ ├── Opc.Ua.Scheduler.NodeIds.csv │ ├── Opc.Ua.Scheduler.NodeIds.permissions.csv │ ├── Opc.Ua.Scheduler.NodeSet2.documentation.csv │ ├── Opc.Ua.Scheduler.NodeSet2.xml │ ├── Opc.Ua.Scheduler.PredefinedNodes.uanodes │ ├── Opc.Ua.Scheduler.PredefinedNodes.xml │ ├── Opc.Ua.Scheduler.Types.bsd │ ├── Opc.Ua.Scheduler.Types.xsd │ ├── OpcUaSchedulerModel.csv │ ├── OpcUaSchedulerModel.xml │ └── opcuascheduler-constants.ts │ └── UAServer.cs ├── UpdateLicense.bat ├── excludes.txt └── license.md /.dockerignore: -------------------------------------------------------------------------------- 1 | **/.git 2 | **/Test 3 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "nuget" 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # A CodeQL query for the project 2 | name: "CodeQL for ModelCompiler" 3 | 4 | on: 5 | push: 6 | branches: [ master, main ] 7 | pull_request: 8 | # The branches below must be a subset of the branches above 9 | branches: [ master, main ] 10 | schedule: 11 | - cron: '30 6 * * 6' 12 | 13 | concurrency: 14 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} 15 | cancel-in-progress: true 16 | 17 | jobs: 18 | analyze: 19 | name: Analyze 20 | runs-on: ubuntu-latest 21 | 22 | strategy: 23 | fail-fast: false 24 | matrix: 25 | language: [ 'csharp' ] 26 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] 27 | # Learn more: 28 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed 29 | 30 | steps: 31 | - name: Checkout repository 32 | uses: actions/checkout@v3 33 | with: 34 | fetch-depth: 0 35 | submodules: true 36 | 37 | # Initializes the CodeQL tools for scanning. 38 | - name: Initialize CodeQL 39 | uses: github/codeql-action/init@v2 40 | with: 41 | languages: ${{ matrix.language }} 42 | # If you wish to specify custom queries, you can do so here or in a config file. 43 | # By default, queries listed here will override any specified in a config file. 44 | # Prefix the list here with "+" to use these queries and those in the config file. 45 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 46 | 47 | - name: Set up .NET 48 | uses: actions/setup-dotnet@v3 49 | with: 50 | dotnet-version: '6.x' 51 | 52 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 53 | # If this step fails, then you should remove it and run the build manually (see below) 54 | - name: Autobuild 55 | uses: github/codeql-action/autobuild@v2 56 | 57 | # ℹ️ Command-line programs to run using the OS shell. 58 | # 📚 https://git.io/JvXDl 59 | 60 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 61 | # and modify them (or add more) to build your code if your project 62 | # uses a compiled language 63 | 64 | #- run: | 65 | # make bootstrap 66 | # make release 67 | 68 | - name: Perform CodeQL Analysis 69 | uses: github/codeql-action/analyze@v2 70 | -------------------------------------------------------------------------------- /.github/workflows/dotnet.yml: -------------------------------------------------------------------------------- 1 | name: ModelCompiler .NET Tool build 2 | 3 | on: 4 | push: 5 | branches: [ master, nuget* ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | concurrency: 10 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} 11 | cancel-in-progress: true 12 | 13 | env: 14 | PUBLISHNUGET: false 15 | 16 | jobs: 17 | build: 18 | runs-on: windows-latest 19 | 20 | steps: 21 | - uses: actions/checkout@v3 22 | with: 23 | fetch-depth: 0 24 | submodules: true 25 | 26 | - name: Set up .NET 8 27 | uses: actions/setup-dotnet@v3 28 | with: 29 | dotnet-version: '8.x' 30 | 31 | - name: Restore dependencies 32 | run: dotnet restore "ModelCompiler Solution.sln" 33 | 34 | - name: Build 35 | run: dotnet build --no-restore --configuration Docker "ModelCompiler Solution.sln" 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Stack"] 2 | path = Stack 3 | url = https://github.com/OPCFoundation/UA-.NETStandard.git 4 | -------------------------------------------------------------------------------- /BuildEngineeringUnits.bat: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | REM **************************************************************************************************************** 3 | REM ** -- 4 | REM ** This script demonstrates how to use the model compiler to generate engineering units. 5 | REM ** -- 6 | REM **************************************************************************************************************** 7 | SETLOCAL 8 | 9 | set ROOT=%~dp0 10 | set MODELCOMPILER=%ROOT%build\bin\Release\net8.0\Opc.Ua.ModelCompiler.exe 11 | set OUTPUT=%ROOT%..\nodesets 12 | set INPUT=%ROOT%Opc.Ua.ModelCompiler\CSVs 13 | set EXCLUDE=-exclude nothing 14 | 15 | IF NOT "%1"=="" (set OUTPUT=%OUTPUT%\%1) else (set OUTPUT=%OUTPUT%\master) 16 | 17 | set ANNEX1_SRCPATH=%INPUT%\rec20_latest_a1.csv 18 | set ANNEX2_SRCPATH=%INPUT%\rec20_latest_a2-3.csv 19 | set OUTPUT_PATH=%OUTPUT%\Schema\UNECE_to_OPCUA.csv 20 | 21 | REM Make sure that all of our output locations exist.. 22 | 23 | IF NOT EXIST %MODELCOMPILER% GOTO noModelCompiler 24 | IF NOT EXIST %OUTPUT% MKDIR %OUTPUT% 25 | IF NOT EXIST %OUTPUT%\Schema MKDIR %OUTPUT%\Schema 26 | 27 | REM STEP 1) Generate files. 28 | 29 | ECHO Building Unit File 30 | ECHO ON 31 | %MODELCOMPILER% units -annex1 "%ANNEX1_SRCPATH%" -annex2 "%ANNEX2_SRCPATH%" -output "%OUTPUT_PATH%" 32 | IF %ERRORLEVEL% NEQ 0 ( ECHO Failed %PARTNAME% & EXIT /B 1 ) 33 | 34 | ECHO Copying CSV files to %OUTPUT%\Schema\ 35 | ECHO ON 36 | COPY "%ANNEX1_SRCPATH%" "%OUTPUT%\Schema\rec20_latest_a1.csv" 37 | COPY "%ANNEX2_SRCPATH%" "%OUTPUT%\Schema\rec20_latest_a2-3.csv" 38 | @ECHO OFF 39 | 40 | GOTO theEnd 41 | 42 | :noModelCompiler 43 | ECHO. 44 | ECHO ModelCompiler not found. Please make sure it is compiled in RELEASE mode. 45 | ECHO Searched for: %MODELCOMPILER% 46 | 47 | :theEnd 48 | ENDLOCAL -------------------------------------------------------------------------------- /CompileNodeSets.bat: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | SETLOCAL 3 | 4 | IF "%1"=="" (goto :usage) 5 | IF "%2"=="" (goto :usage) 6 | IF "%3"=="" (goto :usage) 7 | 8 | set ROOT=%~dp0 9 | set MODELCOMPILER=%ROOT%build\bin\Release\net8.0\Opc.Ua.ModelCompiler.exe 10 | set NODESETS=%1 11 | set OUTPUT=%2 12 | set TARGET=-uri %3 13 | set DEPENDENCY1= 14 | set DEPENDENCY2= 15 | set DEPENDENCY3= 16 | 17 | IF NOT "%4"=="" (set DEPENDENCY1=-uri %4) 18 | IF NOT "%5"=="" (set DEPENDENCY2=-uri %5) 19 | IF NOT "%6"=="" (set DEPENDENCY3=-uri %6) 20 | 21 | ECHO Building Model %TARGET% 22 | IF NOT EXIST "%OUTPUT%" MKDIR "%OUTPUT%" 23 | ECHO %MODELCOMPILER% compile-nodesets -input %NODESETS% -o2 %OUTPUT% %TARGET% %DEPENDENCY1% %DEPENDENCY2% %DEPENDENCY3% 24 | %MODELCOMPILER% compile-nodesets -input %NODESETS% -o2 %OUTPUT% %TARGET% %DEPENDENCY1% %DEPENDENCY2% %DEPENDENCY3% 25 | IF %ERRORLEVEL% NEQ 0 ( ECHO Failed %TARGET% & EXIT /B 3 ) 26 | 27 | ECHO Updating License 28 | ECHO ON 29 | CALL UpdateLicense "%OUTPUT%" 30 | @ECHO OFF 31 | 32 | GOTO :theEnd 33 | 34 | :noModelCompiler 35 | ECHO. 36 | ECHO ModelCompiler not found. Please make sure it is compiled in RELEASE mode. 37 | ECHO Searched for: %MODELCOMPILER% 38 | 39 | :usage 40 | ECHO. 41 | ECHO Usage: CompileNodeSets.bat [nodesets directory] [generated file directory] [URI] [(dependency URI)*] 42 | GOTO :theEnd 43 | 44 | :theEnd 45 | ENDLOCAL -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build 2 | WORKDIR /source 3 | 4 | # copy csproj and restore as distinct layers 5 | COPY . . 6 | RUN dotnet restore "ModelCompiler Solution.sln" 7 | 8 | # copy and publish app and libraries 9 | COPY . . 10 | RUN dotnet publish "ModelCompiler Solution.sln" -f net8.0 -c Release -o /app 11 | 12 | # final stage/image 13 | FROM mcr.microsoft.com/dotnet/runtime:8.0 14 | WORKDIR /app 15 | COPY --from=build /app . 16 | ENTRYPOINT ["dotnet", "/app/Opc.Ua.ModelCompiler.dll"] 17 | -------------------------------------------------------------------------------- /ModelCompiler Solution.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.1.32228.430 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Opc.Ua.ModelCompiler", "Opc.Ua.ModelCompiler\Opc.Ua.ModelCompiler.csproj", "{3CE9C29A-41A4-4F5B-96EE-0DDA6929ED63}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution Files", "{2EDA8446-E853-4739-866C-C224E9B024C7}" 9 | ProjectSection(SolutionItems) = preProject 10 | BuildEngineeringUnits.bat = BuildEngineeringUnits.bat 11 | BuildStandardTypes.bat = BuildStandardTypes.bat 12 | CompileNodeSets.bat = CompileNodeSets.bat 13 | PublishModel.bat = PublishModel.bat 14 | TestNodeSets.bat = TestNodeSets.bat 15 | UpdateLicense.bat = UpdateLicense.bat 16 | EndProjectSection 17 | EndProject 18 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DemoModel", "Tests\DemoModel\DemoModel.csproj", "{E1155082-AFD3-449D-BFB3-008CE10D619C}" 19 | EndProject 20 | Global 21 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 22 | Debug|Any CPU = Debug|Any CPU 23 | Docker|Any CPU = Docker|Any CPU 24 | Release|Any CPU = Release|Any CPU 25 | EndGlobalSection 26 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 27 | {3CE9C29A-41A4-4F5B-96EE-0DDA6929ED63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 28 | {3CE9C29A-41A4-4F5B-96EE-0DDA6929ED63}.Debug|Any CPU.Build.0 = Debug|Any CPU 29 | {3CE9C29A-41A4-4F5B-96EE-0DDA6929ED63}.Docker|Any CPU.ActiveCfg = Docker|Any CPU 30 | {3CE9C29A-41A4-4F5B-96EE-0DDA6929ED63}.Docker|Any CPU.Build.0 = Docker|Any CPU 31 | {3CE9C29A-41A4-4F5B-96EE-0DDA6929ED63}.Release|Any CPU.ActiveCfg = Release|Any CPU 32 | {3CE9C29A-41A4-4F5B-96EE-0DDA6929ED63}.Release|Any CPU.Build.0 = Release|Any CPU 33 | {E1155082-AFD3-449D-BFB3-008CE10D619C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 34 | {E1155082-AFD3-449D-BFB3-008CE10D619C}.Debug|Any CPU.Build.0 = Debug|Any CPU 35 | {E1155082-AFD3-449D-BFB3-008CE10D619C}.Docker|Any CPU.ActiveCfg = Debug|Any CPU 36 | {E1155082-AFD3-449D-BFB3-008CE10D619C}.Release|Any CPU.ActiveCfg = Release|Any CPU 37 | {E1155082-AFD3-449D-BFB3-008CE10D619C}.Release|Any CPU.Build.0 = Release|Any CPU 38 | EndGlobalSection 39 | GlobalSection(SolutionProperties) = preSolution 40 | HideSolutionNode = FALSE 41 | EndGlobalSection 42 | GlobalSection(ExtensibilityGlobals) = postSolution 43 | SolutionGuid = {8D48237F-0D69-4239-A474-2651F58A8293} 44 | EndGlobalSection 45 | EndGlobal 46 | -------------------------------------------------------------------------------- /NuGet.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/BuildSchema.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | 4 | cd %~dp0 5 | 6 | echo Processing UA Model Design Schema 7 | xsd /classes /n:ModelCompiler "UA Model Design.xsd" 8 | 9 | echo #pragma warning disable 1591 > temp.txt 10 | type "UA Model Design.cs" >> temp.txt 11 | type temp.txt > "UA Model Design.cs" 12 | 13 | cd .\StackGenerator\Validators 14 | 15 | echo Processing UA Type Dictionary Schema 16 | xsd /classes /n:CodeGenerator "UA Type Dictionary.xsd" 17 | 18 | echo #pragma warning disable 1591 > temp.txt 19 | type "UA Type Dictionary.cs" >> temp.txt 20 | type temp.txt > "UA Type Dictionary.cs" 21 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/CSVs/Attributes.csv: -------------------------------------------------------------------------------- 1 | NodeId,1 2 | NodeClass,2 3 | BrowseName,3 4 | DisplayName,4 5 | Description,5 6 | WriteMask,6 7 | UserWriteMask,7 8 | IsAbstract,8 9 | Symmetric,9 10 | InverseName,10 11 | ContainsNoLoops,11 12 | EventNotifier,12 13 | Value,13 14 | DataType,14 15 | ValueRank,15 16 | ArrayDimensions,16 17 | AccessLevel,17 18 | UserAccessLevel,18 19 | MinimumSamplingInterval,19 20 | Historizing,20 21 | Executable,21 22 | UserExecutable,22 23 | DataTypeDefinition,23 24 | RolePermissions,24 25 | UserRolePermissions,25 26 | AccessRestrictions,26 27 | AccessLevelEx,27 28 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/CSVs/ServerCapabilities.csv: -------------------------------------------------------------------------------- 1 | NA,No capability information is available. Cannot be used in combination with any other capability. 2 | DA,Provides current data. 3 | HD,Provides historical data. 4 | AC,Provides alarms and conditions that may require operator interaction. 5 | HE,Provides historical alarms and events. 6 | GDS,Supports the Global Discovery Server information model. 7 | LDS,Only supports the Discovery Services. Cannot be used in combination with any other capability. 8 | DI,Supports the Device Integration (DI) information model (see DI). 9 | ADI,Supports the Analyser Device Integration (ADI) information model (see ADI). 10 | FDI,Supports the Field Device Integration (FDI) information model (see FDI). 11 | FDIC,Supports the Field Device Integration (FDI) Communication Server information model (see FDI). 12 | PLC,Supports the PLCopen information model (see PLCopen). 13 | S95,Supports the ISA95 information model (see ISA-95). 14 | RCP,Supports the reverse connect capabilities defined in Part 6. 15 | PUB,Supports the Publisher capabilities defined in Part 14. 16 | NTRS,The server is part of a non-transparent redundant server set defined in Part 4. 17 | AUTOID,Supports the AutoID information model. 18 | MDIS,Supports the MDIS information model. 19 | CNC,Supports the information model for Computerized Numerical Control (CNC) systems. 20 | PLK,Supports the POWERLINK information model. 21 | FDT,Supports the FDT information model. 22 | TMC,Supports the Tobacco Machine Communication (TMC) information model. 23 | CSPP,Supports the CSP+ device profile (CSPPlusForMachine) information model. 24 | 61850,Supports the IEC61850 information model. 25 | PACKML,Supports the PackML information model. 26 | MTC,Supports the MTConnect information model. 27 | AUTOML,Supports the AutomationML information model. 28 | SERCOS,Supports the Sercos information model. 29 | MIMOSA,Supports the MIMOSA information model. 30 | WITSML,Supports the WITSML information model. 31 | DEXPI,Supports the DEXPI information model. 32 | IOLINK,Supports the IOLINK information model. 33 | VROBOT,Supports the VDMA ROBOTICS information model. 34 | PNO,Supports the ProfiNET information model. 35 | PADIM,Supports the information model for Process Automation Devices. 36 | ALIAS,Supports the AliasNames capabilities. 37 | SKS,Supports the Security Key Servers (SKS) capabilities. 38 | FXAC,Supports the UA FX Automation Component information model. 39 | FXCM,Supports the UA FX Connection Manager information model. 40 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/CSVs/rec20_Rev17e-2021.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OPCFoundation/UA-ModelCompiler/20dbd73ecdf59223030dc032d1a8a6b2d0cc5ec9/Opc.Ua.ModelCompiler/CSVs/rec20_Rev17e-2021.xlsx -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Design.v103/UA Attributes.csv: -------------------------------------------------------------------------------- 1 | NodeId,1 2 | NodeClass,2 3 | BrowseName,3 4 | DisplayName,4 5 | Description,5 6 | WriteMask,6 7 | UserWriteMask,7 8 | IsAbstract,8 9 | Symmetric,9 10 | InverseName,10 11 | ContainsNoLoops,11 12 | EventNotifier,12 13 | Value,13 14 | DataType,14 15 | ValueRank,15 16 | ArrayDimensions,16 17 | AccessLevel,17 18 | UserAccessLevel,18 19 | MinimumSamplingInterval,19 20 | Historizing,20 21 | Executable,21 22 | UserExecutable,22 23 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Design.v103/UA ServerCapabilities.csv: -------------------------------------------------------------------------------- 1 | NA, No capability information is available. Cannot be used in combination with any other capability. 2 | DA, Provides current data. 3 | HD, Provides historical data. 4 | AC, Provides alarms and conditions that may require operator interaction. 5 | HE, Provides historical alarms and events. 6 | GDS, Supports the Global Discovery Server information model. 7 | LDS, Only supports the Discovery Services. Cannot be used in combination with any other capability. 8 | DI, Supports the Device Integration (DI) information model. 9 | ADI, Supports the Analyser Device Integration (ADI) information model. 10 | FDI, Supports the Field Device Integration (FDI) information model. 11 | FDIC, Supports the Field Device Integration (FDI) Communication Server information model. 12 | PLC, Supports the PLCopen information model. 13 | S95, Supports the ISA95 information model. -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/HelpFile.txt: -------------------------------------------------------------------------------- 1 | Opc.Ua.ModelCompiler.exe -d2 -c[g] -o2 2 | 3 | Generates classes that implement a UA information model. 4 | 5 | -? Prints this help text 6 | -d2 The path to the XML file which contains the UA information model. New version of code generator is used (option -stack forces to use -d2 switch) 7 | -c The path to the CSV file which contains the unique identifiers for the types defined in the UA information model. 8 | -cg Creates the identifier file if it does not exist (used instead of the -c option). 9 | -o No longer supported. 10 | -o2 The output directory for a multiple file output. 11 | -id The start identifier 12 | -ansic Generates the ANSI C stack code for the core model (not used for vendor defined models). 13 | -stack Generates the .NET stack code for the core model (not used for vendor defined models). 14 | -useXmlInitializers No longer supported. 15 | -console The output goes to the standard error output (console) instead of error window 16 | -exclude Excludes types based on thier ReleaseStatus and/or Category. A simple string compare is used to test. 17 | -version Selects the source for the input files. v103 | v104 | v105 are supported. 18 | -useAllowSubtypes When subtypes are allowed for a field, C# code with the class name from the model is created instead of ExtensionObject. No effect when subtypes are not allowed. 19 | 20 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/License/FLC.txt: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2020-2024 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * The source code in this file is covered under a dual-license scenario: 5 | * - RCL: for OPC Foundation Corporate Members in good-standing 6 | * - GPL V2: everybody else 7 | * 8 | * OPC Foundation Corporate Members: RCL (https://opcfoundation.org/license/rcl.html). 9 | * OPC Foundation corporate members may deploy their applications without being 10 | required to disclose the application code. 11 | * 12 | * Users that are not OPC Foundation corporate-members: GPL 2.0 (https://opcfoundation.org/license/gplv2/) 13 | * Users must disclose their application code when using this code. 14 | * 15 | * This source code is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 | * ======================================================================*/ 19 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/License/NONE.txt: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/License/UA_MIT.txt: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/License/UA_MIT_XML.txt: -------------------------------------------------------------------------------- 1 |  2 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/License/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OPCFoundation/UA-ModelCompiler/20dbd73ecdf59223030dc032d1a8a6b2d0cc5ec9/Opc.Ua.ModelCompiler/License/logo.jpg -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Program.cs: -------------------------------------------------------------------------------- 1 | using ModelCompiler; 2 | using McMaster.Extensions.CommandLineUtils; 3 | using System.Reflection; 4 | using System.Diagnostics; 5 | 6 | try 7 | { 8 | if (System.Diagnostics.Debugger.IsAttached) 9 | { 10 | //string[] args2 = { 11 | // "compile", 12 | // "-d2", 13 | // @"D:\Work\OPC\UA-ModelCompiler\Opc.Ua.ModelCompiler\Design.v105\WotConnection.xml", 14 | // "-cg", 15 | // @"D:\Work\OPC\UA-ModelCompiler\Opc.Ua.ModelCompiler\CSVs\WotConnection.csv", 16 | // "-version", 17 | // "v105", 18 | // "-exclude", 19 | // "Draft", 20 | // "-o2", 21 | // @"D:\Work\OPC\UA-IIoT-StarterKit\Opc.Ua.TestPublisher\Model" 22 | //}; 23 | 24 | string[] args2 = { 25 | "compile-nodesets", 26 | "-input", 27 | @"D:\Work\OPC\nodesets\v105\", 28 | "-o2", 29 | @"D:\Work\OPC\UA-ModelCompiler-Public\Tests\DemoModel\Models\", 30 | "-uri", 31 | @"http://opcfoundation.org/UA/DI/", 32 | "-prefix", 33 | "UAModel.DI" 34 | }; 35 | 36 | ModelCompilerApplication.Run(args2); 37 | 38 | return; 39 | } 40 | 41 | for (int ii = 0; ii < args.Length; ii++) 42 | { 43 | args[ii] = args[ii].Replace("\n", "\\n"); 44 | } 45 | 46 | if (args.Length < 2) 47 | { 48 | Console.WriteLine($"Version: {Assembly.GetExecutingAssembly().GetName().FullName}"); 49 | Console.WriteLine($"FileVersion: {FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion}"); 50 | Console.WriteLine($"Opc.Ua.Core: {typeof(Opc.Ua.NodeId).Assembly.GetName().FullName}"); 51 | } 52 | 53 | ModelCompilerApplication.Run(args); 54 | } 55 | catch (CommandParsingException e) 56 | { 57 | Console.ForegroundColor = ConsoleColor.Yellow; 58 | Console.WriteLine($"[{e.GetType().Name}] {e.Message} ({e.Command})"); 59 | Environment.Exit(3); 60 | } 61 | catch (AggregateException e) 62 | { 63 | Console.ForegroundColor = ConsoleColor.Yellow; 64 | Console.WriteLine($"[{e.GetType().Name}] {e.Message}"); 65 | 66 | foreach (var ie in e.InnerExceptions) 67 | { 68 | Console.WriteLine($">>> [{ie.GetType().Name}] {ie.Message}"); 69 | } 70 | 71 | Environment.Exit(3); 72 | } 73 | catch (Exception e) 74 | { 75 | Console.ForegroundColor = ConsoleColor.Yellow; 76 | Console.WriteLine($"[{e.GetType().Name}] {e.Message}"); 77 | 78 | Exception ie = e.InnerException; 79 | 80 | while (ie != null) 81 | { 82 | Console.WriteLine($">>> [{ie.GetType().Name}] {ie.Message}"); 83 | ie = ie.InnerException; 84 | } 85 | 86 | Console.WriteLine(); 87 | Console.WriteLine($"========================"); 88 | Console.WriteLine($"{e.StackTrace}"); 89 | Console.WriteLine($"========================"); 90 | Console.WriteLine(); 91 | 92 | Environment.Exit(3); 93 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/SemanticVersion.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | 3 | namespace ModelCompiler 4 | { 5 | public static class SemanticVersion 6 | { 7 | public static string Create(string version) 8 | { 9 | if (String.IsNullOrWhiteSpace(version)) 10 | { 11 | return null; 12 | } 13 | 14 | var fields = version.Split('.'); 15 | 16 | StringBuilder output = new(); 17 | 18 | foreach (var field in fields) 19 | { 20 | string suffix = null; 21 | 22 | if (!UInt32.TryParse(field, out var element)) 23 | { 24 | for (int ii = 0; ii < field.Length; ii++) 25 | { 26 | if (field[ii] == '+' || field[ii] == '-') 27 | { 28 | suffix = field.Substring(ii); 29 | UInt32.TryParse(field.Substring(0, ii), out element); 30 | break; 31 | } 32 | } 33 | } 34 | 35 | if (output.Length > 0) 36 | { 37 | output.Append('.'); 38 | } 39 | 40 | output.Append(element); 41 | 42 | if (suffix != null) 43 | { 44 | output.Append(suffix); 45 | } 46 | } 47 | 48 | while (output.ToString().Where(x => x == '.').Count() < 2) 49 | { 50 | output.Append(".0"); 51 | } 52 | 53 | return output.ToString(); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/AnsiC/Templates/ClientApi/File.c: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | /* core */ 32 | #include 33 | 34 | #ifdef OPCUA_HAVE_CLIENTAPI 35 | 36 | /* stack */ 37 | #include 38 | 39 | /* types */ 40 | #include 41 | #include 42 | 43 | #include 44 | #include 45 | #include 46 | 47 | // _Implementation_ 48 | 49 | #endif /* OPCUA_HAVE_CLIENTAPI */ 50 | /* This is the last line of an autogenerated file. */ 51 | // ***ENDAPPENDNEWLINE*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/AnsiC/Templates/ClientApi/File.h: -------------------------------------------------------------------------------- 1 | }// ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | #ifndef __Prefix__ClientApi_H_ 32 | #define __Prefix__ClientApi_H_ 1 33 | #ifdef OPCUA_HAVE_CLIENTAPI 34 | 35 | #include 36 | #include 37 | 38 | OPCUA_BEGIN_EXTERN_C 39 | 40 | // _Declaration_ 41 | 42 | OPCUA_END_EXTERN_C 43 | 44 | #endif /* OPCUA_HAVE_CLIENTAPI */ 45 | #endif /* __Prefix__ClientApi_H_ */ 46 | /* This is the last line of an autogenerated file. */ 47 | // ***ENDAPPENDNEWLINE*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/AnsiC/Templates/ClientApi/Service.h: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | #ifndef OPCUA_EXCLUDE__NAME_ 3 | /*============================================================================ 4 | * Synchronously calls the _NAME_ service. 5 | *===========================================================================*/ 6 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_ClientApi__NAME_( 7 | SyncArgList); 8 | 9 | /*============================================================================ 10 | * Asynchronously calls the _NAME_ service. 11 | *===========================================================================*/ 12 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_ClientApi_Begin_NAME_( 13 | AsyncArgList); 14 | #endif 15 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/AnsiC/Templates/ClientApi/ServiceExtendedAsync.h: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /*============================================================================ 3 | * Synchronously calls the _NAME_ service. 4 | *===========================================================================*/ 5 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_ClientApi__NAME_( 6 | SyncArgList); 7 | 8 | /*============================================================================ 9 | * Asynchronously calls the _NAME_ service. 10 | *===========================================================================*/ 11 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_ClientApi_Begin_NAME_( 12 | AsyncArgList); 13 | 14 | /*============================================================================ 15 | * Service specific callback of the OpcUa_ClientApi_BeginEx_NAME_ service. 16 | *===========================================================================*/ 17 | typedef OpcUa_StatusCode (OpcUa_ClientApi_EndEx_NAME_)( 18 | AsyncRspList); 19 | 20 | /*============================================================================ 21 | * Asynchronously calls the _NAME_ service with service specific callback. 22 | *===========================================================================*/ 23 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_ClientApi_BeginEx_NAME_( 24 | AsyncExArgList); 25 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/AnsiC/Templates/ServerApi/File.c: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | /* base */ 32 | #include 33 | 34 | #ifdef OPCUA_HAVE_SERVERAPI 35 | 36 | /* types */ 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | /* server related */ 44 | #include 45 | #include 46 | #include 47 | 48 | // _Implementation_ 49 | 50 | /*============================================================================ 51 | * Table of standard services. 52 | *===========================================================================*/ 53 | OpcUa_ServiceType* OpcUa_SupportedServiceTypes[] = 54 | { 55 | // _KnownServiceList_ 56 | OpcUa_Null 57 | }; 58 | 59 | #endif /* OPCUA_HAVE_SERVERAPI */ 60 | /* This is the last line of an autogenerated file. */ 61 | // ***ENDAPPENDNEWLINE*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/AnsiC/Templates/ServerApi/File.h: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | #ifndef __Prefix__ServerApi_H_ 32 | #define __Prefix__ServerApi_H_ 1 33 | #ifdef OPCUA_HAVE_SERVERAPI 34 | 35 | #include 36 | #include 37 | 38 | OPCUA_BEGIN_EXTERN_C 39 | 40 | // _Declaration_ 41 | 42 | OPCUA_END_EXTERN_C 43 | 44 | #endif /* OPCUA_HAVE_SERVERAPI */ 45 | #endif /* __Prefix__ServerApi_H_ */ 46 | /* This is the last line of an autogenerated file. */ 47 | // ***ENDAPPENDNEWLINE*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/AnsiC/Templates/ServerApi/Service.h: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | #ifndef OPCUA_EXCLUDE__NAME_ 3 | /*============================================================================ 4 | * Synchronously calls the _NAME_ service. 5 | *===========================================================================*/ 6 | OpcUa_StatusCode OpcUa_ServerApi__NAME_( 7 | ServerSyncArgList); 8 | 9 | /*============================================================================ 10 | * Begins processing of a _NAME_ service request. 11 | *===========================================================================*/ 12 | OPCUA_EXPORT_SYNC_SERVER_API OpcUa_StatusCode OpcUa_Server_Begin_NAME_( 13 | OpcUa_Endpoint a_hEndpoint, 14 | OpcUa_Handle a_hContext, 15 | OpcUa_Void** a_ppRequest, 16 | OpcUa_EncodeableType* a_pRequestType); 17 | #endif 18 | // ***END*** 19 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/AnsiC/Templates/Types/ComplexType.h: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | #ifndef OPCUA_EXCLUDE__NAME_ 3 | /*============================================================================ 4 | * The _NAME_ structure. 5 | *===========================================================================*/ 6 | typedef struct __TYPE_ 7 | { 8 | // _FieldList_ 9 | } 10 | _TYPE_; 11 | 12 | OPCUA_EXPORT OpcUa_Void _TYPE__Initialize(_TYPE_* pValue); 13 | 14 | OPCUA_EXPORT OpcUa_Void _TYPE__Clear(_TYPE_* pValue); 15 | 16 | OPCUA_EXPORT OpcUa_StatusCode _TYPE__GetSize(_TYPE_* pValue, struct _OpcUa_Encoder* pEncoder, OpcUa_Int32* pSize); 17 | 18 | OPCUA_EXPORT OpcUa_StatusCode _TYPE__Encode(_TYPE_* pValue, struct _OpcUa_Encoder* pEncoder); 19 | 20 | OPCUA_EXPORT OpcUa_StatusCode _TYPE__Decode(_TYPE_* pValue, struct _OpcUa_Decoder* pDecoder); 21 | 22 | OPCUA_IMEXPORT extern struct _OpcUa_EncodeableType _TYPE__EncodeableType; 23 | #endif 24 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/AnsiC/Templates/Types/EnumeratedType.c: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | #ifndef OPCUA_EXCLUDE__NAME_ 3 | /*============================================================================ 4 | * _TYPE__EnumeratedType 5 | *===========================================================================*/ 6 | static struct _OpcUa_EnumeratedValue g__TYPE__EnumeratedValues[] = 7 | { 8 | // _ValueStringList_ 9 | { OpcUa_Null, 0 } 10 | }; 11 | 12 | struct _OpcUa_EnumeratedType _TYPE__EnumeratedType = 13 | { 14 | "_NAME_", 15 | g__TYPE__EnumeratedValues 16 | }; 17 | #endif 18 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/AnsiC/Templates/Types/EnumeratedType.h: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | #ifndef OPCUA_EXCLUDE__NAME_ 3 | /*============================================================================ 4 | * The _NAME_ enumeration. 5 | *===========================================================================*/ 6 | typedef enum __TYPE_ 7 | { 8 | // _ValueList_ 9 | } 10 | _TYPE_; 11 | 12 | #define _TYPE__Clear(xValue) OpcUa_EnumeratedType_Clear(xValue, _DEFAULT_) 13 | 14 | #define _TYPE__Initialize(xValue) OpcUa_EnumeratedType_Initialize(xValue, _DEFAULT_) 15 | 16 | OPCUA_IMEXPORT extern struct _OpcUa_EnumeratedType _TYPE__EnumeratedType; 17 | #endif 18 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/AnsiC/Templates/Types/EnumeratedValue.c: -------------------------------------------------------------------------------- 1 | hstatic struct _OpcUa_EnumeratedValue g__TYPE__EnumeratedValues[] = 2 | { 3 | // ***START*** 4 | { "_Name_", _Value_ }, 5 | // ***END*** 6 | }; -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/AnsiC/Templates/Types/File.c: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | /* base */ 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | /* core */ 38 | #include 39 | #include 40 | #include 41 | 42 | /* stack */ 43 | #include 44 | #include 45 | 46 | /* types */ 47 | #include 48 | 49 | /* self */ 50 | #include 51 | 52 | // _Implementation_ 53 | 54 | /*============================================================================ 55 | * Table of known types. 56 | *===========================================================================*/ 57 | static OpcUa_EncodeableType* g_OpcUa_KnownEncodeableTypes[] = 58 | { 59 | // _KnownTypeList_ 60 | OpcUa_Null 61 | }; 62 | 63 | OpcUa_EncodeableType** OpcUa_KnownEncodeableTypes = g_OpcUa_KnownEncodeableTypes; 64 | /* This is the last line of an autogenerated file. */ 65 | // ***ENDAPPENDNEWLINE*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/AnsiC/Templates/Types/File.h: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | #ifndef __Prefix__Types_H_ 32 | #define __Prefix__Types_H_ 1 33 | 34 | #include 35 | 36 | OPCUA_BEGIN_EXTERN_C 37 | 38 | struct _OpcUa_Encoder; 39 | struct _OpcUa_Decoder; 40 | struct _OpcUa_EncodeableType; 41 | struct _OpcUa_EnumeratedType; 42 | 43 | // _Declaration_ 44 | 45 | /*============================================================================ 46 | * Table of known types. 47 | *===========================================================================*/ 48 | OPCUA_IMEXPORT extern struct _OpcUa_EncodeableType** OpcUa_KnownEncodeableTypes; 49 | 50 | OPCUA_END_EXTERN_C 51 | 52 | #endif 53 | /* This is the last line of an autogenerated file. */ 54 | // ***ENDAPPENDNEWLINE*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/AnsiC/Templates/Types/ServiceType.c: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | #ifndef OPCUA_EXCLUDE__NAME_ 3 | // _RequestMessage_ 4 | 5 | // _ResponseMessage_ 6 | #endif 7 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/AnsiC/Templates/Types/ServiceType.h: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | #ifndef OPCUA_EXCLUDE__NAME_ 3 | // _RequestMessage_ 4 | 5 | // _ResponseMessage_ 6 | #endif 7 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/BinarySchema/ComplexType.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | _Description_ 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/BinarySchema/EnumeratedType.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | _Description_ 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/BinarySchema/File.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/BinarySchema/OpaqueType.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | _Description_ 7 | 8 | 9 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/BinarySchema/ServiceType.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | _Description_ 7 | 8 | 9 | 10 | 11 | _Description_ 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/CSharp/Constant.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /// 3 | public const long _SymbolicId_ = _Identifier_; 4 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/CSharp/File.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | namespace Opc.Ua.WebApi 3 | { 4 | /// 5 | /// The well known identifiers for _ClassName_. 6 | /// 7 | public static class _ClassName_ 8 | { 9 | // ListOfIdentifiers 10 | 11 | /// 12 | /// Converts a value to a name for display. 13 | /// 14 | public static string ToName(long value) 15 | { 16 | foreach (var field in typeof(_ClassName_).GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static)) 17 | { 18 | if (field.GetValue(null).Equals(value)) 19 | { 20 | return field.Name; 21 | } 22 | } 23 | 24 | return value.ToString(); 25 | } 26 | } 27 | // StatusCodeHelpers 28 | } 29 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/CSharp/StatusCode.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /// 3 | /// Helper class for working with OPC UA status codes. 4 | /// 5 | public static class StatusUtils 6 | { 7 | /// 8 | /// Returns true if the code is good. 9 | /// 10 | public static bool IsGood(object code) 11 | { 12 | return (ToCode(code) & 0xD0000000) == 0; 13 | } 14 | /// 15 | /// Returns true if the code is uncertain. 16 | /// 17 | public static bool IsUncertain(object code) 18 | { 19 | return (ToCode(code) & 0x40000000) != 0; 20 | } 21 | /// 22 | /// Returns true if the code is bad. 23 | /// 24 | public static bool IsBad(object code) 25 | { 26 | return (ToCode(code) & 0x80000000) != 0; 27 | } 28 | /// 29 | /// Returns top 16 bits which represent the unique code for the error. 30 | /// 31 | public static long CodeBits(object code) 32 | { 33 | return (ToCode(code) & 0xFFFF0000); 34 | } 35 | /// 36 | /// Returns bottom 16 bits which represent the additional information about the error. 37 | /// 38 | public static long InfoBits(object code) 39 | { 40 | return (ToCode(code) & 0x0000FFFF); 41 | } 42 | /// 43 | /// Returns the code formatted as text. 44 | /// 45 | public static string ToText(object code) 46 | { 47 | var number = ToCode(code); 48 | 49 | foreach (var field in typeof(StatusCodes).GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static)) 50 | { 51 | if (field.GetValue(null).Equals(number)) 52 | { 53 | return field.Name; 54 | } 55 | } 56 | 57 | return "0x" + number.ToString("X8"); 58 | } 59 | private static long ToCode(object value) 60 | { 61 | if (value == null) 62 | { 63 | return 0; 64 | } 65 | if (value is long code) 66 | { 67 | return code; 68 | } 69 | var field = value.GetType().GetField("Code"); 70 | if (field != null) 71 | { 72 | var fv = field.GetValue(value) as long?; 73 | if (fv != null) 74 | { 75 | return fv.Value; 76 | } 77 | } 78 | var property = value.GetType().GetProperty("Code"); 79 | if (property != null) 80 | { 81 | var pv = property.GetValue(value) as long?; 82 | if (pv != null) 83 | { 84 | return pv.Value; 85 | } 86 | } 87 | return 0; 88 | } 89 | } 90 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/Constant.cs: -------------------------------------------------------------------------------- 1 | class Placeholder 2 | { 3 | // ***START*** 4 | /// 5 | /// _Description_ 6 | /// 7 | public const _IdType_ _SymbolicId_ = _Identifier_; 8 | // ***END*** 9 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/Constant.csv: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | _ClassName__SymbolicId_,_Identifier_,"_Description_" 3 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/Constant.h: -------------------------------------------------------------------------------- 1 | class Placeholder 2 | { 3 | // ***START*** 4 | /*============================================================================ 5 | * _Description_ 6 | *===========================================================================*/ 7 | #define OpcUa_ClassName___SymbolicId_ _Identifier_ 8 | // ***END*** 9 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/DataTypes.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | using System; 32 | using System.Reflection; 33 | 34 | namespace _Prefix_ 35 | { 36 | /// 37 | /// A class that defines identifiers for datatypes. 38 | /// 39 | /// 40 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 41 | public static partial class DataTypes 42 | { 43 | // ListOfIdentifiers 44 | } 45 | 46 | /// 47 | /// A class that defines identifiers for datatype encodings. 48 | /// 49 | /// 50 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 51 | public static partial class Objects 52 | { 53 | // ListOfEncodings 54 | } 55 | } 56 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/DataTypes.h: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | #ifndef __FileName__H_ 32 | #define __FileName__H_ 1 33 | 34 | OPCUA_BEGIN_EXTERN_C 35 | 36 | // ListOfIdentifiers 37 | // ListOfEncodings 38 | 39 | OPCUA_END_EXTERN_C 40 | 41 | #endif /* __FileName__H_ */ 42 | 43 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/File.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | using System; 32 | using System.Reflection; 33 | 34 | namespace _Prefix_ 35 | { 36 | /// 37 | /// A class that defines constants used by UA applications. 38 | /// 39 | /// 40 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 41 | public static partial class _ClassName_ 42 | { 43 | // ListOfIdentifiers 44 | } 45 | } 46 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/File.csv: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | // ListOfIdentifiers 3 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/File.h: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | #ifndef __FileName__H_ 32 | #define __FileName__H_ 1 33 | 34 | OPCUA_BEGIN_EXTERN_C 35 | 36 | // ListOfIdentifiers 37 | 38 | OPCUA_END_EXTERN_C 39 | 40 | #endif /* __FileName__H_ */ 41 | /* This is the last line of an autogenerated file. */ 42 | // ***ENDAPPENDNEWLINE*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/JavaScript/Constant.js: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | _SymbolicId_: _Identifier_, 3 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/JavaScript/File.js: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | export const _ClassName_ = Object.freeze({ 3 | // ListOfIdentifiers 4 | }); 5 | // StatusCodeHelpers 6 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/JavaScript/StatusCode.js: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | export class StatusUtils { 3 | static toCode(value) { 4 | if (!value) return 0; 5 | let code = typeof value === 'number' ? value : undefined; 6 | if (code === undefined) { 7 | const field = value["code"]; 8 | code = typeof field === 'number' ? field : undefined; 9 | } 10 | return code ?? 0; 11 | } 12 | static toHex(code) { 13 | let text = code.toString(16).toUpperCase(); 14 | while (text.length < 8) { 15 | text = '0' + text; 16 | } 17 | return '0x' + text; 18 | } 19 | static isGood(value) { 20 | return (StatusUtils.toCode(value) & 0xD0000000) === 0; 21 | } 22 | static isUncertain(value) { 23 | return (StatusUtils.toCode(value) & 0x40000000) !== 0; 24 | } 25 | static isBad(value) { 26 | return (StatusUtils.toCode(value) & 0x80000000) !== 0; 27 | } 28 | static codeBits(value) { 29 | return (StatusUtils.toCode(value) ?? 0 & 0xFFFF0000); 30 | } 31 | static infoBits(value) { 32 | return (StatusUtils.toCode(value) ?? 0 & 0x0000FFFF); 33 | } 34 | static toText(value) { 35 | const code = StatusUtils.toCode(value); 36 | return Object.keys(StatusCodes).find(key => StatusCodes[key] === code) ?? StatusUtils.toHex(code); 37 | } 38 | } 39 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/Python/Constant.py: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | _SymbolicId_ = _Identifier_ 3 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/Python/File.py: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | from enum import Enum 3 | 4 | class _ClassName_(Enum): 5 | // ListOfIdentifiers 6 | 7 | def get__ClassName__name(value: int) -> str: 8 | try: 9 | return _ClassName_(value).name 10 | except ValueError: 11 | return None 12 | 13 | // StatusCodeHelpers 14 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/Python/StatusCode.py: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | class StatusUtils: 3 | @staticmethod 4 | def is_good(value) -> bool: 5 | code = value if isinstance(value, int) else None 6 | if (code is None): 7 | if hasattr(value, 'code'): 8 | code = value.code 9 | return code is None or (code & 0xD0000000) == 0 10 | 11 | @staticmethod 12 | def is_uncertain(value) -> bool: 13 | code = value if isinstance(value, int) else None 14 | if (code is None): 15 | if hasattr(value, 'code'): 16 | code = value.code 17 | return code is not None and (code & 0x40000000) != 0 18 | 19 | @staticmethod 20 | def is_bad(value) -> bool: 21 | code = value if isinstance(value, int) else None 22 | if (code is None): 23 | if hasattr(value, 'code'): 24 | code = value.code 25 | return code is not None and (code & 0x80000000) != 0 26 | 27 | @staticmethod 28 | def code_bits(value) -> int: 29 | code = value if isinstance(value, int) else None 30 | if (code is None): 31 | if hasattr(value, 'code'): 32 | code = value.code 33 | return (code & 0xFFFF0000) if code is not None else 0 34 | 35 | @staticmethod 36 | def info_bits(value) -> int: 37 | code = value if isinstance(value, int) else None 38 | if (code is None): 39 | if hasattr(value, 'code'): 40 | code = value.code 41 | return (code & 0x0000FFFF) if code is not None else 0 42 | 43 | @staticmethod 44 | def to_text(value) -> str: 45 | code = value if isinstance(value, int) else None 46 | if (code is None): 47 | if hasattr(value, 'symbol') and value.symbol: 48 | return value.symbol 49 | if hasattr(value, 'code'): 50 | code = value.code 51 | return StatusCodes(code or 0).name 52 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/TypeScript/Constant.ts: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | _SymbolicId_ = _Identifier_, 3 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/TypeScript/File.ts: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | export enum _ClassName_ { 3 | // ListOfIdentifiers 4 | } 5 | // StatusCodeHelpers 6 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Constants/TypeScript/StatusCode.ts: -------------------------------------------------------------------------------- 1 | export enum StatusCodes {} 2 | // ***START*** 3 | export class StatusUtils { 4 | public static toCode(value: number | object | undefined): number { 5 | if (!value) return 0; 6 | let code: number | undefined = typeof value === 'number' ? value : undefined; 7 | if (code === undefined) { 8 | const field = value["code"]; 9 | code = typeof field === 'number' ? field : undefined; 10 | } 11 | return code ?? 0; 12 | } 13 | public static toHex(code: number): string { 14 | let text: string = code.toString(16).toUpperCase(); 15 | while (text.length < 8) { 16 | text = '0' + text; 17 | } 18 | return '0x' + text; 19 | } 20 | public static isGood(value: number | object | undefined): boolean { 21 | return (StatusUtils.toCode(value) & 0xD0000000) === 0; 22 | } 23 | public static isUncertain(value: number | object | undefined): boolean { 24 | return (StatusUtils.toCode(value) & 0x40000000) !== 0; 25 | } 26 | public static isBad(value: number | object | undefined): boolean { 27 | return (StatusUtils.toCode(value) & 0x80000000) !== 0; 28 | } 29 | public static codeBits(value: number | object | undefined): number { 30 | return (StatusUtils.toCode(value) ?? 0 & 0xFFFF0000); 31 | } 32 | public static infoBits(value: number | object | undefined): number { 33 | return (StatusUtils.toCode(value) ?? 0 & 0x0000FFFF); 34 | } 35 | public static toText(value: number | object | undefined): string { 36 | const code = StatusUtils.toCode(value); 37 | return Object.keys(StatusCodes).find(key => StatusCodes[key] === code) ?? StatusUtils.toHex(code); 38 | } 39 | } 40 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Nodes/DataType.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Nodes/File.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | http://opcfoundation.org/UA/ 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Nodes/Service.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Nodes/ServiceType.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/Nodes/TypeDeclaration.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/XmlSchema/Array.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/XmlSchema/Binding.wsdl: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/XmlSchema/ComplexType.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | _Description_ 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/XmlSchema/DerivedType.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | _Description_ 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/XmlSchema/EnumeratedType.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | _Description_ 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/XmlSchema/File.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/XmlSchema/Message.wsdl: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/XmlSchema/PortType.wsdl: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/XmlSchema/ServiceType.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | _Description_ 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DataTypes/Templates/XmlSchema/Services.wsdl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/Channels/BinaryMethodAsync.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | class Placeholder 4 | { 5 | // ***START*** 6 | #if (!OPCUA_EXCLUDE__NAME_) 7 | /// 8 | /// Invokes the _NAME_ service. 9 | /// 10 | public _NAME_Response _NAME_(_NAME_Request request) 11 | { 12 | BinaryMessageContext context = CreateContext(); 13 | byte[] buffer = BinaryEncoder.EncodeMessage(request, context); 14 | 15 | InvokeServiceResponseMessage response = null; 16 | 17 | try 18 | { 19 | response = Channel.InvokeService(new InvokeServiceMessage(buffer)); 20 | } 21 | catch (FaultException e) 22 | { 23 | throw HandleSoapFault(e); 24 | } 25 | 26 | CheckForFault(response); 27 | 28 | return (_NAME_Response)BinaryDecoder.DecodeMessage(response.InvokeServiceResponse, typeof(_NAME_Response), context); 29 | } 30 | 31 | /// 32 | /// The client side implementation of the _NAME_ service contract. 33 | /// 34 | _NAME_ResponseMessage I_ServiceSet_Endpoint._NAME_(_NAME_Message request) 35 | { 36 | _NAME_Response response = _NAME_(request._NAME_Request); 37 | return new _NAME_ResponseMessage(response); 38 | } 39 | 40 | /// 41 | /// Invokes the _NAME_ service. 42 | /// 43 | public IAsyncResult Begin_NAME_(_NAME_Request request, AsyncCallback callback, object asyncState) 44 | { 45 | byte[] buffer = BinaryEncoder.EncodeMessage(request, CreateContext()); 46 | return Channel.BeginInvokeService(new InvokeServiceMessage(buffer), callback, asyncState); 47 | } 48 | 49 | /// 50 | /// The client side implementation of the Begin_NAME_ service contract. 51 | /// 52 | IAsyncResult I_ServiceSet_Channel.Begin_NAME_(_NAME_Message request, AsyncCallback callback, object asyncState) 53 | { 54 | return Begin_NAME_(request._NAME_Request, callback, asyncState); 55 | } 56 | 57 | /// 58 | /// The client side implementation of the End_NAME_ service contract. 59 | /// 60 | _NAME_ResponseMessage I_ServiceSet_Channel.End_NAME_(IAsyncResult result) 61 | { 62 | _NAME_Response response = End_NAME_(result); 63 | return new _NAME_ResponseMessage(response); 64 | } 65 | 66 | /// 67 | /// Completes the _NAME_ service. 68 | /// 69 | public _NAME_Response End_NAME_(IAsyncResult result) 70 | { 71 | InvokeServiceResponseMessage response = null; 72 | 73 | try 74 | { 75 | response = Channel.EndInvokeService(result); 76 | } 77 | catch (FaultException e) 78 | { 79 | throw HandleSoapFault(e); 80 | } 81 | 82 | CheckForFault(response); 83 | 84 | return (_NAME_Response)BinaryDecoder.DecodeMessage(response.InvokeServiceResponse, typeof(_NAME_Response), CreateContext()); 85 | } 86 | #endif 87 | // ***END*** 88 | } 89 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/Channels/File.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | using System; 32 | 33 | #if (!NET_STANDARD) 34 | using System.Collections.Generic; 35 | using System.Xml; 36 | using System.ServiceModel; 37 | using System.ServiceModel.Channels; 38 | using System.Runtime.Serialization; 39 | #endif 40 | 41 | #if (NET_STANDARD_ASYNC) 42 | using System.Threading.Tasks; 43 | #endif 44 | 45 | namespace _Prefix_ 46 | { 47 | // _SERVICESETS_ 48 | } 49 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/Channels/ServiceSet.cs: -------------------------------------------------------------------------------- 1 | namespace _Prefix_ 2 | { 3 | // ***START*** 4 | #region _ServiceSet_Channel Class 5 | /// 6 | /// A channel object used by clients to access a UA service. 7 | /// 8 | /// 9 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 10 | #if (!NET_STANDARD) 11 | public partial class _ServiceSet_Channel : WcfChannelBase, I_ServiceSet_Channel 12 | #else 13 | public partial class _ServiceSet_Channel : UaChannelBase, I_ServiceSet_Channel 14 | #endif 15 | { 16 | /// 17 | /// Initializes the object with the endpoint address. 18 | /// 19 | internal _ServiceSet_Channel() 20 | { 21 | } 22 | 23 | // _XmlChannelAsyncMethodList_ 24 | } 25 | #endregion 26 | // ***END*** 27 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/Classes/ClassCollection.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | 3 | #region _NAME_Collection Class 4 | /// 5 | /// A collection of _NAME_ objects. 6 | /// 7 | /// 8 | // _XMLARRAYTYPE_ 9 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 10 | public partial class _NAME_Collection : List<_NAME_>, ICloneable 11 | { 12 | #region Constructors 13 | /// 14 | /// Initializes the collection with default values. 15 | /// 16 | public _NAME_Collection() {} 17 | 18 | /// 19 | /// Initializes the collection with an initial capacity. 20 | /// 21 | public _NAME_Collection(int capacity) : base(capacity) {} 22 | 23 | /// 24 | /// Initializes the collection with another collection. 25 | /// 26 | public _NAME_Collection(IEnumerable<_NAME_> collection) : base(collection) {} 27 | #endregion 28 | 29 | #region Static Operators 30 | /// 31 | /// Converts an array to a collection. 32 | /// 33 | public static implicit operator _NAME_Collection(_NAME_[] values) 34 | { 35 | if (values != null) 36 | { 37 | return new _NAME_Collection(values); 38 | } 39 | 40 | return new _NAME_Collection(); 41 | } 42 | 43 | /// 44 | /// Converts an array to a collection. 45 | /// 46 | public static _NAME_Collection To_NAME_Collection(_NAME_[] values) 47 | { 48 | if (values != null) 49 | { 50 | return new _NAME_Collection(values); 51 | } 52 | 53 | return new _NAME_Collection(); 54 | } 55 | 56 | /// 57 | /// Converts a collection to an array. 58 | /// 59 | public static explicit operator _NAME_[](_NAME_Collection values) 60 | { 61 | if (values != null) 62 | { 63 | return values.ToArray(); 64 | } 65 | 66 | return null; 67 | } 68 | 69 | /// 70 | /// Converts a collection to an array. 71 | /// 72 | public static _NAME_[] From_NAME_Collection(_NAME_Collection values) 73 | { 74 | if (values != null) 75 | { 76 | return values.ToArray(); 77 | } 78 | 79 | return null; 80 | } 81 | #endregion 82 | 83 | #region ICloneable Methods 84 | /// 85 | /// Creates a deep copy of the collection. 86 | /// 87 | public object Clone() 88 | { 89 | _NAME_Collection clone = new _NAME_Collection(this.Count); 90 | 91 | foreach (_NAME_ element in this) 92 | { 93 | if (element != null) 94 | { 95 | clone.Add((_NAME_)element.Clone()); 96 | } 97 | else 98 | { 99 | clone.Add(null); 100 | } 101 | } 102 | 103 | return clone; 104 | } 105 | #endregion 106 | } 107 | #endregion 108 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/Classes/Enumeration.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | #region _NAME_ Enumeration 3 | #if (!OPCUA_EXCLUDE__NAME_) 4 | /// 5 | /// The _NAME_ enumeration. 6 | /// 7 | /// 8 | // _XMLTYPE_ 9 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 10 | public enum _NAME_ 11 | { 12 | // _VALUELIST_ 13 | } 14 | // _ENUMCOLLECTIONCLASS_ 15 | #endif 16 | #endregion 17 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/Classes/EnumerationCollection.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | 3 | #region _NAME_Collection Class 4 | /// 5 | /// A collection of _NAME_ objects. 6 | /// 7 | /// 8 | // _XMLARRAYTYPE_ 9 | public partial class _NAME_Collection : List<_NAME_>, ICloneable 10 | { 11 | #region Constructors 12 | /// 13 | /// Initializes the collection with default values. 14 | /// 15 | public _NAME_Collection() {} 16 | 17 | /// 18 | /// Initializes the collection with an initial capacity. 19 | /// 20 | public _NAME_Collection(int capacity) : base(capacity) {} 21 | 22 | /// 23 | /// Initializes the collection with another collection. 24 | /// 25 | public _NAME_Collection(IEnumerable<_NAME_> collection) : base(collection) {} 26 | #endregion 27 | 28 | #region Static Operators 29 | /// 30 | /// Converts an array to a collection. 31 | /// 32 | public static implicit operator _NAME_Collection(_NAME_[] values) 33 | { 34 | if (values != null) 35 | { 36 | return new _NAME_Collection(values); 37 | } 38 | 39 | return new _NAME_Collection(); 40 | } 41 | 42 | /// 43 | /// Converts an array to a collection. 44 | /// 45 | public static _NAME_Collection To_NAME_Collection(_NAME_[] values) 46 | { 47 | if (values != null) 48 | { 49 | return new _NAME_Collection(values); 50 | } 51 | 52 | return new _NAME_Collection(); 53 | } 54 | 55 | /// 56 | /// Converts a collection to an array. 57 | /// 58 | public static explicit operator _NAME_[](_NAME_Collection values) 59 | { 60 | if (values != null) 61 | { 62 | return values.ToArray(); 63 | } 64 | 65 | return null; 66 | } 67 | 68 | /// 69 | /// Converts a collection to an array. 70 | /// 71 | public static _NAME_[] From_NAME_Collection(_NAME_Collection values) 72 | { 73 | if (values != null) 74 | { 75 | return values.ToArray(); 76 | } 77 | 78 | return null; 79 | } 80 | #endregion 81 | 82 | #region ICloneable Methods 83 | /// 84 | /// Creates a deep copy of the collection. 85 | /// 86 | public object Clone() 87 | { 88 | return new _NAME_Collection(this); 89 | } 90 | #endregion 91 | } 92 | #endregion 93 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/Classes/EnumerationValue.cs: -------------------------------------------------------------------------------- 1 | enum Placeholder 2 | { 3 | // ***START*** 4 | /// 5 | /// _NAME_ = _VALUE_ 6 | /// 7 | // _XMLTYPE_ 8 | _NAME_ = _VALUE_ 9 | // ***END*** 10 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/Classes/EventType.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | #region _NAME_ Class 3 | /// 4 | /// The _NAME_ class. 5 | /// 6 | /// 7 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 8 | public partial class _NAME_ : _BASETYPE_ 9 | { 10 | #region Constructors 11 | /// 12 | /// The default constructor. 13 | /// 14 | public _NAME_() 15 | { 16 | Initialize(); 17 | } 18 | 19 | /// 20 | /// Sets private members to default values. 21 | /// 22 | private void Initialize() 23 | { 24 | // _DEFAULTLIST_ 25 | } 26 | #endregion 27 | 28 | #region Public Properties 29 | /// 30 | /// The identier for the EventType. 31 | /// 32 | public override ExpandedNodeId TypeId 33 | { 34 | get { return m_TypeId; } 35 | } 36 | 37 | private static ExpandedNodeId m_TypeId = new ExpandedNodeId(ObjectTypes._NAME_Type, Namespaces._Namespace_); 38 | 39 | // _PROPERTYLIST_ 40 | #endregion 41 | 42 | #region Overridden Methods 43 | /// 44 | /// Returns the valid of the field identified by the QualifiedName. 45 | /// 46 | public override object GetFieldValue( 47 | NamespaceTable namespaceUris, 48 | QualifiedName propertyName) 49 | { 50 | if (QualifiedName.IsNull(propertyName)) 51 | { 52 | return null; 53 | } 54 | 55 | // The namespace qualifying the property name must be the same namespace used for the TypeId. 56 | NodeId typeId = ExpandedNodeId.ToNodeId(_NAME_.m_TypeId, namespaceUris); 57 | 58 | // select the value. 59 | if (propertyName.NamespaceIndex == typeId.NamespaceIndex) 60 | { 61 | switch (propertyName.Name) 62 | { 63 | // _FIELDNAMESWITCH_ 64 | } 65 | } 66 | 67 | return base.GetFieldValue(namespaceUris, propertyName); 68 | } 69 | 70 | /// 71 | /// The BrowseNames for the fields defined by the type. 72 | /// 73 | public static new class Names 74 | { 75 | // _FIELDNAMES_ 76 | } 77 | #endregion 78 | 79 | #region Private Fields 80 | // _MEMBERLIST_ 81 | #endregion 82 | } 83 | #endregion 84 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/Classes/FieldValue.cs: -------------------------------------------------------------------------------- 1 | public partial class _NAME_ : _BASETYPE_ 2 | { 3 | // ***START*** 4 | #region GetFieldValue 5 | /// 6 | /// Returns the valid of the field identified by the QualifiedName. 7 | /// 8 | public override object GetFieldValue( 9 | NamespaceTable namespaceUris, 10 | QualifiedName propertyName) 11 | { 12 | if (QualifiedName.IsNull(propertyName)) 13 | { 14 | return null; 15 | } 16 | 17 | // The namespace qualifying the property name must be the same namespace used for the TypeId. 18 | NodeId typeId = ExpandedNodeId.ToNodeId(_NAME_.m_TypeId, namespaceUris); 19 | 20 | // select the value. 21 | if (propertyName.NamespaceIndex == typeId.NamespaceIndex) 22 | { 23 | switch (propertyName.Name) 24 | { 25 | // _FIELDNAMESWITCH_ 26 | } 27 | } 28 | 29 | return base.GetFieldValue(namespaceUris, propertyName); 30 | } 31 | 32 | /// 33 | /// The BrowseNames for the fields defined by the type. 34 | /// 35 | public static new class Names 36 | { 37 | // _FIELDNAMES_ 38 | } 39 | #endregion 40 | // ***END*** 41 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/Classes/File.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | using System; 32 | using System.Collections.Generic; 33 | #if (!NET_STANDARD) 34 | using System.Xml; 35 | using System.ServiceModel; 36 | using System.Runtime.Serialization; 37 | #endif 38 | 39 | namespace _Prefix_ 40 | { 41 | // _TypeList_ 42 | } 43 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/Classes/Property.cs: -------------------------------------------------------------------------------- 1 | class Placeholder 2 | { 3 | // ***START*** 4 | /// 5 | /// The _EXTERNALNAME_ property. 6 | /// 7 | // _XMLTYPE_ 8 | public _TYPE_ _EXTERNALNAME_ 9 | { 10 | get { return m__INTERNALNAME_; } 11 | set { m__INTERNALNAME_ = value; } 12 | } 13 | // ***END*** 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/Classes/PropertyArray.cs: -------------------------------------------------------------------------------- 1 | class Placeholder 2 | { 3 | // ***START*** 4 | /// 5 | /// The _EXTERNALNAME_ property. 6 | /// 7 | // _XMLTYPE_ 8 | public _TYPE_ _EXTERNALNAME_ 9 | { 10 | get { return m__INTERNALNAME_; } 11 | 12 | set 13 | { 14 | if (value != null) 15 | { 16 | m__INTERNALNAME_ = value; 17 | } 18 | else 19 | { 20 | m__INTERNALNAME_ = new _TYPE_(); 21 | } 22 | } 23 | } 24 | // ***END*** 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/ClientApi/File.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | using System; 32 | using System.Collections.Generic; 33 | 34 | #if (NET_STANDARD_ASYNC) 35 | using System.Threading; 36 | using System.Threading.Tasks; 37 | #endif 38 | 39 | namespace _Prefix_ 40 | { 41 | // _SERVICESETS_ 42 | } 43 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/ClientApi/Interface.cs: -------------------------------------------------------------------------------- 1 | class Placeholder 2 | { 3 | // ***START*** 4 | #region _NAME_ Methods 5 | #if (!OPCUA_EXCLUDE__NAME_) 6 | /// 7 | /// Invokes the _NAME_ service. 8 | /// 9 | void SyncCall(); 10 | 11 | /// 12 | /// Begins an asynchronous invocation of the _NAME_ service. 13 | /// 14 | void BeginAsyncCall(); 15 | 16 | /// 17 | /// Finishes an asynchronous invocation of the _NAME_ service. 18 | /// 19 | void EndAsyncCall(); 20 | 21 | #if (NET_STANDARD_ASYNC) 22 | /// 23 | /// Invokes the _NAME_ service using async Task based request. 24 | /// 25 | void AsyncCall(); 26 | #endif 27 | #endif 28 | #endregion 29 | // ***END*** 30 | } 31 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/ClientApi/ServiceSet.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace _Prefix_ 5 | { 6 | // ***START*** 7 | #region I_ServiceSet_ClientMethods Interface 8 | /// 9 | /// An interface used by by clients to access a UA server. 10 | /// 11 | /// 12 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 13 | public interface I_ServiceSet_ClientMethods 14 | { 15 | #region Client Interface 16 | // _ClientInterface_ 17 | #endregion 18 | } 19 | #endregion 20 | 21 | /// 22 | /// The client side interface for a UA server. 23 | /// 24 | /// 25 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 26 | public partial class _ServiceSet_Client : ClientBase, I_ServiceSet_ClientMethods 27 | { 28 | #region Constructors 29 | /// 30 | /// Intializes the object with a channel and a message context. 31 | /// 32 | public _ServiceSet_Client(ITransportChannel channel) 33 | : 34 | base(channel) 35 | { 36 | } 37 | #endregion 38 | 39 | #region Public Properties 40 | /// 41 | /// The component contains classes object use to communicate with the server. 42 | /// 43 | public new I_ServiceSet_Channel InnerChannel 44 | { 45 | get { return (I_ServiceSet_Channel)base.InnerChannel; } 46 | } 47 | #endregion 48 | 49 | #region Client API 50 | // _ClientApi_ 51 | #endregion 52 | } 53 | // ***END*** 54 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/Endpoints/File.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | using System; 32 | 33 | #if (!NET_STANDARD) 34 | using System.Collections.Generic; 35 | using System.Xml; 36 | using System.Threading; 37 | using System.Security.Principal; 38 | using System.ServiceModel; 39 | using System.Runtime.Serialization; 40 | #endif 41 | 42 | #if (NET_STANDARD_ASYNC) 43 | using System.Threading.Tasks; 44 | #endif 45 | 46 | namespace _Prefix_ 47 | { 48 | // _SERVICESETS_ 49 | } 50 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/Endpoints/ServiceSet.cs: -------------------------------------------------------------------------------- 1 | namespace _Prefix_ 2 | { 3 | // ***START*** 4 | #region _ServiceSet_Endpoint Class 5 | /// 6 | /// A endpoint object used by clients to access a UA service. 7 | /// 8 | /// 9 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 10 | #if (!NET_STANDARD) 11 | [ServiceMessageContextBehavior()] 12 | [ServiceBehavior(Namespace = Namespaces._ServicesNamespace_, InstanceContextMode=InstanceContextMode.PerSession, ConcurrencyMode=ConcurrencyMode.Multiple)] 13 | #endif 14 | public partial class _ServiceSet_Endpoint : EndpointBase, _IEndpoints_ 15 | { 16 | #region Constructors 17 | /// 18 | /// Initializes the object when it is created by the WCF framework. 19 | /// 20 | public _ServiceSet_Endpoint() 21 | { 22 | this.CreateKnownTypes(); 23 | } 24 | 25 | /// 26 | /// Initializes the when it is created directly. 27 | /// 28 | public _ServiceSet_Endpoint(IServiceHostBase host) : base(host) 29 | { 30 | this.CreateKnownTypes(); 31 | } 32 | 33 | /// 34 | /// Initializes a new instance of the class. 35 | /// 36 | /// The server. 37 | public _ServiceSet_Endpoint(ServerBase server) : base(server) 38 | { 39 | this.CreateKnownTypes(); 40 | } 41 | #endregion 42 | 43 | #region Public Members 44 | /// 45 | /// The UA server instance that the endpoint is connected to. 46 | /// 47 | protected I_ServiceSet_Server ServerInstance 48 | { 49 | get 50 | { 51 | if (ServiceResult.IsBad(ServerError)) 52 | { 53 | throw new ServiceResultException(ServerError); 54 | } 55 | 56 | return ServerForContext as I_ServiceSet_Server; 57 | } 58 | } 59 | #endregion 60 | 61 | #region I_ServiceSet_Endpoint Members 62 | // _MethodList_ 63 | #endregion 64 | 65 | #region Protected Members 66 | /// 67 | /// Populates the known types table. 68 | /// 69 | protected virtual void CreateKnownTypes() 70 | { 71 | // AddKnownType 72 | } 73 | #endregion 74 | } 75 | #endregion 76 | // ***END*** 77 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/Interfaces/File.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | using System; 32 | 33 | #if (!NET_STANDARD) 34 | using System.Collections.Generic; 35 | using System.Xml; 36 | using System.ServiceModel; 37 | using System.Runtime.Serialization; 38 | #endif 39 | 40 | #if (NET_STANDARD_ASYNC) 41 | using System.Threading.Tasks; 42 | #endif 43 | 44 | namespace _Prefix_ 45 | { 46 | // _SERVICESETS_ 47 | } 48 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/Interfaces/Operation.cs: -------------------------------------------------------------------------------- 1 | class Placeholder 2 | { 3 | // ***START*** 4 | #if (!OPCUA_EXCLUDE__NAME_) 5 | /// 6 | /// The operation contract for the _NAME_ service. 7 | /// 8 | [OperationContract(Action = Namespaces._ServicesNamespace_ + "/_NAME_", ReplyAction = Namespaces._ServicesNamespace_ + "/_NAME_Response")] 9 | [FaultContract(typeof(ServiceFault), Action = Namespaces._ServicesNamespace_ + "/_NAME_Fault", Name="ServiceFault", Namespace=Namespaces._TypesNamespace_)] 10 | _NAME_ResponseMessage _NAME_(_NAME_Message request); 11 | #endif 12 | // ***END*** 13 | } 14 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/Interfaces/OperationAsync.cs: -------------------------------------------------------------------------------- 1 | class Placeholder 2 | { 3 | // ***START*** 4 | #if (!OPCUA_EXCLUDE__NAME_) 5 | /// 6 | /// The operation contract for the _NAME_ service. 7 | /// 8 | #if (!NET_STANDARD) 9 | [OperationContract(Action = Namespaces._ServicesNamespace_ + "/_NAME_", ReplyAction = Namespaces._ServicesNamespace_ + "/_NAME_Response")] 10 | [FaultContract(typeof(ServiceFault), Action = Namespaces._ServicesNamespace_ + "/_NAME_Fault", Name="ServiceFault", Namespace=Namespaces._TypesNamespace_)] 11 | #endif 12 | _NAME_ResponseMessage _NAME_(_NAME_Message request); 13 | 14 | /// 15 | /// The operation contract for the _NAME_ service. 16 | /// 17 | #if (!NET_STANDARD) 18 | [OperationContractAttribute(AsyncPattern=true, Action=Namespaces._ServicesNamespace_ + "/_NAME_", ReplyAction = Namespaces._ServicesNamespace_ + "/_NAME_Response")] 19 | #endif 20 | IAsyncResult Begin_NAME_(_NAME_Message request, AsyncCallback callback, object asyncState); 21 | 22 | /// 23 | /// The method used to retrieve the results of a _NAME_ service request. 24 | /// 25 | _NAME_ResponseMessage End_NAME_(IAsyncResult result); 26 | 27 | #if (NET_STANDARD_ASYNC) 28 | /// 29 | /// The async operation contract for the _NAME_ service. 30 | /// 31 | Task<_NAME_ResponseMessage> _NAME_Async(_NAME_Message request); 32 | #endif 33 | #endif 34 | // ***END*** 35 | } 36 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/Interfaces/OperationAsyncEndpoint.cs: -------------------------------------------------------------------------------- 1 | class Placeholder 2 | { 3 | // ***START*** 4 | #if (!OPCUA_EXCLUDE__NAME_) 5 | /// 6 | /// The operation contract for the _NAME_ service. 7 | /// 8 | #if (!NET_STANDARD) 9 | [OperationContractAttribute(AsyncPattern=true, Action=Namespaces._ServicesNamespace_ + "/_NAME_", ReplyAction = Namespaces._ServicesNamespace_ + "/_NAME_Response")] 10 | [FaultContract(typeof(ServiceFault), Action = Namespaces._ServicesNamespace_ + "/_NAME_Fault", Name = "ServiceFault", Namespace = Namespaces._TypesNamespace_)] 11 | #endif 12 | IAsyncResult Begin_NAME_(_NAME_Message request, AsyncCallback callback, object asyncState); 13 | 14 | /// 15 | /// The method used to retrieve the results of a _NAME_ service request. 16 | /// 17 | _NAME_ResponseMessage End_NAME_(IAsyncResult result); 18 | 19 | #endif 20 | // ***END*** 21 | } 22 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/Interfaces/ServiceSet.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Xml; 4 | using System.ServiceModel; 5 | using System.Runtime.Serialization; 6 | 7 | namespace _Prefix_ 8 | { 9 | // ***START*** 10 | #region I_ServiceSet_Endpoint Interface 11 | #if OPCUA_USE_SYNCHRONOUS_ENDPOINTS 12 | /// 13 | /// The service contract which must be implemented by all UA servers. 14 | /// 15 | /// 16 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 17 | [ServiceContract(Namespace = Namespaces._ServicesNamespace_)] 18 | public interface I_ServiceSet_Endpoint : IEndpointBase 19 | { 20 | // _OPERATIONLIST_ 21 | } 22 | #else 23 | /// 24 | /// The asynchronous service contract which must be implemented by UA servers. 25 | /// 26 | /// 27 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 28 | #if (!NET_STANDARD) 29 | [ServiceContract(Namespace = Namespaces._ServicesNamespace_)] 30 | #endif 31 | public interface I_ServiceSet_Endpoint : IEndpointBase 32 | { 33 | // _ASYNCENDPOINTOPERATIONLIST_ 34 | } 35 | #endif 36 | #endregion 37 | 38 | #region I_ServiceSet_Channel Interface 39 | /// 40 | /// An interface used by by clients to access a UA server. 41 | /// 42 | /// 43 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 44 | #if (!NET_STANDARD) 45 | [ServiceContract(Namespace = Namespaces._ServicesNamespace_)] 46 | #endif 47 | public interface I_ServiceSet_Channel : IChannelBase 48 | { 49 | // _ASYNCOPERATIONLIST_ 50 | } 51 | #endregion 52 | // ***END*** 53 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/ServerApi/File.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | using System; 32 | using System.Collections.Generic; 33 | 34 | namespace _Prefix_ 35 | { 36 | // _SERVICESETS_ 37 | } 38 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/ServerApi/InterfaceMethod.cs: -------------------------------------------------------------------------------- 1 | class Placeholder 2 | { 3 | // ***START*** 4 | #if (!OPCUA_EXCLUDE__NAME_) 5 | /// 6 | /// Invokes the _NAME_ service. 7 | /// 8 | void Interface(); 9 | #endif 10 | // ***END*** 11 | } 12 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/ServerApi/Method.cs: -------------------------------------------------------------------------------- 1 | class Placeholder 2 | { 3 | // ***START*** 4 | #if (!OPCUA_EXCLUDE__NAME_) 5 | /// 6 | /// Invokes the _NAME_ service. 7 | /// 8 | void Stub() 9 | { 10 | // ResponseParameters 11 | 12 | ValidateRequest(requestHeader); 13 | 14 | // Insert implementation. 15 | 16 | return CreateResponse(requestHeader, StatusCodes.BadServiceUnsupported); 17 | } 18 | #endif 19 | // ***END*** 20 | } 21 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/DotNet/Templates/ServerApi/ServiceSet.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace _Prefix_ 5 | { 6 | // ***START*** 7 | #region I_ServiceSet_Server Interface 8 | /// 9 | /// An interface to a UA server implementation. 10 | /// 11 | /// 12 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 13 | public interface I_ServiceSet_Server : IServerBase 14 | { 15 | // _ServerApi_ 16 | } 17 | #endregion 18 | 19 | #region _ServiceSet_ServerBase Class 20 | /// 21 | /// A basic implementation of the UA server. 22 | /// 23 | /// 24 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 25 | public partial class _ServiceSet_ServerBase : ServerBase, I_ServiceSet_Server 26 | { 27 | // _ServerStubs_ 28 | } 29 | #endregion 30 | // ***END*** 31 | } 32 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/Namespaces.cs: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | namespace CodeGenerator 31 | { 32 | /// 33 | /// Defines well-known namespaces. 34 | /// 35 | public static class Namespaces 36 | { 37 | /// 38 | /// The XML Schema namespace. 39 | /// 40 | public const string XmlSchema = "http://www.w3.org/2001/XMLSchema"; 41 | 42 | /// 43 | /// The XML Schema Instance namespace. 44 | /// 45 | public const string XmlSchemaInstance = "http://www.w3.org/2001/XMLSchema-instance"; 46 | 47 | /// 48 | /// The base URI for all UA related namespaces. 49 | /// 50 | public const string OpcUa = "http://opcfoundation.org/UA/"; 51 | 52 | /// 53 | /// The URI for the built-in types namespace. 54 | /// 55 | public const string OpcUaBuiltInTypes = OpcUa + "BuiltInTypes/"; 56 | 57 | /// 58 | /// The URI for the built-in nodes namespace. 59 | /// 60 | public const string OpcUaBuiltInNodes = OpcUa + "BuiltInNodes/"; 61 | 62 | /// 63 | /// The URI for the OPC Binary Schema. 64 | /// 65 | public const string OpcBinarySchema = "http://opcfoundation.org/BinarySchema/"; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/Validators/BuiltInTypes.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/Validators/TypeDictionary.cs: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | using System.Xml; 31 | using System.Xml.Serialization; 32 | 33 | namespace CodeGenerator 34 | { 35 | /// 36 | /// A description of type, 37 | /// 38 | public partial class DataType 39 | { 40 | /// 41 | /// The qualifed name for the data type. 42 | /// 43 | [XmlIgnore()] 44 | public XmlQualifiedName QName 45 | { 46 | get { return m_qname; } 47 | set { m_qname = value; } 48 | } 49 | 50 | 51 | public override string ToString() 52 | { 53 | if (m_qname != null) 54 | { 55 | return m_qname.Name; 56 | } 57 | 58 | return base.ToString(); 59 | } 60 | 61 | private XmlQualifiedName m_qname; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/Wireshark/Template/complexparserfunction.c: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | 3 | gint ett_opcua__NAME_ = -1; 4 | void parse_NAME_(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, char *szFieldName) 5 | { 6 | proto_item *ti = proto_tree_add_text(tree, tvb, 0, -1, "%s : _NAME_", szFieldName); 7 | proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua__NAME_); 8 | // _BASE_ 9 | // _FIELDS_ 10 | } 11 | 12 | // ***END*** 13 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/Wireshark/Template/enumparser.c: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | 3 | /** _NAME_ enum table */ 4 | static const value_string g__NAME_Table[] = { 5 | // _ENTRY_ 6 | { 0, NULL } 7 | }; 8 | static int hf_opcua__NAME_ = -1; 9 | 10 | void parse_NAME_(proto_tree *tree, tvbuff_t *tvb, gint *pOffset) 11 | { 12 | proto_tree_add_item(tree, hf_opcua__NAME_, tvb, *pOffset, 4, TRUE); *pOffset+=4; 13 | } 14 | 15 | // ***END*** 16 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/Wireshark/Template/enumregisterinfo.c: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | { &hf_opcua__NAME_, 3 | { "_NAME_", "", FT_UINT32, BASE_HEX, VALS(g__NAME_Table), 0x0, "", HFILL } 4 | } 5 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/Wireshark/Template/hfentries.c: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /****************************************************************************** 3 | ** $Id$ 4 | ** 5 | ** Copyright (C) 2006-2008 ascolab GmbH. All Rights Reserved. 6 | ** Web: http://www.ascolab.com 7 | ** 8 | ** This program is free software; you can redistribute it and/or 9 | ** modify it under the terms of the GNU General Public License 10 | ** as published by the Free Software Foundation; either version 2 11 | ** of the License, or (at your option) any later version. 12 | ** 13 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 14 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 15 | ** 16 | ** Project: OpcUa Wireshark Plugin 17 | ** 18 | ** Description: This file contains protocol field information. 19 | ** 20 | ** DON'T MODIFY THIS FILE! 21 | ** 22 | ******************************************************************************/ 23 | 24 | #ifdef HAVE_CONFIG_H 25 | # include "config.h" 26 | #endif 27 | 28 | #include 29 | #include 30 | 31 | // _INDECES_ 32 | 33 | /** header field definitions */ 34 | static hf_register_info hf[] = 35 | { 36 | 37 | // _FIELDS_ 38 | }; 39 | 40 | /** Register field types. */ 41 | void registerFieldTypes(int proto) 42 | { 43 | proto_register_field_array(proto, hf, array_length(hf)); 44 | } 45 | 46 | // ***END*** 47 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/Wireshark/Template/hfentries.h: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /****************************************************************************** 3 | ** $Id$ 4 | ** 5 | ** Copyright (C) 2006-2008 ascolab GmbH. All Rights Reserved. 6 | ** Web: http://www.ascolab.com 7 | ** 8 | ** This program is free software; you can redistribute it and/or 9 | ** modify it under the terms of the GNU General Public License 10 | ** as published by the Free Software Foundation; either version 2 11 | ** of the License, or (at your option) any later version. 12 | ** 13 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 14 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 15 | ** 16 | ** Project: OpcUa Wireshark Plugin 17 | ** 18 | ** Description: This file contains protocol field handles. 19 | ** 20 | ** DON'T MODIFY THIS FILE! 21 | ** 22 | ******************************************************************************/ 23 | 24 | #ifdef HAVE_CONFIG_H 25 | # include "config.h" 26 | #endif 27 | 28 | #include 29 | #include 30 | 31 | // _EXTERNINDECES_ 32 | 33 | /** Register field types. */ 34 | void registerFieldTypes(int proto); 35 | 36 | // ***END*** 37 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/Wireshark/Template/opcua_identifiers.h: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /****************************************************************************** 3 | ** $Id$ 4 | ** 5 | ** Copyright (C) 2006-2008 ascolab GmbH. All Rights Reserved. 6 | ** Web: http://www.ascolab.com 7 | ** 8 | ** This program is free software; you can redistribute it and/or 9 | ** modify it under the terms of the GNU General Public License 10 | ** as published by the Free Software Foundation; either version 2 11 | ** of the License, or (at your option) any later version. 12 | ** 13 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 14 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 15 | ** 16 | ** Project: OpcUa Wireshark Plugin 17 | ** 18 | ** Description: Parser type definitions. 19 | ** 20 | ** DON'T MODIFY THIS FILE! 21 | ** 22 | ******************************************************************************/ 23 | 24 | #ifdef HAVE_CONFIG_H 25 | # include "config.h" 26 | #endif 27 | 28 | #include 29 | #include 30 | 31 | /* declare service parser function prototype */ 32 | typedef void (*fctServiceParser)(proto_tree *tree, tvbuff_t *tvb, gint *pOffset); 33 | /* declare enum parser function prototype */ 34 | typedef void (*fctEnumParser)(proto_tree *tree, tvbuff_t *tvb, gint *pOffset); 35 | /* declare type parser function prototype */ 36 | typedef void (*fctComplexTypeParser)(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, char *szFieldName); 37 | /* declare type parser function prototype */ 38 | typedef void (*fctSimpleTypeParser)(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex); 39 | 40 | typedef struct _ParserEntry 41 | { 42 | int iRequestId; 43 | fctServiceParser pParser; 44 | } ParserEntry; 45 | 46 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/Wireshark/Template/serviceparserfunction.c: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | 3 | gint ett_opcua__NAME_ = -1; 4 | void parse_NAME_(proto_tree *tree, tvbuff_t *tvb, gint *pOffset) 5 | { 6 | proto_item *ti = proto_tree_add_text(tree, tvb, 0, -1, "_NAME_"); 7 | proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua__NAME_); 8 | 9 | // _FIELDS_ 10 | } 11 | 12 | // ***END*** 13 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/StackGenerator/Wireshark/Template/servicetable.c: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /****************************************************************************** 3 | ** $Id$ 4 | ** 5 | ** Copyright (C) 2006-2008 ascolab GmbH. All Rights Reserved. 6 | ** Web: http://www.ascolab.com 7 | ** 8 | ** This program is free software; you can redistribute it and/or 9 | ** modify it under the terms of the GNU General Public License 10 | ** as published by the Free Software Foundation; either version 2 11 | ** of the License, or (at your option) any later version. 12 | ** 13 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 14 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 15 | ** 16 | ** Project: OpcUa Wireshark Plugin 17 | ** 18 | ** Description: Service table and service dispatcher. 19 | ** 20 | ** DON'T MODIFY THIS FILE! 21 | ** 22 | ******************************************************************************/ 23 | 24 | #ifdef HAVE_CONFIG_H 25 | # include "config.h" 26 | #endif 27 | 28 | #include 29 | #include 30 | #include "opcua_identifiers.h" 31 | #include "opcua_serviceparser.h" 32 | 33 | ParserEntry g_arParserTable[] = { 34 | 35 | // _PARSER_ENTRY_ 36 | }; 37 | const int g_NumServices = sizeof(g_arParserTable) / sizeof(ParserEntry); 38 | 39 | /** Service type table */ 40 | const value_string g_requesttypes[] = { 41 | // _REQUEST_ENTRY_ 42 | { 0, NULL } 43 | }; 44 | 45 | /** Dispatch all services to a special parser function. */ 46 | void dispatchService(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int ServiceId) 47 | { 48 | int index = 0; 49 | 50 | while (index < g_NumServices) 51 | { 52 | if (g_arParserTable[index].iRequestId == ServiceId) 53 | { 54 | (*g_arParserTable[index].pParser)(tree, tvb, pOffset); 55 | break; 56 | } 57 | index++; 58 | } 59 | } 60 | 61 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/BinarySchema/ComplexType.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/BinarySchema/EnumeratedType.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/BinarySchema/File.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/BinarySchema/OpaqueType.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Types/Identifiers.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using System.Reflection; 6 | using System.IO; 7 | using System.Xml; 8 | // ListOfImports 9 | 10 | namespace _Namespace_ 11 | { 12 | /// 13 | /// Defines identifiers for all the ReferenceTypes defined in a model design. 14 | /// 15 | /// 16 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 17 | public static partial class ReferenceTypes 18 | { 19 | // ListOfReferenceTypes 20 | } 21 | 22 | /// 23 | /// Defines identifiers for all the DataTypes defined in a model design. 24 | /// 25 | /// 26 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 27 | public static partial class DataTypes 28 | { 29 | // ListOfDataTypes 30 | } 31 | 32 | /// 33 | /// Defines identifiers for all the ObjectTypes defined in a model design. 34 | /// 35 | /// 36 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 37 | public static partial class ObjectTypes 38 | { 39 | // ListOfObjectTypes 40 | // ListOfEventTypes 41 | } 42 | 43 | /// 44 | /// Defines identifiers for all the VariableTypes defined in a model design. 45 | /// 46 | /// 47 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 48 | public static partial class VariableTypes 49 | { 50 | // ListOfVariableTypes 51 | } 52 | 53 | /// 54 | /// Defines identifiers for all the Objects defined in a model design. 55 | /// 56 | /// 57 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 58 | public static partial class Objects 59 | { 60 | // ListOfObjects 61 | } 62 | 63 | /// 64 | /// Defines identifiers for all the Variables defined in a model design. 65 | /// 66 | /// 67 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 68 | public static partial class Variables 69 | { 70 | // ListOfVariables 71 | } 72 | } 73 | // ***END*** 74 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Types/Identifiers.h: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | #ifndef __FileName__H_ 32 | #define __FileName__H_ 1 33 | 34 | // ListOfIdentifiers 35 | 36 | #endif /* __FileName__H_ */ 37 | /* This is the last line of an autogenerated file. */ 38 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Types/Name.cs: -------------------------------------------------------------------------------- 1 | class _Name_ { 2 | // ***START*** 3 | /// 4 | /// The browse name for the _SymbolicId_ node. 5 | /// 6 | public const string _SymbolicId_ = "_BrowseName_"; 7 | // ***END*** 8 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Types/Names.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | // ListOfImports 6 | 7 | namespace _Namespace_ 8 | { 9 | /// 10 | /// Defines constants for all names in the model. 11 | /// 12 | /// 13 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 14 | public static partial class Names 15 | { 16 | // ListOfNames 17 | } 18 | } 19 | // ***END*** 20 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Types/NamespaceUri.cs: -------------------------------------------------------------------------------- 1 | class _Name_ { 2 | // ***START*** 3 | /// 4 | /// The URI for the _Name_ namespace (.NET code namespace is '_CodeName_'). 5 | /// 6 | public const string _Name_ = "_NamespaceUri_"; 7 | // ***END*** 8 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Types/Namespaces.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using System.Reflection; 6 | using System.IO; 7 | using System.Xml; 8 | // ListOfImports 9 | 10 | namespace _Namespace_ 11 | { 12 | /// 13 | /// Defines constants for all namespace referenced by the model design. 14 | /// 15 | /// 16 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 17 | public static partial class Namespaces 18 | { 19 | // ListOfNamespaceUris 20 | } 21 | } 22 | // ***END*** 23 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/BrowseName.cs: -------------------------------------------------------------------------------- 1 | class _Name_{ 2 | // ***START*** 3 | /// 4 | public const string _SymbolicName_ = "_BrowseName_"; 5 | // ***END*** 6 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/CSharp/BrowseName.cs: -------------------------------------------------------------------------------- 1 | export class BrowseNames { 2 | // ***START*** 3 | /// 4 | public const string _Key_ = "_Value_"; 5 | // ***END*** 6 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/CSharp/BuiltInTypes.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /// 3 | /// The built-in data types. 4 | /// 5 | public enum BuiltInType { 6 | /// 7 | Null = 0, 8 | /// 9 | Boolean = 1, 10 | /// 11 | SByte = 2, 12 | /// 13 | Byte = 3, 14 | /// 15 | Int16 = 4, 16 | /// 17 | UInt16 = 5, 18 | /// 19 | Int32 = 6, 20 | /// 21 | UInt32 = 7, 22 | /// 23 | Int64 = 8, 24 | /// 25 | UInt64 = 9, 26 | /// 27 | Float = 10, 28 | /// 29 | Double = 11, 30 | /// 31 | String = 12, 32 | /// 33 | DateTime = 13, 34 | /// 35 | Guid = 14, 36 | /// 37 | ByteString = 15, 38 | /// 39 | XmlElement = 16, 40 | /// 41 | NodeId = 17, 42 | /// 43 | ExpandedNodeId = 18, 44 | /// 45 | StatusCode = 19, 46 | /// 47 | QualifiedName = 20, 48 | /// 49 | LocalizedText = 21, 50 | /// 51 | ExtensionObject = 22, 52 | /// 53 | DataValue = 23, 54 | /// 55 | Variant = 24, 56 | /// 57 | DiagnosticInfo = 25, 58 | /// 59 | Number = 26, 60 | /// 61 | Integer = 27, 62 | /// 63 | UInteger = 28, 64 | /// 65 | Enumeration = 29 66 | } 67 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/CSharp/ConstantsFile.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | namespace _NamespacePrefix_.WebApi 3 | { 4 | /// 5 | /// The namespaces used in the model. 6 | /// 7 | public static class Namespaces 8 | { 9 | /// 10 | public const string Uri = "_NamespaceUri_"; 11 | } 12 | 13 | /// 14 | /// The browse names defined in the model. 15 | /// 16 | public static class BrowseNames 17 | { 18 | // ListOfBrowseNames 19 | } 20 | 21 | // ListOfNodeIds 22 | // BuiltInTypes 23 | } 24 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/CSharp/Identifier.cs: -------------------------------------------------------------------------------- 1 | export class Identifiers { 2 | // ***START*** 3 | /// 4 | public const string _Key_ = "nsu=" + Namespaces.Uri + ";_Value_"; 5 | // ***END*** 6 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/CSharp/Identifier_NoNamespace.cs: -------------------------------------------------------------------------------- 1 | export class Identifiers { 2 | // ***START*** 3 | /// 4 | public const string _Key_ = "_Value_"; 5 | // ***END*** 6 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/CSharp/NodeIdClass.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /// 3 | /// The well known identifiers for _NodeClass_ nodes. 4 | /// 5 | public static class _NodeClass_Ids { 6 | // ListOfIdentifiers 7 | 8 | /// 9 | /// Converts a value to a name for display. 10 | /// 11 | public static string ToName(string value) 12 | { 13 | foreach (var field in typeof(_NodeClass_Ids).GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static)) 14 | { 15 | if (field.GetValue(null).Equals(value)) 16 | { 17 | return field.Name; 18 | } 19 | } 20 | 21 | return value.ToString(); 22 | } 23 | } 24 | // ***END*** 25 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/ConstantsFile.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | using System; 32 | using System.Collections.Generic; 33 | using System.Text; 34 | using System.Reflection; 35 | using System.Xml; 36 | using System.Runtime.Serialization; 37 | // ListOfImports 38 | 39 | namespace _Namespace_ 40 | { 41 | // ListOfIdentifiers 42 | 43 | // ListOfNodeIds 44 | 45 | #region BrowseName Declarations 46 | /// 47 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 48 | public static partial class BrowseNames 49 | { 50 | // ListOfBrowseNames 51 | } 52 | #endregion 53 | 54 | #region Namespace Declarations 55 | /// 56 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 57 | public static partial class Namespaces 58 | { 59 | // ListOfNamespaceUris 60 | } 61 | #endregion 62 | } 63 | // ***END*** 64 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/DataTypes/ArrayProperty.cs: -------------------------------------------------------------------------------- 1 | class _Name_{ 2 | // ***START*** 3 | /// 4 | [DataMember(Name = "_BrowseName_", IsRequired = _IsRequired_, EmitDefaultValue = _EmitDefaultValue_, Order = _FieldIndex_)] 5 | public _TypeName_ _BrowseName_ 6 | { 7 | get 8 | { 9 | return _FieldName_; 10 | } 11 | 12 | set 13 | { 14 | _FieldName_ = value; 15 | 16 | if (value == null) 17 | { 18 | _FieldName_ = _DefaultValue_; 19 | } 20 | } 21 | } 22 | // ***END*** 23 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/DataTypes/CollectionClass.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | #region _BrowseName_Collection Class 3 | /// 4 | /// 5 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 6 | [CollectionDataContract(Name = "ListOf_BrowseName_", Namespace = _XmlNamespaceUri_, ItemName = "_BrowseName_")] 7 | public partial class _BrowseName_Collection : List<_BrowseName_>, ICloneable 8 | { 9 | #region Constructors 10 | /// 11 | public _BrowseName_Collection() {} 12 | 13 | /// 14 | public _BrowseName_Collection(int capacity) : base(capacity) {} 15 | 16 | /// 17 | public _BrowseName_Collection(IEnumerable<_BrowseName_> collection) : base(collection) {} 18 | #endregion 19 | 20 | #region Static Operators 21 | /// 22 | public static implicit operator _BrowseName_Collection(_BrowseName_[] values) 23 | { 24 | if (values != null) 25 | { 26 | return new _BrowseName_Collection(values); 27 | } 28 | 29 | return new _BrowseName_Collection(); 30 | } 31 | 32 | /// 33 | public static explicit operator _BrowseName_[](_BrowseName_Collection values) 34 | { 35 | if (values != null) 36 | { 37 | return values.ToArray(); 38 | } 39 | 40 | return null; 41 | } 42 | #endregion 43 | 44 | #region ICloneable Methods 45 | /// 46 | public object Clone() 47 | { 48 | return (_BrowseName_Collection)this.MemberwiseClone(); 49 | } 50 | #endregion 51 | 52 | /// 53 | public new object MemberwiseClone() 54 | { 55 | _BrowseName_Collection clone = new _BrowseName_Collection(this.Count); 56 | 57 | for (int ii = 0; ii < this.Count; ii++) 58 | { 59 | clone.Add((_BrowseName_)Utils.Clone(this[ii])); 60 | } 61 | 62 | return clone; 63 | } 64 | } 65 | #endregion 66 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/DataTypes/Enumeration.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | #region _BrowseName_ Enumeration 3 | #if (!OPCUA_EXCLUDE__BrowseName_) 4 | /// 5 | /// 6 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 7 | [DataContract(Namespace = _XmlNamespaceUri_)][Flags] 8 | public enum _BrowseName_ : _BasicType_ 9 | { 10 | // ListOfProperties 11 | } 12 | // CollectionClass 13 | #endif 14 | #endregion 15 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/DataTypes/EnumerationValue.cs: -------------------------------------------------------------------------------- 1 | enum Placeholder { 2 | // ***START*** 3 | /// 4 | [EnumMember(Value = "_XmlIdentifier_")] 5 | _BrowseName_ = _Identifier_, 6 | // ***END*** 7 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/DataTypes/Property.cs: -------------------------------------------------------------------------------- 1 | class _Name_{ 2 | // ***START*** 3 | /// 4 | [DataMember(Name = "_BrowseName_", IsRequired = _IsRequired_, EmitDefaultValue = _EmitDefaultValue_, Order = _FieldIndex_)] 5 | public _TypeName_ _BrowseName_ 6 | { 7 | get { return _FieldName_; } 8 | set { _FieldName_ = value; } 9 | } 10 | // ***END*** 11 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/File.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | using System; 32 | using System.Collections.Generic; 33 | using System.Text; 34 | using System.Xml; 35 | using System.Runtime.Serialization; 36 | // ListOfImports 37 | 38 | namespace _Namespace_ 39 | { 40 | // ListOfIdentifiers 41 | 42 | // ListOfNodeIds 43 | 44 | #region BrowseName Declarations 45 | /// 46 | public static partial class BrowseNames 47 | { 48 | // ListOfBrowseNames 49 | } 50 | #endregion 51 | 52 | #region Namespace Declarations 53 | /// 54 | public static partial class Namespaces 55 | { 56 | // ListOfNamespaceUris 57 | } 58 | #endregion 59 | 60 | // ListOfTypes 61 | } 62 | // ***END*** 63 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/FindChildCase.cs: -------------------------------------------------------------------------------- 1 | class _Name_{ public void Method(int x) { switch (x) { 2 | // ***START*** 3 | case _BrowseNameNamespacePrefix_.BrowseNames._ChildName_: 4 | { 5 | if (createOrReplace) 6 | { 7 | if (_ChildName_ == null) 8 | { 9 | if (replacement == null) 10 | { 11 | _ChildName_ = new _ClassName_(this); 12 | } 13 | else 14 | { 15 | _ChildName_ = (_ClassName_)replacement; 16 | } 17 | } 18 | } 19 | 20 | instance = _ChildName_; 21 | break; 22 | } 23 | // ***END*** 24 | } } } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/FindChildMethods.cs: -------------------------------------------------------------------------------- 1 | class _Name_{ 2 | // ***START*** 3 | /// 4 | public override void GetChildren( 5 | ISystemContext context, 6 | IList children) 7 | { 8 | // ListOfFindChildren 9 | 10 | base.GetChildren(context, children); 11 | } 12 | 13 | /// 14 | protected override BaseInstanceState FindChild( 15 | ISystemContext context, 16 | QualifiedName browseName, 17 | bool createOrReplace, 18 | BaseInstanceState replacement) 19 | { 20 | if (QualifiedName.IsNull(browseName)) 21 | { 22 | return null; 23 | } 24 | 25 | BaseInstanceState instance = null; 26 | 27 | switch (browseName.Name) 28 | { 29 | // ListOfFindChildCase 30 | } 31 | 32 | if (instance != null) 33 | { 34 | return instance; 35 | } 36 | 37 | return base.FindChild(context, browseName, createOrReplace, replacement); 38 | } 39 | // ***END*** 40 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/FindChildren.cs: -------------------------------------------------------------------------------- 1 | class _Name_{ public void Method() { 2 | // ***START*** 3 | if (_FieldName_ != null) 4 | { 5 | children.Add(_FieldName_); 6 | } 7 | // ***END*** 8 | } } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/IdClass.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | #region _NodeClass_ Identifiers 3 | /// 4 | /// 5 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 6 | public static partial class _NodeClass_s 7 | { 8 | // ListOfIdentifiers 9 | } 10 | #endregion 11 | // ***END*** 12 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/IdDeclaration.cs: -------------------------------------------------------------------------------- 1 | class _Name_{ 2 | // ***START*** 3 | /// 4 | public const _IdType_ _SymbolicName_ = _Identifier_; 5 | // ***END*** 6 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/InitializeOptionalChild.cs: -------------------------------------------------------------------------------- 1 | class _Name_{ public void Method(int x) { 2 | // ***START*** 3 | if (_ChildName_ != null) 4 | { 5 | _ChildName_.Initialize(context, _ChildName__InitializationString); 6 | } 7 | // ***END*** 8 | } } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/JavaScript/BrowseName.js: -------------------------------------------------------------------------------- 1 | export BrowseNames = Object.freeze({ 2 | // ***START*** 3 | _Key_: '_Value_', 4 | // ***END*** 5 | }); -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/JavaScript/BuiltInTypes.js: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | export const BuiltInType = Object.freeze({ 3 | Null: 0, 4 | Boolean: 1, 5 | SByte: 2, 6 | Byte: 3, 7 | Int16: 4, 8 | UInt16: 5, 9 | Int32: 6, 10 | UInt32: 7, 11 | Int64: 8, 12 | UInt64: 9, 13 | Float: 10, 14 | Double: 11, 15 | String: 12, 16 | DateTime: 13, 17 | Guid: 14, 18 | ByteString: 15, 19 | XmlElement: 16, 20 | NodeId: 17, 21 | ExpandedNodeId: 18, 22 | StatusCode: 19, 23 | QualifiedName: 20, 24 | LocalizedText: 21, 25 | ExtensionObject: 22, 26 | DataValue: 23, 27 | Variant: 24, 28 | DiagnosticInfo: 25, 29 | Number: 26, 30 | Integer: 27, 31 | UInteger: 28, 32 | Enumeration: 29 33 | }); 34 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/JavaScript/ConstantsFile.js: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | export const NS = '_NamespaceUri_'; 3 | 4 | export const BrowseNames = Object.freeze({ 5 | // ListOfBrowseNames 6 | }); 7 | 8 | // ListOfNodeIds 9 | // BuiltInTypes 10 | // ***END*** 11 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/JavaScript/Identifier.js: -------------------------------------------------------------------------------- 1 | export class BrowseNames { 2 | // ***START*** 3 | _Key_: 'nsu=' + NS + ';_Value_', 4 | // ***END*** 5 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/JavaScript/Identifier_NoNamespace.js: -------------------------------------------------------------------------------- 1 | export class BrowseNames { 2 | // ***START*** 3 | _Key_: '_Value_', 4 | // ***END*** 5 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/JavaScript/NodeIdClass.js: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | export const _NodeClass_Ids = Object.freeze({ 3 | // ListOfIdentifiers 4 | }); 5 | // ***END*** 6 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/MethodType.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | #region _ClassName_ Class 3 | #if (!OPCUA_EXCLUDE__ClassName_) 4 | /// 5 | /// 6 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 7 | public partial class _ClassName_ : MethodState 8 | { 9 | #region Constructors 10 | /// 11 | public _ClassName_(NodeState parent) : base(parent) 12 | { 13 | } 14 | 15 | /// 16 | public new static NodeState Construct(NodeState parent) 17 | { 18 | return new _ClassName_(parent); 19 | } 20 | 21 | #if (!OPCUA_EXCLUDE_InitializationStrings) 22 | /// 23 | protected override void Initialize(ISystemContext context) 24 | { 25 | base.Initialize(context); 26 | Initialize(context, InitializationString); 27 | InitializeOptionalChildren(context); 28 | } 29 | 30 | /// 31 | protected override void InitializeOptionalChildren(ISystemContext context) 32 | { 33 | base.InitializeOptionalChildren(context); 34 | // InitializeOptionalChildren 35 | } 36 | 37 | #region Initialization String 38 | // InitializationString 39 | #endregion 40 | #endif 41 | #endregion 42 | 43 | #region Event Callbacks 44 | /// 45 | public _ClassName_MethodCallHandler OnCall; 46 | #endregion 47 | 48 | #region Public Properties 49 | // ListOfProperties 50 | #endregion 51 | 52 | #region Overridden Methods 53 | /// 54 | protected override ServiceResult Call( 55 | ISystemContext _context, 56 | NodeId _objectId, 57 | IList _inputArguments, 58 | IList _outputArguments) 59 | { 60 | if (OnCall == null) 61 | { 62 | return base.Call(_context, _objectId, _inputArguments, _outputArguments); 63 | } 64 | 65 | ServiceResult _result = null; 66 | // ListOfInputArguments 67 | // ListOfOutputDeclarations 68 | 69 | if (OnCall != null) 70 | { 71 | _result = OnCall(_context); 72 | } 73 | // ListOfOutputArguments 74 | 75 | return _result; 76 | } 77 | // FindChildMethods 78 | #endregion 79 | 80 | #region Private Fields 81 | // ListOfFields 82 | #endregion 83 | } 84 | 85 | /// 86 | /// 87 | public delegate ServiceResult _ClassName_MethodCallHandler( 88 | _ISystemContext context_); 89 | #endif 90 | #endregion 91 | // ***END*** 92 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/NamespaceUri.cs: -------------------------------------------------------------------------------- 1 | class _Name_ { 2 | // ***START*** 3 | /// 4 | /// The URI for the _Name_ namespace (.NET code namespace is '_CodeName_'). 5 | /// 6 | public const string _Name_ = "_NamespaceUri_"; 7 | // ***END*** 8 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/NodeIdClass.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | #region _NodeClass_ Node Identifiers 3 | /// 4 | /// 5 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 6 | public static partial class _NodeClass_Ids 7 | { 8 | // ListOfIdentifiers 9 | } 10 | #endregion 11 | // ***END*** 12 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/NodeIdDeclaration.cs: -------------------------------------------------------------------------------- 1 | class _Name_{ 2 | // ***START*** 3 | /// 4 | public static readonly NodeId _SymbolicName_ = new NodeId(_NamespacePrefix_._NodeClass_s._SymbolicName_); 5 | // ***END*** 6 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/NodeIdDeclarationAbsolute.cs: -------------------------------------------------------------------------------- 1 | class _Name_{ 2 | // ***START*** 3 | /// 4 | public static readonly ExpandedNodeId _SymbolicName_ = new ExpandedNodeId(_NamespacePrefix_._NodeClass_s._SymbolicName_, _NamespaceUri_); 5 | // ***END*** 6 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/Property.cs: -------------------------------------------------------------------------------- 1 | class _Name_{ 2 | // ***START*** 3 | /// 4 | public new _ClassName_ _ChildName_ 5 | { 6 | get 7 | { 8 | return _FieldName_; 9 | } 10 | 11 | set 12 | { 13 | if (!Object.ReferenceEquals(_FieldName_, value)) 14 | { 15 | ChangeMasks |= NodeStateChangeMasks.Children; 16 | } 17 | 18 | _FieldName_ = value; 19 | } 20 | } 21 | // ***END*** 22 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/PropertyOverride.cs: -------------------------------------------------------------------------------- 1 | class _Name_{ 2 | // ***START*** 3 | /// 4 | public new _ClassName_ _ChildName_ 5 | { 6 | get { return (_ClassName_)base._ChildName_; } 7 | set { base._ChildName_ = value; } 8 | } 9 | // ***END*** 10 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/Python/BrowseName.py: -------------------------------------------------------------------------------- 1 | class BrowseNames(Enum): 2 | // ***START*** 3 | _Key_ = "_Value_" 4 | // ***END*** 5 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/Python/BuiltInTypes.py: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | class BuiltInType(Enum): 3 | Null = 0 4 | Boolean = 1 5 | SByte = 2 6 | Byte = 3 7 | Int16 = 4 8 | UInt16 = 5 9 | Int32 = 6 10 | UInt32 = 7 11 | Int64 = 8 12 | UInt64 = 9 13 | Float = 10 14 | Double = 11 15 | String = 12 16 | DateTime = 13 17 | Guid = 14 18 | ByteString = 15 19 | XmlElement = 16 20 | NodeId = 17 21 | ExpandedNodeId = 18 22 | StatusCode = 19 23 | QualifiedName = 20 24 | LocalizedText = 21 25 | ExtensionObject = 22 26 | DataValue = 23 27 | Variant = 24 28 | DiagnosticInfo = 25 29 | Number = 26 30 | Integer = 27 31 | UInteger = 28 32 | Enumeration = 29 33 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/Python/ConstantsFile.py: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | from enum import Enum 3 | 4 | class Namespaces(Enum): 5 | Uri = "_NamespaceUri_" 6 | 7 | class BrowseNames(Enum): 8 | // ListOfBrowseNames 9 | 10 | // ListOfNodeIds 11 | // BuiltInTypes 12 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/Python/Identifier.py: -------------------------------------------------------------------------------- 1 | class BrowseNames(Enum): 2 | // ***START*** 3 | _Key_ = "nsu=_Namespace_;_Value_" 4 | // ***END*** 5 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/Python/Identifier_NoNamespace.py: -------------------------------------------------------------------------------- 1 | class BrowseNames(Enum): 2 | // ***START*** 3 | _Key_ = "_Value_" 4 | // ***END*** 5 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/Python/NodeIdClass.py: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | class _NodeClass_Ids(Enum): 3 | // ListOfIdentifiers 4 | 5 | def get__NodeClass_Ids_name(value: str) -> str: 6 | try: 7 | return _NodeClass_Ids(value).name 8 | except ValueError: 9 | return None 10 | 11 | // ***END*** 12 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/TypeScript/BrowseName.ts: -------------------------------------------------------------------------------- 1 | export class BrowseNames { 2 | // ***START*** 3 | static readonly _Key_: string = '_Value_' 4 | // ***END*** 5 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/TypeScript/BuiltInTypes.ts: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | export enum BuiltInType { 3 | Null = 0, 4 | Boolean = 1, 5 | SByte = 2, 6 | Byte = 3, 7 | Int16 = 4, 8 | UInt16 = 5, 9 | Int32 = 6, 10 | UInt32 = 7, 11 | Int64 = 8, 12 | UInt64 = 9, 13 | Float = 10, 14 | Double = 11, 15 | String = 12, 16 | DateTime = 13, 17 | Guid = 14, 18 | ByteString = 15, 19 | XmlElement = 16, 20 | NodeId = 17, 21 | ExpandedNodeId = 18, 22 | StatusCode = 19, 23 | QualifiedName = 20, 24 | LocalizedText = 21, 25 | ExtensionObject = 22, 26 | DataValue = 23, 27 | Variant = 24, 28 | DiagnosticInfo = 25, 29 | Number = 26, 30 | Integer = 27, 31 | UInteger = 28, 32 | Enumeration = 29 33 | } 34 | // ***END*** -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/TypeScript/ConstantsFile.ts: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | export const NS = '_NamespaceUri_'; 3 | 4 | export class BrowseNames { 5 | // ListOfBrowseNames 6 | } 7 | 8 | // ListOfNodeIds 9 | // BuiltInTypes 10 | // ***END*** 11 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/TypeScript/Identifier.ts: -------------------------------------------------------------------------------- 1 | export class BrowseNames { 2 | // ***START*** 3 | static readonly _Key_: string = 'nsu=' + NS + ';_Value_' 4 | // ***END*** 5 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/TypeScript/Identifier_NoNamespace.ts: -------------------------------------------------------------------------------- 1 | export class BrowseNames { 2 | // ***START*** 3 | static readonly _Key_: string = '_Value_' 4 | // ***END*** 5 | } -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/TypeScript/NodeIdClass.ts: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | export class _NodeClass_Ids { 3 | // ListOfIdentifiers 4 | } 5 | // ***END*** 6 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/TypedVariableType.cs: -------------------------------------------------------------------------------- 1 | #region _TypeName_State Class 2 | /// 3 | /// 4 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 5 | public class _TypeName_State : _TypeName_State 6 | { 7 | #region Constructors 8 | /// 9 | public _TypeName_State() 10 | { 11 | Value = default(T); 12 | } 13 | 14 | /// 15 | protected override void Initialize(ISystemContext context) 16 | { 17 | base.Initialize(context); 18 | 19 | Value = default(T); 20 | DataType = TypeInfo.GetDataTypeId(typeof(T)); 21 | ValueRank = TypeInfo.GetValueRank(typeof(T)); 22 | } 23 | #endregion 24 | 25 | #region Public Members 26 | /// 27 | public new T Value 28 | { 29 | get { return (T)((BaseVariableState)this).Value; } 30 | set { ((BaseVariableState)this).Value = value; } 31 | } 32 | #endregion 33 | 34 | #region Overridden Methods 35 | /// 36 | public override BaseInstanceState CreateInstance(NodeState parent) 37 | { 38 | return new _ClassName_State(parent); 39 | } 40 | #endregion 41 | } 42 | #endregion 43 | // ***START*** 44 | #region _ClassName_State Class 45 | /// 46 | /// 47 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")] 48 | public class _ClassName_State : _ClassName_State 49 | { 50 | #region Constructors 51 | /// 52 | public _ClassName_State(NodeState parent) : base(parent) 53 | { 54 | Value = default(T); 55 | } 56 | 57 | /// 58 | protected override void Initialize(ISystemContext context) 59 | { 60 | base.Initialize(context); 61 | 62 | Value = default(T); 63 | DataType = TypeInfo.GetDataTypeId(typeof(T)); 64 | ValueRank = TypeInfo.GetValueRank(typeof(T)); 65 | } 66 | 67 | /// 68 | protected override void Initialize(ISystemContext context, NodeState source) 69 | { 70 | InitializeOptionalChildren(context); 71 | base.Initialize(context, source); 72 | } 73 | #endregion 74 | 75 | #region Public Members 76 | /// 77 | public new T Value 78 | { 79 | get 80 | { 81 | return CheckTypeBeforeCast(((BaseVariableState)this).Value, true); 82 | } 83 | 84 | set 85 | { 86 | ((BaseVariableState)this).Value = value; 87 | } 88 | } 89 | #endregion 90 | } 91 | #endregion 92 | // ***END*** 93 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/TypesFile.cs: -------------------------------------------------------------------------------- 1 | // ***START*** 2 | /* ======================================================================== 3 | * Copyright (c) 2005-2024 The OPC Foundation, Inc. All rights reserved. 4 | * 5 | * OPC Foundation MIT License 1.00 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | * 27 | * The complete license agreement can be found here: 28 | * http://opcfoundation.org/License/MIT/1.00/ 29 | * ======================================================================*/ 30 | 31 | using System; 32 | using System.Collections.Generic; 33 | using System.Text; 34 | using System.Xml; 35 | using System.Linq; 36 | using System.Runtime.Serialization; 37 | // ListOfImports 38 | 39 | namespace _Namespace_ 40 | { 41 | // ListOfTypes 42 | } 43 | // ***END*** 44 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/Version2/VariableTypeValueField.cs: -------------------------------------------------------------------------------- 1 | public class _ClassName_Value 2 | { 3 | // ***START*** 4 | #region _ChildName_ Access Methods 5 | /// 6 | private ServiceResult OnRead__ChildName_( 7 | ISystemContext context, 8 | NodeState node, 9 | NumericRange indexRange, 10 | QualifiedName dataEncoding, 11 | ref object value, 12 | ref StatusCode statusCode, 13 | ref DateTime timestamp) 14 | { 15 | lock (Lock) 16 | { 17 | DoBeforeReadProcessing(context, node); 18 | 19 | var childVariable = m_variable?._ChildPath_; 20 | if (childVariable != null && StatusCode.IsBad(childVariable.StatusCode)) 21 | { 22 | value = null; 23 | statusCode = childVariable.StatusCode; 24 | return new ServiceResult(statusCode); 25 | } 26 | 27 | if (m_value != null) 28 | { 29 | value = m_value._ChildPath_; 30 | } 31 | 32 | var result = Read(context, node, indexRange, dataEncoding, ref value, ref statusCode, ref timestamp); 33 | 34 | if (childVariable != null && ServiceResult.IsNotBad(result)) 35 | { 36 | timestamp = childVariable.Timestamp; 37 | if (statusCode != childVariable.StatusCode) 38 | { 39 | statusCode = childVariable.StatusCode; 40 | result = new ServiceResult(statusCode); 41 | } 42 | } 43 | 44 | return result; 45 | } 46 | } 47 | 48 | /// 49 | private ServiceResult OnWrite__ChildName_( 50 | ISystemContext context, 51 | NodeState node, 52 | NumericRange indexRange, 53 | QualifiedName dataEncoding, 54 | ref object value, 55 | ref StatusCode statusCode, 56 | ref DateTime timestamp) 57 | { 58 | lock (Lock) 59 | { 60 | UpdateChildVariableStatus(m_variable._ChildPath_, ref statusCode, ref timestamp); 61 | m_value._ChildPath_ = (_ChildDataType_)Write(value); 62 | UpdateParent(context, ref statusCode, ref timestamp); 63 | } 64 | 65 | return ServiceResult.Good; 66 | } 67 | #endregion 68 | // ***END*** 69 | } 70 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/XmlSchema/Array.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/XmlSchema/CollectionType.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/XmlSchema/ComplexType.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/XmlSchema/DerivedType.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/XmlSchema/Documentation.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | _Description_ 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/XmlSchema/EnumeratedType.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/XmlSchema/File.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/XmlSchema/SimpleType.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/Templates/XmlSchema/Union.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/packages.Opc.Ua.ModelCompiler.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Opc.Ua.ModelCompiler/packages.Opc.Ua.ModelCompiler.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /PublishModel.bat: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | SETLOCAL 3 | 4 | set ROOT=%~dp0 5 | set MODELCOMPILER=%ROOT%build\bin\Release\net8.0\Opc.Ua.ModelCompiler.exe 6 | set SOURCE=%1 7 | set TARGET=%2 8 | set OUTPUT=%ROOT%..\nodesets 9 | set INPUT=%ROOT%Opc.Ua.ModelCompiler\Design 10 | set CSVINPUT=%ROOT%Opc.Ua.ModelCompiler\CSVs 11 | 12 | IF NOT "%3"=="" (set INPUT=%INPUT%.%3) else (set INPUT=%INPUT%.v105) 13 | IF NOT "%3"=="" (set OUTPUT=%OUTPUT%\%3) else (set OUTPUT=%OUTPUT%\master) 14 | IF NOT "%3"=="" set VERSION=-version %3 15 | IF NOT "%4"=="" set EXCLUDE=-exclude %4 16 | 17 | IF "%3"=="v105" set OUTPUT=%ROOT%..\nodesets\v105 18 | IF "%3"=="v103" set CSVINPUT=%INPUT% 19 | 20 | ECHO Building Model %TARGET% 21 | IF NOT EXIST "%OUTPUT%\%TARGET%" MKDIR "%OUTPUT%\%TARGET%" 22 | ECHO %MODELCOMPILER% compile %VERSION% %EXCLUDE% -d2 "%INPUT%\%SOURCE%.xml" -cg "%CSVINPUT%\%SOURCE%.csv" -o2 "%OUTPUT%\%TARGET%\\" %USEALLOWSUBTYPES% 23 | %MODELCOMPILER% compile %VERSION% %EXCLUDE% -d2 "%INPUT%\%SOURCE%.xml" -cg "%CSVINPUT%\%SOURCE%.csv" -o2 "%OUTPUT%\%TARGET%\\" %USEALLOWSUBTYPES% 24 | IF %ERRORLEVEL% NEQ 0 ( ECHO Failed %TARGET% & EXIT /B 3 ) 25 | 26 | ECHO Copying Model files to %OUTPUT%\%TARGET%\%SOURCE% 27 | COPY "%INPUT%\%SOURCE%.xml" "%OUTPUT%\%TARGET%\%SOURCE%.xml" 28 | TYPE "%CSVINPUT%\%SOURCE%.csv" | FINDSTR /V /E Unspecified > "%OUTPUT%\%TARGET%\%SOURCE%.csv" 29 | DEL /f /q "%OUTPUT%\%TARGET%\*NodeSet.xml" 30 | GOTO theEnd 31 | 32 | ECHO Updating License 33 | ECHO ON 34 | CALL UpdateLicense "%OUTPUT%\%TARGET%" 35 | @ECHO OFF 36 | 37 | :noModelCompiler 38 | ECHO. 39 | ECHO ModelCompiler not found. Please make sure it is compiled in RELEASE mode. 40 | ECHO Searched for: %MODELCOMPILER% 41 | 42 | :theEnd 43 | ENDLOCAL -------------------------------------------------------------------------------- /PublishModel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #**************************************************************************************************************** 4 | #** -- 5 | #** This script demonstrates how to use the model compiler to generate source code from a variety 6 | #** of XML files that adhere to the 'Nodeset2.xml' format. Please refer to the UA Specifications Part 6 7 | #** for more information. 8 | #** -- 9 | #**************************************************************************************************************** 10 | 11 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" 12 | export MODELCOMPILER=$DIR/Opc.Ua.ModelCompiler.exe 13 | 14 | if [ "$#" -ne 3 ]; then 15 | echo "Usage: SOURCE_FILE_NAME TARGET_FOLDER_NAME OUTPUT_DIR" 16 | exit 3 17 | fi 18 | 19 | export SOURCE=$1 20 | export TARGET=$2 21 | export OUTPUT=$3 22 | 23 | echo "Building Model for '${TARGET}'" 24 | mkdir -p "${OUTPUT}/${TARGET}" 25 | echo ${MODELCOMPILER} -console -d2 "$(realpath ${SOURCE}.xml)" -cg "$(realpath ${SOURCE}.csv)" -o2 "$(realpath ${OUTPUT}/${TARGET}/)" 26 | mono ${MODELCOMPILER} -console -d2 "$(realpath ${SOURCE}.xml)" -cg "$(realpath ${SOURCE}.csv)" -o2 "$(realpath ${OUTPUT}/${TARGET}/)" 27 | if [ $? -ne 0 ]; then 28 | echo "Failed ${TARGET}" 29 | exit 3 30 | fi 31 | 32 | echo Copying Model files to $(realpath ${OUTPUT}/${TARGET}) 33 | cp "$(realpath ${SOURCE}.xml)" "${OUTPUT}/${TARGET}/" 34 | cp "$(realpath ${SOURCE}.csv)" "${OUTPUT}/${TARGET}/" 35 | rm -f "${OUTPUT}/${TARGET}/*NodeSet.xml" 36 | -------------------------------------------------------------------------------- /PublishNodeSet.bat: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | SETLOCAL 3 | 4 | IF "%1"=="" (goto :usage) 5 | IF "%2"=="" (goto :usage) 6 | IF "%3"=="" (goto :usage) 7 | 8 | set ROOT=%~dp0 9 | set MODELCOMPILER=%ROOT%build\bin\Release\net6.0\Opc.Ua.ModelCompiler.exe 10 | set NODESETS=%1 11 | set NAME=%2 12 | set TARGET=-uri %3 13 | set OUTPUT=%ROOT%Tests\DemoModel\Models 14 | 15 | IF NOT "%4"=="" set PREFIX=-prefix %4 16 | 17 | ECHO Building Model %TARGET% 18 | IF EXIST "%OUTPUT%\%NAME%" RMDIR /S /Q "%OUTPUT%\%NAME%" 19 | IF NOT EXIST "%OUTPUT%" MKDIR "%OUTPUT%" 20 | ECHO %MODELCOMPILER% compile-nodesets -input %NODESETS% -o2 %OUTPUT% %TARGET% %PREFIX% 21 | %MODELCOMPILER% compile-nodesets -input %NODESETS% -o2 %OUTPUT% %TARGET% %PREFIX% 22 | IF %ERRORLEVEL% NEQ 0 ( ECHO Failed %TARGET% & EXIT /B 3 ) 23 | 24 | ECHO Updating License 25 | ECHO ON 26 | CALL UpdateLicense %OUTPUT% 27 | @ECHO OFF 28 | 29 | COPY /Y "%OUTPUT%\%NAME%\*.*" "%NODESETS%\%NAME%" 30 | 31 | GOTO :theEnd 32 | 33 | :noModelCompiler 34 | ECHO. 35 | ECHO ModelCompiler not found. Please make sure it is compiled in RELEASE mode. 36 | ECHO Searched for: %MODELCOMPILER% 37 | 38 | :usage 39 | ECHO. 40 | ECHO Usage: CompileNodeSets.bat [nodesets directory] [generated file directory] [URI] [(dependency URI)*] 41 | GOTO :theEnd 42 | 43 | :theEnd 44 | ENDLOCAL -------------------------------------------------------------------------------- /Schemas/ServerCapabilities.csv: -------------------------------------------------------------------------------- 1 | NA,No capability information is available. Cannot be used in combination with any other capability. 2 | DA,Provides current data. 3 | HD,Provides historical data. 4 | AC,Provides alarms and conditions that may require operator interaction. 5 | HE,Provides historical alarms and events. 6 | GDS,Supports the Global Discovery Server information model. 7 | LDS,Only supports the Discovery Services. Cannot be used in combination with any other capability. 8 | DI,Supports the Device Integration (DI) information model (see DI). 9 | ADI,Supports the Analyser Device Integration (ADI) information model (see ADI). 10 | FDI,Supports the Field Device Integration (FDI) information model (see FDI). 11 | FDIC,Supports the Field Device Integration (FDI) Communication Server information model (see FDI). 12 | PLC,Supports the PLCopen information model (see PLCopen). 13 | S95,Supports the ISA95 information model (see ISA-95). 14 | RCP,Supports the reverse connect capabilities defined in Part 6. 15 | PUB,Supports the Publisher capabilities defined in Part 14. 16 | AUTOID,Supports the AutoID information model. 17 | MDIS,Supports the MDIS information model. 18 | CNC,Supports the information model for Computerized Numerical Control (CNC) systems. 19 | PLK,Supports the POWERLINK information model. 20 | FDT,Supports the FDT information model. 21 | TMC,Supports the Tobacco Machine Communication (TMC) information model. 22 | CSPP,Supports the CSP+ device profile (CSPPlusForMachine) information model. 23 | 61850,Supports the IEC61850 information model. 24 | PACKML,Supports the PackML information model. 25 | MTC,Supports the MTConnect information model. 26 | AUTOML,Supports the AutomationML information model. 27 | SERCOS,Supports the Sercos information model. 28 | MIMOSA,Supports the MIMOSA information model. 29 | WITSML,Supports the WITSML information model. 30 | DEXPI,Supports the DEXPI information model. 31 | IOLINK,Supports the IOLINK information model. 32 | VROBOT,Supports the VDMA ROBOTICS information model. 33 | PNO,Supports the ProfiNET information model. 34 | -------------------------------------------------------------------------------- /TestNodeSets.bat: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | SETLOCAL 3 | 4 | set ROOT=%~dp0 5 | set BUILD=msbuild -v:m 6 | set NODESETS=..\nodesets 7 | set OUTPUT=.\Tests\DemoModel\Models 8 | 9 | if NOT "%1"=="" (set NODESETS=%NODESETS%\%1) else (set NODESETS=%NODESETS%\v105) 10 | if NOT "%2"=="" (set OUTPUT=%2) 11 | 12 | set PROJECT=BACnet 13 | set URIS=http://opcfoundation.org/UA/BACnet_V2/ 14 | call :GenerateAndBuild 15 | 16 | REM set PROJECT=PLCopen 17 | REM set URIS=http://PLCopen.org/OpcUa/IEC61131-3/ http://opcfoundation.org/UA/DI/ 18 | REM call "%ROOT%\CompileNodeSets.bat" %NODESETS% %OUTPUT% %URIS% 19 | REM %BUILD% .\Tests\DemoModel\DemoModel.Debug.csproj 20 | 21 | REM set PROJECT=IEC61850 22 | REM set URIS=http://opcfoundation.org/UA/IEC61850-6 http://opcfoundation.org/UA/IEC61850-7-4 http://opcfoundation.org/UA/IEC61850-7-3 23 | REM CALL :GenerateAndBuild 24 | 25 | goto :theEnd 26 | 27 | :GenerateAndBuild 28 | if EXIST "%OUTPUT%\%PROJECT%" (rmdir /Q /S "%OUTPUT%\%PROJECT%") 29 | call "%ROOT%\CompileNodeSets.bat" %NODESETS% %OUTPUT% %URIS% 30 | %BUILD% .\Tests\DemoModel\DemoModel.Debug.csproj 31 | EXIT /B 0 32 | 33 | goto :theEnd 34 | 35 | :usage 36 | echo. 37 | echo Usage: TestNodeSets.bat [nodesets directory] 38 | goto :theEnd 39 | 40 | :theEnd 41 | ENDLOCAL -------------------------------------------------------------------------------- /Tests/DemoModel/BuildModel.bat: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | SETLOCAL 3 | 4 | set MODELCOMPILER=..\..\..\build\bin\Release\net8.0\Opc.Ua.ModelCompiler.exe 5 | set MODEL=DemoModel 6 | set VERSION=v105 7 | set EXCLUDE=Draft 8 | set INPUT=. 9 | set CSVINPUT=. 10 | set OUTPUT=. 11 | set USEALLOWSUBTYPES=-useAllowSubtypes 12 | 13 | ECHO Building Model %MODEL% 14 | ECHO %MODELCOMPILER% compile -version %VERSION% -exclude %EXCLUDE% -d2 "%INPUT%\%MODEL%.xml" -cg "%CSVINPUT%\%MODEL%.csv" -o2 "%OUTPUT%" %USEALLOWSUBTYPES% 15 | %MODELCOMPILER% compile -version %VERSION% -exclude %EXCLUDE% -d2 "%INPUT%\%MODEL%.xml" -cg "%CSVINPUT%\%MODEL%.csv" -o2 "%OUTPUT%" %USEALLOWSUBTYPES% 16 | IF %ERRORLEVEL% NEQ 0 ( ECHO Failed %MODEL% & EXIT /B 3 ) -------------------------------------------------------------------------------- /Tests/DemoModel/DemoModel.Debug.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | DemoModel 7 | $(SolutionDir)build\obj\$(Configuration)\$(MSBuildProjectName)\ 8 | DemoModel 9 | ModelCompiler 10 | 11 | 12 | 13 | $(SolutionDir)build\bin\$(Configuration)\$(MSBuildProjectName)\ 14 | NET_STANDARD 15 | 16 | 17 | 18 | $(SolutionDir)build\bin\$(Configuration)\$(MSBuildProjectName)\ 19 | TRACE;NET_STANDARD 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | Always 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /Tests/DemoModel/DemoModel.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Exe 5 | net8.0 6 | DemoModel 7 | $(SolutionDir)build\obj\$(Configuration)\$(MSBuildProjectName)\ 8 | DemoModel 9 | ModelCompiler 10 | 11 | 12 | 13 | $(SolutionDir)build\bin\$(Configuration)\$(MSBuildProjectName)\ 14 | NET_STANDARD 15 | 16 | 17 | 18 | $(SolutionDir)build\bin\$(Configuration)\$(MSBuildProjectName)\ 19 | TRACE;NET_STANDARD 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | Always 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /Tests/DemoModel/DemoModel/DemoModel.NodeIds.permissions.csv: -------------------------------------------------------------------------------- 1 | Seeker_Identities,10,Variable,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(59391) All'}" 2 | TestObject,128,Object,,"{'AuthenticatedUser':'(4097) Browse|Call'}" 3 | TestObject_Blue,71,Method,"[SigningRequired,SessionRequired,ApplyRestrictionsToBrowse]","{'SecurityAdmin':'(4097) Browse|Call'}" 4 | TestObject_Red,60,Variable,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(97) Browse|Read|Write'}" 5 | TestObject_Red_X,219,Variable,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(97) Browse|Read|Write'}" 6 | TestObject_Red_Y,220,Variable,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(97) Browse|Read|Write'}" 7 | TestObject_Red_Yellow,61,Variable,"[SigningRequired,SessionRequired]","{'AccessRestrictionType':'(33) Browse|Read'}" 8 | TestObject_Red_Z,221,Variable,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(97) Browse|Read|Write'}" 9 | -------------------------------------------------------------------------------- /Tests/DemoModel/DemoModel/DemoModel.PredefinedNodes.uanodes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OPCFoundation/UA-ModelCompiler/20dbd73ecdf59223030dc032d1a8a6b2d0cc5ec9/Tests/DemoModel/DemoModel/DemoModel.PredefinedNodes.uanodes -------------------------------------------------------------------------------- /Tests/DemoModel/Onboarding/Opc.Ua.Onboarding.NodeIds.permissions.csv: -------------------------------------------------------------------------------- 1 | WellKnownRole_RegistrarAdmin_AddApplication,5045,Method,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(61455) All'}" 2 | WellKnownRole_RegistrarAdmin_AddApplication_InputArguments,5046,Variable,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(59391) All'}" 3 | WellKnownRole_RegistrarAdmin_AddEndpoint,5049,Method,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(61455) All'}" 4 | WellKnownRole_RegistrarAdmin_AddEndpoint_InputArguments,5050,Variable,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(59391) All'}" 5 | WellKnownRole_RegistrarAdmin_AddIdentity,5041,Method,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(61455) All'}" 6 | WellKnownRole_RegistrarAdmin_AddIdentity_InputArguments,5042,Variable,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(59391) All'}" 7 | WellKnownRole_RegistrarAdmin_Applications,5037,Variable,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(59391) All'}" 8 | WellKnownRole_RegistrarAdmin_ApplicationsExclude,5036,Variable,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(59391) All'}" 9 | WellKnownRole_RegistrarAdmin_CustomConfiguration,5040,Variable,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(59391) All'}" 10 | WellKnownRole_RegistrarAdmin_Endpoints,5039,Variable,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(59391) All'}" 11 | WellKnownRole_RegistrarAdmin_EndpointsExclude,5038,Variable,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(59391) All'}" 12 | WellKnownRole_RegistrarAdmin_Identities,5035,Variable,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(59391) All'}" 13 | WellKnownRole_RegistrarAdmin_RemoveApplication,5047,Method,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(61455) All'}" 14 | WellKnownRole_RegistrarAdmin_RemoveApplication_InputArguments,5048,Variable,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(59391) All'}" 15 | WellKnownRole_RegistrarAdmin_RemoveEndpoint,5051,Method,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(61455) All'}" 16 | WellKnownRole_RegistrarAdmin_RemoveEndpoint_InputArguments,5052,Variable,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(59391) All'}" 17 | WellKnownRole_RegistrarAdmin_RemoveIdentity,5043,Method,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(61455) All'}" 18 | WellKnownRole_RegistrarAdmin_RemoveIdentity_InputArguments,5044,Variable,"[SigningRequired,EncryptionRequired]","{'SecurityAdmin':'(59391) All'}" 19 | -------------------------------------------------------------------------------- /Tests/DemoModel/Onboarding/Opc.Ua.Onboarding.NodeSet2.documentation.csv: -------------------------------------------------------------------------------- 1 | Id,Name,Link,ConformanceUnits 2 | 1,http://opcfoundation.org/UA/Onboarding/,"https://reference.opcfoundation.org/Onboarding/docs/10.1","" 3 | 1164,CertificateAuthorityType,"https://reference.opcfoundation.org/Onboarding/docs/8.2.6","Onboarding Ticket Reader;" 4 | 1165,BaseTicketType,"https://reference.opcfoundation.org/Onboarding/docs/8.2.2","Onboarding Ticket Reader;" 5 | 1166,DeviceIdentityTicketType,"https://reference.opcfoundation.org/Onboarding/docs/8.2.3","Onboarding Ticket Reader;" 6 | 1167,CompositeIdentityTicketType,"https://reference.opcfoundation.org/Onboarding/docs/8.2.4","Onboarding Ticket Reader;" 7 | 1168,TicketListType,"https://reference.opcfoundation.org/Onboarding/docs/8.2.5","Onboarding Ticket Reader;" 8 | 1175,DeviceRegistrarAdminType,"https://reference.opcfoundation.org/Onboarding/docs/9.2.10","Onboarding Registrar Administration;" 9 | 1176,RegisterTickets,"https://reference.opcfoundation.org/Onboarding/docs/9.2.11","" 10 | 1179,UnregisterTickets,"https://reference.opcfoundation.org/Onboarding/docs/9.2.12","" 11 | 1259,DeviceRegistrarType,"https://reference.opcfoundation.org/Onboarding/docs/9.2.2","Onboarding Registrar PullManagement;" 12 | 1260,ProvideIdentities,"https://reference.opcfoundation.org/Onboarding/docs/9.2.3","" 13 | 1263,RegisterDeviceEndpoint,"https://reference.opcfoundation.org/Onboarding/docs/9.2.5","" 14 | 1344,DeviceRegistrar,"https://reference.opcfoundation.org/Onboarding/docs/9.2.9","Onboarding Registrar PullManagement;" 15 | 1345,ProvideIdentities,"https://reference.opcfoundation.org/v105/Onboarding/docs/9.2.3","" 16 | 1348,RegisterDeviceEndpoint,"https://reference.opcfoundation.org/v105/Onboarding/docs/9.2.5","" 17 | 1351,RegisterTickets,"https://reference.opcfoundation.org/v105/Onboarding/docs/9.2.12","" 18 | 1354,UnregisterTickets,"https://reference.opcfoundation.org/v105/Onboarding/docs/9.2.13","" 19 | 1495,ManagerDescription,"https://reference.opcfoundation.org/Onboarding/docs/9.2.7","Onboarding Registrar PullManagement;" 20 | 1503,UpdateSoftwareStatus,"https://reference.opcfoundation.org/Onboarding/docs/9.2.4","" 21 | 1505,GetManagers,"https://reference.opcfoundation.org/Onboarding/docs/9.2.6","" 22 | 1507,RegisterManagedApplication,"https://reference.opcfoundation.org/Onboarding/docs/9.2.8","" 23 | 1510,UpdateSoftwareStatus,"https://reference.opcfoundation.org/v105/Onboarding/docs/9.2.4","" 24 | 1517,DeviceRegistrationAuditEventType,"https://reference.opcfoundation.org/Onboarding/docs/9.2.13","Onboarding Registrar PullManagement;" 25 | 1533,DeviceIdentityAcceptedAuditEventType,"https://reference.opcfoundation.org/Onboarding/docs/9.2.14","Onboarding Registrar PullManagement;" 26 | 1552,DeviceSoftwareUpdatedAuditEventType,"https://reference.opcfoundation.org/Onboarding/docs/9.2.15","Onboarding Registrar PullManagement;" 27 | -------------------------------------------------------------------------------- /Tests/DemoModel/Onboarding/Opc.Ua.Onboarding.PredefinedNodes.uanodes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OPCFoundation/UA-ModelCompiler/20dbd73ecdf59223030dc032d1a8a6b2d0cc5ec9/Tests/DemoModel/Onboarding/Opc.Ua.Onboarding.PredefinedNodes.uanodes -------------------------------------------------------------------------------- /Tests/DemoModel/ReferenceServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Security.Cryptography.X509Certificates; 5 | using Opc.Ua; 6 | using Opc.Ua.Server; 7 | 8 | namespace ModelCompiler 9 | { 10 | public partial class ReferenceServer : ReverseConnectServer 11 | { 12 | #region Properties 13 | #endregion 14 | 15 | #region Overridden Methods 16 | protected override MasterNodeManager CreateMasterNodeManager(IServerInternal server, ApplicationConfiguration configuration) 17 | { 18 | Utils.LogInfo(Utils.TraceMasks.StartStop, "Creating the Reference Server Node Manager."); 19 | 20 | IList nodeManagers = new List(); 21 | 22 | // create the custom node manager. 23 | nodeManagers.Add(new ReferenceNodeManager(server, configuration)); 24 | 25 | // create master node manager. 26 | return new MasterNodeManager(server, configuration, null, nodeManagers.ToArray()); 27 | } 28 | 29 | protected override ServerProperties LoadServerProperties() 30 | { 31 | ServerProperties properties = new ServerProperties 32 | { 33 | ManufacturerName = "OPC Foundation", 34 | ProductName = "Reference Server", 35 | ProductUri = "http://opcfoundation.org/Quickstart/ReferenceServer/v1.04", 36 | SoftwareVersion = Utils.GetAssemblySoftwareVersion(), 37 | BuildNumber = Utils.GetAssemblyBuildNumber(), 38 | BuildDate = Utils.GetAssemblyTimestamp() 39 | }; 40 | 41 | return properties; 42 | } 43 | #endregion 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Tests/DemoModel/Scheduler/Opc.Ua.Scheduler.NodeIds.permissions.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OPCFoundation/UA-ModelCompiler/20dbd73ecdf59223030dc032d1a8a6b2d0cc5ec9/Tests/DemoModel/Scheduler/Opc.Ua.Scheduler.NodeIds.permissions.csv -------------------------------------------------------------------------------- /Tests/DemoModel/Scheduler/Opc.Ua.Scheduler.NodeSet2.documentation.csv: -------------------------------------------------------------------------------- 1 | Id,Name,Link,ConformanceUnits 2 | 1,http://opcfoundation.org/UA/Scheduler/,"https://reference.opcfoundation.org/Scheduler/docs/10.1","" 3 | 37,CalendarType,"https://reference.opcfoundation.org/Scheduler/docs/7.1.2","Scheduler Calendar Base;" 4 | 40,AddDateListElements,"https://reference.opcfoundation.org/Scheduler/docs/7.1.3","" 5 | 43,RemoveDateListElements,"https://reference.opcfoundation.org/Scheduler/docs/7.1.4","" 6 | 52,ScheduleType,"https://reference.opcfoundation.org/Scheduler/docs/7.2.2","Scheduler Scheduling Base;" 7 | 54,AddExceptionScheduleElements,"https://reference.opcfoundation.org/Scheduler/docs/7.2.3","" 8 | 57,RemoveExceptionScheduleElements,"https://reference.opcfoundation.org/Scheduler/docs/7.2.4","" 9 | 70,SpecialEventType,"https://reference.opcfoundation.org/Scheduler/docs/8.1","Scheduler Scheduling Base;" 10 | 71,SpecialEventPeriodType,"https://reference.opcfoundation.org/Scheduler/docs/8.2","Scheduler Scheduling Base;" 11 | 72,CalendarEntryType,"https://reference.opcfoundation.org/Scheduler/docs/8.3","Scheduler Scheduling Base;Scheduler Calendar Base;" 12 | 73,DateType,"https://reference.opcfoundation.org/Scheduler/docs/8.4","Scheduler Scheduling Base;Scheduler Calendar Base;" 13 | 74,Month,"https://reference.opcfoundation.org/Scheduler/docs/8.5","Scheduler Scheduling Base;Scheduler Calendar Base;" 14 | 76,DayOfMonth,"https://reference.opcfoundation.org/Scheduler/docs/8.6","Scheduler Scheduling Base;Scheduler Calendar Base;" 15 | 78,DayOfWeek,"https://reference.opcfoundation.org/Scheduler/docs/8.7","Scheduler Scheduling Base;Scheduler Calendar Base;" 16 | 80,DateRangeType,"https://reference.opcfoundation.org/Scheduler/docs/8.8","Scheduler Scheduling Base;Scheduler Calendar Base;" 17 | 81,TimeActionsType,"https://reference.opcfoundation.org/Scheduler/docs/8.9","Scheduler Scheduling Base;" 18 | 82,BaseActionType,"https://reference.opcfoundation.org/Scheduler/docs/8.10","Scheduler Scheduling Base;" 19 | 83,WriteLocalVariableActionType,"https://reference.opcfoundation.org/Scheduler/docs/8.11","Scheduler Scheduling Base;" 20 | 84,CallLocalMethodActionType,"https://reference.opcfoundation.org/Scheduler/docs/8.12","Scheduler Scheduling Base;" 21 | 85,TimeType,"https://reference.opcfoundation.org/Scheduler/docs/8.13","Scheduler Scheduling Base;" 22 | 86,DailyScheduleType,"https://reference.opcfoundation.org/Scheduler/docs/8.14","Scheduler Scheduling Base;" 23 | -------------------------------------------------------------------------------- /Tests/DemoModel/Scheduler/Opc.Ua.Scheduler.PredefinedNodes.uanodes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OPCFoundation/UA-ModelCompiler/20dbd73ecdf59223030dc032d1a8a6b2d0cc5ec9/Tests/DemoModel/Scheduler/Opc.Ua.Scheduler.PredefinedNodes.uanodes -------------------------------------------------------------------------------- /UpdateLicense.bat: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | SETLOCAL 3 | 4 | set ROOT=%~dp0 5 | set MODELCOMPILER=%ROOT%build\bin\Release\net8.0\Opc.Ua.ModelCompiler.exe 6 | set OUTPUT=%1 7 | 8 | "%MODELCOMPILER%" update-headers -input %OUTPUT% -pattern *.xml -license MITXML -silent 9 | "%MODELCOMPILER%" update-headers -input %OUTPUT% -pattern *.xsd -license MITXML -silent 10 | "%MODELCOMPILER%" update-headers -input %OUTPUT% -pattern *.bsd -license MITXML -silent 11 | "%MODELCOMPILER%" update-headers -input %OUTPUT% -pattern *.cs -license MIT -silent 12 | "%MODELCOMPILER%" update-headers -input %OUTPUT% -pattern *.h -license MIT -silent 13 | "%MODELCOMPILER%" update-headers -input %OUTPUT% -pattern *.c -license MIT -silent 14 | 15 | :theEnd 16 | ENDLOCAL -------------------------------------------------------------------------------- /excludes.txt: -------------------------------------------------------------------------------- 1 | \.git\ 2 | \bin\ 3 | \obj\ 4 | \debug\ 5 | \release\ 6 | \.svn\ 7 | .pdb 8 | .ncb 9 | .suo 10 | .git -------------------------------------------------------------------------------- /license.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 opcfoundation.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | --------------------------------------------------------------------------------