Compare commits
95 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 637790ae45 | |||
| 485b56e467 | |||
| 2b353d11e7 | |||
| 1254624d49 | |||
| a18ea48967 | |||
| 293c39e3dd | |||
| 25eca0ef0d | |||
| a4ab465e47 | |||
| 64109ebb4a | |||
| c51cc36d53 | |||
| c13b4c161e | |||
| 246eb7d1fa | |||
| 7af058777c | |||
| 0c05754e31 | |||
| 17f76bcbbe | |||
| 572c4a079b | |||
| dc50afa47b | |||
| 3cdcc761b4 | |||
| 0fed85d874 | |||
| 59c07674ab | |||
| 7190735aec | |||
| c62a892662 | |||
| d174437f2e | |||
| d8d0332050 | |||
| 5b6f04a03a | |||
| 80360f371d | |||
| 855c028048 | |||
| 32ca7c18e5 | |||
| ef92d5e251 | |||
| ffee58bc91 | |||
| a3c13bacc3 | |||
| 5c2b53e8b5 | |||
| 63e901087f | |||
| 6a21190fbe | |||
| 6f6f855edf | |||
| 59f54e94fc | |||
| a26e9339db | |||
| 0d2a0a7b58 | |||
| cefa86be5e | |||
| 17fcc18290 | |||
| dfb7a083b8 | |||
| 5858ea11f4 | |||
| bd528ac568 | |||
| 3ee74e2096 | |||
| 4b65914018 | |||
| 90231ebcbd | |||
| 29439b08f8 | |||
| c087e32f22 | |||
| 1a25d5ce9b | |||
| cb054c1f54 | |||
| 757f3d74d3 | |||
| ee5ca14e6f | |||
| dab21eee84 | |||
| e4b4a0868a | |||
| e2328dab6a | |||
| 024d3b7169 | |||
| 2e48c131eb | |||
| b2a6ff802f | |||
| e484b64ee3 | |||
| 803ad225e1 | |||
| 96215da7cc | |||
| d198a0f47e | |||
| 9ac5bb6533 | |||
| 86725d29f1 | |||
| 7d7aa0b77a | |||
| 6185c53411 | |||
| 6a3b6f0b46 | |||
| e562b490fd | |||
| ae28f33b55 | |||
| a7aacc13a3 | |||
| ebc4be0670 | |||
| ded18cce24 | |||
| d6ab37fd78 | |||
| 76cf7efb79 | |||
| ab317d1a9c | |||
| 4d156b9be8 | |||
| e737d69288 | |||
| 1bbf12bc82 | |||
| 0cda46c6d5 | |||
| d865f6ede4 | |||
| 9d40fa1666 | |||
| 5277dd5ebe | |||
| 22690359cb | |||
| d0a3e1d76a | |||
| f226b6125b | |||
| a5bae9d3bc | |||
| b4d1ff3d7c | |||
| b29de8e820 | |||
| 95d2f15dee | |||
| bffa9d3dd6 | |||
| 7561a0437c | |||
| ce5ea97ebd | |||
| 119483a283 | |||
| 7382511787 | |||
| 21b68210e5 |
Vendored
+169
@@ -0,0 +1,169 @@
|
||||
pipeline {
|
||||
agent none
|
||||
environment {
|
||||
EMAIL_RECIPIENTS = 'samuele@steamware.net'
|
||||
}
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
agent any
|
||||
steps {
|
||||
|
||||
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
|
||||
script {
|
||||
withEnv(['NEXT_BUILD_NUMBER=285']) {
|
||||
// env.versionNumber = VersionNumber(versionNumberString : '2.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
|
||||
env.versionNumber = VersionNumber(versionNumberString : '2.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
env.APP_NAME = 'SOUR'
|
||||
}
|
||||
}
|
||||
script {
|
||||
currentBuild.displayName = "${env.versionNumber}"
|
||||
if (env.BRANCH_NAME == "develop" || env.BRANCH_NAME.contains("DEMO") || env.BRANCH_NAME.contains("UnitTesting")) {
|
||||
currentBuild.description = "TEST ${env.versionNumber}"
|
||||
}
|
||||
else {
|
||||
currentBuild.description = "BUILD ${env.versionNumber}"
|
||||
}
|
||||
}
|
||||
|
||||
/* CAMBIO numero versione in file sorgente!!! */
|
||||
bat "e:\\fart.exe src\\SharedAssemblyInfo.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
agent any
|
||||
steps {
|
||||
script {
|
||||
// calcolo il config...
|
||||
if (env.BRANCH_NAME == "develop") {
|
||||
env.config = "Debug"
|
||||
}
|
||||
else if (env.BRANCH_NAME == "master") {
|
||||
env.config = "Release"
|
||||
}
|
||||
|
||||
// compilo installers in base al BRANCH...
|
||||
if (env.BRANCH_NAME == "develop" || env.BRANCH_NAME == "master") {
|
||||
// CAMBIO numero versione in file sorgente!!!
|
||||
bat "e:\\fart.exe src\\SharedAssemblyInfo.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
|
||||
// restore nuget packages
|
||||
bat "e:\\nuget.exe restore ${WORKSPACE}\\src\\SOUR.sln"
|
||||
// BUILD Develop!
|
||||
bat "\"${tool 'MSBuild-16.0'}\" src/SOUR/SOUR.csproj -target:Build /p:Configuration=${env.config} /p:Platform=\"x86\" /p:OutputPath=bin/${env.config}/ /m"
|
||||
}
|
||||
else {
|
||||
echo 'NON faccio test di Build se non per BRANCH DEVELOP...'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
steps {
|
||||
echo 'Testing.. 2 be done...'
|
||||
}
|
||||
}
|
||||
stage('Deploy') {
|
||||
agent any
|
||||
steps {
|
||||
// in primis compilo a seconda del branch... TUTTO tranne develop...
|
||||
script {
|
||||
// calcolo il config...
|
||||
if (env.BRANCH_NAME == "develop") {
|
||||
env.config = "Debug"
|
||||
env.classifier = "unstable"
|
||||
}
|
||||
else if (env.BRANCH_NAME == "master") {
|
||||
env.config = "Release"
|
||||
env.classifier = ""
|
||||
}
|
||||
// procedo solo se NON si tratta di commit in ramo UnitTesting...
|
||||
if (env.BRANCH_NAME != "UnitTesting") {
|
||||
// CAMBIO numero versione in file sorgente!!!
|
||||
bat "e:\\fart.exe src\\SharedAssemblyInfo.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
|
||||
// restore nuget packages
|
||||
bat "e:\\nuget.exe restore ${WORKSPACE}\\src\\SOUR.sln"
|
||||
// BUILD!
|
||||
bat "\"${tool 'MSBuild-16.0'}\" src/SOUR/SOUR.csproj -target:Build /p:Configuration=${env.config} /p:Platform=\"x86\" /p:OutputPath=bin/ /m"
|
||||
// creo installer MSI...
|
||||
bat "\"${tool 'MSBuild-16.0'}\" src/SOUR.Setup/SOUR.Setup.wixproj /p:Configuration=${env.config} /p:ProdVersion=${env.versionNumber} /p:Platform=\"x86\" /p:OutputPath=bin/ /m"
|
||||
}
|
||||
else
|
||||
{
|
||||
echo 'Nessun Deploy x UnitTesting'
|
||||
}
|
||||
}
|
||||
// ora mi occupo delle operazioni di invio a NEXUS...
|
||||
script {
|
||||
|
||||
if (env.BRANCH_NAME != "UnitTesting") {
|
||||
nexusArtifactUploader(
|
||||
nexusVersion: 'nexus3',
|
||||
protocol: 'https',
|
||||
nexusUrl: 'repository.scmgroup.com',
|
||||
//groupId: 'SOUR',
|
||||
version: "${env.versionNumber}",
|
||||
repository: 'mconnect-raw',
|
||||
credentialsId: 'b1dcea22-0d35-4092-80a1-973e6be41c78',
|
||||
artifacts: [
|
||||
[artifactId: 'SOUR',
|
||||
classifier: "${env.classifier}",
|
||||
file: "src\\SOUR.Setup\\bin\\SOUR.msi",
|
||||
type: 'msi']
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
success {
|
||||
sendSlack("Successful", "good")
|
||||
}
|
||||
failure {
|
||||
sendSlack("Failed", "danger")
|
||||
}
|
||||
unstable {
|
||||
sendSlack("Unstable", "warning")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NonCPS
|
||||
def getChangeString() {
|
||||
MAX_MSG_LEN = 100
|
||||
def changeString = ""
|
||||
|
||||
echo "Gathering SCM changes"
|
||||
def changeLogSets = currentBuild.changeSets
|
||||
for (int i = 0; i < changeLogSets.size(); i++) {
|
||||
def entries = changeLogSets[i].items
|
||||
for (int j = 0; j < entries.length; j++) {
|
||||
def entry = entries[j]
|
||||
truncated_msg = entry.msg.take(MAX_MSG_LEN)
|
||||
changeString += " - ${truncated_msg} [${entry.author}]\n"
|
||||
}
|
||||
}
|
||||
|
||||
if (!changeString) {
|
||||
changeString = " - Nessuna Modifica"
|
||||
}
|
||||
return changeString
|
||||
}
|
||||
|
||||
def sendEmail(status) {
|
||||
mail (
|
||||
to: "$EMAIL_RECIPIENTS",
|
||||
subject: "Build $BUILD_NUMBER - " + status + " ($JOB_NAME)",
|
||||
body: "Modifiche:\n " + getChangeString() + "\n\n Verifica console output: $BUILD_URL/console" + "\n")
|
||||
}
|
||||
|
||||
// Funzione x invio slack
|
||||
def sendSlack(status, colorCode) {
|
||||
slackSend (
|
||||
color: colorCode,
|
||||
channel: "#sour-dev",
|
||||
message: "${env.JOB_NAME} ${env.versionNumber} | " + status + ": Build ${env.BUILD_NUMBER}\n\n" +
|
||||
"Modifiche:\n " + getChangeString() + "\n\n Verifica build: <${env.BUILD_URL}|Apri>" + "\n"
|
||||
)
|
||||
}
|
||||
@@ -6,6 +6,8 @@ Progetto per l'implementazione del server OPC-UA di gruppo basato su REDIS per a
|
||||
|
||||
- [SOUR (SCM OPC-UA REDIS)](#sour-scm-opc-ua-redis)
|
||||
- [Organizzazione documenti e codice](#organizzazione-documenti-e-codice)
|
||||
- [MQTT](#mqtt)
|
||||
- [MSI installer](#msi-installer)
|
||||
- [Versioni](#versioni)
|
||||
|
||||
## Organizzazione documenti e codice
|
||||
@@ -14,13 +16,35 @@ Progetto per l'implementazione del server OPC-UA di gruppo basato su REDIS per a
|
||||
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| images | Files supporto documentazione |
|
||||
| LogConversion | Gestione conversione traccaito di LOG SOUR in formato leggibile per MSIM (superato da versioni > 1.*) |
|
||||
| Rilasci | Folder dei rilasci (in versione release/debug) del server SOUR |
|
||||
| Rilasci | Folder dei rilasci (in versione release/debug) del server SOUR, IN PHASE OUT con impiego del nuovo server NEXUS |
|
||||
| Specifiche.pdf | File contenente le specifiche di interfaccia per SOUR (che devono essere note ai vari Adapters) e tutte le definizioni a livello di interfaccia |
|
||||
| Specifiche.md | File sorgente (in formato Markdown) delle specifiche |
|
||||
| src | Folder contenente i sorgenti di SOUR |
|
||||
| TestClients | Client di riferimento per testing funzionalità OPC-UA |
|
||||
| Utility | script ed utility varie |
|
||||
| Varie | Documentazioni ed esempi a corredo |
|
||||
| Video | Brevi demo dell'utilizzo |
|
||||
|
||||
## MQTT
|
||||
|
||||
Dalla versione 2.2 è attivo un broker di pubblicazione MQTT verso il cloud.
|
||||
|
||||
Condizioni necessarie al funzionamento:
|
||||
|
||||
- Non sia presente la chiave di vet in REDIS all'indirizzo `SOUR:GwHw:Vers`, se vuoto/nullo = nessun veto, se presente il numero di versioni (o anceh solo una stringa non vuota) riferita al Gateway Hw viene inibito il funzionamento della sezione MQTT
|
||||
- macchina attivata con SDK (quindi disponibili le informaizoni di user e pwd per il broker)
|
||||
|
||||
|
||||
## MSI installer
|
||||
|
||||
Aggiunto il progetto di generazione installer con wix, il processo jenkis crea l'installer come ultimo step di deploy
|
||||
|
||||
Modalità di installaizone file installer msi:
|
||||
|
||||
```powershell
|
||||
SOUR.Setup.msi INSTALLFOLDER=C:\IOT\SOUR /quiet
|
||||
```
|
||||
|
||||
|
||||
## Versioni
|
||||
|
||||
@@ -28,3 +52,4 @@ Progetto per l'implementazione del server OPC-UA di gruppo basato su REDIS per a
|
||||
| ------ | ---------- | --------------------------------------------------------------------------------------------------------- |
|
||||
| <= 1.2 | 2018.12.06 | Documento impiegato epr definizione specifiche SOUR |
|
||||
| >= 1.3 | 2018.12.06 | Documento suddiviso tra organizzaizone progetto (corrente) e specifiche progetto SOUR (Specifiche.md/pdf) |
|
||||
| >= 2.2 | 2019.08.02 | Aggiunta MQTT server embedded, generazione installer msi |
|
||||
|
||||
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+34
-2
@@ -12,12 +12,15 @@ Progetto per l'implementazione del server OPC-UA di gruppo basato su REDIS per a
|
||||
- [Requisiti per installazione](#requisiti-per-installazione)
|
||||
- [Regole di Naming](#regole-di-naming)
|
||||
- [Schemi di dettaglio](#schemi-di-dettaglio)
|
||||
- [Riferimenti importanti](#riferimenti-importanti)
|
||||
- [MQTT](#mqtt)
|
||||
- [MSI installer](#msi-installer)
|
||||
- [Elementi della soluzione](#elementi-della-soluzione)
|
||||
- [SPECIALIZED ADAPTER --> REDIS SERVER](#specialized-adapter----redis-server)
|
||||
- [OPC-UA SERVER --> REDIS SERVER](#opc-ua-server----redis-server)
|
||||
- [DataModel](#datamodel)
|
||||
- [Riferimenti per il server OPC-UA](#riferimenti-per-il-server-opc-ua)
|
||||
- [Modalità di funzionamento SOUR](#modalit%C3%A0-di-funzionamento-sour)
|
||||
- [Modalità di funzionamento SOUR](#modalit%c3%a0-di-funzionamento-sour)
|
||||
- [Dettaglio struttura memoria DB del server REDIS](#dettaglio-struttura-memoria-db-del-server-redis)
|
||||
- [Adapter - Adp](#adapter---adp)
|
||||
- [Adapter - AdpConf](#adapter---adpconf)
|
||||
@@ -27,7 +30,7 @@ Progetto per l'implementazione del server OPC-UA di gruppo basato su REDIS per a
|
||||
- [Adapter - MConnect](#adapter---mconnect)
|
||||
- [Dettaglio protocollo comunicazione HMI - Maestro Connect](#dettaglio-protocollo-comunicazione-hmi---maestro-connect)
|
||||
- [Aspetti tecnici salienti](#aspetti-tecnici-salienti)
|
||||
- [Schema Funzionalità](#schema-funzionalit%C3%A0)
|
||||
- [Schema Funzionalità](#schema-funzionalit%c3%a0)
|
||||
- [**ChannelsIN**: notifica info dal Cloud / richiesta esecuzione task -> HMI](#channelsin-notifica-info-dal-cloud--richiesta-esecuzione-task---hmi)
|
||||
- [Caso d’uso ChannelsIN:DataError](#caso-duso-channelsindataerror)
|
||||
- [Caso d’uso ChannelsIN:AlertHMI](#caso-duso-channelsinalerthmi)
|
||||
@@ -62,6 +65,10 @@ Le versioni rilasciate della documentazione e del server SOUR sono le seguenti:
|
||||
| 1.2.6 | 2018.12.06 | Completata documentazione area REDIS e aggiornamento server (1.2.1812.185) |
|
||||
| 1.3.1 | 2019.01.31 | Implementata gestione nuovi parametri in DataModel per SampleGroup, DeadBand, VisibilityGroup --> testing con FANUC/SIEMENS ed adapter CMS (1.3.1901.195) |
|
||||
| 1.3.2 | 2019.02.03 | Review documentazione x definizione modelli tracciati JSON per log eventi/allarmi/produzione su base riunione 2018.01.30 (1.3.1902.196) |
|
||||
| 1.4 | 2019.02.18 | Cambio Namespace, fix gestione allarmi |
|
||||
| 2.0 | 2019.03.08 | Prima release 2.0 stabile |
|
||||
| 2.1 | 2019.04.12 | modifica comportamento in avvio per sincronizzazione allarmi, sincronizzazione variabili e proprietà |
|
||||
| 2.2 | 2019.08.01 | Prima release 2.2 con MQTT, fix comportamento invio allarmi 8gestione memoria persistente precedente invio stato allarmi), nuovo installer MSI |
|
||||
|
||||
<div style="page-break-after: always;"></div>
|
||||
|
||||
@@ -186,6 +193,31 @@ A valle di questo si trova il server REDIS che persiste le informaizone e fa da
|
||||
|
||||
<div style="page-break-after: always;"></div>
|
||||
|
||||
## Riferimenti importanti
|
||||
|
||||
Alcune note importatnti riguardo l'installer MSI di SOUR e il broker MQTT embedded in SOUR
|
||||
|
||||
### MQTT
|
||||
|
||||
Dalla versione 2.2 è attivo un broker di pubblicazione MQTT verso il cloud.
|
||||
|
||||
Condizioni necessarie al funzionamento:
|
||||
|
||||
- Non sia presente la chiave di vet in REDIS all'indirizzo `SOUR:GwHw:Vers`, se vuoto/nullo = nessun veto, se presente il numero di versioni (o anceh solo una stringa non vuota) riferita al Gateway Hw viene inibito il funzionamento della sezione MQTT
|
||||
- macchina attivata con SDK (quindi disponibili le informaizoni di user e pwd per il broker)
|
||||
|
||||
|
||||
### MSI installer
|
||||
|
||||
Aggiunto il progetto di generazione installer con wix, il processo jenkis crea l'installer come ultimo step di deploy
|
||||
|
||||
Modalità di installaizone file installer msi:
|
||||
|
||||
```powershell
|
||||
SOUR.Setup.msi INSTALLFOLDER=C:\IOT\SOUR /quiet
|
||||
```
|
||||
|
||||
|
||||
## Elementi della soluzione
|
||||
|
||||
Di seguito sono indicati i vari elementi in gioco nel sistema e le specifiche di impiego e funzionamento.
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
------------------------------------------------
|
||||
- Check e todo's
|
||||
------------------------------------------------
|
||||
|
||||
OK - Inserire Costura Fody x fare ILMerge di dll + assembly vari x SOUR
|
||||
- Verifica distinzione caso release e debug: https://tech.trailmax.info/2014/01/bundling-all-your-assemblies-into-one-or-alternative-to-ilmerge/
|
||||
- Continuare costruzione MSI con WIX con soli files di assembly merged...
|
||||
File diff suppressed because it is too large
Load Diff
@@ -35,14 +35,14 @@
|
||||
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MQTTnet, Version=3.0.5.0, Culture=neutral, PublicKeyToken=b69712f52770c0a7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MQTTnet.3.0.5\lib\net461\MQTTnet.dll</HintPath>
|
||||
<Reference Include="MQTTnet, Version=3.0.8.0, Culture=neutral, PublicKeyToken=b69712f52770c0a7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MQTTnet.3.0.8\lib\net461\MQTTnet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MQTTnet.Extensions.ManagedClient, Version=3.0.5.0, Culture=neutral, PublicKeyToken=b69712f52770c0a7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MQTTnet.Extensions.ManagedClient.3.0.5\lib\net452\MQTTnet.Extensions.ManagedClient.dll</HintPath>
|
||||
<Reference Include="MQTTnet.Extensions.ManagedClient, Version=3.0.8.0, Culture=neutral, PublicKeyToken=b69712f52770c0a7, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MQTTnet.Extensions.ManagedClient.3.0.8\lib\net452\MQTTnet.Extensions.ManagedClient.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
|
||||
@@ -6,387 +6,507 @@ using Newtonsoft.Json.Converters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
|
||||
namespace OpcUaCommon.Services
|
||||
{
|
||||
public class MQTT_Client
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe di configurazione per accesso MQTT
|
||||
/// "plugId": "dev-5c86dced371e9e980142167d", "auth_password": "9c4173da75"
|
||||
/// Enum stati allarmi
|
||||
/// </summary>
|
||||
public class confData
|
||||
public enum alarmState
|
||||
{
|
||||
/// <summary>
|
||||
/// Determina se sia abilitato o meno il protocollo
|
||||
/// </summary>
|
||||
public bool isEnabled = false;
|
||||
/// <summary>
|
||||
/// Base NameSpace (se manca lo aggiunge al channel in fase di invio...
|
||||
/// </summary>
|
||||
public string baseNS { get; set; } = "data/";
|
||||
/// <summary>
|
||||
/// URL del brooker
|
||||
/// api.cloudplugs.com
|
||||
/// </summary>
|
||||
public string broker_address { get; set; }
|
||||
/// <summary>
|
||||
/// PORT del broker
|
||||
/// </summary>
|
||||
public int port_broker { get; set; }
|
||||
/// <summary>
|
||||
/// Tempo di attesa prima di tentare una auto-reconnect (in ms)
|
||||
/// </summary>
|
||||
public int autoReconnectDelayMs { get; set; }
|
||||
/// <summary>
|
||||
/// User - da API mconnect
|
||||
/// "plugId": "dev-5c86dced371e9e980142167d"
|
||||
/// </summary>
|
||||
public string usr_broker { get; set; }
|
||||
/// <summary>
|
||||
/// Password - da API mconnect
|
||||
/// "auth_password": "9c4173da75"
|
||||
/// </summary>
|
||||
public string pwd_broker { get; set; }
|
||||
Active,
|
||||
Inactive
|
||||
}
|
||||
/// <summary>
|
||||
/// Configurazione attiva
|
||||
/// </summary>
|
||||
protected confData _currConf;
|
||||
/// <summary>
|
||||
/// Obj factory MQTT
|
||||
/// </summary>
|
||||
protected MqttFactory factory;
|
||||
/// <summary>
|
||||
/// Opzioni di connessione (managed client)
|
||||
/// </summary>
|
||||
protected ManagedMqttClientOptions options;
|
||||
/// <summary>
|
||||
/// Client MQTT (managed)
|
||||
/// </summary>
|
||||
protected IManagedMqttClient mqttClientMan;
|
||||
/// <summary>
|
||||
/// Cancellation token
|
||||
/// </summary>
|
||||
protected System.Threading.CancellationToken cancellationToken;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Inizializzazione obj gestione MQTT
|
||||
/// Classe del contenuto DATA dell'oggetto (base)
|
||||
/// </summary>
|
||||
/// <param name="currConfig"></param>
|
||||
public MQTT_Client(confData currConfig)
|
||||
public class alarmPayload : dataPayload
|
||||
{
|
||||
// salvo config
|
||||
_currConf = currConfig;
|
||||
mqttClientMan = new MqttFactory().CreateManagedMqttClient();
|
||||
}
|
||||
/// <summary>
|
||||
/// Avvio del client MQTT
|
||||
/// </summary>
|
||||
public async Task startAsync()
|
||||
{
|
||||
// preparo token cancellazione
|
||||
cancellationToken = new System.Threading.CancellationToken();
|
||||
#region Public Properties
|
||||
|
||||
Guid newGuid = Guid.NewGuid();
|
||||
string clientId = $"SOUR-SRG-{newGuid}";
|
||||
/// <summary>
|
||||
/// Stato corrente della condition
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public alarmState activeState { get; set; } = alarmState.Inactive;
|
||||
|
||||
// Setup and start del client MQTT managed.
|
||||
options = new ManagedMqttClientOptionsBuilder()
|
||||
.WithAutoReconnectDelay(TimeSpan.FromMilliseconds(_currConf.autoReconnectDelayMs))
|
||||
.WithClientOptions(new MqttClientOptionsBuilder()
|
||||
.WithClientId(clientId)
|
||||
.WithTcpServer(_currConf.broker_address, _currConf.port_broker)
|
||||
.WithCredentials(_currConf.usr_broker, _currConf.pwd_broker)
|
||||
//.WithTls()
|
||||
.Build())
|
||||
.Build();
|
||||
// avvio client MQTT
|
||||
await mqttClientMan.StartAsync(options);
|
||||
}
|
||||
/// <summary>
|
||||
/// COntrolla se il channel contenga il valore baseNS da config, altrimenti aggiunge...
|
||||
/// </summary>
|
||||
/// <param name="channel"></param>
|
||||
/// <returns></returns>
|
||||
protected string fixChannel(string channel)
|
||||
{
|
||||
// verifico se aggiungere o meno il baseNS...
|
||||
string answ = channel.StartsWith(_currConf.baseNS) ? channel : _currConf.baseNS + channel;
|
||||
// fix in caso ci fossero ":" al psoto di "/"...
|
||||
answ = answ.Replace(":", "/");
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Invia messaggio richiesto
|
||||
/// </summary>
|
||||
/// <param name="channel">Channel su cui pubblicare</param>
|
||||
/// <param name="valore">Valore da trasmettere</param>
|
||||
/// <param name="ttlSec">TTL da impostare: -1 = never, null = default 100gg, >=0 imposta TTL</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> sendValueAsync(string channel, string valore, int? ttlSec)
|
||||
{
|
||||
bool answ = false;
|
||||
// invio SOLO SE il valore è != ""...
|
||||
if (valore != "")
|
||||
{
|
||||
try
|
||||
/// <summary>
|
||||
/// Chiave univoca allarme (CODICE|SEVERITY)
|
||||
/// </summary>
|
||||
public string conditionName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// K rappresenta il channel della condition
|
||||
/// </summary>
|
||||
public string eventType { get; set; } = "AlarmConditionType";
|
||||
|
||||
/// <summary>
|
||||
/// K rappresenta il channel della condition
|
||||
/// </summary>
|
||||
public string k { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// rappresenta la severity della condition (0..1000) calcolata in automatico dalla condition name (dopo il simbolo pipe "|")
|
||||
/// </summary>
|
||||
public string severity
|
||||
{
|
||||
string payload = createValuePayload(valore, ttlSec);
|
||||
// registro esito...
|
||||
answ = await sendPayloadAsync(channel, payload);
|
||||
get
|
||||
{
|
||||
string answ = "0";
|
||||
int idx = conditionName.IndexOf("|");
|
||||
if (idx > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = conditionName.Substring(idx + 1);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
else
|
||||
{
|
||||
// no invio se vuoto...
|
||||
}
|
||||
// restituico esito...
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Invia messaggio richiesto
|
||||
/// </summary>
|
||||
/// <param name="channel">Channel su cui pubblicare</param>
|
||||
/// <param name="conditionKey">KEY della condition nel formato codice+severity (codice_allarme|severity)</param>
|
||||
/// <param name="conditionValue">Valore condition = TESTO dell'allarme</param>
|
||||
/// <param name="activeState">Stato dell'allarme</param>
|
||||
/// <param name="ttlSec">TTL da impostare: -1 = never, null = default 100gg, >=0 imposta TTL</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> sendAlarmAsync(string channel, string conditionKey, string conditionValue, alarmState activeState, int? ttlSec)
|
||||
{
|
||||
bool answ = false;
|
||||
// invio SOLO SE il valore è != ""...
|
||||
if (conditionKey != "")
|
||||
{
|
||||
try
|
||||
{
|
||||
string payload = createAlarmPayload(channel, conditionKey, conditionValue, activeState, _currConf.baseNS, ttlSec);
|
||||
// registro esito...
|
||||
answ = await sendPayloadAsync($"{channel}/{conditionKey}", payload);
|
||||
}
|
||||
catch(Exception exc)
|
||||
{ }
|
||||
}
|
||||
else
|
||||
{
|
||||
// no invio se vuoto...
|
||||
}
|
||||
// restituico esito...
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Invia messaggio richiesto
|
||||
/// </summary>
|
||||
/// <param name="channel">Channel su cui pubblicare</param>
|
||||
/// <param name="payload">Payload da trasmettere</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> sendPayloadAsync(string channel, string payload)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
// impacchetto il messaggio
|
||||
var message = new MqttApplicationMessageBuilder()
|
||||
.WithTopic($"{_currConf.usr_broker}/{fixChannel(channel)}")
|
||||
.WithPayload(payload)
|
||||
.WithExactlyOnceQoS()
|
||||
.WithRetainFlag()
|
||||
.Build();
|
||||
// invio in modalità async
|
||||
await mqttClientMan.PublishAsync(message, cancellationToken);
|
||||
// registro esito...
|
||||
answ = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{ }
|
||||
// restituico esito...
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Invia 1:1 le stringhe di payload ricevute
|
||||
/// </summary>
|
||||
/// <param name="rowList">Array di linee da registrare</param>
|
||||
public void Send(List<string> rowList)
|
||||
{
|
||||
// spacchetta i payload
|
||||
foreach (var item in rowList)
|
||||
{
|
||||
// e li invia 1:1...
|
||||
|
||||
//string jsonData = MQTT_Client.createPayload("Starting", null);
|
||||
//await mqttCli.sendMessageAsync("data/SRG", jsonData);
|
||||
}
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Formatta il payload in modo che sia un JSon valido partendo dal VALUE che si vuole trasmettere...
|
||||
/// Classe del contenuto DATA dell'oggetto (base)
|
||||
/// </summary>
|
||||
/// <param name="valore">Valore da inviare</param>
|
||||
/// <param name="ttlSec">Indica un TTL (inserisce meta se non vuoto)</param>
|
||||
/// <returns></returns>
|
||||
public static string createValuePayload(string valore, int? ttlSec)
|
||||
public class dataPayload
|
||||
{
|
||||
string jsonData = "";
|
||||
// se ttl null --> imposto default 100 gg
|
||||
ttlSec = ttlSec == null ? 86400 * 100 : ttlSec;
|
||||
// se ttl < 0 --> imposto null (never expiry...)
|
||||
ttlSec = ttlSec < 0 ? null : ttlSec;
|
||||
// preparo oggetto
|
||||
mqttValuePayload currData = new mqttValuePayload()
|
||||
{
|
||||
data = new dataPayload()
|
||||
{
|
||||
v = valore
|
||||
},
|
||||
ttl = ttlSec,
|
||||
at = DTUtils.dtAtMqtt(DateTime.UtcNow)
|
||||
};
|
||||
// serializzo
|
||||
jsonData = JsonConvert.SerializeObject(currData);
|
||||
// restituisco!
|
||||
return jsonData;
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// ts = timestamp server
|
||||
/// </summary>
|
||||
public string ts { get; set; } = DTUtils.timestamp;
|
||||
|
||||
/// <summary>
|
||||
/// v = value
|
||||
/// </summary>
|
||||
public string v { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
/// <summary>
|
||||
/// Formatta il payload in modo che sia un JSon valido x gli allarmi da trasmettere...
|
||||
/// </summary>
|
||||
/// <param name="conditionKey">KEY della condition nel formato codice+severity (codice_allarme|severity)</param>
|
||||
/// <param name="conditionValue">Valore condition = TESTO dell'allarme</param>
|
||||
/// <param name="activeState">Stato dell'allarme</param>
|
||||
/// <param name="baseNS">Componente NS da togliere nel valore "K" del payload dell'allarme</param>
|
||||
/// <param name="ttlSec">TTL da impostare: -1 = never, null = default 100gg, >=0 imposta TTL</param>
|
||||
/// <returns></returns>
|
||||
public static string createAlarmPayload(string channel, string conditionKey, string conditionValue, alarmState activeState, string baseNS, int? ttlSec)
|
||||
|
||||
public class MQTT_Client
|
||||
{
|
||||
string jsonData = "";
|
||||
// se ttl null --> imposto default 100 gg
|
||||
ttlSec = ttlSec == null ? 86400 * 100 : ttlSec;
|
||||
// se ttl < 0 --> imposto null (never expiry...)
|
||||
ttlSec = ttlSec < 0 ? null : ttlSec;
|
||||
// preparo oggetto
|
||||
mqttConditionPayload currData = new mqttConditionPayload()
|
||||
{
|
||||
data = new alarmPayload()
|
||||
#region Private Fields
|
||||
|
||||
private readonly IPrinter _printer;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Configurazione attiva
|
||||
/// </summary>
|
||||
protected confData _currConf;
|
||||
|
||||
/// <summary>
|
||||
/// Cancellation token
|
||||
/// </summary>
|
||||
protected System.Threading.CancellationToken cancellationToken;
|
||||
|
||||
/// <summary>
|
||||
/// Obj factory MQTT
|
||||
/// </summary>
|
||||
protected MqttFactory factory;
|
||||
|
||||
/// <summary>
|
||||
/// Client MQTT (managed)
|
||||
/// </summary>
|
||||
protected IManagedMqttClient mqttClientMan;
|
||||
|
||||
/// <summary>
|
||||
/// Opzioni di connessione (managed client)
|
||||
/// </summary>
|
||||
protected ManagedMqttClientOptions options;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Inizializzazione obj gestione MQTT
|
||||
/// </summary>
|
||||
/// <param name="currConfig"></param>
|
||||
/// <param name="printer"></param>
|
||||
public MQTT_Client(confData currConfig, IPrinter printer)
|
||||
{
|
||||
k = channel.Replace(baseNS, ""),
|
||||
v = conditionValue,
|
||||
conditionName = conditionKey,
|
||||
currState = activeState
|
||||
},
|
||||
ttl = ttlSec,
|
||||
at = DTUtils.dtAtMqtt(DateTime.UtcNow)
|
||||
};
|
||||
// serializzo
|
||||
jsonData = JsonConvert.SerializeObject(currData);
|
||||
// restituisco!
|
||||
return jsonData;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Classe costruzione di un payload MQTT di tipo VALORE STANDARD da serializzare
|
||||
/// </summary>
|
||||
public class mqttValuePayload
|
||||
{
|
||||
/// <summary>
|
||||
/// ts = timestamp pubblicazione
|
||||
/// </summary>
|
||||
public ulong at { get; set; } = DTUtils.dtAtMqtt(DateTime.UtcNow);
|
||||
/// <summary>
|
||||
/// Payload del messaggio MQTT
|
||||
/// </summary>
|
||||
public dataPayload data { get; set; }
|
||||
/// <summary>
|
||||
/// Time To Live, IN SECONDI, default 100 gg (86'400 * 100)
|
||||
/// </summary>
|
||||
public int? ttl { get; set; } = 8640000;
|
||||
}
|
||||
/// <summary>
|
||||
/// Classe costruzione di un payload MQTT di tipo CONDITION da serializzare
|
||||
/// </summary>
|
||||
public class mqttConditionPayload
|
||||
{
|
||||
/// <summary>
|
||||
/// ts = timestamp pubblicazione
|
||||
/// </summary>
|
||||
public ulong at { get; set; } = DTUtils.dtAtMqtt(DateTime.UtcNow);
|
||||
/// <summary>
|
||||
/// Payload del messaggio MQTT
|
||||
/// </summary>
|
||||
public alarmPayload data { get; set; }
|
||||
/// <summary>
|
||||
/// Time To Live, IN SECONDI, default 100 gg (86'400 * 100)
|
||||
/// </summary>
|
||||
public int? ttl { get; set; } = 8640000;
|
||||
}
|
||||
/// <summary>
|
||||
/// Classe del contenuto DATA dell'oggetto (base)
|
||||
/// </summary>
|
||||
public class dataPayload
|
||||
{
|
||||
/// <summary>
|
||||
/// ts = timestamp server
|
||||
/// </summary>
|
||||
public string ts { get; set; } = DTUtils.timestamp;
|
||||
/// <summary>
|
||||
/// v = value
|
||||
/// </summary>
|
||||
public string v { get; set; } = "";
|
||||
}
|
||||
/// <summary>
|
||||
/// Classe del contenuto DATA dell'oggetto (base)
|
||||
/// </summary>
|
||||
public class alarmPayload : dataPayload
|
||||
{
|
||||
/// <summary>
|
||||
/// K rappresenta il channel della condition
|
||||
/// </summary>
|
||||
public string k { get; set; } = "";
|
||||
/// <summary>
|
||||
/// rappresenta la severity della condition (0..1000) calcolata in automatico dalla condition name (dopo il simbolo pipe "|")
|
||||
/// </summary>
|
||||
public string severity
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "0";
|
||||
int idx = conditionName.IndexOf("|");
|
||||
if (idx > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = conditionName.Substring(idx + 1);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
// salvo config
|
||||
_currConf = currConfig;
|
||||
_printer = printer;
|
||||
mqttClientMan = new MqttFactory().CreateManagedMqttClient();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// COntrolla se il channel contenga il valore baseNS da config, altrimenti aggiunge...
|
||||
/// </summary>
|
||||
/// <param name="channel"></param>
|
||||
/// <returns></returns>
|
||||
protected string fixChannel(string channel)
|
||||
{
|
||||
// verifico se aggiungere o meno il baseNS...
|
||||
string answ = channel.StartsWith(_currConf.baseNS) ? channel : _currConf.baseNS + channel;
|
||||
// fix in caso ci fossero ":" al psoto di "/"...
|
||||
answ = answ.Replace(":", "/");
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Formatta il payload in modo che sia un JSon valido x gli allarmi da trasmettere...
|
||||
/// </summary>
|
||||
/// <param name="conditionKey">KEY della condition nel formato codice+severity (codice_allarme|severity)</param>
|
||||
/// <param name="conditionValue">Valore condition = TESTO dell'allarme</param>
|
||||
/// <param name="alrmState">Stato dell'allarme</param>
|
||||
/// <param name="baseNS">Componente NS da togliere nel valore "K" del payload dell'allarme</param>
|
||||
/// <param name="ttlSec">TTL da impostare: -1 = never, null = default 100gg, >=0 imposta TTL</param>
|
||||
/// <returns></returns>
|
||||
public static string createAlarmPayload(string channel, string conditionKey, string conditionValue, alarmState alrmState, string baseNS, int? ttlSec)
|
||||
{
|
||||
string jsonData = "";
|
||||
// se ttl null --> imposto default 100 gg
|
||||
ttlSec = ttlSec == null ? 86400 * 100 : ttlSec;
|
||||
// se ttl < 0 --> imposto null (never expiry...)
|
||||
ttlSec = ttlSec < 0 ? null : ttlSec;
|
||||
// preparo oggetto
|
||||
mqttConditionPayload currData = new mqttConditionPayload()
|
||||
{
|
||||
data = new alarmPayload()
|
||||
{
|
||||
k = channel.Replace(baseNS, ""),
|
||||
v = conditionValue,
|
||||
conditionName = conditionKey,
|
||||
activeState = alrmState
|
||||
},
|
||||
ttl = ttlSec,
|
||||
at = DTUtils.dtAtMqtt(DateTime.UtcNow)
|
||||
};
|
||||
// serializzo
|
||||
jsonData = JsonConvert.SerializeObject(currData);
|
||||
// restituisco!
|
||||
return jsonData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Formatta il payload in modo che sia un JSon valido partendo dal VALUE che si vuole trasmettere...
|
||||
/// </summary>
|
||||
/// <param name="valore">Valore da inviare</param>
|
||||
/// <param name="ttlSec">Indica un TTL (inserisce meta se non vuoto)</param>
|
||||
/// <returns></returns>
|
||||
public static string createValuePayload(string valore, int? ttlSec)
|
||||
{
|
||||
string jsonData = "";
|
||||
// se ttl null --> imposto default 100 gg
|
||||
ttlSec = ttlSec == null ? 86400 * 100 : ttlSec;
|
||||
// se ttl < 0 --> imposto null (never expiry...)
|
||||
ttlSec = ttlSec < 0 ? null : ttlSec;
|
||||
// preparo oggetto
|
||||
mqttValuePayload currData = new mqttValuePayload()
|
||||
{
|
||||
data = new dataPayload()
|
||||
{
|
||||
v = valore
|
||||
},
|
||||
ttl = ttlSec,
|
||||
at = DTUtils.dtAtMqtt(DateTime.UtcNow)
|
||||
};
|
||||
// serializzo
|
||||
jsonData = JsonConvert.SerializeObject(currData);
|
||||
// restituisco!
|
||||
return jsonData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Formatta il payload in modo che sia un JSon valido partendo dal VALUE che si vuole trasmettere...
|
||||
/// </summary>
|
||||
/// <param name="valore">Valore da inviare</param>
|
||||
/// <param name="ttlSec">Indica un TTL (inserisce meta se non vuoto)</param>
|
||||
/// <param name="EventDT">Data-ora dell'evento da creare</param>
|
||||
/// <returns></returns>
|
||||
public static string createValuePayload(string valore, int? ttlSec, DateTime EventDT)
|
||||
{
|
||||
string jsonData = "";
|
||||
// se ttl null --> imposto default 100 gg
|
||||
ttlSec = ttlSec == null ? 86400 * 100 : ttlSec;
|
||||
// se ttl < 0 --> imposto null (never expiry...)
|
||||
ttlSec = ttlSec < 0 ? null : ttlSec;
|
||||
// preparo oggetto
|
||||
mqttValuePayload currData = new mqttValuePayload()
|
||||
{
|
||||
data = new dataPayload()
|
||||
{
|
||||
v = valore
|
||||
},
|
||||
ttl = ttlSec,
|
||||
at = DTUtils.dtAtMqtt(EventDT)
|
||||
};
|
||||
// serializzo
|
||||
jsonData = JsonConvert.SerializeObject(currData);
|
||||
// restituisco!
|
||||
return jsonData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invia 1:1 le stringhe di payload ricevute
|
||||
/// </summary>
|
||||
/// <param name="rowList">Array di linee da registrare</param>
|
||||
public void Send(List<string> rowList)
|
||||
{
|
||||
// spacchetta i payload
|
||||
foreach (var item in rowList)
|
||||
{
|
||||
// e li invia 1:1...
|
||||
|
||||
//string jsonData = MQTT_Client.createPayload("Starting", null);
|
||||
//await mqttCli.sendMessageAsync("data/SRG", jsonData);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invia messaggio richiesto
|
||||
/// </summary>
|
||||
/// <param name="channel">Channel su cui pubblicare</param>
|
||||
/// <param name="conditionKey">KEY della condition nel formato codice+severity (codice_allarme|severity)</param>
|
||||
/// <param name="conditionValue">Valore condition = TESTO dell'allarme</param>
|
||||
/// <param name="activeState">Stato dell'allarme</param>
|
||||
/// <param name="ttlSec">TTL da impostare: -1 = never, null = default 100gg, >=0 imposta TTL</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> sendAlarmAsync(string channel, string conditionKey, string conditionValue, alarmState activeState, int? ttlSec)
|
||||
{
|
||||
bool answ = false;
|
||||
// invio SOLO SE il valore è != ""...
|
||||
if (conditionKey != "")
|
||||
{
|
||||
try
|
||||
{
|
||||
string payload = createAlarmPayload(channel, conditionKey, conditionValue, activeState, _currConf.baseNS, ttlSec);
|
||||
// registro esito...
|
||||
answ = await sendPayloadAsync($"{channel}/{conditionKey}", payload);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
_printer.Print($"EXCEPTION during sendAlarmAsync: channel {channel} | conditionKey = {conditionKey} | conditionValue = {conditionValue} | activeState = {activeState} | TTL = {ttlSec}");
|
||||
_printer.Print(exc.ToString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// no invio se vuoto...
|
||||
}
|
||||
// restituico esito...
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invia messaggio richiesto
|
||||
/// </summary>
|
||||
/// <param name="channel">Channel su cui pubblicare</param>
|
||||
/// <param name="payload">Payload da trasmettere</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> sendPayloadAsync(string channel, string payload)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
// impacchetto il messaggio
|
||||
var message = new MqttApplicationMessageBuilder()
|
||||
.WithTopic($"{_currConf.usr_broker}/{fixChannel(channel)}")
|
||||
.WithPayload(payload)
|
||||
.WithExactlyOnceQoS()
|
||||
.WithRetainFlag()
|
||||
.Build();
|
||||
// invio in modalità async
|
||||
await mqttClientMan.PublishAsync(message, cancellationToken);
|
||||
// registro esito...
|
||||
answ = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
_printer.Print($"EXCEPTION during sendPayloadAsync: channel {channel} | payload = {payload}");
|
||||
_printer.Print(exc.ToString());
|
||||
}
|
||||
// restituico esito...
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invia messaggio richiesto
|
||||
/// </summary>
|
||||
/// <param name="channel">Channel su cui pubblicare</param>
|
||||
/// <param name="valore">Valore da trasmettere</param>
|
||||
/// <param name="ttlSec">TTL da impostare: -1 = never, null = default 100gg, >=0 imposta TTL</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> sendValueAsync(string channel, string valore, int? ttlSec)
|
||||
{
|
||||
bool answ = false;
|
||||
// invio SOLO SE il valore è != ""...
|
||||
if (!string.IsNullOrEmpty(valore))
|
||||
{
|
||||
try
|
||||
{
|
||||
string payload = createValuePayload(valore, ttlSec);
|
||||
// registro esito...
|
||||
answ = await sendPayloadAsync(channel, payload);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
_printer.Print($"EXCEPTION during sendValueAsync: channel {channel} | valore = {valore} | TTL = {ttlSec}");
|
||||
_printer.Print(exc.ToString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// no invio se vuoto...
|
||||
}
|
||||
// restituico esito...
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Avvio del client MQTT
|
||||
/// </summary>
|
||||
public async Task startAsync()
|
||||
{
|
||||
// preparo token cancellazione
|
||||
cancellationToken = new System.Threading.CancellationToken();
|
||||
|
||||
Guid newGuid = Guid.NewGuid();
|
||||
string clientId = $"SOUR-SRG-{newGuid}";
|
||||
|
||||
// Setup and start del client MQTT managed.
|
||||
options = new ManagedMqttClientOptionsBuilder()
|
||||
.WithAutoReconnectDelay(TimeSpan.FromMilliseconds(_currConf.autoReconnectDelayMs))
|
||||
.WithClientOptions(new MqttClientOptionsBuilder()
|
||||
.WithClientId(clientId)
|
||||
.WithTcpServer(_currConf.broker_address, _currConf.port_broker)
|
||||
.WithCredentials(_currConf.usr_broker, _currConf.pwd_broker)
|
||||
//.WithTls()
|
||||
.Build())
|
||||
.Build();
|
||||
// avvio client MQTT
|
||||
await mqttClientMan.StartAsync(options);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Public Classes
|
||||
|
||||
/// <summary>
|
||||
/// Classe di configurazione per accesso MQTT
|
||||
/// "plugId": "dev-5c86dced371e9e980142167d", "auth_password": "9c4173da75"
|
||||
/// </summary>
|
||||
public class confData
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
/// Determina se sia abilitato o meno il protocollo
|
||||
/// </summary>
|
||||
public bool isEnabled = false;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Tempo di attesa prima di tentare una auto-reconnect (in ms)
|
||||
/// </summary>
|
||||
public int autoReconnectDelayMs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Base NameSpace (se manca lo aggiunge al channel in fase di invio...
|
||||
/// </summary>
|
||||
public string baseNS { get; set; } = "data/";
|
||||
|
||||
/// <summary>
|
||||
/// URL del brooker
|
||||
/// api.cloudplugs.com
|
||||
/// </summary>
|
||||
public string broker_address { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// PORT del broker
|
||||
/// </summary>
|
||||
public int port_broker { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Password - da API mconnect
|
||||
/// "auth_password": "9c4173da75"
|
||||
/// </summary>
|
||||
public string pwd_broker { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User - da API mconnect
|
||||
/// "plugId": "dev-5c86dced371e9e980142167d"
|
||||
/// </summary>
|
||||
public string usr_broker { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
#endregion Public Classes
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// K rappresenta il channel della condition
|
||||
/// Classe costruzione di un payload MQTT di tipo CONDITION da serializzare
|
||||
/// </summary>
|
||||
public string eventType { get; set; } = "AlarmConditionType";
|
||||
public class mqttConditionPayload
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// ts = timestamp pubblicazione
|
||||
/// </summary>
|
||||
public ulong at { get; set; } = DTUtils.dtAtMqtt(DateTime.UtcNow);
|
||||
|
||||
/// <summary>
|
||||
/// Payload del messaggio MQTT
|
||||
/// </summary>
|
||||
public alarmPayload data { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Time To Live, IN SECONDI, default 100 gg (86'400 * 100)
|
||||
/// </summary>
|
||||
public int? ttl { get; set; } = 8640000;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chiave univoca allarme (CODICE|SEVERITY)
|
||||
/// Classe costruzione di un payload MQTT di tipo VALORE STANDARD da serializzare
|
||||
/// </summary>
|
||||
public string conditionName { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Stato corrente della condition
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public alarmState currState { get; set; } = alarmState.Inactive;
|
||||
}
|
||||
/// <summary>
|
||||
/// Enum stati allarmi
|
||||
/// </summary>
|
||||
public enum alarmState
|
||||
{
|
||||
Active,
|
||||
Inactive
|
||||
}
|
||||
}
|
||||
public class mqttValuePayload
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// ts = timestamp pubblicazione
|
||||
/// </summary>
|
||||
public ulong at { get; set; } = DTUtils.dtAtMqtt(DateTime.UtcNow);
|
||||
|
||||
/// <summary>
|
||||
/// Payload del messaggio MQTT
|
||||
/// </summary>
|
||||
public dataPayload data { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Time To Live, IN SECONDI, default 100 gg (86'400 * 100)
|
||||
/// </summary>
|
||||
public int? ttl { get; set; } = 8640000;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.8" targetFramework="net461" />
|
||||
<package id="Microsoft.NETCore.Platforms" version="2.2.2" targetFramework="net461" />
|
||||
<package id="MQTTnet" version="3.0.5" targetFramework="net461" />
|
||||
<package id="MQTTnet.Extensions.ManagedClient" version="3.0.5" targetFramework="net461" />
|
||||
<package id="Microsoft.NETCore.Platforms" version="3.0.0" targetFramework="net461" />
|
||||
<package id="MQTTnet" version="3.0.8" targetFramework="net461" />
|
||||
<package id="MQTTnet.Extensions.ManagedClient" version="3.0.8" targetFramework="net461" />
|
||||
<package id="NETStandard.Library" version="2.0.3" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
|
||||
<package id="System.Net.Security" version="4.3.2" targetFramework="net461" />
|
||||
<package id="System.Net.WebSockets" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Net.WebSockets.Client" version="4.3.2" targetFramework="net461" />
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.2.1.0" newVersion="1.2.1.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.2.4.0" newVersion="1.2.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
|
||||
@@ -25,7 +25,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.1" newVersion="4.0.3.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
@@ -33,7 +33,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.AspNetCore.Hosting" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.2.7.0" newVersion="2.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel.Https" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
@@ -49,7 +49,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
@@ -77,7 +77,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
@@ -85,7 +85,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.AspNetCore.Http.Features" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.AspNetCore.Http" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
@@ -93,7 +93,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Security.Cryptography.Cng" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.3.2.0" newVersion="4.3.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
@@ -103,6 +103,90 @@
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.AspNetCore.Connections.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Configuration.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.FileProviders.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Configuration" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Configuration.Binder" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Hosting.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Configuration.EnvironmentVariables" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Configuration.FileExtensions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.FileProviders.Physical" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Options" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.ObjectPool" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Logging" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.4.4.0" newVersion="1.4.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Security.Principal.Windows" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Reflection.DispatchProxy" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Security.Cryptography.Xml" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
<ModelDesign>
|
||||
<Machine DefaultGenerationRate="2000">
|
||||
<Property SymbolicName="ModelName" BrowseName="ModelName" DataType="ua:String" ValueRank="Scalar" Value="Morbidelli P200 - SOUR" />
|
||||
<Property SymbolicName="MachineID" BrowseName="MachineID" DataType="ua:String" ValueRank="Scalar" Value="SOUR/0001" />
|
||||
<Property SymbolicName="Matricola" BrowseName="Matricola" DataType="ua:String" ValueRank="Scalar" Value="SOUR/0001" />
|
||||
<Property SymbolicName="ManufacturerName" BrowseName="ManufacturerName" DataType="ua:String" ValueRank="Scalar" Value="SCM" />
|
||||
<Variable SymbolicName="AlarmState" BrowseName="AlarmState" DataType="ua:Boolean" ValueRank="Scalar" GenerationRate="" Range="[0,1]" Units="Enumeration" />
|
||||
<Variable SymbolicName="EmergencyState" BrowseName="EmergencyState" DataType="ua:Boolean" ValueRank="Scalar" GenerationRate="" Range="[0,1]" Units="Enumeration" />
|
||||
<Variable SymbolicName="ExecutionState" BrowseName="ExecutionState" DataType="ua:Boolean" ValueRank="Scalar" GenerationRate="" Range="[0,1]" Units="Enumeration" />
|
||||
<Variable SymbolicName="HoldState" BrowseName="HoldState" DataType="ua:Boolean" ValueRank="Scalar" GenerationRate="" Range="[0,1]" Units="Enumeration" />
|
||||
<Variable SymbolicName="Power" BrowseName="Power" DataType="ua:Boolean" ValueRank="Scalar" GenerationRate="" Range="[1,1]" Units="Enumeration" />
|
||||
<Variable SymbolicName="Mode" BrowseName="Mode" DataType="ua:String" ValueRank="Scalar" GenerationRate="" Range="[Auto,MDI,Manual,Calibration]" Units="Enumeration" />
|
||||
<Condition SymbolicName="CNC" BrowseName="CNC" DataType="ua:String" ValueRank="Scalar" type="OffNormalAlarmState" Severity="high" GenerationRate="10000" Range="[]" Units="" />
|
||||
<Condition SymbolicName="PLC" BrowseName="PLC" DataType="ua:String" ValueRank="Scalar" type="OffNormalAlarmState" Severity="high" GenerationRate="5000" Range="[]" Units="" />
|
||||
<Component Name="Axes">
|
||||
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
|
||||
<Variable SymbolicName="Override" BrowseName="Override" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
|
||||
<Component Name="AxisX">
|
||||
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
|
||||
<Variable SymbolicName="Override" BrowseName="Override" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
|
||||
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,1000000]" Units="Count" />
|
||||
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,1000]" Units="Count" />
|
||||
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,500000]" Units="Count" />
|
||||
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,1000]" Units="Count" />
|
||||
</Component>
|
||||
<Component Name="AxisY">
|
||||
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
|
||||
<Variable SymbolicName="Override" BrowseName="Override" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
|
||||
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,1000000]" Units="Count" />
|
||||
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,1000]" Units="Count" />
|
||||
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,500000]" Units="Count" />
|
||||
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,1000]" Units="Count" />
|
||||
</Component>
|
||||
<Component Name="AxisZ">
|
||||
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
|
||||
<Variable SymbolicName="Override" BrowseName="Override" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
|
||||
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,1000000]" Units="Count" />
|
||||
<Variable SymbolicName="CurrentPos" BrowseName="CurrentPos" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,1000]" Units="Count" />
|
||||
<Variable SymbolicName="Distance" BrowseName="Distance" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,500000]" Units="Count" />
|
||||
<Variable SymbolicName="TargetPos" BrowseName="TargetPos" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,1000]" Units="Count" />
|
||||
</Component>
|
||||
<Component Name="AxisB">
|
||||
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
|
||||
<Variable SymbolicName="Override" BrowseName="Override" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
|
||||
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,1000000]" Units="Count" />
|
||||
<Variable SymbolicName="CurrentAng" BrowseName="CurrentAng" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,360]" Units="Count" />
|
||||
<Variable SymbolicName="Revolutions" BrowseName="Revolutions" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,500000]" Units="Count" />
|
||||
<Variable SymbolicName="TargetAng" BrowseName="TargetAng" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,360]" Units="Count" />
|
||||
</Component>
|
||||
<Component Name="AxisU">
|
||||
<Variable SymbolicName="FeedRate" BrowseName="FeedRate" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
|
||||
<Variable SymbolicName="Override" BrowseName="Override" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
|
||||
<Variable SymbolicName="Inversions" BrowseName="Inversions" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,1000000]" Units="Count" />
|
||||
<Variable SymbolicName="CurrentAng" BrowseName="CurrentAng" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,360]" Units="Count" />
|
||||
<Variable SymbolicName="Revolutions" BrowseName="Revolutions" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,500000]" Units="Count" />
|
||||
<Variable SymbolicName="TargetAng" BrowseName="TargetAng" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,360]" Units="Count" />
|
||||
</Component>
|
||||
</Component>
|
||||
|
||||
<Component Name="OperatingGroups">
|
||||
<Variable SymbolicName="Override" BrowseName="Override" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Percent" />
|
||||
<Component Name="Heads">
|
||||
<Component Name="Head_1">
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,130]" Units="Percent" />
|
||||
<Variable SymbolicName="Speed" BrowseName="Speed" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
|
||||
<Variable SymbolicName="SpindleRevs" BrowseName="SpindleRevs" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
|
||||
<Variable SymbolicName="SpindleActiveDuration" BrowseName="SpindeActiveDuration" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,100]" Units="Count" />
|
||||
<Variable SymbolicName="ToolChanges" BrowseName="ToolChanges" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,250]" Units="Count" />
|
||||
<Variable SymbolicName="ToolId" BrowseName="ToolId" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
|
||||
</Component>
|
||||
<Component Name="Head_2">
|
||||
<Variable SymbolicName="Load" BrowseName="Load" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,130]" Units="Percent" />
|
||||
<Variable SymbolicName="Speed" BrowseName="Speed" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
|
||||
<Variable SymbolicName="SpindleRevs" BrowseName="SpindleRevs" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,5000]" Units="Count" />
|
||||
<Variable SymbolicName="SpindleActiveDuration" BrowseName="SpindeActiveDuration" DataType="ua:Float" ValueRank="Scalar" GenerationRate="" Range="[0,100]" Units="Count" />
|
||||
</Component>
|
||||
</Component>
|
||||
</Component>
|
||||
<Component Name="VacuumPumps">
|
||||
<Component Name="VacuumPump_1">
|
||||
<Variable SymbolicName="WorkingTime" BrowseName="WorkingTime" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,100]" Units="Count" />
|
||||
</Component>
|
||||
<Component Name="VacuumPump_2">
|
||||
<Variable SymbolicName="WorkingTime" BrowseName="WorkingTime" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,100]" Units="Count" />
|
||||
</Component>
|
||||
<Component Name="VacuumPump_3">
|
||||
<Variable SymbolicName="WorkingTime" BrowseName="WorkingTime" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,100]" Units="Count" />
|
||||
</Component>
|
||||
<Component Name="VacuumPump_4">
|
||||
<Variable SymbolicName="WorkingTime" BrowseName="WorkingTime" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,100]" Units="Count" />
|
||||
</Component>
|
||||
</Component>
|
||||
<Component Name="Lubro">
|
||||
<Component Name="Lube_1">
|
||||
<Variable SymbolicName="Activations" BrowseName="Activations" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,1000]" Units="Count" />
|
||||
<Variable SymbolicName="Empty" BrowseName="Empty" DataType="ua:Boolean" ValueRank="Scalar" GenerationRate="" Range="[0,1]" Units="Enumeration" />
|
||||
</Component>
|
||||
|
||||
<Component Name="Lube_2">
|
||||
<Variable SymbolicName="Activations" BrowseName="Activations" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[0,1000]" Units="Count" />
|
||||
<Variable SymbolicName="Empty" BrowseName="Empty" DataType="ua:Boolean" ValueRank="Scalar" GenerationRate="" Range="[0,1]" Units="Enumeration" />
|
||||
</Component>
|
||||
</Component>
|
||||
<Component Name="WorkingArea">
|
||||
<Component Name="Area_1">
|
||||
<Property SymbolicName="AreaID" BrowseName="AreaID" DataType="ua:String" ValueRank="Scalar" Value="A"/>
|
||||
<Component Name="Program_1">
|
||||
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" GenerationRate="" Range="[Progr1,Prog2,Prog3]" Units="Enumeration" />
|
||||
<Variable SymbolicName="RepsLeft" BrowseName="RepsLeft" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[1,10]" Units="Enumeration" />
|
||||
<Variable SymbolicName="RepsProgrammed" BrowseName="RepsProgrammed" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[12,12]" Units="Enumeration" />
|
||||
<Variable SymbolicName="ProgramState" BrowseName="ProgramState" DataType="ua:String" ValueRank="Scalar" GenerationRate="" Range="[Exe,Loading,Alarm,Ready,Reserved]" Units="Enumeration" />
|
||||
</Component>
|
||||
</Component>
|
||||
<Component Name="Area_2">
|
||||
<Property SymbolicName="AreaID" BrowseName="AreaID" DataType="ua:String" ValueRank="Scalar" Value="A"/>
|
||||
<Component Name="Program_1">
|
||||
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" GenerationRate="" Range="[Progr1,Prog2,Prog3]" Units="Enumeration" />
|
||||
<Variable SymbolicName="RepsLeft" BrowseName="RepsLeft" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[1,10]" Units="Enumeration" />
|
||||
<Variable SymbolicName="RepsProgrammed" BrowseName="RepsProgrammed" DataType="ua:UInt32" ValueRank="Scalar" GenerationRate="" Range="[12,12]" Units="Enumeration" />
|
||||
<Variable SymbolicName="ProgramState" BrowseName="ProgramState" DataType="ua:String" ValueRank="Scalar" GenerationRate="" Range="[Exe,Loading,Alarm,Ready,Reserved]" Units="Enumeration" />
|
||||
</Component>
|
||||
</Component>
|
||||
</Component>
|
||||
</Machine>
|
||||
</ModelDesign>
|
||||
@@ -35,16 +35,16 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="BouncyCastle.Crypto, Version=1.8.5.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Portable.BouncyCastle.1.8.5\lib\net40\BouncyCastle.Crypto.dll</HintPath>
|
||||
<HintPath>..\packages\Portable.BouncyCastle.1.8.5.2\lib\net40\BouncyCastle.Crypto.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.AspNetCore.Connections.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNetCore.Connections.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Connections.Abstractions.dll</HintPath>
|
||||
<Reference Include="Microsoft.AspNetCore.Connections.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNetCore.Connections.Abstractions.3.0.0\lib\netstandard2.0\Microsoft.AspNetCore.Connections.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.AspNetCore.Hosting, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNetCore.Hosting.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Hosting.dll</HintPath>
|
||||
<Reference Include="Microsoft.AspNetCore.Hosting, Version=2.2.7.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNetCore.Hosting.2.2.7\lib\netstandard2.0\Microsoft.AspNetCore.Hosting.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.AspNetCore.Hosting.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNetCore.Hosting.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Hosting.Abstractions.dll</HintPath>
|
||||
@@ -61,8 +61,8 @@
|
||||
<Reference Include="Microsoft.AspNetCore.Http.Extensions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNetCore.Http.Extensions.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.AspNetCore.Http.Features, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNetCore.Http.Features.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Features.dll</HintPath>
|
||||
<Reference Include="Microsoft.AspNetCore.Http.Features, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNetCore.Http.Features.3.0.0\lib\netstandard2.0\Microsoft.AspNetCore.Http.Features.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.AspNetCore.Server.Kestrel, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNetCore.Server.Kestrel.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Server.Kestrel.dll</HintPath>
|
||||
@@ -83,56 +83,59 @@
|
||||
<Reference Include="Microsoft.AspNetCore.WebUtilities, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNetCore.WebUtilities.2.2.0\lib\netstandard2.0\Microsoft.AspNetCore.WebUtilities.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.Configuration, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Configuration.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.dll</HintPath>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.Configuration.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Configuration.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath>
|
||||
<Reference Include="Microsoft.Extensions.Configuration, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Configuration.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.Configuration.Binder, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Configuration.Binder.2.2.4\lib\netstandard2.0\Microsoft.Extensions.Configuration.Binder.dll</HintPath>
|
||||
<Reference Include="Microsoft.Extensions.Configuration.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Configuration.Abstractions.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.Configuration.EnvironmentVariables, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Configuration.EnvironmentVariables.2.2.4\lib\netstandard2.0\Microsoft.Extensions.Configuration.EnvironmentVariables.dll</HintPath>
|
||||
<Reference Include="Microsoft.Extensions.Configuration.Binder, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Configuration.Binder.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.Binder.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.Configuration.FileExtensions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Configuration.FileExtensions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.FileExtensions.dll</HintPath>
|
||||
<Reference Include="Microsoft.Extensions.Configuration.EnvironmentVariables, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Configuration.EnvironmentVariables.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.EnvironmentVariables.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.2.2.0\lib\net461\Microsoft.Extensions.DependencyInjection.dll</HintPath>
|
||||
<Reference Include="Microsoft.Extensions.Configuration.FileExtensions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Configuration.FileExtensions.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.FileExtensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
|
||||
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.3.0.0\lib\net461\Microsoft.Extensions.DependencyInjection.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.FileProviders.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.FileProviders.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.FileProviders.Abstractions.dll</HintPath>
|
||||
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.3.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.FileProviders.Physical, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.FileProviders.Physical.2.2.0\lib\netstandard2.0\Microsoft.Extensions.FileProviders.Physical.dll</HintPath>
|
||||
<Reference Include="Microsoft.Extensions.FileProviders.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.FileProviders.Abstractions.3.0.0\lib\netstandard2.0\Microsoft.Extensions.FileProviders.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.FileSystemGlobbing, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.FileSystemGlobbing.2.2.0\lib\netstandard2.0\Microsoft.Extensions.FileSystemGlobbing.dll</HintPath>
|
||||
<Reference Include="Microsoft.Extensions.FileProviders.Physical, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.FileProviders.Physical.3.0.0\lib\netstandard2.0\Microsoft.Extensions.FileProviders.Physical.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.Hosting.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Hosting.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Hosting.Abstractions.dll</HintPath>
|
||||
<Reference Include="Microsoft.Extensions.FileSystemGlobbing, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.FileSystemGlobbing.3.0.0\lib\netstandard2.0\Microsoft.Extensions.FileSystemGlobbing.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.Logging, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Logging.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Logging.dll</HintPath>
|
||||
<Reference Include="Microsoft.Extensions.Hosting.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Hosting.Abstractions.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Hosting.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
||||
<Reference Include="Microsoft.Extensions.Logging, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Logging.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.ObjectPool, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.ObjectPool.2.2.0\lib\netstandard2.0\Microsoft.Extensions.ObjectPool.dll</HintPath>
|
||||
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.Options, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Options.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Options.dll</HintPath>
|
||||
<Reference Include="Microsoft.Extensions.ObjectPool, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.ObjectPool.3.0.0\lib\netstandard2.0\Microsoft.Extensions.ObjectPool.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.Options, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Options.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Options.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.PlatformAbstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.PlatformAbstractions.1.1.0\lib\net451\Microsoft.Extensions.PlatformAbstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Extensions.Primitives, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Primitives.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll</HintPath>
|
||||
<Reference Include="Microsoft.Extensions.Primitives, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Extensions.Primitives.3.0.0\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Net.Http.Headers, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.Headers.2.2.0\lib\netstandard2.0\Microsoft.Net.Http.Headers.dll</HintPath>
|
||||
@@ -141,25 +144,25 @@
|
||||
<HintPath>..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Opc.Ua.Client, Version=1.4.355.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.355.26\lib\net46\Opc.Ua.Client.dll</HintPath>
|
||||
<Reference Include="Opc.Ua.Client, Version=1.4.354.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.354.23\lib\net46\Opc.Ua.Client.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Opc.Ua.Configuration, Version=1.4.355.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.355.26\lib\net46\Opc.Ua.Configuration.dll</HintPath>
|
||||
<Reference Include="Opc.Ua.Configuration, Version=1.4.354.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.354.23\lib\net46\Opc.Ua.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Opc.Ua.Core, Version=1.4.355.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.355.26\lib\net46\Opc.Ua.Core.dll</HintPath>
|
||||
<Reference Include="Opc.Ua.Core, Version=1.4.354.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.354.23\lib\net46\Opc.Ua.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Opc.Ua.Gds.Client.Common, Version=1.4.355.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.355.26\lib\net46\Opc.Ua.Gds.Client.Common.dll</HintPath>
|
||||
<Reference Include="Opc.Ua.Gds.Client.Common, Version=1.4.354.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.354.23\lib\net46\Opc.Ua.Gds.Client.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Opc.Ua.Gds.Server.Common, Version=1.4.355.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.355.26\lib\net46\Opc.Ua.Gds.Server.Common.dll</HintPath>
|
||||
<Reference Include="Opc.Ua.Gds.Server.Common, Version=1.4.354.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.354.23\lib\net46\Opc.Ua.Gds.Server.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Opc.Ua.Server, Version=1.4.355.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.355.26\lib\net46\Opc.Ua.Server.dll</HintPath>
|
||||
<Reference Include="Opc.Ua.Server, Version=1.4.354.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.1.4.354.23\lib\net46\Opc.Ua.Server.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
@@ -169,8 +172,8 @@
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Collections.Immutable, Version=1.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Collections.Immutable.1.5.0\lib\netstandard2.0\System.Collections.Immutable.dll</HintPath>
|
||||
<Reference Include="System.Collections.Immutable, Version=1.2.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Collections.Immutable.1.6.0\lib\netstandard2.0\System.Collections.Immutable.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Collections.NonGeneric, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Collections.NonGeneric.4.3.0\lib\net46\System.Collections.NonGeneric.dll</HintPath>
|
||||
@@ -179,10 +182,11 @@
|
||||
<HintPath>..\packages\System.Collections.Specialized.4.3.0\lib\net46\System.Collections.Specialized.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ComponentModel.Annotations, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ComponentModel.Annotations.4.5.0\lib\net461\System.ComponentModel.Annotations.dll</HintPath>
|
||||
<HintPath>..\packages\System.ComponentModel.Annotations.4.6.0\lib\net461\System.ComponentModel.Annotations.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Console, Version=4.0.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Console.4.3.1\lib\net46\System.Console.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@@ -192,8 +196,9 @@
|
||||
<Reference Include="System.Data.Common, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Data.Common.4.3.0\lib\net451\System.Data.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.3.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.5.1\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||
<Reference Include="System.Data.OracleClient" />
|
||||
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.6.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Globalization.Calendars, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
@@ -214,12 +219,13 @@
|
||||
<Reference Include="System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.IO.Pipelines, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Pipelines.4.5.3\lib\netstandard2.0\System.IO.Pipelines.dll</HintPath>
|
||||
<Reference Include="System.IO.Pipelines, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Pipelines.4.6.0\lib\netstandard2.0\System.IO.Pipelines.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net" />
|
||||
<Reference Include="System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@@ -248,17 +254,20 @@
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Reflection.DispatchProxy, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Reflection.DispatchProxy.4.5.1\lib\net461\System.Reflection.DispatchProxy.dll</HintPath>
|
||||
<Reference Include="System.Private.ServiceModel, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Private.ServiceModel.4.6.0\lib\netstandard2.0\System.Private.ServiceModel.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Reflection.Metadata, Version=1.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Reflection.Metadata.1.6.0\lib\netstandard2.0\System.Reflection.Metadata.dll</HintPath>
|
||||
<Reference Include="System.Reflection.DispatchProxy, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Reflection.DispatchProxy.4.6.0\lib\net461\System.Reflection.DispatchProxy.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Reflection.TypeExtensions, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Reflection.TypeExtensions.4.5.1\lib\net461\System.Reflection.TypeExtensions.dll</HintPath>
|
||||
<Reference Include="System.Reflection.Metadata, Version=1.4.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Reflection.Metadata.1.7.0\lib\netstandard2.0\System.Reflection.Metadata.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
<Reference Include="System.Reflection.TypeExtensions, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Reflection.TypeExtensions.4.6.0\lib\net461\System.Reflection.TypeExtensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
|
||||
@@ -271,6 +280,10 @@
|
||||
<Reference Include="System.Runtime.Serialization.Xml, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.Serialization.Xml.4.3.0\lib\net46\System.Runtime.Serialization.Xml.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Security.AccessControl, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.AccessControl.4.6.0\lib\net461\System.Security.AccessControl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Claims, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Claims.4.3.0\lib\net46\System.Security.Claims.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -279,8 +292,8 @@
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Cng, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.Cng.4.5.0\lib\net461\System.Security.Cryptography.Cng.dll</HintPath>
|
||||
<Reference Include="System.Security.Cryptography.Cng, Version=4.3.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.Cng.4.6.0\lib\net461\System.Security.Cryptography.Cng.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
|
||||
@@ -293,19 +306,27 @@
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Principal.Windows, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Principal.Windows.4.5.1\lib\net461\System.Security.Principal.Windows.dll</HintPath>
|
||||
<Reference Include="System.Security.Cryptography.Xml, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.Xml.4.6.0\lib\net461\System.Security.Cryptography.Xml.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Permissions, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Permissions.4.6.0\lib\net461\System.Security.Permissions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Principal.Windows, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Principal.Windows.4.6.0\lib\net461\System.Security.Principal.Windows.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.ServiceModel.Primitives, Version=4.5.0.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ServiceModel.Primitives.4.5.3\lib\net461\System.ServiceModel.Primitives.dll</HintPath>
|
||||
<Reference Include="System.ServiceModel.Primitives, Version=4.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ServiceModel.Primitives.4.6.0\lib\net461\System.ServiceModel.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Encodings.Web, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encodings.Web.4.5.0\lib\netstandard2.0\System.Text.Encodings.Web.dll</HintPath>
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="System.Text.Encodings.Web, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encodings.Web.4.6.0\lib\netstandard2.0\System.Text.Encodings.Web.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
@@ -320,6 +341,7 @@
|
||||
<Reference Include="System.Xml.XmlDocument, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Xml.XmlDocument.4.3.0\lib\net46\System.Xml.XmlDocument.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\SharedAssemblyInfo.cs">
|
||||
@@ -348,34 +370,15 @@
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\XmlNodeParser.cs" />
|
||||
<Compile Include="Windows\ServerDiagnosticsCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Windows\ServerDiagnosticsCtrl.Designer.cs">
|
||||
<DependentUpon>ServerDiagnosticsCtrl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Services\WindowsFormServerStarter.cs" />
|
||||
<Compile Include="Windows\ExceptionDlg.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Windows\ExceptionDlg.Designer.cs">
|
||||
<DependentUpon>ExceptionDlg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Windows\ServerForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Windows\ServerForm.Designer.cs">
|
||||
<DependentUpon>ServerForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="CONF\DATA\.placeholder">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="CONF\DATA\TracciatoXmlCnc.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Server.Config.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@@ -386,6 +389,7 @@
|
||||
<Name>OpcUaCommon</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
|
||||
@@ -4,7 +4,6 @@ using OpcUaCommon.Services;
|
||||
using OpcUaServer.Server.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IdentityModel;
|
||||
|
||||
namespace OpcUaServer.Server
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using OpcUaCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Threading;
|
||||
@@ -23,10 +22,15 @@ namespace OpcUaServer.Server
|
||||
/// Dictionary dell'elenco delle condizioni passate dal server con ULTIMO stato disponibile (attiva/disattiva)
|
||||
/// </summary>
|
||||
protected Dictionary<string, CondHelper> currConditions;
|
||||
/// <summary>
|
||||
/// Elenco dei valori dei nodi (Property + Value)
|
||||
/// </summary>
|
||||
protected Dictionary<string, object> currNodeValues;
|
||||
|
||||
public ServerDecorator(IPrinter printer, string pathXml)
|
||||
{
|
||||
currConditions = new Dictionary<string, CondHelper>();
|
||||
currNodeValues = new Dictionary<string, object>();
|
||||
Server = new Server(printer, pathXml);
|
||||
Server.eh_reqRefreshCondition += Server_eh_reqRefreshConditionAsync;
|
||||
// conf x tempo std resend...
|
||||
@@ -41,7 +45,10 @@ namespace OpcUaServer.Server
|
||||
/// <param name="e"></param>
|
||||
public async void Server_eh_reqRefreshConditionAsync(object sender, System.EventArgs e)
|
||||
{
|
||||
// attenzione con MQTT reinvia solo ULTIME VARIAZIONI ALLARMI (altri stati li considera come già inviati...)
|
||||
await sendCurrentConditions();
|
||||
// commentato invio valori on refresh che NON serve...
|
||||
//await sendAllPropVal();
|
||||
}
|
||||
|
||||
public async Task<string> sendCurrentConditions()
|
||||
@@ -60,9 +67,34 @@ namespace OpcUaServer.Server
|
||||
});
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua refresh di TUTTI i nodi NON conditions (proprietà, valori)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<string> sendAllPropVal()
|
||||
{
|
||||
string answ = "";
|
||||
await Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(waitResendCondition);
|
||||
foreach (var item in currNodeValues)
|
||||
{
|
||||
// invio con ReportEvent!
|
||||
Server.SetNodeValue(item.Key, item.Value);
|
||||
}
|
||||
});
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void SetNodeValue(string nodeName, object value)
|
||||
{
|
||||
// se c'è elimino
|
||||
if (currNodeValues.ContainsKey(nodeName))
|
||||
{
|
||||
currNodeValues.Remove(nodeName);
|
||||
}
|
||||
currNodeValues.Add(nodeName, value);
|
||||
// faccio report valore!
|
||||
Server.SetNodeValue(nodeName, value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Opc.Ua;
|
||||
using OpcUaServer.Server.Model;
|
||||
|
||||
namespace OpcUaServer.Server.Services
|
||||
{
|
||||
public class FakeNodeParser
|
||||
{
|
||||
public FolderInstanceState Parse(ServerNodeManager serverNodeManager, IList<IReference> externalReferences)
|
||||
{
|
||||
var folderInstanceState = new FolderInstanceState();
|
||||
|
||||
CreateRootFolder(externalReferences, serverNodeManager, folderInstanceState);
|
||||
CreateChildernNodes(folderInstanceState, serverNodeManager);
|
||||
|
||||
return folderInstanceState;
|
||||
}
|
||||
|
||||
|
||||
private void CreateRootFolder(IList<IReference> references, ServerNodeManager serverNodeManager, FolderInstanceState folderInstanceState)
|
||||
{
|
||||
var root = CreateFolder(null, "CNC", "CNC", serverNodeManager);
|
||||
root.AddReference(ReferenceTypes.Organizes, true, ObjectIds.ObjectsFolder);
|
||||
references.Add(new NodeStateReference(ReferenceTypes.Organizes, false, root.NodeId));
|
||||
root.EventNotifier = EventNotifiers.SubscribeToEvents;
|
||||
//AddRootNotifier(root);
|
||||
|
||||
folderInstanceState.Folder = root;
|
||||
}
|
||||
|
||||
|
||||
private BaseDataVariableState CreateVariable(NodeState parent, string path, string name, BuiltInType dataType, int valueRank, ServerNodeManager serverNodeManager)
|
||||
{
|
||||
return CreateVariable(parent, path, name, (uint)dataType, valueRank, serverNodeManager);
|
||||
}
|
||||
|
||||
private void CreateChildernNodes(FolderInstanceState folderInstanceState, ServerNodeManager serverNodeManager)
|
||||
{
|
||||
string actuatorFolderName = "Actuator";
|
||||
FolderState actuatoirFolder = CreateFolder(folderInstanceState.Folder, "/" + actuatorFolderName, actuatorFolderName, serverNodeManager);
|
||||
|
||||
string lubrificationFolderName = "Lubrification";
|
||||
var lubrificationFolder = CreateFolder(actuatoirFolder, lubrificationFolderName, lubrificationFolderName, serverNodeManager);
|
||||
|
||||
Dictionary<string, Opc.Ua.BuiltInType> nodes = new Dictionary<string, BuiltInType>();
|
||||
nodes.Add("Lubro_01", BuiltInType.Int32);
|
||||
nodes.Add("Lubro_01_status", BuiltInType.String);
|
||||
|
||||
|
||||
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
folderInstanceState.Variables.Add(node.Key, CreateVariable(lubrificationFolder, "/" + actuatorFolderName + "/" + node.Key, node.Key, node.Value, ValueRanks.Any, serverNodeManager));
|
||||
switch (node.Value)
|
||||
{
|
||||
case BuiltInType.Int32:
|
||||
folderInstanceState.Variables[node.Key].Value = 0;
|
||||
//_variables[node.Key].OnReadValue = OnReadMyInt32Node;
|
||||
break;
|
||||
case BuiltInType.Float:
|
||||
break;
|
||||
case BuiltInType.Double:
|
||||
break;
|
||||
case BuiltInType.String:
|
||||
folderInstanceState.Variables[node.Key].Value = "Good";
|
||||
//_variables[node.Key].OnReadValue = OnReadMyStringNode;
|
||||
break;
|
||||
case BuiltInType.DateTime:
|
||||
break;
|
||||
case BuiltInType.Variant:
|
||||
break;
|
||||
case BuiltInType.Number:
|
||||
break;
|
||||
case BuiltInType.Integer:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new variable.
|
||||
/// </summary>
|
||||
private BaseDataVariableState CreateVariable(NodeState parent, string path, string name, NodeId dataType, int valueRank, ServerNodeManager serverNodeManager)
|
||||
{
|
||||
BaseDataVariableState variable = new BaseDataVariableState(parent)
|
||||
{
|
||||
SymbolicName = name,
|
||||
ReferenceTypeId = Opc.Ua.ReferenceTypes.Organizes,
|
||||
TypeDefinitionId = VariableTypeIds.BaseDataVariableType,
|
||||
NodeId = new NodeId(path, serverNodeManager.NamespaceIndex),
|
||||
BrowseName = new QualifiedName(path, serverNodeManager.NamespaceIndex),
|
||||
DisplayName = new LocalizedText("en", name),
|
||||
WriteMask = AttributeWriteMask.DisplayName | AttributeWriteMask.Description,
|
||||
UserWriteMask = AttributeWriteMask.DisplayName | AttributeWriteMask.Description,
|
||||
DataType = dataType,
|
||||
ValueRank = valueRank,
|
||||
AccessLevel = AccessLevels.CurrentReadOrWrite,
|
||||
UserAccessLevel = AccessLevels.CurrentReadOrWrite,
|
||||
Historizing = false,
|
||||
StatusCode = StatusCodes.Good,
|
||||
Timestamp = DateTime.UtcNow
|
||||
};
|
||||
|
||||
|
||||
if (valueRank == ValueRanks.OneDimension)
|
||||
{
|
||||
variable.ArrayDimensions = new ReadOnlyList<uint>(new List<uint> { 0 });
|
||||
}
|
||||
else if (valueRank == ValueRanks.TwoDimensions)
|
||||
{
|
||||
variable.ArrayDimensions = new ReadOnlyList<uint>(new List<uint> { 0, 0 });
|
||||
}
|
||||
|
||||
if (parent != null)
|
||||
{
|
||||
parent.AddChild(variable);
|
||||
}
|
||||
|
||||
return variable;
|
||||
}
|
||||
|
||||
private FolderState CreateFolder(NodeState parent, string path, string name, ServerNodeManager serverNodeManager)
|
||||
{
|
||||
var folder = new FolderState(parent)
|
||||
{
|
||||
SymbolicName = name,
|
||||
ReferenceTypeId = ReferenceTypes.Organizes,
|
||||
TypeDefinitionId = ObjectTypeIds.FolderType,
|
||||
NodeId = new NodeId(path, serverNodeManager.NamespaceIndex),
|
||||
BrowseName = new QualifiedName(path, serverNodeManager.NamespaceIndex),
|
||||
DisplayName = new LocalizedText("en", name),
|
||||
WriteMask = AttributeWriteMask.None,
|
||||
UserWriteMask = AttributeWriteMask.None,
|
||||
EventNotifier = EventNotifiers.None
|
||||
};
|
||||
|
||||
parent?.AddChild(folder);
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
|
||||
public Dictionary<string, BaseDataVariableState> Parse(ServerNodeManager serverNodeManager, IList<IReference> externalReferences, Dictionary<string, BaseDataVariableState> variables)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -155,7 +155,9 @@ namespace OpcUaServer.Server.Services
|
||||
node.ConditionName.Value = value;
|
||||
node.Time.Value = DateTime.UtcNow;
|
||||
node.ReceiveTime.Value = node.Time.Value;
|
||||
node.LocalTime.Value = Utils.GetTimeZoneInfo();
|
||||
|
||||
// 2019.08.07 commentato che si pianta
|
||||
//node.LocalTime.Value = Utils.GetTimeZoneInfo();
|
||||
|
||||
// 2019.03.23 imposto forzatamente retain del valore
|
||||
node.EventId.Value = Guid.NewGuid().ToByteArray();
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Opc.Ua.Configuration;
|
||||
using OpcUaServer.Server.OpcUa;
|
||||
using OpcUaServer.Server.Windows;
|
||||
|
||||
namespace OpcUaServer.Server.Services
|
||||
{
|
||||
public class WindowsFormServerStarter : IServerStarter
|
||||
{
|
||||
private readonly ApplicationInstanceBuilder _applicationInstanceBuilder;
|
||||
|
||||
public WindowsFormServerStarter(ApplicationInstanceBuilder applicationInstanceBuilder)
|
||||
{
|
||||
_applicationInstanceBuilder = applicationInstanceBuilder;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
var application = _applicationInstanceBuilder.Build(null);
|
||||
try
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
|
||||
ApplicationInstance.MessageDlg = new ApplicationMessageDlg();
|
||||
|
||||
Application.Run(new ServerForm(application));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ExceptionDlg.Show(application.ApplicationName, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,414 +8,425 @@ using System.Xml;
|
||||
|
||||
namespace OpcUaServer.Server.Services
|
||||
{
|
||||
public class XmlNodeParser : INodeParser
|
||||
{
|
||||
public FolderInstanceState Parse(SystemContext systemContext, IEnumerable<ushort> namespaceIndexes, IList<IReference> externalReferences, string pathXml)
|
||||
public class XmlNodeParser : INodeParser
|
||||
{
|
||||
var treeInstance = new FolderInstanceState();
|
||||
var xmlDocument = new XmlDocument();
|
||||
xmlDocument.Load(pathXml);
|
||||
#region Private Methods
|
||||
|
||||
var itemRef = xmlDocument.GetElementsByTagName("Machine");
|
||||
|
||||
var rootFolder = CreateRootFolder(itemRef, externalReferences, treeInstance, namespaceIndexes.ToArray().First());
|
||||
|
||||
treeInstance.Folder = rootFolder;
|
||||
foreach (var baseDataVariableState in treeInstance.Variables)
|
||||
{
|
||||
Console.WriteLine("NODE PATH >>>> CHIAVE {0}", baseDataVariableState.Key);
|
||||
}
|
||||
return treeInstance;
|
||||
}
|
||||
|
||||
private FolderState CreateRootFolder(XmlNodeList itemRef, ICollection<IReference> externalReferences, FolderInstanceState treeInstance, ushort nameSpaceIndex)
|
||||
{
|
||||
var rootName = "Machine";
|
||||
var root = CreateFolder(null, rootName, rootName, null, null, treeInstance, nameSpaceIndex);
|
||||
|
||||
root.AddReference(ReferenceTypes.Organizes, true, ObjectIds.ObjectsFolder);
|
||||
externalReferences.Add(new NodeStateReference(ReferenceTypes.Organizes, false, root.NodeId));
|
||||
root.EventNotifier = EventNotifiers.SubscribeToEvents;
|
||||
|
||||
|
||||
var xmlNodeList = itemRef[0]?.ChildNodes;
|
||||
if (xmlNodeList == null)
|
||||
{
|
||||
return root;
|
||||
}
|
||||
|
||||
foreach (XmlElement xmlElement in xmlNodeList)
|
||||
{
|
||||
AddNode(treeInstance, nameSpaceIndex, rootName, root, xmlElement);
|
||||
}
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
private void AddEvent(FolderInstanceState treeInstance, ushort nameSpaceIndex, XmlNode component, string rootName, FolderState root)
|
||||
{
|
||||
if (component?.Attributes == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var varName = component.Attributes["BrowseName"].Value;
|
||||
var symbolicName = component.Attributes["SymbolicName"].Value;
|
||||
treeInstance.Variables.Add(rootName + "/" + symbolicName,
|
||||
CreateEvent(root, rootName + "/" + symbolicName, symbolicName, varName, nameSpaceIndex));
|
||||
}
|
||||
|
||||
private BaseObjectState CreateEvent(NodeState parent, string path, string symbolicName, string name, ushort nameSpaceIndex)
|
||||
{
|
||||
var variable = new SystemEventState(parent)
|
||||
{
|
||||
SymbolicName = symbolicName,
|
||||
Description = name,
|
||||
ReferenceTypeId = Opc.Ua.ReferenceTypes.HasEventSource,
|
||||
TypeDefinitionId = ObjectTypeIds.SystemEventType,
|
||||
NodeId = new NodeId(path, nameSpaceIndex),
|
||||
BrowseName = new QualifiedName(path, nameSpaceIndex),
|
||||
DisplayName = new LocalizedText("en", symbolicName),
|
||||
WriteMask = AttributeWriteMask.None,
|
||||
UserWriteMask = AttributeWriteMask.None,
|
||||
EventNotifier = EventNotifiers.SubscribeToEvents
|
||||
};
|
||||
|
||||
parent?.AddChild(variable);
|
||||
|
||||
return variable;
|
||||
}
|
||||
|
||||
|
||||
private void AddCondition(FolderInstanceState treeInstance, ushort nameSpaceIndex, XmlNode component,
|
||||
string rootName, FolderState root)
|
||||
{
|
||||
if (component == null || component.Attributes == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var varName = component.Attributes["BrowseName"].Value;
|
||||
var symbolicName = component.Attributes["SymbolicName"].Value;
|
||||
var baseObjectState = CreateCondition(root, rootName + "/" + symbolicName, symbolicName, varName, component.Attributes["Type"].Value,
|
||||
nameSpaceIndex);
|
||||
|
||||
|
||||
treeInstance.Variables.Add(rootName + "/" + symbolicName,
|
||||
baseObjectState);
|
||||
}
|
||||
|
||||
|
||||
private BaseObjectState CreateCondition(NodeState parent, string path, string symbolicName, string name, string conditiontype, ushort nameSpaceIndex)
|
||||
{
|
||||
|
||||
var node = new BaseObjectState(parent)
|
||||
{
|
||||
SymbolicName = symbolicName,
|
||||
Description = name,
|
||||
TypeDefinitionId = ObjectTypeIds.BaseObjectType,
|
||||
NodeId = new NodeId(path, nameSpaceIndex),
|
||||
BrowseName = new QualifiedName(path, nameSpaceIndex),
|
||||
DisplayName = new LocalizedText("en", symbolicName),
|
||||
WriteMask = AttributeWriteMask.None,
|
||||
UserWriteMask = AttributeWriteMask.None,
|
||||
ReferenceTypeId = ReferenceTypeIds.HasEventSource,
|
||||
EventNotifier = EventNotifiers.SubscribeToEvents
|
||||
};
|
||||
|
||||
//AlarmConditionState node = new AlarmConditionState(parent);
|
||||
|
||||
//node.SymbolicName = symbolicName;
|
||||
|
||||
//// add optional components.
|
||||
//node.Comment = new ConditionVariableState<LocalizedText>(node);
|
||||
//node.ClientUserId = new PropertyState<string>(node);
|
||||
//node.AddComment = new AddCommentMethodState(node);
|
||||
//node.ConfirmedState = new TwoStateVariableState(node);
|
||||
//node.Confirm = new AddCommentMethodState(node);
|
||||
|
||||
//node.SuppressedState = new TwoStateVariableState(node);
|
||||
//node.ShelvingState = new ShelvedStateMachineState(node);
|
||||
|
||||
//node.EnabledState = new TwoStateVariableState(node);
|
||||
//node.EnabledState.TransitionTime = new PropertyState<DateTime>(node.EnabledState);
|
||||
//node.EnabledState.EffectiveDisplayName = new PropertyState<LocalizedText>(node.EnabledState);
|
||||
//node.EnabledState.Create(_systemContext, null, BrowseNames.EnabledState, null, false);
|
||||
|
||||
//// same procedure add optional components to the ActiveState component.
|
||||
//node.ActiveState = new TwoStateVariableState(node);
|
||||
//node.ActiveState.TransitionTime = new PropertyState<DateTime>(node.ActiveState);
|
||||
//node.ActiveState.EffectiveDisplayName = new PropertyState<LocalizedText>(node.ActiveState);
|
||||
//node.ActiveState.Create(_systemContext, null, BrowseNames.ActiveState, null, false);
|
||||
|
||||
//// specify reference type between the source and the alarm.
|
||||
//node.ReferenceTypeId = ReferenceTypeIds.HasEventSource;
|
||||
//node.EventNotifier = EventNotifiers.SubscribeToEvents;
|
||||
|
||||
//node.Create(
|
||||
// _systemContext,
|
||||
// new NodeId(path, nameSpaceIndex),
|
||||
// new QualifiedName(path, nameSpaceIndex),
|
||||
// new LocalizedText("en", symbolicName),
|
||||
// true);
|
||||
|
||||
parent.AddChild(node);
|
||||
|
||||
// initialize event information.node
|
||||
//node.EventType.Value = node.TypeDefinitionId;
|
||||
//node.SourceNode.Value = new NodeId(path, nameSpaceIndex);
|
||||
//node.SourceName.Value = path;
|
||||
|
||||
return node;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void AddVariable(FolderInstanceState treeInstance, ushort nameSpaceIndex, XmlNode component,
|
||||
string rootName, FolderState root)
|
||||
{
|
||||
//Eventi e variabili
|
||||
|
||||
if (component == null || component.Attributes == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var varName = component.Attributes["BrowseName"].Value;
|
||||
var symbolicName = component.Attributes["SymbolicName"].Value;
|
||||
var dataType = component.Attributes["DataType"].Value;
|
||||
var valueRank = component.Attributes["ValueRank"].Value;
|
||||
var builtInType = (uint)GetBuiltInTypeFromString(dataType);
|
||||
var valueRankFromString = GetValueRankFromString(valueRank);
|
||||
var baseDataVariableState = CreateVariable(root, rootName + "/" + symbolicName, symbolicName, varName, builtInType, valueRankFromString,
|
||||
nameSpaceIndex);
|
||||
|
||||
treeInstance.Variables.Add(rootName + "/" + symbolicName,
|
||||
baseDataVariableState);
|
||||
}
|
||||
|
||||
|
||||
private FolderState CreateFolder(NodeState parent, string path, string name, IEnumerable component,
|
||||
string stringNome, FolderInstanceState folderInstanceState, ushort nameSpaceIndex)
|
||||
{
|
||||
var stringFolderName = stringNome + "/" + name;
|
||||
|
||||
var folder = new FolderState(parent)
|
||||
{
|
||||
SymbolicName = name,
|
||||
ReferenceTypeId = ReferenceTypes.Organizes,
|
||||
TypeDefinitionId = ObjectTypeIds.FolderType,
|
||||
NodeId = new NodeId(path, nameSpaceIndex),
|
||||
BrowseName = new QualifiedName(path, nameSpaceIndex),
|
||||
DisplayName = new LocalizedText("en", name),
|
||||
WriteMask = AttributeWriteMask.None,
|
||||
UserWriteMask = AttributeWriteMask.None,
|
||||
//EventNotifier = EventNotifiers.SubscribeToEvents
|
||||
};
|
||||
|
||||
|
||||
|
||||
parent?.AddChild(folder);
|
||||
if (component == null)
|
||||
{
|
||||
return folder;
|
||||
}
|
||||
|
||||
foreach (XmlElement xmlElement in component)
|
||||
{
|
||||
AddNode(folderInstanceState, nameSpaceIndex, stringFolderName, folder, xmlElement);
|
||||
}
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
//private FolderState CreateConditions(NodeState parent, string path, string name, IEnumerable component, string stringNome, FolderInstanceState folderInstanceState, ushort nameSpaceIndex)
|
||||
//{
|
||||
// FolderState folder = CreateFolder(parent, path+ "/" + name, name, component, stringNome, folderInstanceState, nameSpaceIndex);
|
||||
// folder.ReferenceTypeId = ReferenceTypeIds.HasNotifier;
|
||||
// ((FolderState)parent).ReferenceTypeId = ReferenceTypeIds.HasNotifier;
|
||||
// return folder;
|
||||
//}
|
||||
|
||||
private void AddNode(FolderInstanceState folderInstanceState, ushort nameSpaceIndex, string stringFolderName,
|
||||
FolderState folder, XmlElement xmlElement)
|
||||
{
|
||||
if (xmlElement.Name != "Component" && xmlElement.Name != "Conditions")
|
||||
{
|
||||
switch (xmlElement.Name)
|
||||
private static int GetValueRankFromString(string valueRank)
|
||||
{
|
||||
case "Property":
|
||||
AddProperty(folder, xmlElement, stringFolderName, nameSpaceIndex, folderInstanceState);
|
||||
break;
|
||||
//case "Event":
|
||||
// AddEvent(folderInstanceState, nameSpaceIndex, xmlElement, stringFolderName, folder);
|
||||
// break;
|
||||
case "Condition":
|
||||
AddCondition(folderInstanceState, nameSpaceIndex, xmlElement, stringFolderName, folder);
|
||||
break;
|
||||
default:
|
||||
AddVariable(folderInstanceState, nameSpaceIndex, xmlElement, stringFolderName, folder);
|
||||
break;
|
||||
var returnValue = 0;
|
||||
switch (valueRank)
|
||||
{
|
||||
case "Scalar":
|
||||
returnValue = ValueRanks.Scalar;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var varName = xmlElement.Attributes["Name"].Value;
|
||||
if (xmlElement.Name == "Conditions")
|
||||
|
||||
private void AddCondition(FolderInstanceState treeInstance, ushort nameSpaceIndex, XmlNode component,
|
||||
string rootName, FolderState root)
|
||||
{
|
||||
//CreateConditions(folder, stringFolderName + "/" + varName, varName, xmlElement, stringFolderName, folderInstanceState, nameSpaceIndex);
|
||||
if (component == null || component.Attributes == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var varName = component.Attributes["BrowseName"].Value;
|
||||
var symbolicName = component.Attributes["SymbolicName"].Value;
|
||||
var baseObjectState = CreateCondition(root, rootName + "/" + symbolicName, symbolicName, varName, component.Attributes["Type"].Value,
|
||||
nameSpaceIndex);
|
||||
|
||||
treeInstance.Variables.Add(rootName + "/" + symbolicName,
|
||||
baseObjectState);
|
||||
}
|
||||
else
|
||||
|
||||
private void AddEvent(FolderInstanceState treeInstance, ushort nameSpaceIndex, XmlNode component, string rootName, FolderState root)
|
||||
{
|
||||
CreateFolder(folder, stringFolderName + "/" + varName, varName, xmlElement, stringFolderName, folderInstanceState, nameSpaceIndex);
|
||||
if (component?.Attributes == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var varName = component.Attributes["BrowseName"].Value;
|
||||
var symbolicName = component.Attributes["SymbolicName"].Value;
|
||||
treeInstance.Variables.Add(rootName + "/" + symbolicName,
|
||||
CreateEvent(root, rootName + "/" + symbolicName, symbolicName, varName, nameSpaceIndex));
|
||||
}
|
||||
}
|
||||
|
||||
private void AddNode(FolderInstanceState folderInstanceState, ushort nameSpaceIndex, string stringFolderName,
|
||||
FolderState folder, XmlElement xmlElement)
|
||||
{
|
||||
if (xmlElement.Name != "Component" && xmlElement.Name != "Conditions")
|
||||
{
|
||||
switch (xmlElement.Name)
|
||||
{
|
||||
case "Property":
|
||||
AddProperty(folder, xmlElement, stringFolderName, nameSpaceIndex, folderInstanceState);
|
||||
break;
|
||||
|
||||
#if false
|
||||
case "Events":
|
||||
// aggiungo "Events:"
|
||||
AddVariable(folderInstanceState, nameSpaceIndex, xmlElement, $"{stringFolderName}/Events", folder);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case "Condition":
|
||||
AddCondition(folderInstanceState, nameSpaceIndex, xmlElement, stringFolderName, folder);
|
||||
break;
|
||||
|
||||
default:
|
||||
AddVariable(folderInstanceState, nameSpaceIndex, xmlElement, stringFolderName, folder);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var varName = xmlElement.Attributes["Name"].Value;
|
||||
if (xmlElement.Name == "Conditions")
|
||||
{
|
||||
//CreateConditions(folder, stringFolderName + "/" + varName, varName, xmlElement, stringFolderName, folderInstanceState, nameSpaceIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
CreateFolder(folder, stringFolderName + "/" + varName, varName, xmlElement, stringFolderName, folderInstanceState, nameSpaceIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddProperty(BaseObjectState parent, XmlNode component, string rootName, ushort nameSpaceIndex,
|
||||
FolderInstanceState treeInstance)
|
||||
{
|
||||
if (component.Attributes == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PropertyState propertyState;
|
||||
switch (component.Attributes["DataType"].Value)
|
||||
{
|
||||
case "ua:UInt32":
|
||||
propertyState = parent.AddProperty<int>(component.Attributes["SymbolicName"].Value,
|
||||
DataTypeIds.Int32, ValueRanks.Scalar);
|
||||
|
||||
break;
|
||||
|
||||
case "ua:Double":
|
||||
propertyState = parent.AddProperty<double>(component.Attributes["SymbolicName"].Value,
|
||||
DataTypeIds.Double, ValueRanks.Scalar);
|
||||
break;
|
||||
|
||||
case "ua:Float":
|
||||
propertyState = parent.AddProperty<float>(component.Attributes["SymbolicName"].Value,
|
||||
DataTypeIds.Float, ValueRanks.Scalar);
|
||||
break;
|
||||
|
||||
case "ua:String":
|
||||
propertyState = parent.AddProperty<string>(component.Attributes["SymbolicName"].Value,
|
||||
DataTypeIds.String, ValueRanks.Scalar);
|
||||
break;
|
||||
|
||||
case "ua:DateTime":
|
||||
propertyState = parent.AddProperty<DateTime>(component.Attributes["SymbolicName"].Value,
|
||||
DataTypeIds.DateTime, ValueRanks.Scalar);
|
||||
break;
|
||||
|
||||
case "ua:Boolean":
|
||||
propertyState = parent.AddProperty<bool>(component.Attributes["SymbolicName"].Value,
|
||||
DataTypeIds.Boolean, ValueRanks.Scalar);
|
||||
break;
|
||||
|
||||
default:
|
||||
propertyState = parent.AddProperty<string>(component.Attributes["SymbolicName"].Value,
|
||||
DataTypeIds.String, ValueRanks.Scalar);
|
||||
break;
|
||||
}
|
||||
|
||||
propertyState.Value = component.Attributes["Value"].Value;
|
||||
propertyState.NodeId = new NodeId(rootName + "/" + component.Attributes["SymbolicName"].Value, nameSpaceIndex);
|
||||
propertyState.BrowseName = rootName + "/" + component.Attributes["SymbolicName"].Value;
|
||||
propertyState.TypeDefinitionId = VariableTypeIds.PropertyType;
|
||||
|
||||
var bName = propertyState.BrowseName.Name;
|
||||
var type = propertyState.DataType;
|
||||
var rank = propertyState.ValueRank;
|
||||
|
||||
treeInstance.Variables.Add(bName,
|
||||
CreateVariable(parent, bName, bName, bName, type, rank,
|
||||
nameSpaceIndex));
|
||||
}
|
||||
|
||||
private void AddVariable(FolderInstanceState treeInstance, ushort nameSpaceIndex, XmlNode component,
|
||||
string rootName, FolderState root)
|
||||
{
|
||||
//Eventi e variabili
|
||||
|
||||
if (component == null || component.Attributes == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var varName = component.Attributes["BrowseName"].Value;
|
||||
var symbolicName = component.Attributes["SymbolicName"].Value;
|
||||
var dataType = component.Attributes["DataType"].Value;
|
||||
var valueRank = component.Attributes["ValueRank"].Value;
|
||||
var builtInType = (uint)GetBuiltInTypeFromString(dataType);
|
||||
var valueRankFromString = GetValueRankFromString(valueRank);
|
||||
var baseDataVariableState = CreateVariable(root, rootName + "/" + symbolicName, symbolicName, varName, builtInType, valueRankFromString,
|
||||
nameSpaceIndex);
|
||||
|
||||
treeInstance.Variables.Add(rootName + "/" + symbolicName,
|
||||
baseDataVariableState);
|
||||
}
|
||||
|
||||
private BaseObjectState CreateCondition(NodeState parent, string path, string symbolicName, string name, string conditiontype, ushort nameSpaceIndex)
|
||||
{
|
||||
var node = new BaseObjectState(parent)
|
||||
{
|
||||
SymbolicName = symbolicName,
|
||||
Description = name,
|
||||
TypeDefinitionId = ObjectTypeIds.BaseObjectType,
|
||||
NodeId = new NodeId(path, nameSpaceIndex),
|
||||
BrowseName = new QualifiedName(path, nameSpaceIndex),
|
||||
DisplayName = new LocalizedText("en", symbolicName),
|
||||
WriteMask = AttributeWriteMask.None,
|
||||
UserWriteMask = AttributeWriteMask.None,
|
||||
ReferenceTypeId = ReferenceTypeIds.HasEventSource,
|
||||
EventNotifier = EventNotifiers.SubscribeToEvents
|
||||
};
|
||||
|
||||
//AlarmConditionState node = new AlarmConditionState(parent);
|
||||
|
||||
//node.SymbolicName = symbolicName;
|
||||
|
||||
//// add optional components.
|
||||
//node.Comment = new ConditionVariableState<LocalizedText>(node);
|
||||
//node.ClientUserId = new PropertyState<string>(node);
|
||||
//node.AddComment = new AddCommentMethodState(node);
|
||||
//node.ConfirmedState = new TwoStateVariableState(node);
|
||||
//node.Confirm = new AddCommentMethodState(node);
|
||||
|
||||
//node.SuppressedState = new TwoStateVariableState(node);
|
||||
//node.ShelvingState = new ShelvedStateMachineState(node);
|
||||
|
||||
//node.EnabledState = new TwoStateVariableState(node);
|
||||
//node.EnabledState.TransitionTime = new PropertyState<DateTime>(node.EnabledState);
|
||||
//node.EnabledState.EffectiveDisplayName = new PropertyState<LocalizedText>(node.EnabledState);
|
||||
//node.EnabledState.Create(_systemContext, null, BrowseNames.EnabledState, null, false);
|
||||
|
||||
//// same procedure add optional components to the ActiveState component.
|
||||
//node.ActiveState = new TwoStateVariableState(node);
|
||||
//node.ActiveState.TransitionTime = new PropertyState<DateTime>(node.ActiveState);
|
||||
//node.ActiveState.EffectiveDisplayName = new PropertyState<LocalizedText>(node.ActiveState);
|
||||
//node.ActiveState.Create(_systemContext, null, BrowseNames.ActiveState, null, false);
|
||||
|
||||
//// specify reference type between the source and the alarm.
|
||||
//node.ReferenceTypeId = ReferenceTypeIds.HasEventSource;
|
||||
//node.EventNotifier = EventNotifiers.SubscribeToEvents;
|
||||
|
||||
//node.Create(
|
||||
// _systemContext,
|
||||
// new NodeId(path, nameSpaceIndex),
|
||||
// new QualifiedName(path, nameSpaceIndex),
|
||||
// new LocalizedText("en", symbolicName),
|
||||
// true);
|
||||
|
||||
parent.AddChild(node);
|
||||
|
||||
// initialize event information.node
|
||||
//node.EventType.Value = node.TypeDefinitionId;
|
||||
//node.SourceNode.Value = new NodeId(path, nameSpaceIndex);
|
||||
//node.SourceName.Value = path;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
private BaseObjectState CreateEvent(NodeState parent, string path, string symbolicName, string name, ushort nameSpaceIndex)
|
||||
{
|
||||
var variable = new SystemEventState(parent)
|
||||
{
|
||||
SymbolicName = symbolicName,
|
||||
Description = name,
|
||||
ReferenceTypeId = Opc.Ua.ReferenceTypes.HasEventSource,
|
||||
TypeDefinitionId = ObjectTypeIds.SystemEventType,
|
||||
NodeId = new NodeId(path, nameSpaceIndex),
|
||||
BrowseName = new QualifiedName(path, nameSpaceIndex),
|
||||
DisplayName = new LocalizedText("en", symbolicName),
|
||||
WriteMask = AttributeWriteMask.None,
|
||||
UserWriteMask = AttributeWriteMask.None,
|
||||
EventNotifier = EventNotifiers.SubscribeToEvents
|
||||
};
|
||||
|
||||
parent?.AddChild(variable);
|
||||
|
||||
return variable;
|
||||
}
|
||||
|
||||
private FolderState CreateFolder(NodeState parent, string path, string name, IEnumerable component,
|
||||
string stringNome, FolderInstanceState folderInstanceState, ushort nameSpaceIndex)
|
||||
{
|
||||
var stringFolderName = stringNome + "/" + name;
|
||||
|
||||
var folder = new FolderState(parent)
|
||||
{
|
||||
SymbolicName = name,
|
||||
ReferenceTypeId = ReferenceTypes.Organizes,
|
||||
TypeDefinitionId = ObjectTypeIds.FolderType,
|
||||
NodeId = new NodeId(path, nameSpaceIndex),
|
||||
BrowseName = new QualifiedName(path, nameSpaceIndex),
|
||||
DisplayName = new LocalizedText("en", name),
|
||||
WriteMask = AttributeWriteMask.None,
|
||||
UserWriteMask = AttributeWriteMask.None,
|
||||
//EventNotifier = EventNotifiers.SubscribeToEvents
|
||||
};
|
||||
|
||||
parent?.AddChild(folder);
|
||||
if (component == null)
|
||||
{
|
||||
return folder;
|
||||
}
|
||||
|
||||
foreach (XmlElement xmlElement in component)
|
||||
{
|
||||
AddNode(folderInstanceState, nameSpaceIndex, stringFolderName, folder, xmlElement);
|
||||
}
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
private FolderState CreateRootFolder(XmlNodeList itemRef, ICollection<IReference> externalReferences, FolderInstanceState treeInstance, ushort nameSpaceIndex)
|
||||
{
|
||||
var rootName = "Machine";
|
||||
var root = CreateFolder(null, rootName, rootName, null, null, treeInstance, nameSpaceIndex);
|
||||
|
||||
root.AddReference(ReferenceTypes.Organizes, true, ObjectIds.ObjectsFolder);
|
||||
externalReferences.Add(new NodeStateReference(ReferenceTypes.Organizes, false, root.NodeId));
|
||||
root.EventNotifier = EventNotifiers.SubscribeToEvents;
|
||||
|
||||
var xmlNodeList = itemRef[0]?.ChildNodes;
|
||||
if (xmlNodeList == null)
|
||||
{
|
||||
return root;
|
||||
}
|
||||
|
||||
foreach (XmlElement xmlElement in xmlNodeList)
|
||||
{
|
||||
AddNode(treeInstance, nameSpaceIndex, rootName, root, xmlElement);
|
||||
}
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
private BaseDataVariableState CreateVariable(NodeState parent, string path, string symbolicName, string name, NodeId dataType, int valueRank, ushort nameSpaceIndex)
|
||||
{
|
||||
var variable = new BaseDataVariableState(parent)
|
||||
{
|
||||
SymbolicName = symbolicName,
|
||||
Description = name,
|
||||
TypeDefinitionId = VariableTypeIds.BaseDataVariableType,
|
||||
NodeId = new NodeId(path, nameSpaceIndex),
|
||||
BrowseName = new QualifiedName(path, nameSpaceIndex),
|
||||
DisplayName = new LocalizedText("en", symbolicName),
|
||||
WriteMask = AttributeWriteMask.DisplayName | AttributeWriteMask.Description,
|
||||
UserWriteMask = AttributeWriteMask.DisplayName | AttributeWriteMask.Description,
|
||||
DataType = dataType,
|
||||
ValueRank = valueRank,
|
||||
AccessLevel = AccessLevels.CurrentRead,
|
||||
UserAccessLevel = AccessLevels.CurrentRead,
|
||||
Historizing = false,
|
||||
StatusCode = StatusCodes.Good,
|
||||
Timestamp = DateTime.UtcNow
|
||||
};
|
||||
|
||||
switch (valueRank)
|
||||
{
|
||||
case ValueRanks.OneDimension:
|
||||
variable.ArrayDimensions = new ReadOnlyList<uint>(new List<uint> { 0 });
|
||||
break;
|
||||
|
||||
case ValueRanks.TwoDimensions:
|
||||
variable.ArrayDimensions = new ReadOnlyList<uint>(new List<uint> { 0, 0 });
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
parent?.AddChild(variable);
|
||||
|
||||
return variable;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
//private FolderState CreateConditions(NodeState parent, string path, string name, IEnumerable component, string stringNome, FolderInstanceState folderInstanceState, ushort nameSpaceIndex)
|
||||
//{
|
||||
// FolderState folder = CreateFolder(parent, path+ "/" + name, name, component, stringNome, folderInstanceState, nameSpaceIndex);
|
||||
// folder.ReferenceTypeId = ReferenceTypeIds.HasNotifier;
|
||||
// ((FolderState)parent).ReferenceTypeId = ReferenceTypeIds.HasNotifier;
|
||||
// return folder;
|
||||
//}
|
||||
public static BuiltInType GetBuiltInTypeFromString(string dataType)
|
||||
{
|
||||
var returnValue = BuiltInType.Null;
|
||||
switch (dataType)
|
||||
{
|
||||
case "ua:UInt32":
|
||||
returnValue = BuiltInType.UInt32;
|
||||
break;
|
||||
|
||||
case "ua:Double":
|
||||
returnValue = BuiltInType.Double;
|
||||
break;
|
||||
|
||||
case "ua:Float":
|
||||
returnValue = BuiltInType.Float;
|
||||
break;
|
||||
|
||||
case "ua:String":
|
||||
returnValue = BuiltInType.String;
|
||||
break;
|
||||
|
||||
case "ua:DateTime":
|
||||
returnValue = BuiltInType.DateTime;
|
||||
break;
|
||||
|
||||
case "ua:Boolean":
|
||||
returnValue = BuiltInType.Boolean;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public FolderInstanceState Parse(SystemContext systemContext, IEnumerable<ushort> namespaceIndexes, IList<IReference> externalReferences, string pathXml)
|
||||
{
|
||||
var treeInstance = new FolderInstanceState();
|
||||
var xmlDocument = new XmlDocument();
|
||||
xmlDocument.Load(pathXml);
|
||||
|
||||
var itemRef = xmlDocument.GetElementsByTagName("Machine");
|
||||
|
||||
var rootFolder = CreateRootFolder(itemRef, externalReferences, treeInstance, namespaceIndexes.ToArray().First());
|
||||
|
||||
treeInstance.Folder = rootFolder;
|
||||
foreach (var baseDataVariableState in treeInstance.Variables)
|
||||
{
|
||||
Console.WriteLine("NODE PATH >>>> CHIAVE {0}", baseDataVariableState.Key);
|
||||
}
|
||||
return treeInstance;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
|
||||
public static BuiltInType GetBuiltInTypeFromString(string dataType)
|
||||
{
|
||||
var returnValue = BuiltInType.Null;
|
||||
switch (dataType)
|
||||
{
|
||||
case "ua:UInt32":
|
||||
returnValue = BuiltInType.UInt32;
|
||||
break;
|
||||
case "ua:Double":
|
||||
returnValue = BuiltInType.Double;
|
||||
break;
|
||||
case "ua:Float":
|
||||
returnValue = BuiltInType.Float;
|
||||
break;
|
||||
case "ua:String":
|
||||
returnValue = BuiltInType.String;
|
||||
break;
|
||||
case "ua:DateTime":
|
||||
returnValue = BuiltInType.DateTime;
|
||||
break;
|
||||
case "ua:Boolean":
|
||||
returnValue = BuiltInType.Boolean;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
private void AddProperty(BaseObjectState parent, XmlNode component, string rootName, ushort nameSpaceIndex,
|
||||
FolderInstanceState treeInstance)
|
||||
{
|
||||
if (component.Attributes == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PropertyState propertyState;
|
||||
switch (component.Attributes["DataType"].Value)
|
||||
{
|
||||
case "ua:UInt32":
|
||||
propertyState = parent.AddProperty<int>(component.Attributes["SymbolicName"].Value,
|
||||
DataTypeIds.Int32, ValueRanks.Scalar);
|
||||
|
||||
break;
|
||||
case "ua:Double":
|
||||
propertyState = parent.AddProperty<double>(component.Attributes["SymbolicName"].Value,
|
||||
DataTypeIds.Double, ValueRanks.Scalar);
|
||||
break;
|
||||
case "ua:Float":
|
||||
propertyState = parent.AddProperty<float>(component.Attributes["SymbolicName"].Value,
|
||||
DataTypeIds.Float, ValueRanks.Scalar);
|
||||
break;
|
||||
case "ua:String":
|
||||
propertyState = parent.AddProperty<string>(component.Attributes["SymbolicName"].Value,
|
||||
DataTypeIds.String, ValueRanks.Scalar);
|
||||
break;
|
||||
case "ua:DateTime":
|
||||
propertyState = parent.AddProperty<DateTime>(component.Attributes["SymbolicName"].Value,
|
||||
DataTypeIds.DateTime, ValueRanks.Scalar);
|
||||
break;
|
||||
case "ua:Boolean":
|
||||
propertyState = parent.AddProperty<bool>(component.Attributes["SymbolicName"].Value,
|
||||
DataTypeIds.Boolean, ValueRanks.Scalar);
|
||||
break;
|
||||
default:
|
||||
propertyState = parent.AddProperty<string>(component.Attributes["SymbolicName"].Value,
|
||||
DataTypeIds.String, ValueRanks.Scalar);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
propertyState.Value = component.Attributes["Value"].Value;
|
||||
propertyState.NodeId = new NodeId(rootName + "/" + component.Attributes["SymbolicName"].Value, nameSpaceIndex);
|
||||
propertyState.BrowseName = rootName + "/" + component.Attributes["SymbolicName"].Value;
|
||||
propertyState.TypeDefinitionId = VariableTypeIds.PropertyType;
|
||||
|
||||
var bName = propertyState.BrowseName.Name;
|
||||
var type = propertyState.DataType;
|
||||
var rank = propertyState.ValueRank;
|
||||
|
||||
|
||||
treeInstance.Variables.Add(bName,
|
||||
CreateVariable(parent, bName, bName, bName, type, rank,
|
||||
nameSpaceIndex));
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static int GetValueRankFromString(string valueRank)
|
||||
{
|
||||
var returnValue = 0;
|
||||
switch (valueRank)
|
||||
{
|
||||
case "Scalar":
|
||||
returnValue = ValueRanks.Scalar;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
private BaseDataVariableState CreateVariable(NodeState parent, string path, string symbolicName, string name, NodeId dataType, int valueRank, ushort nameSpaceIndex)
|
||||
{
|
||||
var variable = new BaseDataVariableState(parent)
|
||||
{
|
||||
SymbolicName = symbolicName,
|
||||
Description = name,
|
||||
TypeDefinitionId = VariableTypeIds.BaseDataVariableType,
|
||||
NodeId = new NodeId(path, nameSpaceIndex),
|
||||
BrowseName = new QualifiedName(path, nameSpaceIndex),
|
||||
DisplayName = new LocalizedText("en", symbolicName),
|
||||
WriteMask = AttributeWriteMask.DisplayName | AttributeWriteMask.Description,
|
||||
UserWriteMask = AttributeWriteMask.DisplayName | AttributeWriteMask.Description,
|
||||
DataType = dataType,
|
||||
ValueRank = valueRank,
|
||||
AccessLevel = AccessLevels.CurrentRead,
|
||||
UserAccessLevel = AccessLevels.CurrentRead,
|
||||
Historizing = false,
|
||||
StatusCode = StatusCodes.Good,
|
||||
Timestamp = DateTime.UtcNow
|
||||
};
|
||||
|
||||
switch (valueRank)
|
||||
{
|
||||
case ValueRanks.OneDimension:
|
||||
variable.ArrayDimensions = new ReadOnlyList<uint>(new List<uint> { 0 });
|
||||
break;
|
||||
case ValueRanks.TwoDimensions:
|
||||
variable.ArrayDimensions = new ReadOnlyList<uint>(new List<uint> { 0, 0 });
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
parent?.AddChild(variable);
|
||||
|
||||
return variable;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
-124
@@ -1,124 +0,0 @@
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace OpcUaServer.Server.Windows
|
||||
{
|
||||
partial class ExceptionDlg
|
||||
{
|
||||
/// <summary>
|
||||
/// Variabile di progettazione necessaria.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Pulire le risorse in uso.
|
||||
/// </summary>
|
||||
/// <param name="disposing">ha valore true se le risorse gestite devono essere eliminate, false in caso contrario.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Codice generato da Progettazione componenti
|
||||
|
||||
/// <summary>
|
||||
/// Metodo necessario per il supporto della finestra di progettazione. Non modificare
|
||||
/// il contenuto del metodo con l'editor di codice.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.BottomPN = new System.Windows.Forms.Panel();
|
||||
this.ShowStackTracesCK = new System.Windows.Forms.CheckBox();
|
||||
this.CloseBTN = new System.Windows.Forms.Button();
|
||||
this.MainPN = new System.Windows.Forms.Panel();
|
||||
this.ExceptionBrowser = new System.Windows.Forms.WebBrowser();
|
||||
this.BottomPN.SuspendLayout();
|
||||
this.MainPN.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// BottomPN
|
||||
//
|
||||
this.BottomPN.Controls.Add(this.ShowStackTracesCK);
|
||||
this.BottomPN.Controls.Add(this.CloseBTN);
|
||||
this.BottomPN.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.BottomPN.Location = new System.Drawing.Point(0, 181);
|
||||
this.BottomPN.Name = "BottomPN";
|
||||
this.BottomPN.Size = new System.Drawing.Size(780, 29);
|
||||
this.BottomPN.TabIndex = 1;
|
||||
//
|
||||
// ShowStackTracesCK
|
||||
//
|
||||
this.ShowStackTracesCK.AutoSize = true;
|
||||
this.ShowStackTracesCK.Location = new System.Drawing.Point(3, 7);
|
||||
this.ShowStackTracesCK.Name = "ShowStackTracesCK";
|
||||
this.ShowStackTracesCK.Size = new System.Drawing.Size(138, 17);
|
||||
this.ShowStackTracesCK.TabIndex = 1;
|
||||
this.ShowStackTracesCK.Text = "Show Exception Details";
|
||||
this.ShowStackTracesCK.UseVisualStyleBackColor = true;
|
||||
this.ShowStackTracesCK.CheckedChanged += new System.EventHandler(this.ShowStackTracesCK_CheckedChanged);
|
||||
//
|
||||
// CloseBTN
|
||||
//
|
||||
this.CloseBTN.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
|
||||
this.CloseBTN.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.CloseBTN.Location = new System.Drawing.Point(353, 3);
|
||||
this.CloseBTN.Name = "CloseBTN";
|
||||
this.CloseBTN.Size = new System.Drawing.Size(75, 23);
|
||||
this.CloseBTN.TabIndex = 0;
|
||||
this.CloseBTN.Text = "Close";
|
||||
this.CloseBTN.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// MainPN
|
||||
//
|
||||
this.MainPN.AutoSize = true;
|
||||
this.MainPN.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.MainPN.Controls.Add(this.ExceptionBrowser);
|
||||
this.MainPN.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.MainPN.Location = new System.Drawing.Point(0, 0);
|
||||
this.MainPN.Name = "MainPN";
|
||||
this.MainPN.Size = new System.Drawing.Size(780, 181);
|
||||
this.MainPN.TabIndex = 1;
|
||||
//
|
||||
// ExceptionBrowser
|
||||
//
|
||||
this.ExceptionBrowser.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ExceptionBrowser.Location = new System.Drawing.Point(0, 0);
|
||||
this.ExceptionBrowser.MinimumSize = new System.Drawing.Size(20, 20);
|
||||
this.ExceptionBrowser.Name = "ExceptionBrowser";
|
||||
this.ExceptionBrowser.ScriptErrorsSuppressed = true;
|
||||
this.ExceptionBrowser.Size = new System.Drawing.Size(780, 181);
|
||||
this.ExceptionBrowser.TabIndex = 1;
|
||||
//
|
||||
// ExceptionDlg
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSize = true;
|
||||
this.ClientSize = new System.Drawing.Size(780, 210);
|
||||
this.Controls.Add(this.MainPN);
|
||||
this.Controls.Add(this.BottomPN);
|
||||
this.MaximumSize = new System.Drawing.Size(4096, 4096);
|
||||
this.Name = "ExceptionDlg";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Exception";
|
||||
this.BottomPN.ResumeLayout(false);
|
||||
this.BottomPN.PerformLayout();
|
||||
this.MainPN.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel BottomPN;
|
||||
private System.Windows.Forms.Button CloseBTN;
|
||||
private System.Windows.Forms.Panel MainPN;
|
||||
private System.Windows.Forms.WebBrowser ExceptionBrowser;
|
||||
private System.Windows.Forms.CheckBox ShowStackTracesCK;
|
||||
|
||||
public FormStartPosition StartPosition { get; private set; }
|
||||
}
|
||||
}
|
||||
@@ -1,185 +0,0 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Opc.Ua;
|
||||
|
||||
namespace OpcUaServer.Server.Windows
|
||||
{
|
||||
public partial class ExceptionDlg : Form
|
||||
{
|
||||
public ExceptionDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private Exception m_exception;
|
||||
|
||||
/// <summary>
|
||||
/// Replaces all special characters in the message.
|
||||
/// </summary>
|
||||
private string ReplaceSpecialCharacters(string message)
|
||||
{
|
||||
message = message.Replace("&", "&");
|
||||
message = message.Replace("<", "<");
|
||||
message = message.Replace(">", ">");
|
||||
message = message.Replace("\"", """);
|
||||
message = message.Replace("'", "'");
|
||||
message = message.Replace("\r\n", "<br/>");
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
private void AddBlock(StringBuilder buffer, string text)
|
||||
{
|
||||
AddBlock(buffer, text, 0);
|
||||
}
|
||||
|
||||
private void AddBlock(StringBuilder buffer, string text, int level)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(text))
|
||||
{
|
||||
if (level > 0)
|
||||
{
|
||||
if (level == 1)
|
||||
{
|
||||
buffer.Append("<tr style='background-color:#990000;");
|
||||
}
|
||||
else if (level == 2)
|
||||
{
|
||||
buffer.Append("<tr style='background-color:#CC6600;");
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer.Append("<tr style='background-color:#999999;");
|
||||
}
|
||||
|
||||
buffer.Append("color:#FFFFFF;font-weight:bold;font-size:10pt;font-family:Verdana'><td>");
|
||||
buffer.Append("<p>");
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer.Append("<tr style='font-size:10pt;font-family:Verdana'><td>");
|
||||
buffer.Append("<p>");
|
||||
}
|
||||
|
||||
buffer.Append(ReplaceSpecialCharacters(text));
|
||||
buffer.Append("</p>");
|
||||
buffer.Append("</td></tr>");
|
||||
}
|
||||
}
|
||||
|
||||
private void Add(StringBuilder buffer, Exception e, bool showStackTrace)
|
||||
{
|
||||
AddBlock(buffer, "EXCEPTION (" + e.GetType().Name + ")", 1);
|
||||
AddBlock(buffer, e.Message);
|
||||
|
||||
ServiceResultException sre = e as ServiceResultException;
|
||||
|
||||
if (sre != null)
|
||||
{
|
||||
ServiceResult sr = new ServiceResult(sre);
|
||||
|
||||
while (sr != null)
|
||||
{
|
||||
AddBlock(buffer, "SERVICE RESULT (" + new StatusCode(sr.Code).ToString() + ")", 2);
|
||||
|
||||
string text = (sr.LocalizedText != null) ? sr.LocalizedText.Text : null;
|
||||
|
||||
if (text != e.Message)
|
||||
{
|
||||
AddBlock(buffer, text);
|
||||
}
|
||||
|
||||
AddBlock(buffer, sr.SymbolicId);
|
||||
AddBlock(buffer, sr.NamespaceUri);
|
||||
|
||||
if (showStackTrace)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(sre.AdditionalInfo))
|
||||
{
|
||||
AddBlock(buffer, "ADDITIONAL INFO (" + new StatusCode(sr.Code).ToString() + ")", 3);
|
||||
AddBlock(buffer, sre.AdditionalInfo);
|
||||
}
|
||||
}
|
||||
|
||||
sr = sr.InnerResult;
|
||||
}
|
||||
}
|
||||
|
||||
if (showStackTrace)
|
||||
{
|
||||
AddBlock(buffer, "STACK TRACE", 3);
|
||||
AddBlock(buffer, e.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
private void Show(bool showStackTrace)
|
||||
{
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.Append("<html><body style='margin:0;width:100%'>");
|
||||
//buffer.Append(ExceptionBrowser.Parent.Width);
|
||||
//buffer.Append("px'>");
|
||||
buffer.Append("<table border='1' style='width:100%'>");
|
||||
|
||||
Exception e = m_exception;
|
||||
|
||||
while (e != null)
|
||||
{
|
||||
Add(buffer, e, showStackTrace);
|
||||
e = e.InnerException;
|
||||
}
|
||||
|
||||
buffer.Append("</table>");
|
||||
buffer.Append("</body></html>");
|
||||
|
||||
ExceptionBrowser.DocumentText = buffer.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Displays the exception in a dialog.
|
||||
/// </summary>
|
||||
public static void Show(string caption, Exception e)
|
||||
{
|
||||
// check if running as a service.
|
||||
if (!Environment.UserInteractive)
|
||||
{
|
||||
Utils.Trace(e, "Unexpected error in '{0}'.", caption);
|
||||
return;
|
||||
}
|
||||
|
||||
new ExceptionDlg().ShowDialog(caption, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Display the exception in the dialog.
|
||||
/// </summary>
|
||||
public void ShowDialog(string caption, Exception e)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(caption))
|
||||
{
|
||||
Text = caption;
|
||||
}
|
||||
|
||||
m_exception = e;
|
||||
|
||||
ShowStackTracesCK.Checked = true;
|
||||
//True in DEBUG
|
||||
//ShowStackTracesCK.Checked = false;
|
||||
|
||||
Show(ShowStackTracesCK.Checked);
|
||||
|
||||
ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
private void OkButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void ShowStackTracesCK_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
Show(ShowStackTracesCK.Checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,359 +0,0 @@
|
||||
namespace OpcUaServer.Server
|
||||
{
|
||||
partial class ServerDiagnosticsCtrl
|
||||
{
|
||||
/// <summary>
|
||||
/// Variabile di progettazione necessaria.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Pulire le risorse in uso.
|
||||
/// </summary>
|
||||
/// <param name="disposing">ha valore true se le risorse gestite devono essere eliminate, false in caso contrario.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Codice generato da Progettazione componenti
|
||||
|
||||
/// <summary>
|
||||
/// Metodo necessario per il supporto della finestra di progettazione. Non modificare
|
||||
/// il contenuto del metodo con l'editor di codice.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.MainPN = new System.Windows.Forms.SplitContainer();
|
||||
this.SessionsGB = new System.Windows.Forms.GroupBox();
|
||||
this.SessionsLV = new System.Windows.Forms.ListView();
|
||||
this.SessionIdCH = new System.Windows.Forms.ColumnHeader();
|
||||
this.SessionNameCH = new System.Windows.Forms.ColumnHeader();
|
||||
this.UserNameCH = new System.Windows.Forms.ColumnHeader();
|
||||
this.LastContactTimeCH = new System.Windows.Forms.ColumnHeader();
|
||||
this.SubscriptionsGB = new System.Windows.Forms.GroupBox();
|
||||
this.SubscriptionsLV = new System.Windows.Forms.ListView();
|
||||
this.SubscriptionIdCH = new System.Windows.Forms.ColumnHeader();
|
||||
this.PublishingIntervalCH = new System.Windows.Forms.ColumnHeader();
|
||||
this.ItemCountCH = new System.Windows.Forms.ColumnHeader();
|
||||
this.SequenceNumberCH = new System.Windows.Forms.ColumnHeader();
|
||||
this.AddressPN = new System.Windows.Forms.Panel();
|
||||
this.EndpointsLB = new System.Windows.Forms.Label();
|
||||
this.UrlCB = new System.Windows.Forms.ComboBox();
|
||||
this.StatusBAR = new System.Windows.Forms.StatusStrip();
|
||||
this.ServerStatusLB = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.ServerStateLB = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.ServerTimeLB = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.sessionsLB = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.subscriptionsLB = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStripStatusLabel4 = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.itemsLB = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.UpdateTimerCTRL = new System.Windows.Forms.Timer(this.components);
|
||||
this.MainPN.Panel1.SuspendLayout();
|
||||
this.MainPN.Panel2.SuspendLayout();
|
||||
this.MainPN.SuspendLayout();
|
||||
this.SessionsGB.SuspendLayout();
|
||||
this.SubscriptionsGB.SuspendLayout();
|
||||
this.AddressPN.SuspendLayout();
|
||||
this.StatusBAR.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// MainPN
|
||||
//
|
||||
this.MainPN.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.MainPN.Location = new System.Drawing.Point(0, 32);
|
||||
this.MainPN.Name = "MainPN";
|
||||
this.MainPN.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// MainPN.Panel1
|
||||
//
|
||||
this.MainPN.Panel1.Controls.Add(this.SessionsGB);
|
||||
this.MainPN.Panel1.Padding = new System.Windows.Forms.Padding(2);
|
||||
//
|
||||
// MainPN.Panel2
|
||||
//
|
||||
this.MainPN.Panel2.Controls.Add(this.SubscriptionsGB);
|
||||
this.MainPN.Panel2.Padding = new System.Windows.Forms.Padding(2);
|
||||
this.MainPN.Size = new System.Drawing.Size(532, 291);
|
||||
this.MainPN.SplitterDistance = 131;
|
||||
this.MainPN.TabIndex = 3;
|
||||
//
|
||||
// SessionsGB
|
||||
//
|
||||
this.SessionsGB.Controls.Add(this.SessionsLV);
|
||||
this.SessionsGB.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.SessionsGB.Location = new System.Drawing.Point(2, 2);
|
||||
this.SessionsGB.Name = "SessionsGB";
|
||||
this.SessionsGB.Size = new System.Drawing.Size(528, 127);
|
||||
this.SessionsGB.TabIndex = 0;
|
||||
this.SessionsGB.TabStop = false;
|
||||
this.SessionsGB.Text = "Sessions";
|
||||
//
|
||||
// SessionsLV
|
||||
//
|
||||
this.SessionsLV.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.SessionIdCH,
|
||||
this.SessionNameCH,
|
||||
this.UserNameCH,
|
||||
this.LastContactTimeCH});
|
||||
this.SessionsLV.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.SessionsLV.FullRowSelect = true;
|
||||
this.SessionsLV.Location = new System.Drawing.Point(3, 16);
|
||||
this.SessionsLV.Name = "SessionsLV";
|
||||
this.SessionsLV.Size = new System.Drawing.Size(522, 108);
|
||||
this.SessionsLV.TabIndex = 0;
|
||||
this.SessionsLV.UseCompatibleStateImageBehavior = false;
|
||||
this.SessionsLV.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// SessionIdCH
|
||||
//
|
||||
this.SessionIdCH.Text = "SessionId";
|
||||
this.SessionIdCH.Width = 101;
|
||||
//
|
||||
// SessionNameCH
|
||||
//
|
||||
this.SessionNameCH.Text = "Name";
|
||||
this.SessionNameCH.Width = 90;
|
||||
//
|
||||
// UserNameCH
|
||||
//
|
||||
this.UserNameCH.Text = "User";
|
||||
this.UserNameCH.Width = 90;
|
||||
//
|
||||
// LastContactTimeCH
|
||||
//
|
||||
this.LastContactTimeCH.Text = "Last Contact";
|
||||
this.LastContactTimeCH.Width = 126;
|
||||
//
|
||||
// SubscriptionsGB
|
||||
//
|
||||
this.SubscriptionsGB.Controls.Add(this.SubscriptionsLV);
|
||||
this.SubscriptionsGB.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.SubscriptionsGB.Location = new System.Drawing.Point(2, 2);
|
||||
this.SubscriptionsGB.Name = "SubscriptionsGB";
|
||||
this.SubscriptionsGB.Size = new System.Drawing.Size(528, 152);
|
||||
this.SubscriptionsGB.TabIndex = 0;
|
||||
this.SubscriptionsGB.TabStop = false;
|
||||
this.SubscriptionsGB.Text = "Subscriptions";
|
||||
//
|
||||
// SubscriptionsLV
|
||||
//
|
||||
this.SubscriptionsLV.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.SubscriptionIdCH,
|
||||
this.PublishingIntervalCH,
|
||||
this.ItemCountCH,
|
||||
this.SequenceNumberCH});
|
||||
this.SubscriptionsLV.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.SubscriptionsLV.FullRowSelect = true;
|
||||
this.SubscriptionsLV.Location = new System.Drawing.Point(3, 16);
|
||||
this.SubscriptionsLV.Name = "SubscriptionsLV";
|
||||
this.SubscriptionsLV.Size = new System.Drawing.Size(522, 133);
|
||||
this.SubscriptionsLV.TabIndex = 0;
|
||||
this.SubscriptionsLV.UseCompatibleStateImageBehavior = false;
|
||||
this.SubscriptionsLV.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// SubscriptionIdCH
|
||||
//
|
||||
this.SubscriptionIdCH.Text = "SubscriptionId";
|
||||
this.SubscriptionIdCH.Width = 90;
|
||||
//
|
||||
// PublishingIntervalCH
|
||||
//
|
||||
this.PublishingIntervalCH.Text = "Publishing Interval";
|
||||
this.PublishingIntervalCH.Width = 101;
|
||||
//
|
||||
// ItemCountCH
|
||||
//
|
||||
this.ItemCountCH.Text = "Item Count";
|
||||
this.ItemCountCH.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.ItemCountCH.Width = 126;
|
||||
//
|
||||
// SequenceNumberCH
|
||||
//
|
||||
this.SequenceNumberCH.Text = "Seq No";
|
||||
this.SequenceNumberCH.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// AddressPN
|
||||
//
|
||||
this.AddressPN.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.AddressPN.Controls.Add(this.EndpointsLB);
|
||||
this.AddressPN.Controls.Add(this.UrlCB);
|
||||
this.AddressPN.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.AddressPN.Location = new System.Drawing.Point(0, 0);
|
||||
this.AddressPN.Name = "AddressPN";
|
||||
this.AddressPN.Padding = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.AddressPN.Size = new System.Drawing.Size(532, 32);
|
||||
this.AddressPN.TabIndex = 0;
|
||||
//
|
||||
// EndpointsLB
|
||||
//
|
||||
this.EndpointsLB.AutoSize = true;
|
||||
this.EndpointsLB.Location = new System.Drawing.Point(0, 7);
|
||||
this.EndpointsLB.Name = "EndpointsLB";
|
||||
this.EndpointsLB.Size = new System.Drawing.Size(113, 13);
|
||||
this.EndpointsLB.TabIndex = 0;
|
||||
this.EndpointsLB.Text = "Server Endpoint URLs";
|
||||
this.EndpointsLB.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// UrlCB
|
||||
//
|
||||
this.UrlCB.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.UrlCB.FormattingEnabled = true;
|
||||
this.UrlCB.Location = new System.Drawing.Point(119, 4);
|
||||
this.UrlCB.Name = "UrlCB";
|
||||
this.UrlCB.Size = new System.Drawing.Size(406, 21);
|
||||
this.UrlCB.TabIndex = 1;
|
||||
//
|
||||
// StatusBAR
|
||||
//
|
||||
this.StatusBAR.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.ServerStatusLB,
|
||||
this.ServerStateLB,
|
||||
this.toolStripStatusLabel1,
|
||||
this.ServerTimeLB,
|
||||
this.toolStripStatusLabel2,
|
||||
this.sessionsLB,
|
||||
this.toolStripStatusLabel3,
|
||||
this.subscriptionsLB,
|
||||
this.toolStripStatusLabel4,
|
||||
this.itemsLB});
|
||||
this.StatusBAR.Location = new System.Drawing.Point(0, 323);
|
||||
this.StatusBAR.Name = "StatusBAR";
|
||||
this.StatusBAR.Size = new System.Drawing.Size(532, 22);
|
||||
this.StatusBAR.TabIndex = 1;
|
||||
this.StatusBAR.Text = "statusStrip1";
|
||||
//
|
||||
// ServerStatusLB
|
||||
//
|
||||
this.ServerStatusLB.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.ServerStatusLB.Name = "ServerStatusLB";
|
||||
this.ServerStatusLB.Size = new System.Drawing.Size(45, 17);
|
||||
this.ServerStatusLB.Text = "Status:";
|
||||
//
|
||||
// ServerStateLB
|
||||
//
|
||||
this.ServerStateLB.Name = "ServerStateLB";
|
||||
this.ServerStateLB.Size = new System.Drawing.Size(52, 17);
|
||||
this.ServerStateLB.Text = "Running";
|
||||
//
|
||||
// toolStripStatusLabel1
|
||||
//
|
||||
this.toolStripStatusLabel1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
|
||||
this.toolStripStatusLabel1.Size = new System.Drawing.Size(84, 17);
|
||||
this.toolStripStatusLabel1.Text = "Current Time:";
|
||||
//
|
||||
// ServerTimeLB
|
||||
//
|
||||
this.ServerTimeLB.Name = "ServerTimeLB";
|
||||
this.ServerTimeLB.Size = new System.Drawing.Size(49, 17);
|
||||
this.ServerTimeLB.Text = "00:00:00";
|
||||
//
|
||||
// toolStripStatusLabel2
|
||||
//
|
||||
this.toolStripStatusLabel2.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.toolStripStatusLabel2.Name = "toolStripStatusLabel2";
|
||||
this.toolStripStatusLabel2.Size = new System.Drawing.Size(56, 17);
|
||||
this.toolStripStatusLabel2.Text = "Sessions:";
|
||||
//
|
||||
// sessionsLB
|
||||
//
|
||||
this.sessionsLB.Name = "sessionsLB";
|
||||
this.sessionsLB.Size = new System.Drawing.Size(13, 17);
|
||||
this.sessionsLB.Text = "0";
|
||||
//
|
||||
// toolStripStatusLabel3
|
||||
//
|
||||
this.toolStripStatusLabel3.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.toolStripStatusLabel3.Name = "toolStripStatusLabel3";
|
||||
this.toolStripStatusLabel3.Size = new System.Drawing.Size(84, 17);
|
||||
this.toolStripStatusLabel3.Text = "Subscriptions:";
|
||||
//
|
||||
// subscriptionsLB
|
||||
//
|
||||
this.subscriptionsLB.Name = "subscriptionsLB";
|
||||
this.subscriptionsLB.Size = new System.Drawing.Size(13, 17);
|
||||
this.subscriptionsLB.Text = "0";
|
||||
//
|
||||
// toolStripStatusLabel4
|
||||
//
|
||||
this.toolStripStatusLabel4.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
|
||||
this.toolStripStatusLabel4.Name = "toolStripStatusLabel4";
|
||||
this.toolStripStatusLabel4.Size = new System.Drawing.Size(42, 17);
|
||||
this.toolStripStatusLabel4.Text = "Items:";
|
||||
//
|
||||
// itemsLB
|
||||
//
|
||||
this.itemsLB.Name = "itemsLB";
|
||||
this.itemsLB.Size = new System.Drawing.Size(13, 17);
|
||||
this.itemsLB.Text = "0";
|
||||
//
|
||||
// UpdateTimerCTRL
|
||||
//
|
||||
this.UpdateTimerCTRL.Interval = 1000;
|
||||
this.UpdateTimerCTRL.Tick += new System.EventHandler(this.UpdateTimerCTRL_Tick);
|
||||
//
|
||||
// ServerDiagnosticsCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.MainPN);
|
||||
this.Controls.Add(this.StatusBAR);
|
||||
this.Controls.Add(this.AddressPN);
|
||||
this.Name = "ServerDiagnosticsCtrl";
|
||||
this.Size = new System.Drawing.Size(532, 345);
|
||||
this.MainPN.Panel1.ResumeLayout(false);
|
||||
this.MainPN.Panel2.ResumeLayout(false);
|
||||
this.MainPN.ResumeLayout(false);
|
||||
this.SessionsGB.ResumeLayout(false);
|
||||
this.SubscriptionsGB.ResumeLayout(false);
|
||||
this.AddressPN.ResumeLayout(false);
|
||||
this.AddressPN.PerformLayout();
|
||||
this.StatusBAR.ResumeLayout(false);
|
||||
this.StatusBAR.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.SplitContainer MainPN;
|
||||
private System.Windows.Forms.GroupBox SessionsGB;
|
||||
private System.Windows.Forms.ListView SessionsLV;
|
||||
private System.Windows.Forms.ColumnHeader SessionIdCH;
|
||||
private System.Windows.Forms.ColumnHeader SessionNameCH;
|
||||
private System.Windows.Forms.ColumnHeader UserNameCH;
|
||||
private System.Windows.Forms.ColumnHeader LastContactTimeCH;
|
||||
private System.Windows.Forms.GroupBox SubscriptionsGB;
|
||||
private System.Windows.Forms.ListView SubscriptionsLV;
|
||||
private System.Windows.Forms.ColumnHeader SubscriptionIdCH;
|
||||
private System.Windows.Forms.ColumnHeader PublishingIntervalCH;
|
||||
private System.Windows.Forms.ColumnHeader ItemCountCH;
|
||||
private System.Windows.Forms.ColumnHeader SequenceNumberCH;
|
||||
private System.Windows.Forms.Panel AddressPN;
|
||||
private System.Windows.Forms.Label EndpointsLB;
|
||||
private System.Windows.Forms.ComboBox UrlCB;
|
||||
private System.Windows.Forms.StatusStrip StatusBAR;
|
||||
private System.Windows.Forms.ToolStripStatusLabel ServerStatusLB;
|
||||
private System.Windows.Forms.ToolStripStatusLabel ServerStateLB;
|
||||
private System.Windows.Forms.ToolStripStatusLabel ServerTimeLB;
|
||||
private System.Windows.Forms.Timer UpdateTimerCTRL;
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2;
|
||||
private System.Windows.Forms.ToolStripStatusLabel sessionsLB;
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel3;
|
||||
private System.Windows.Forms.ToolStripStatusLabel subscriptionsLB;
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel4;
|
||||
private System.Windows.Forms.ToolStripStatusLabel itemsLB;
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using Opc.Ua;
|
||||
using Opc.Ua.Server;
|
||||
|
||||
namespace OpcUaServer.Server
|
||||
{
|
||||
public partial class ServerDiagnosticsCtrl : UserControl
|
||||
{
|
||||
private StandardServer m_server;
|
||||
private ApplicationConfiguration m_configuration;
|
||||
|
||||
public ServerDiagnosticsCtrl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void Initialize(StandardServer server, ApplicationConfiguration configuration)
|
||||
{
|
||||
m_server = server;
|
||||
m_configuration = configuration;
|
||||
UpdateTimerCTRL.Enabled = true;
|
||||
|
||||
// add the urls to the drop down.
|
||||
UrlCB.Items.Clear();
|
||||
|
||||
foreach (EndpointDescription endpoint in m_server.GetEndpoints())
|
||||
{
|
||||
if (UrlCB.FindStringExact(endpoint.EndpointUrl) == -1)
|
||||
{
|
||||
UrlCB.Items.Add(endpoint.EndpointUrl);
|
||||
}
|
||||
}
|
||||
|
||||
if (UrlCB.Items.Count > 0)
|
||||
{
|
||||
UrlCB.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateTimerCTRL_Tick(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
ServerStateLB.Text = m_server.CurrentInstance.CurrentState.ToString();
|
||||
ServerTimeLB.Text = String.Format("{0:HH:mm:ss}", DateTime.Now);
|
||||
UpdateSessions();
|
||||
sessionsLB.Text = Convert.ToString(SessionsLV.Items.Count);
|
||||
UpdateSubscriptions();
|
||||
subscriptionsLB.Text = Convert.ToString(SubscriptionsLV.Items.Count);
|
||||
int itemTotal = 0;
|
||||
for (int i = 0; i < SubscriptionsLV.Items.Count; i++)
|
||||
{
|
||||
itemTotal += Convert.ToInt32(SubscriptionsLV.Items[i].SubItems[2].Text);
|
||||
}
|
||||
itemsLB.Text = Convert.ToString(itemTotal);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ClientUtils.HandleException(this.Text, exception);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateSessions()
|
||||
{
|
||||
SessionsLV.Items.Clear();
|
||||
|
||||
IList<Session> sessions = m_server.CurrentInstance.SessionManager.GetSessions();
|
||||
|
||||
for (int ii = 0; ii < sessions.Count; ii++)
|
||||
{
|
||||
Session session = sessions[ii];
|
||||
|
||||
lock (session.DiagnosticsLock)
|
||||
{
|
||||
ListViewItem item = new ListViewItem(session.SessionDiagnostics.SessionName);
|
||||
|
||||
if (session.Identity != null)
|
||||
{
|
||||
item.SubItems.Add(session.Identity.DisplayName);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.SubItems.Add(String.Empty);
|
||||
}
|
||||
|
||||
item.SubItems.Add(String.Format("{0}", session.Id));
|
||||
item.SubItems.Add(String.Format("{0:HH:mm:ss}", session.SessionDiagnostics.ClientLastContactTime.ToLocalTime()));
|
||||
|
||||
SessionsLV.Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
// adjust
|
||||
for (int ii = 0; ii < SessionsLV.Columns.Count; ii++)
|
||||
{
|
||||
SessionsLV.Columns[ii].Width = -2;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateSubscriptions()
|
||||
{
|
||||
SubscriptionsLV.Items.Clear();
|
||||
|
||||
IList<Subscription> subscriptions = m_server.CurrentInstance.SubscriptionManager.GetSubscriptions();
|
||||
|
||||
for (int ii = 0; ii < subscriptions.Count; ii++)
|
||||
{
|
||||
Subscription subscription = subscriptions[ii];
|
||||
|
||||
ListViewItem item = new ListViewItem(subscription.Id.ToString());
|
||||
|
||||
item.SubItems.Add(String.Format("{0}", (int)subscription.PublishingInterval));
|
||||
item.SubItems.Add(String.Format("{0}", subscription.MonitoredItemCount));
|
||||
|
||||
lock (subscription.DiagnosticsLock)
|
||||
{
|
||||
item.SubItems.Add(String.Format("{0}", subscription.Diagnostics.NextSequenceNumber));
|
||||
}
|
||||
|
||||
SubscriptionsLV.Items.Add(item);
|
||||
}
|
||||
|
||||
for (int ii = 0; ii < SubscriptionsLV.Columns.Count; ii++)
|
||||
{
|
||||
SubscriptionsLV.Columns[ii].Width = -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-146
@@ -1,146 +0,0 @@
|
||||
|
||||
|
||||
namespace OpcUaServer.Server.Windows
|
||||
{
|
||||
partial class ServerForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.TrayIcon = new System.Windows.Forms.NotifyIcon(this.components);
|
||||
this.ServerDiagnosticsCTRL = new ServerDiagnosticsCtrl();
|
||||
this.serverHeaderBranding1 = new HeaderBreading();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.contentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// TrayIcon
|
||||
//
|
||||
this.TrayIcon.Text = "TrayIcon";
|
||||
this.TrayIcon.Visible = true;
|
||||
this.TrayIcon.MouseMove += new System.Windows.Forms.MouseEventHandler(this.TrayIcon_MouseMove);
|
||||
this.TrayIcon.DoubleClick += new System.EventHandler(this.TrayIcon_DoubleClick);
|
||||
//
|
||||
// ServerDiagnosticsCTRL
|
||||
//
|
||||
this.ServerDiagnosticsCTRL.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ServerDiagnosticsCTRL.Location = new System.Drawing.Point(0, 114);
|
||||
this.ServerDiagnosticsCTRL.Name = "ServerDiagnosticsCTRL";
|
||||
this.ServerDiagnosticsCTRL.Size = new System.Drawing.Size(739, 368);
|
||||
this.ServerDiagnosticsCTRL.TabIndex = 0;
|
||||
//
|
||||
// serverHeaderBranding1
|
||||
//
|
||||
this.serverHeaderBranding1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.serverHeaderBranding1.BackColor = System.Drawing.Color.White;
|
||||
this.serverHeaderBranding1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.serverHeaderBranding1.Location = new System.Drawing.Point(0, 24);
|
||||
this.serverHeaderBranding1.MaximumSize = new System.Drawing.Size(0, 100);
|
||||
this.serverHeaderBranding1.MinimumSize = new System.Drawing.Size(500, 90);
|
||||
this.serverHeaderBranding1.Name = "serverHeaderBranding1";
|
||||
this.serverHeaderBranding1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.serverHeaderBranding1.Size = new System.Drawing.Size(739, 90);
|
||||
this.serverHeaderBranding1.TabIndex = 1;
|
||||
this.serverHeaderBranding1.Visible = false;
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fileToolStripMenuItem,
|
||||
this.helpToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(739, 24);
|
||||
this.menuStrip1.TabIndex = 2;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// fileToolStripMenuItem
|
||||
//
|
||||
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.exitToolStripMenuItem});
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||
this.fileToolStripMenuItem.Text = "&File";
|
||||
//
|
||||
// exitToolStripMenuItem
|
||||
//
|
||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(92, 22);
|
||||
this.exitToolStripMenuItem.Text = "E&xit";
|
||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.ExitToolStripMenuItem_Click);
|
||||
//
|
||||
// helpToolStripMenuItem
|
||||
//
|
||||
this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.contentsToolStripMenuItem});
|
||||
this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
|
||||
this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
|
||||
this.helpToolStripMenuItem.Text = "&Help";
|
||||
//
|
||||
// contentsToolStripMenuItem
|
||||
//
|
||||
this.contentsToolStripMenuItem.Name = "contentsToolStripMenuItem";
|
||||
this.contentsToolStripMenuItem.Size = new System.Drawing.Size(122, 22);
|
||||
this.contentsToolStripMenuItem.Text = "&Contents";
|
||||
this.contentsToolStripMenuItem.Click += new System.EventHandler(this.ContentsToolStripMenuItem_Click);
|
||||
//
|
||||
// ServerForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(739, 482);
|
||||
this.Controls.Add(this.ServerDiagnosticsCTRL);
|
||||
this.Controls.Add(this.serverHeaderBranding1);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Name = "ServerForm";
|
||||
this.Text = "Quickstart Empty Server";
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ServerForm_FormClosed);
|
||||
this.Resize += new System.EventHandler(this.ServerForm_Resize);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ServerDiagnosticsCtrl ServerDiagnosticsCTRL;
|
||||
private System.Windows.Forms.NotifyIcon TrayIcon;
|
||||
private HeaderBreading serverHeaderBranding1;
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem contentsToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using Opc.Ua;
|
||||
using Opc.Ua.Configuration;
|
||||
using Opc.Ua.Server;
|
||||
|
||||
namespace OpcUaServer.Server.Windows
|
||||
{
|
||||
public partial class ServerForm : Form
|
||||
{
|
||||
private readonly StandardServer _mServer;
|
||||
private readonly ApplicationConfiguration _mConfiguration;
|
||||
|
||||
|
||||
public ServerForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
public ServerForm(ApplicationInstance application)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_mServer = application.Server as StandardServer;
|
||||
_mConfiguration = application.ApplicationConfiguration;
|
||||
this.ServerDiagnosticsCTRL.Initialize(_mServer, _mConfiguration);
|
||||
|
||||
TrayIcon.Text = this.Text = _mConfiguration.ApplicationName;
|
||||
|
||||
//ComponentResourceManager resources = new ComponentResourceManager(typeof(ServerForm));
|
||||
//TrayIcon.Icon = (Icon)(resources.GetObject("App.ico"));
|
||||
}
|
||||
|
||||
private void ServerForm_Resize(object sender, EventArgs e)
|
||||
{
|
||||
if (FormWindowState.Minimized == WindowState)
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
}
|
||||
|
||||
private void TrayIcon_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
Show();
|
||||
WindowState = FormWindowState.Normal;
|
||||
}
|
||||
|
||||
private void ServerForm_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_mServer.Stop();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Utils.Trace(exception, "Error stopping server.");
|
||||
}
|
||||
}
|
||||
|
||||
private void TrayIcon_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
TrayIcon.Text = String.Format(
|
||||
"{0} [{1} {2:HH:mm:ss}]",
|
||||
_mConfiguration.ApplicationName,
|
||||
_mServer.CurrentInstance.CurrentState,
|
||||
DateTime.Now);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
Utils.Trace(exception, "Error getting server status.");
|
||||
}
|
||||
}
|
||||
|
||||
private void ExitToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show("Quit the application", "OPC UA", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
|
||||
private void ContentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.Diagnostics.Process.Start(Path.GetDirectoryName(Application.ExecutablePath) + Path.DirectorySeparatorChar + "WebHelp" + Path.DirectorySeparatorChar + "index.htm");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Unable to launch help documentation. Error: " + ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,59 +2,60 @@
|
||||
<packages>
|
||||
<package id="Libuv" version="1.10.0" targetFramework="net461" />
|
||||
<package id="log4net" version="2.0.8" targetFramework="net461" />
|
||||
<package id="Microsoft.AspNetCore.Connections.Abstractions" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.AspNetCore.Hosting" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.AspNetCore.Connections.Abstractions" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.AspNetCore.Hosting" version="2.2.7" targetFramework="net461" />
|
||||
<package id="Microsoft.AspNetCore.Hosting.Abstractions" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.AspNetCore.Hosting.Server.Abstractions" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.AspNetCore.Http" version="2.2.2" targetFramework="net461" />
|
||||
<package id="Microsoft.AspNetCore.Http.Abstractions" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.AspNetCore.Http.Extensions" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.AspNetCore.Http.Features" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.AspNetCore.Http.Features" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.AspNetCore.Server.Kestrel" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.AspNetCore.Server.Kestrel.Core" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.AspNetCore.Server.Kestrel.Https" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" version="2.2.1" targetFramework="net461" />
|
||||
<package id="Microsoft.AspNetCore.WebUtilities" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Configuration" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Configuration.Abstractions" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Configuration.Binder" version="2.2.4" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Configuration.EnvironmentVariables" version="2.2.4" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Configuration.FileExtensions" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.DependencyInjection" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.FileProviders.Abstractions" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.FileProviders.Physical" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.FileSystemGlobbing" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Hosting.Abstractions" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Logging" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Logging.Abstractions" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.ObjectPool" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Options" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Configuration" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Configuration.Abstractions" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Configuration.Binder" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Configuration.EnvironmentVariables" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Configuration.FileExtensions" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.DependencyInjection" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.FileProviders.Abstractions" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.FileProviders.Physical" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.FileSystemGlobbing" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Hosting.Abstractions" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Logging" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Logging.Abstractions" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.ObjectPool" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Options" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.PlatformAbstractions" version="1.1.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Primitives" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Extensions.Primitives" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Net.Http.Headers" version="2.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.NETCore.Platforms" version="2.2.2" targetFramework="net461" />
|
||||
<package id="Microsoft.NETCore.Platforms" version="3.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net461" />
|
||||
<package id="NETStandard.Library" version="2.0.3" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net461" />
|
||||
<package id="OPCFoundation.NetStandard.Opc.Ua" version="1.4.355.26" targetFramework="net461" />
|
||||
<package id="Portable.BouncyCastle" version="1.8.5" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
|
||||
<package id="OPCFoundation.NetStandard.Opc.Ua" version="1.4.354.23" targetFramework="net461" />
|
||||
<package id="Portable.BouncyCastle" version="1.8.5.2" targetFramework="net461" />
|
||||
<package id="System.AppContext" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Buffers" version="4.5.0" targetFramework="net461" />
|
||||
<package id="System.Collections" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="net461" />
|
||||
<package id="System.Collections.Immutable" version="1.6.0" targetFramework="net461" />
|
||||
<package id="System.Collections.NonGeneric" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Collections.Specialized" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.ComponentModel" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.ComponentModel.Annotations" version="4.5.0" targetFramework="net461" />
|
||||
<package id="System.ComponentModel.Annotations" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.ComponentModel.EventBasedAsync" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Console" version="4.3.1" targetFramework="net461" />
|
||||
<package id="System.Data.Common" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Diagnostics.Contracts" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Diagnostics.DiagnosticSource" version="4.5.1" targetFramework="net461" />
|
||||
<package id="System.Diagnostics.DiagnosticSource" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Globalization" version="4.3.0" targetFramework="net461" />
|
||||
@@ -64,7 +65,7 @@
|
||||
<package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.IO.FileSystem" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.IO.Pipelines" version="4.5.3" targetFramework="net461" />
|
||||
<package id="System.IO.Pipelines" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.Linq" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Linq.Queryable" version="4.3.0" targetFramework="net461" />
|
||||
@@ -79,16 +80,16 @@
|
||||
<package id="System.Net.WebSockets.Client" version="4.3.2" targetFramework="net461" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
|
||||
<package id="System.ObjectModel" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Private.ServiceModel" version="4.5.3" targetFramework="net461" />
|
||||
<package id="System.Private.ServiceModel" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.Reflection" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Reflection.DispatchProxy" version="4.5.1" targetFramework="net461" />
|
||||
<package id="System.Reflection.DispatchProxy" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Reflection.Metadata" version="1.6.0" targetFramework="net461" />
|
||||
<package id="System.Reflection.Metadata" version="1.7.0" targetFramework="net461" />
|
||||
<package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Reflection.TypeExtensions" version="4.5.1" targetFramework="net461" />
|
||||
<package id="System.Reflection.TypeExtensions" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Runtime" version="4.3.1" targetFramework="net461" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net461" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.Runtime.Extensions" version="4.3.1" targetFramework="net461" />
|
||||
<package id="System.Runtime.Handles" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net461" />
|
||||
@@ -96,18 +97,21 @@
|
||||
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Runtime.Serialization.Primitives" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Runtime.Serialization.Xml" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.AccessControl" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.Security.Claims" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Cng" version="4.5.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Cng" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.X509Certificates" version="4.3.2" targetFramework="net461" />
|
||||
<package id="System.Security.Cryptography.Xml" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.Security.Permissions" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.Security.Principal" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Security.Principal.Windows" version="4.5.1" targetFramework="net461" />
|
||||
<package id="System.ServiceModel.Primitives" version="4.5.3" targetFramework="net461" />
|
||||
<package id="System.Security.Principal.Windows" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.ServiceModel.Primitives" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Text.Encodings.Web" version="4.5.0" targetFramework="net461" />
|
||||
<package id="System.Text.Encodings.Web" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.Text.RegularExpressions" version="4.3.1" targetFramework="net461" />
|
||||
<package id="System.Threading" version="4.3.0" targetFramework="net461" />
|
||||
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="net461" />
|
||||
|
||||
+265
-214
@@ -9,234 +9,285 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace SOUR.Core
|
||||
{
|
||||
public class ApplicationStarter
|
||||
{
|
||||
private readonly IPrinter _printer;
|
||||
private readonly DataRecorder _recorder;
|
||||
protected MQTT_Client.confData _mqttConf;
|
||||
protected MQTT_Client _mqttCli;
|
||||
private readonly XmlParser _xmlParser;
|
||||
private readonly string _serverConfigurationFilePath;
|
||||
protected bool redisOk = false;
|
||||
/// <summary>
|
||||
/// FIle conf XML (da sostituire con quello scaricato da REDIS) !!!FARE!!!
|
||||
/// </summary>
|
||||
protected string _xmlConfigurationPath;
|
||||
|
||||
public ServerManagerDecorator ServerManagerDecorator { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Avvio applicazione principale
|
||||
/// </summary>
|
||||
/// <param name="printer"></param>
|
||||
/// <param name="xmlConfigurationPath"></param>
|
||||
/// <param name="xmlParser"></param>
|
||||
/// <param name="serverConfigurationFilePath"></param>
|
||||
/// <param name="recorder"></param>
|
||||
/// <param name="mqttConf"></param>
|
||||
public ApplicationStarter(IPrinter printer, string xmlConfigurationPath, XmlParser xmlParser, string serverConfigurationFilePath, DataRecorder recorder, MQTT_Client.confData mqttConf)
|
||||
public class ApplicationStarter
|
||||
{
|
||||
_printer = printer;
|
||||
_recorder = recorder;
|
||||
_mqttConf = mqttConf;
|
||||
_xmlConfigurationPath = xmlConfigurationPath;
|
||||
_xmlParser = xmlParser;
|
||||
_serverConfigurationFilePath = serverConfigurationFilePath;
|
||||
#region Private Fields
|
||||
|
||||
testRedisServerConn(_printer);
|
||||
int reconTOut = 1 * 1000;
|
||||
// se non trova server REDIS ritenta dopo 1 sec...
|
||||
while (!redisOk)
|
||||
{
|
||||
testRedisServerConn(printer);
|
||||
Thread.Sleep(reconTOut);
|
||||
}
|
||||
redisPreStartup(_printer);
|
||||
mqttCliPreStartup(_printer);
|
||||
}
|
||||
/// <summary>
|
||||
/// Test connesisone server redis
|
||||
/// </summary>
|
||||
/// <param name="printer"></param>
|
||||
private void testRedisServerConn(IPrinter printer)
|
||||
{
|
||||
// controllo se il server è connesso
|
||||
if (memLayer.man.connRedis.IsConnected)
|
||||
{
|
||||
printer.Print("***** REDIS server connected... *****");
|
||||
redisOk = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
printer.Print("***** ERROR: REDIS NOT available... please check service status *****");
|
||||
}
|
||||
}
|
||||
private readonly IPrinter _printer;
|
||||
private readonly DataRecorder _recorder;
|
||||
private readonly string _serverConfigurationFilePath;
|
||||
private readonly XmlParser _xmlParser;
|
||||
|
||||
/// <summary>
|
||||
/// Effettua operazioni preliminari su redis x startup (check configurazione)
|
||||
/// </summary>
|
||||
/// <param name="printer"></param>
|
||||
private void redisPreStartup(IPrinter printer)
|
||||
{
|
||||
// chiamo metodo start registrazione REDIS
|
||||
string srvVers = typeof(ApplicationStarter).Assembly.GetName().Version.ToString();
|
||||
DataHelper.sendRedisStart(srvVers);
|
||||
#endregion Private Fields
|
||||
|
||||
// recupero i primi dati da redis (versione) x dire OK
|
||||
string redVal = "";
|
||||
string currKey = "";
|
||||
bool redOk = false;
|
||||
// controllo e loggo
|
||||
currKey = memLayer.man.redHash("Srv:Vers");
|
||||
redVal = memLayer.man.getRSV(currKey);
|
||||
redOk = tryLog(redVal, string.Format("***** REDIS SOUR SERVER vers {0} set! *****", redVal), "***** ERROR: impossible to save SOUR SERVER Version... please check Redis*****");
|
||||
#region Protected Fields
|
||||
|
||||
// verifica se ci sia chiave Versione dell' Adp...
|
||||
currKey = memLayer.man.redHash("Adp:Vers");
|
||||
redVal = memLayer.man.getRSV(currKey);
|
||||
redOk = tryLog(redVal, string.Format("***** REDIS SOUR ADAPTER vers {0} found! *****", redVal), "***** ERROR: No SOUR ADAPTER Version found... please check adapter *****");
|
||||
protected MQTT_Client _mqttCli;
|
||||
protected MQTT_Client.confData _mqttConf;
|
||||
|
||||
// Verifico se trovo XML...
|
||||
currKey = memLayer.man.redHash("AdpConf:DataModel");
|
||||
redVal = memLayer.man.getRSV(currKey);
|
||||
redOk = tryLog(redVal, string.Format("***** DataModel found, now saving as {0}! *****", _xmlConfigurationPath), "***** ERROR: No XML DataModel found... pause + retry *****");
|
||||
/// <summary>
|
||||
/// FIle conf XML (da sostituire con quello scaricato da REDIS) !!!FARE!!!
|
||||
/// </summary>
|
||||
protected string _xmlConfigurationPath;
|
||||
|
||||
// attendo di avere un file XML valido da REDIS sennò RESTO in attesa... per 10 tentativi
|
||||
int reconTOut = 1 * 1000;
|
||||
int numTry = memLayer.man.confReadInt("xmlReadMaxRetry");
|
||||
while (!redOk)
|
||||
{
|
||||
// se non trova XML REDIS ritenta dopo reconTOut sec...
|
||||
numTry--;
|
||||
Thread.Sleep(reconTOut);
|
||||
redVal = memLayer.man.getRSV(currKey);
|
||||
redOk = tryLog(redVal, string.Format("***** DataModel found, now saving as {0}! *****", _xmlConfigurationPath), "***** ERROR: No XML DataModel found... pause + retry *****");
|
||||
if (numTry <= 0 && !redOk)
|
||||
protected bool redisOk = false;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Avvio applicazione principale
|
||||
/// </summary>
|
||||
/// <param name="printer"></param>
|
||||
/// <param name="xmlConfigurationPath"></param>
|
||||
/// <param name="xmlParser"></param>
|
||||
/// <param name="serverConfigurationFilePath"></param>
|
||||
/// <param name="recorder"></param>
|
||||
/// <param name="mqttConf"></param>
|
||||
public ApplicationStarter(IPrinter printer, string xmlConfigurationPath, XmlParser xmlParser, string serverConfigurationFilePath, DataRecorder recorder, MQTT_Client.confData mqttConf)
|
||||
{
|
||||
redOk = true;
|
||||
printer.Print("***** ERROR: No XML DataModel found... using previous copy *****");
|
||||
_printer = printer;
|
||||
_recorder = recorder;
|
||||
_mqttConf = mqttConf;
|
||||
_xmlConfigurationPath = xmlConfigurationPath;
|
||||
_xmlParser = xmlParser;
|
||||
_serverConfigurationFilePath = serverConfigurationFilePath;
|
||||
|
||||
testRedisServerConn(_printer);
|
||||
int reconTOut = 1 * 1000;
|
||||
// se non trova server REDIS ritenta dopo 1 sec...
|
||||
while (!redisOk)
|
||||
{
|
||||
testRedisServerConn(printer);
|
||||
Thread.Sleep(reconTOut);
|
||||
}
|
||||
redisPreStartup(_printer);
|
||||
mqttCliPreStartup(_printer);
|
||||
}
|
||||
}
|
||||
// se OK --> proseguo
|
||||
if (redOk)
|
||||
{
|
||||
if (redVal != null && redVal != "")
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public ServerManagerDecorator ServerManagerDecorator { get; private set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Avvia in modalità async l'oggetto MQTT
|
||||
/// </summary>
|
||||
/// <param name="mqttCli"></param>
|
||||
/// <returns></returns>
|
||||
private static async Task setupMqtt(MQTT_Client mqttCli)
|
||||
{
|
||||
string dataModel = DataHelper.xmlSanitize(redVal);
|
||||
File.WriteAllText(_xmlConfigurationPath, dataModel);
|
||||
printer.Print("***** XML DataModel saved! *****");
|
||||
await mqttCli.startAsync();
|
||||
await mqttCli.sendValueAsync("data/SRG", "STARTED", null);
|
||||
}
|
||||
else
|
||||
|
||||
private static void StartServer(IPrinter printer, ServerDecorator server, string serverConfigurationFilePath)
|
||||
{
|
||||
printer.Print("***** EMPTY XML DataModel --> using old one if present! *****");
|
||||
new ConsoleServerStarter(new ApplicationInstanceBuilder(printer, server), printer).Start(serverConfigurationFilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua operazioni preliminari su MQTT client x startup (check configurazione + avvio + scrittura avviato...)
|
||||
/// </summary>
|
||||
/// <param name="printer"></param>
|
||||
private void mqttCliPreStartup(IPrinter printer)
|
||||
{
|
||||
// faccio i controlli per capire SE si possa avviare...
|
||||
if (redisOk)
|
||||
{
|
||||
_mqttCli = new MQTT_Client(_mqttConf);
|
||||
printer.Print("***** SRG MQTT publishing server created... *****");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua operazioni preliminari su MQTT client x startup (check configurazione + avvio + scrittura avviato...)
|
||||
/// </summary>
|
||||
/// <param name="printer"></param>
|
||||
private void mqttCliStartup(IPrinter printer)
|
||||
{
|
||||
// faccio i controlli per capire SE si possa avviare...
|
||||
if (redisOk)
|
||||
{
|
||||
setupMqtt(_mqttCli);
|
||||
printer.Print("***** SRG MQTT publishing server started... *****");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Avvia in modalità async l'oggetto MQTT
|
||||
/// </summary>
|
||||
/// <param name="mqttCli"></param>
|
||||
/// <returns></returns>
|
||||
private static async Task setupMqtt(MQTT_Client mqttCli)
|
||||
{
|
||||
await mqttCli.startAsync();
|
||||
await mqttCli.sendValueAsync("data/SRG", "STARTED", null);
|
||||
}
|
||||
/// <summary>
|
||||
/// Classe avvio
|
||||
/// </summary>
|
||||
public void Start()
|
||||
{
|
||||
try
|
||||
{
|
||||
// avvio server redis
|
||||
_printer.Print("***** OPC UA XML configuration settings file loading ... *****");
|
||||
var server = new ServerDecorator(_printer, _xmlConfigurationPath);
|
||||
_printer.Print("***** OPC UA Server Instance created... *****");
|
||||
// avvio server
|
||||
StartServer(_printer, server, _serverConfigurationFilePath);
|
||||
_printer.Print("***** OPC UA Server started... *****");
|
||||
|
||||
// avvio MQTT
|
||||
mqttCliStartup(_printer);
|
||||
/// <summary>
|
||||
/// Avvia il componente Sampler che effettua lettura periodica da area redis
|
||||
/// </summary>
|
||||
/// <param name="server"></param>
|
||||
/// <returns></returns>
|
||||
private IRedisSampler GetSampler(ServerDecorator server)
|
||||
{
|
||||
var nodesDictionary = _xmlParser.CreateDictionaryFromXmlToGenerateValues(_xmlConfigurationPath);
|
||||
|
||||
// avvio il sampler REDIS
|
||||
GetSampler(server).Start();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_printer.Print("**** EXCEPTION *****");
|
||||
_printer.Print(ex.ToString());
|
||||
//Console.ReadLine();
|
||||
}
|
||||
ServerManagerDecorator = new ServerManagerDecorator(server);
|
||||
|
||||
return new RedisSampler(ServerManagerDecorator, _xmlConfigurationPath, _printer,
|
||||
nodesDictionary, new EventMessageMan(), _recorder, _mqttConf, _mqttCli);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua operazioni preliminari su MQTT client x startup (check configurazione + avvio + scrittura avviato...)
|
||||
/// </summary>
|
||||
/// <param name="printer"></param>
|
||||
private void mqttCliPreStartup(IPrinter printer)
|
||||
{
|
||||
// faccio i controlli per capire SE si possa avviare...
|
||||
if (redisOk)
|
||||
{
|
||||
// SOLO SE indica che è enabled...
|
||||
if (_mqttConf.isEnabled)
|
||||
{
|
||||
_mqttCli = new MQTT_Client(_mqttConf, printer);
|
||||
printer.Print("***** SRG MQTT publishing server created... *****");
|
||||
}
|
||||
else
|
||||
{
|
||||
printer.Print("***** SRG MQTT NOT ENABLED - server HAS NOT BEEN created... *****");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua operazioni preliminari su MQTT client x startup (check configurazione + avvio + scrittura avviato...)
|
||||
/// </summary>
|
||||
/// <param name="printer"></param>
|
||||
private void mqttCliStartup(IPrinter printer)
|
||||
{
|
||||
// faccio i controlli per capire SE si possa avviare...
|
||||
if (redisOk)
|
||||
{
|
||||
// SOLO SE indica che è enabled...
|
||||
if (_mqttConf.isEnabled)
|
||||
{
|
||||
setupMqtt(_mqttCli);
|
||||
printer.Print("***** SRG MQTT publishing server started... *****");
|
||||
}
|
||||
else
|
||||
{
|
||||
printer.Print("***** SRG MQTT NOT ENABLED - server IS NOT starting... *****");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua operazioni preliminari su redis x startup (check configurazione)
|
||||
/// </summary>
|
||||
/// <param name="printer"></param>
|
||||
private void redisPreStartup(IPrinter printer)
|
||||
{
|
||||
// chiamo metodo start registrazione REDIS
|
||||
string srvVers = typeof(ApplicationStarter).Assembly.GetName().Version.ToString();
|
||||
DataHelper.sendRedisStart(srvVers);
|
||||
|
||||
// recupero i primi dati da redis (versione) x dire OK
|
||||
string redVal = "";
|
||||
string currKey = "";
|
||||
bool redOk = false;
|
||||
// controllo e loggo
|
||||
currKey = memLayer.man.redHash("Srv:Vers");
|
||||
redVal = memLayer.man.getRSV(currKey);
|
||||
redOk = tryLog(redVal, string.Format("***** REDIS SOUR SERVER vers {0} set! *****", redVal), "***** ERROR: impossible to save SOUR SERVER Version... please check Redis*****");
|
||||
|
||||
// verifica se ci sia chiave Versione dell' Adp...
|
||||
currKey = memLayer.man.redHash("Adp:Vers");
|
||||
redVal = memLayer.man.getRSV(currKey);
|
||||
redOk = tryLog(redVal, string.Format("***** REDIS SOUR ADAPTER vers {0} found! *****", redVal), "***** ERROR: No SOUR ADAPTER Version found... please check adapter *****");
|
||||
|
||||
// Verifico se trovo XML...
|
||||
currKey = memLayer.man.redHash("AdpConf:DataModel");
|
||||
redVal = memLayer.man.getRSV(currKey);
|
||||
redOk = tryLog(redVal, string.Format("***** DataModel found, now saving as {0}! *****", _xmlConfigurationPath), "***** ERROR: No XML DataModel found... pause + retry *****");
|
||||
|
||||
// attendo di avere un file XML valido da REDIS sennò RESTO in attesa... per 10 tentativi
|
||||
int reconTOut = 1 * 1000;
|
||||
int numTry = memLayer.man.confReadInt("xmlReadMaxRetry");
|
||||
while (!redOk)
|
||||
{
|
||||
// se non trova XML REDIS ritenta dopo reconTOut sec...
|
||||
numTry--;
|
||||
Thread.Sleep(reconTOut);
|
||||
redVal = memLayer.man.getRSV(currKey);
|
||||
redOk = tryLog(redVal, string.Format("***** DataModel found, now saving as {0}! *****", _xmlConfigurationPath), "***** ERROR: No XML DataModel found... pause + retry *****");
|
||||
if (numTry <= 0 && !redOk)
|
||||
{
|
||||
redOk = true;
|
||||
printer.Print("***** ERROR: No XML DataModel found... using previous copy *****");
|
||||
}
|
||||
}
|
||||
// se OK --> proseguo
|
||||
if (redOk)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(redVal))
|
||||
{
|
||||
string dataModel = DataHelper.xmlSanitize(redVal);
|
||||
File.WriteAllText(_xmlConfigurationPath, dataModel);
|
||||
printer.Print("***** XML DataModel saved! *****");
|
||||
}
|
||||
else
|
||||
{
|
||||
printer.Print("***** EMPTY XML DataModel --> using old one if present! *****");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test connesisone server redis
|
||||
/// </summary>
|
||||
/// <param name="printer"></param>
|
||||
private void testRedisServerConn(IPrinter printer)
|
||||
{
|
||||
// controllo se il server è connesso
|
||||
if (memLayer.man.connRedis.IsConnected)
|
||||
{
|
||||
printer.Print("***** REDIS server connected... *****");
|
||||
redisOk = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
printer.Print("***** ERROR: REDIS NOT available... please check service status *****");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Effettua verifica di value, se !="" effettua log con messageOk altrimenti con messageKo
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="messageOk">messaggio se OK</param>
|
||||
/// <param name="messageKo">messaggio se KO</param>
|
||||
protected bool tryLog(string value, string messageOk, string messageKo)
|
||||
{
|
||||
bool answ = false;
|
||||
if (value != "" && value != null)
|
||||
{
|
||||
_printer.Print(messageOk);
|
||||
answ = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_printer.Print(messageKo);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Classe avvio
|
||||
/// </summary>
|
||||
public void Start()
|
||||
{
|
||||
try
|
||||
{
|
||||
// avvio server redis
|
||||
_printer.Print("***** OPC UA XML configuration settings file loading ... *****");
|
||||
var server = new ServerDecorator(_printer, _xmlConfigurationPath);
|
||||
_printer.Print("***** OPC UA Server Instance created... *****");
|
||||
// avvio server
|
||||
StartServer(_printer, server, _serverConfigurationFilePath);
|
||||
_printer.Print("***** OPC UA Server started... *****");
|
||||
|
||||
// avvio MQTT
|
||||
mqttCliStartup(_printer);
|
||||
|
||||
// avvio il sampler REDIS
|
||||
GetSampler(server).Start();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_printer.Print("**** EXCEPTION *****");
|
||||
_printer.Print(ex.ToString());
|
||||
//Console.ReadLine();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Avvia il componente Sampler che effettua lettura periodica da area redis
|
||||
/// </summary>
|
||||
/// <param name="server"></param>
|
||||
/// <returns></returns>
|
||||
private IRedisSampler GetSampler(ServerDecorator server)
|
||||
{
|
||||
var nodesDictionary = _xmlParser.CreateDictionaryFromXmlToGenerateValues(_xmlConfigurationPath);
|
||||
|
||||
ServerManagerDecorator = new ServerManagerDecorator(server);
|
||||
|
||||
return new RedisSampler(ServerManagerDecorator, _xmlConfigurationPath, _printer,
|
||||
nodesDictionary, new EventMessageMan(), _recorder, _mqttConf, _mqttCli);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua verifica di value, se !="" effettua log con messageOk altrimenti con messageKo
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="messageOk">messaggio se OK</param>
|
||||
/// <param name="messageKo">messaggio se KO</param>
|
||||
protected bool tryLog(string value, string messageOk, string messageKo)
|
||||
{
|
||||
bool answ = false;
|
||||
if (value != "" && value != null)
|
||||
{
|
||||
_printer.Print(messageOk);
|
||||
answ = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_printer.Print(messageKo);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private static void StartServer(IPrinter printer, ServerDecorator server, string serverConfigurationFilePath)
|
||||
{
|
||||
new ConsoleServerStarter(new ApplicationInstanceBuilder(printer, server), printer).Start(serverConfigurationFilePath);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+148
-121
@@ -1,133 +1,160 @@
|
||||
using SOUR.Core.Services;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
namespace SOUR.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe di supporto x gestione dati
|
||||
/// </summary>
|
||||
public class DataHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Formato output timestamp
|
||||
/// </summary>
|
||||
protected static string dataFormat = "yyyy-MM-dd\\THH:mm:ss.fffK";
|
||||
// !!!TDB!!! provare questo formato ma ha 7 decimali...
|
||||
//protected string dataFormat = "O";
|
||||
/// Classe di supporto x gestione dati
|
||||
/// </summary>
|
||||
public class DataHelper
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp formattato...
|
||||
/// </summary>
|
||||
protected static string timestamp
|
||||
{
|
||||
get
|
||||
{
|
||||
return DateTime.UtcNow.ToString(dataFormat);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Formato output timestamp
|
||||
/// </summary>
|
||||
protected static string dataFormat = "yyyy-MM-dd\\THH:mm:ss.fffK";
|
||||
|
||||
/// <summary>
|
||||
/// TTL eventi BREVI (15 sec)
|
||||
/// </summary>
|
||||
public static int shortTTL = 15;
|
||||
/// <summary>
|
||||
/// TTL eventi LUNGI (5 minuto)
|
||||
/// </summary>
|
||||
public static int longTTL = 300;
|
||||
#endregion Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// classe gestione accessi a Session, cache, viewstate, configuration...
|
||||
/// </summary>
|
||||
protected DataHelper()
|
||||
{
|
||||
shortTTL = memLayer.man.confReadInt("shortTTL");
|
||||
if (shortTTL <= 0) shortTTL = 15;
|
||||
// !!!TDB!!! provare questo formato ma ha 7 decimali...
|
||||
//protected string dataFormat = "O";
|
||||
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
/// TTL eventi LUNGI (5 minuto)
|
||||
/// </summary>
|
||||
public static int longTTL = 300;
|
||||
|
||||
/// <summary>
|
||||
/// oggetto singleton x accesso metodi Helper (redis, XML)
|
||||
/// </summary>
|
||||
public static DataHelper man = new DataHelper();
|
||||
|
||||
/// <summary>
|
||||
/// TTL eventi BREVI (15 sec)
|
||||
/// </summary>
|
||||
public static int shortTTL = 15;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Protected Constructors
|
||||
|
||||
/// <summary>
|
||||
/// classe gestione accessi a Session, cache, viewstate, configuration...
|
||||
/// </summary>
|
||||
protected DataHelper()
|
||||
{
|
||||
shortTTL = memLayer.man.confReadInt("shortTTL");
|
||||
if (shortTTL <= 0) shortTTL = 15;
|
||||
}
|
||||
|
||||
#endregion Protected Constructors
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp formattato...
|
||||
/// </summary>
|
||||
protected static string timestamp
|
||||
{
|
||||
get
|
||||
{
|
||||
return DateTime.UtcNow.ToString(dataFormat);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Invio eventi di tipo heartbeat/watchdog server redis
|
||||
/// </summary>
|
||||
public static void sendRedisHBeat()
|
||||
{
|
||||
string currKey = "";
|
||||
// registro status + heartbeat
|
||||
currKey = memLayer.man.redHash("Srv:Status");
|
||||
memLayer.man.setRSV(currKey, "running", shortTTL);
|
||||
currKey = memLayer.man.redHash("Srv:Heartbeat");
|
||||
memLayer.man.setRSV(currKey, timestamp, shortTTL);
|
||||
// aggiunta bitmap di status: 00001111 --> 255
|
||||
currKey = memLayer.man.redHash("Srv:StatBitmap");
|
||||
memLayer.man.setRSV(currKey, "00001111", shortTTL);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invio eventi di tipo start server redis
|
||||
/// </summary>
|
||||
/// <param name="srvVers">Versione server (esplicita)</param>
|
||||
public static void sendRedisStart(string srvVers)
|
||||
{
|
||||
string currKey = "";
|
||||
// in primis resetto aree server che devo poi compilare...
|
||||
memLayer.man.redFlushKey(memLayer.man.redHash("Srv*"));
|
||||
// scrive versione server...
|
||||
currKey = memLayer.man.redHash("Srv:Vers");
|
||||
memLayer.man.setRSV(currKey, srvVers);
|
||||
// registro status + heartbeat
|
||||
currKey = memLayer.man.redHash("Srv:Status");
|
||||
memLayer.man.setRSV(currKey, "started", longTTL);
|
||||
currKey = memLayer.man.redHash("Srv:Heartbeat");
|
||||
memLayer.man.setRSV(currKey, timestamp, shortTTL);
|
||||
// aggiunta bitmap di status: 00001111 --> 255
|
||||
currKey = memLayer.man.redHash("Srv:StatBitmap");
|
||||
memLayer.man.setRSV(currKey, "00001111", shortTTL);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invio eventi di tipo stop server redis
|
||||
/// </summary>
|
||||
public static void sendRedisStop()
|
||||
{
|
||||
string currKey = "";
|
||||
// registro status + heartbeat
|
||||
currKey = memLayer.man.redHash("Srv:Status");
|
||||
memLayer.man.setRSV(currKey, "stopped");
|
||||
currKey = memLayer.man.redHash("Srv:Heartbeat");
|
||||
memLayer.man.setRSV(currKey, timestamp);
|
||||
// aggiunta bitmap di status: 00001111 --> 255
|
||||
currKey = memLayer.man.redHash("Srv:StatBitmap");
|
||||
memLayer.man.setRSV(currKey, "00001111", shortTTL);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo di sanitizzazione XML
|
||||
/// - elimina commenti
|
||||
/// - formatta
|
||||
/// </summary>
|
||||
/// <param name="xmlOrig"></param>
|
||||
/// <returns></returns>
|
||||
public static string xmlSanitize(string xmlOrig)
|
||||
{
|
||||
string sXml = xmlOrig; // primo step: converto stringa in dox XML
|
||||
XmlDocument xmlDoc = new XmlDocument();
|
||||
xmlDoc.PreserveWhitespace = false;
|
||||
xmlDoc.LoadXml(sXml);
|
||||
// ora lo parso come lista eliminando i commenti
|
||||
XmlNodeList list = xmlDoc.SelectNodes("//comment()");
|
||||
foreach (XmlNode node in list)
|
||||
{
|
||||
node.ParentNode.RemoveChild(node);
|
||||
}
|
||||
// fix formattazione "riscrivendo" indentazione...
|
||||
StringWriter string_writer = new StringWriter();
|
||||
XmlTextWriter xml_text_writer = new XmlTextWriter(string_writer);
|
||||
xml_text_writer.Formatting = Formatting.Indented;
|
||||
xmlDoc.WriteTo(xml_text_writer);
|
||||
sXml = string_writer.ToString();
|
||||
// restituisco
|
||||
return sXml;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
/// <summary>
|
||||
/// oggetto singleton x accesso metodi Helper (redis, XML)
|
||||
/// </summary>
|
||||
public static DataHelper man = new DataHelper();
|
||||
/// <summary>
|
||||
/// Invio eventi di tipo start server redis
|
||||
/// </summary>
|
||||
/// <param name="srvVers">Versione server (esplicita)</param>
|
||||
public static void sendRedisStart(string srvVers)
|
||||
{
|
||||
string currKey = "";
|
||||
// in primis resetto aree server che devo poi compilare...
|
||||
memLayer.man.redFlushKey(memLayer.man.redHash("Srv*"));
|
||||
// scrive versione server...
|
||||
currKey = memLayer.man.redHash("Srv:Vers");
|
||||
memLayer.man.setRSV(currKey, srvVers);
|
||||
// registro status + heartbeat
|
||||
currKey = memLayer.man.redHash("Srv:Status");
|
||||
memLayer.man.setRSV(currKey, "started", longTTL);
|
||||
currKey = memLayer.man.redHash("Srv:Heartbeat");
|
||||
memLayer.man.setRSV(currKey, timestamp, shortTTL);
|
||||
// aggiunta bitmap di status: 00001111 --> 255
|
||||
currKey = memLayer.man.redHash("Srv:StatBitmap");
|
||||
memLayer.man.setRSV(currKey, "00001111", shortTTL);
|
||||
}
|
||||
/// <summary>
|
||||
/// Invio eventi di tipo stop server redis
|
||||
/// </summary>
|
||||
public static void sendRedisStop()
|
||||
{
|
||||
string currKey = "";
|
||||
// registro status + heartbeat
|
||||
currKey = memLayer.man.redHash("Srv:Status");
|
||||
memLayer.man.setRSV(currKey, "stopped");
|
||||
currKey = memLayer.man.redHash("Srv:Heartbeat");
|
||||
memLayer.man.setRSV(currKey, timestamp);
|
||||
// aggiunta bitmap di status: 00001111 --> 255
|
||||
currKey = memLayer.man.redHash("Srv:StatBitmap");
|
||||
memLayer.man.setRSV(currKey, "00001111", shortTTL);
|
||||
}
|
||||
/// <summary>
|
||||
/// Invio eventi di tipo heartbeat/watchdog server redis
|
||||
/// </summary>
|
||||
public static void sendRedisHBeat()
|
||||
{
|
||||
string currKey = "";
|
||||
// registro status + heartbeat
|
||||
currKey = memLayer.man.redHash("Srv:Status");
|
||||
memLayer.man.setRSV(currKey, "running", shortTTL);
|
||||
currKey = memLayer.man.redHash("Srv:Heartbeat");
|
||||
memLayer.man.setRSV(currKey, timestamp, shortTTL);
|
||||
// aggiunta bitmap di status: 00001111 --> 255
|
||||
currKey = memLayer.man.redHash("Srv:StatBitmap");
|
||||
memLayer.man.setRSV(currKey, "00001111", shortTTL);
|
||||
}
|
||||
/// <summary>
|
||||
/// Metodo di sanitizzazione XML
|
||||
/// - elimina commenti
|
||||
/// - formatta
|
||||
/// </summary>
|
||||
/// <param name="xmlOrig"></param>
|
||||
/// <returns></returns>
|
||||
public static string xmlSanitize(string xmlOrig)
|
||||
{
|
||||
string sXml = xmlOrig;
|
||||
// primo step: converto stringa in dox XML
|
||||
XmlDocument xmlDoc = new XmlDocument();
|
||||
xmlDoc.PreserveWhitespace = false;
|
||||
xmlDoc.LoadXml(sXml);
|
||||
// ora lo parso come lista eliminando i commenti
|
||||
XmlNodeList list = xmlDoc.SelectNodes("//comment()");
|
||||
foreach (XmlNode node in list)
|
||||
{
|
||||
node.ParentNode.RemoveChild(node);
|
||||
}
|
||||
// fix formattazione "riscrivendo" indentazione...
|
||||
StringWriter string_writer = new StringWriter();
|
||||
XmlTextWriter xml_text_writer = new XmlTextWriter(string_writer);
|
||||
xml_text_writer.Formatting = Formatting.Indented;
|
||||
xmlDoc.WriteTo(xml_text_writer);
|
||||
sXml = string_writer.ToString();
|
||||
// restituisco
|
||||
return sXml;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,10 +34,10 @@
|
||||
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Pipelines.Sockets.Unofficial, Version=1.0.0.0, Culture=neutral, PublicKeyToken=42ea0a778e13fbe2, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Pipelines.Sockets.Unofficial.2.0.22\lib\net461\Pipelines.Sockets.Unofficial.dll</HintPath>
|
||||
<HintPath>..\packages\Pipelines.Sockets.Unofficial.2.1.0\lib\net461\Pipelines.Sockets.Unofficial.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\StackExchange.Redis.2.0.601\lib\net461\StackExchange.Redis.dll</HintPath>
|
||||
@@ -47,12 +47,12 @@
|
||||
<HintPath>..\packages\System.Buffers.4.5.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Diagnostics.PerformanceCounter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Diagnostics.PerformanceCounter.4.5.0\lib\net461\System.Diagnostics.PerformanceCounter.dll</HintPath>
|
||||
<Reference Include="System.Diagnostics.PerformanceCounter, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Diagnostics.PerformanceCounter.4.6.0\lib\net461\System.Diagnostics.PerformanceCounter.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.IO.Pipelines, Version=4.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Pipelines.4.5.3\lib\netstandard2.0\System.IO.Pipelines.dll</HintPath>
|
||||
<Reference Include="System.IO.Pipelines, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Pipelines.4.6.0\lib\netstandard2.0\System.IO.Pipelines.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
|
||||
@@ -61,12 +61,12 @@
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Threading.Channels, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Channels.4.5.0\lib\netstandard2.0\System.Threading.Channels.dll</HintPath>
|
||||
<Reference Include="System.Threading.Channels, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Channels.4.6.0\lib\netstandard2.0\System.Threading.Channels.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace SOUR.Core.Services
|
||||
{
|
||||
string singleAlarm = memLayer.man.redGetHashField(currKey, AlarmKey);
|
||||
//int alrNum = 0;
|
||||
if (singleAlarm != "")
|
||||
if (!string.IsNullOrEmpty( singleAlarm ))
|
||||
{
|
||||
var splitted = AlarmKey.Split('|');
|
||||
if (splitted.Length > 1)
|
||||
@@ -53,6 +53,10 @@ namespace SOUR.Core.Services
|
||||
answ = new EventMessage(AlarmKey, singleAlarm, splitted[1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = new EventMessage(AlarmKey, $"ALARM {AlarmKey} - key not found in currKey");
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
namespace SOUR.Core.Services
|
||||
{
|
||||
public class MemDataItem
|
||||
{
|
||||
public string browseName;
|
||||
public string elType;
|
||||
public string dataType;
|
||||
public string lastVal;
|
||||
public string currVal;
|
||||
public int sGroup = 3;
|
||||
public float dBand = 0;
|
||||
public bool changed;
|
||||
}
|
||||
}
|
||||
public class MemDataItem
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public string browseName;
|
||||
public bool changed;
|
||||
public string currVal;
|
||||
public string dataType;
|
||||
public float dBand = 0;
|
||||
public string elType;
|
||||
public string lastVal;
|
||||
public int sGroup = 3;
|
||||
|
||||
#endregion Public Fields
|
||||
}
|
||||
}
|
||||
+1008
-801
File diff suppressed because it is too large
Load Diff
+1239
-1053
File diff suppressed because it is too large
Load Diff
@@ -8,11 +8,11 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.1" newVersion="4.0.3.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.2.1.0" newVersion="1.2.1.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.2.4.0" newVersion="1.2.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
|
||||
@@ -24,7 +24,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.AspNetCore.Hosting" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.2.7.0" newVersion="2.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel.Https" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
@@ -60,11 +60,11 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
|
||||
@@ -76,7 +76,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
@@ -84,7 +84,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.AspNetCore.Http.Features" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.AspNetCore.Http" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
@@ -92,7 +92,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Security.Cryptography.Cng" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.3.2.0" newVersion="4.3.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
@@ -102,6 +102,90 @@
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.AspNetCore.Connections.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Configuration.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.FileProviders.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Configuration" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Configuration.Binder" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Hosting.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Configuration.EnvironmentVariables" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Configuration.FileExtensions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.FileProviders.Physical" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Channels" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Options" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.ObjectPool" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Extensions.Logging" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.4.4.0" newVersion="1.4.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Security.Principal.Windows" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Reflection.DispatchProxy" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.5.0" newVersion="4.0.5.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Security.Cryptography.Xml" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.8" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net461" />
|
||||
<package id="Pipelines.Sockets.Unofficial" version="2.0.22" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
|
||||
<package id="Pipelines.Sockets.Unofficial" version="2.1.0" targetFramework="net461" />
|
||||
<package id="StackExchange.Redis" version="2.0.601" targetFramework="net461" />
|
||||
<package id="System.Buffers" version="4.5.0" targetFramework="net461" />
|
||||
<package id="System.Diagnostics.PerformanceCounter" version="4.5.0" targetFramework="net461" />
|
||||
<package id="System.IO.Pipelines" version="4.5.3" targetFramework="net461" />
|
||||
<package id="System.Diagnostics.PerformanceCounter" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.IO.Pipelines" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.Memory" version="4.5.3" targetFramework="net461" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net461" />
|
||||
<package id="System.Threading.Channels" version="4.5.0" targetFramework="net461" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.Threading.Channels" version="4.6.0" targetFramework="net461" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -0,0 +1,49 @@
|
||||
{\rtf1\ansi\ansicpg1252\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\froman\fprq2\fcharset2 Symbol;}}
|
||||
{\colortbl ;\red0\green0\blue0;\red0\green0\blue255;}
|
||||
{\*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\pard\nowidctlpar\sb120\sa120\b\f0\fs20 MICROSOFT SOFTWARE LICENSE TERMS\f1\par
|
||||
\pard\brdrb\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120\f0 MICROSOFT SPEECH PLATFORM - SERVER RUNTIME \cf1 10.\f1 0\cf0\par
|
||||
\pard\nowidctlpar\sb120\sa120\b0\f0 These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft\f1\par
|
||||
\pard\nowidctlpar\fi-360\li360\sb120\sa120\tx360\f2\'b7\tab\f0 updates,\f1\par
|
||||
\pard\nowidctlpar\fi-360\li360\sb120\sa120\f2\'b7\tab\f0 supplements,\f1\par
|
||||
\f2\'b7\tab\f0 Internet-based services, and \f1\par
|
||||
\f2\'b7\tab\f0 support services\f1\par
|
||||
\pard\nowidctlpar\sb120\sa120\f0 for this software, unless other terms accompany those items. If so, those terms apply.\f1\par
|
||||
\b\f0 By using the software, you accept these terms. If you do not accept them, do not use the software.\f1\par
|
||||
\pard\brdrt\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120\f0 If you comply with these license terms, you have the rights below.\f1\par
|
||||
\pard\nowidctlpar\fi-357\li357\sb120\sa120\tx360\f0 1.\tab INSTALLATION AND USE RIGHTS. \b0 You may install and use any number of copies of the software on your devices running validly licensed copies of Windows Server 2003 or later version, as well as Microsoft Speech Platform SDK v10.1 and/or a non-Microsoft product which has been developed using the Microsoft Speech Platform SDK v10.0. If you are downloading this software in connection with such non-Microsoft product, then the terms associated with that product apply.\b\f1\par
|
||||
\pard\nowidctlpar\fi-357\li357\sb120\sa120\caps\f0 2.\tab Scope of License\caps0\f1 .\b0\f0 The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not\b\f1\par
|
||||
\pard\nowidctlpar\fi-363\li720\sb120\sa120\tx720\b0\f2\'b7\tab\f0 disclose the results of any benchmark tests of the software to any third party without Microsoft\rquote s prior written approval\fs19 ;\f1\fs20\par
|
||||
\pard\nowidctlpar\fi-363\li720\sb120\sa120\f2\'b7\tab\f0 work around any technical limitations in the software\fs19 ;\f1\fs20\par
|
||||
\f2\'b7\tab\f0 reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation\fs19 ;\f1\fs20\par
|
||||
\f2\'b7\tab\f0 make more copies of the software than specified in this agreement or allowed by applicable law, despite this limitation\fs19 ;\f1\fs20\par
|
||||
\f2\'b7\tab\f0 publish the software for others to copy\fs19 ;\f1\fs20\par
|
||||
\f2\'b7\tab\f0 rent, lease or lend the software\fs19 ;\f1\fs20\par
|
||||
\f2\'b7\tab\f0 transfer the software or this agreement to any third party\fs19 ; or\f1\fs20\par
|
||||
\f2\'b7\tab\f0 use the software for commercial software hosting services\f1\fs19 .\fs20\par
|
||||
\pard\nowidctlpar\fi-357\li357\sb120\sa120\tx360\b\f0 3.\tab BACKUP COPY.\b0 You may make one backup copy of the software. You may use it only to reinstall the software.\b\f1\par
|
||||
\pard\nowidctlpar\fi-357\li357\sb120\sa120\f0 4.\tab DOCUMENTATION.\b0 Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.\b\f1\par
|
||||
\caps\f0 5.\tab Export Restrictions\caps0\f1 .\b0\f0 The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see {\field{\*\fldinst{HYPERLINK "www.microsoft.com/exporting"}}{\fldrslt{\ul\cf2 www.microsoft.com/exporting}}}\f1\fs20 .\b\par
|
||||
\caps\f0 6.\tab SUPPORT SERVICES.\caps0 \b0 Because this software is \ldblquote as is,\rdblquote we may not provide support services for it.\b\f1\par
|
||||
\caps\f0 7.\tab Entire Agreement.\b0\caps0 This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.\f1\par
|
||||
\pard\nowidctlpar\fi-360\li360\sb120\sa120\tx360\b\caps\f0 8.\tab Applicable Law\caps0\f1 .\par
|
||||
\pard\nowidctlpar\fi-363\li720\sb120\sa120\tx720\f0 a.\tab United States.\b0 If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.\b\f1\par
|
||||
\pard\nowidctlpar\fi-363\li720\sb120\sa120\f0 b.\tab Outside the United States.\b0 If you acquired the software in any other country, the laws of that country apply.\b\f1\par
|
||||
\pard\nowidctlpar\fi-357\li357\sb120\sa120\tx360\caps\f0 9.\tab Legal Effect.\b0\caps0 This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.\b\caps\f1\par
|
||||
\pard\nowidctlpar\fi-357\li357\sb120\sa120\f0 10.\tab Disclaimer of Warranty.\caps0 The software is licensed \ldblquote as-is.\rdblquote You bear the risk of using it. Microsoft gives no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this agreement cannot change. To the extent permitted under your local laws, Microsoft excludes the implied warranties of merchantability, fitness for a particular purpose and non-infringement.\caps\f1\par
|
||||
\pard\nowidctlpar\fi-360\li360\sb120\sa120\tx360\f0 11.\tab Limitation on and Exclusion of Remedies and Damages. \caps0 You can recover from Microsoft and its suppliers only direct damages up to U.S. $5.00. You cannot recover any other damages, including consequential, lost profits, special, indirect or incidental damages.\caps\f1\par
|
||||
\pard\nowidctlpar\li357\sb120\sa120\b0\caps0\f0 This limitation applies to\f1\par
|
||||
\pard\nowidctlpar\fi-363\li720\sb120\sa120\tx720\f2\'b7\tab\f0 anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and\f1\par
|
||||
\pard\nowidctlpar\fi-363\li720\sb120\sa120\f2\'b7\tab\f0 claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.\f1\par
|
||||
\pard\nowidctlpar\li360\sb120\sa120\f0 It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.\f1\par
|
||||
\pard\nowidctlpar\sb120\sa120\b\f0 Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.\f1\par
|
||||
\f0 Remarque : Ce logiciel \'e9tant distribu\'e9 au Qu\'e9bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran\'e7ais.\f1\par
|
||||
\f0 EXON\'c9RATION DE GARANTIE.\b0 Le logiciel vis\'e9 par une licence est offert \'ab tel quel \'bb. Toute utilisation de ce logiciel est \'e0 votre seule risque et p\'e9ril. Microsoft n\rquote accorde aucune autre garantie expresse. Vous pouvez b\'e9n\'e9ficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit\'e9 marchande, d\rquote ad\'e9quation \'e0 un usage particulier et d\rquote absence de contrefa\'e7on sont exclues.\f1\par
|
||||
\b\f0 LIMITATION DES DOMMAGES-INT\'c9R\'caTS ET EXCLUSION DE RESPONSABILIT\'c9 POUR LES DOMMAGES.\b0 Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement \'e0 hauteur de 5,00 $ US. Vous ne pouvez pr\'e9tendre \'e0 aucune indemnisation pour les autres dommages, y compris les dommages sp\'e9ciaux, indirects ou accessoires et pertes de b\'e9n\'e9fices.\f1\par
|
||||
\f0 Cette limitation concerne :\f1\par
|
||||
\pard\nowidctlpar\fi-360\li360\sb120\sa120\tx360\f2\'b7\tab\f0 tout ce qui est reli\'e9 au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et\f1\par
|
||||
\pard\nowidctlpar\fi-360\li360\sb120\sa120\f2\'b7\tab\f0 les r\'e9clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit\'e9 stricte, de n\'e9gligence ou d\rquote une autre faute dans la limite autoris\'e9e par la loi en vigueur.\f1\par
|
||||
\pard\nowidctlpar\sb120\sa120\f0 Elle s\rquote applique \'e9galement, m\'eame si Microsoft connaissait ou devrait conna\'eetre l\rquote\'e9ventualit\'e9 d\rquote un tel dommage. Si votre pays n\rquote autorise pas l\rquote exclusion ou la limitation de responsabilit\'e9 pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l\rquote exclusion ci-dessus ne s\rquote appliquera pas \'e0 votre \'e9gard.\f1\par
|
||||
\b\f0 EFFET JURIDIQUE.\b0 Le pr\'e9sent contrat d\'e9crit certains droits juridiques. Vous pourriez avoir d\rquote autres droits pr\'e9vus par les lois de votre pays. \lang1036 Le pr\'e9sent contrat ne modifie pas les droits que vous conf\'e8rent les lois de votre pays si celles-ci ne le permettent pas.\par
|
||||
\b\f1\par
|
||||
}
|
||||
| ||||