Skip to content

Commit ca1afdf

Browse files
committed
OPC-UA-Client: valueJson property filled when auto created json tag.
1 parent e649367 commit ca1afdf

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/OPC-UA-Client/AsduReceiveHandler.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,18 @@ private void ConvertOpcValue(DataValue value, out string tp, out double dblValue
678678
}
679679
}
680680
else
681+
if (base_type == "nodeid" && !isArray)
682+
{
683+
dblValue = 0;
684+
strValue = value.WrappedValue.ToString();
685+
}
686+
else
687+
if (base_type == "expandednodeid" && !isArray)
688+
{
689+
dblValue = 0;
690+
strValue = value.WrappedValue.ToString();
691+
}
692+
else
681693
if (base_type == "xmlelement" && !isArray)
682694
{
683695
dblValue = 0;
@@ -695,8 +707,6 @@ private void ConvertOpcValue(DataValue value, out string tp, out double dblValue
695707
(base_type == "string" ||
696708
base_type == "localeid" ||
697709
base_type == "localizedtext" ||
698-
base_type == "nodeid" ||
699-
base_type == "expandediodeid" ||
700710
base_type == "xmlelement" ||
701711
base_type == "qualifiedname" ||
702712
base_type == "guid")
@@ -710,8 +720,6 @@ private void ConvertOpcValue(DataValue value, out string tp, out double dblValue
710720
if (base_type == "string" ||
711721
base_type == "localeid" ||
712722
base_type == "localizedtext" ||
713-
base_type == "nodeid" ||
714-
base_type == "expandednodeid" ||
715723
base_type == "xmlelement" ||
716724
base_type == "gualifiedname" ||
717725
base_type == "guid")

src/OPC-UA-Client/TagsCreation.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ public class rtData
188188
[BsonSerializer(typeof(BsonDoubleSerializer)), BsonDefaultValue(0.0)]
189189
public BsonDouble valueDefault;
190190
[BsonDefaultValue("")]
191+
public BsonString valueJson { get; set; }
192+
[BsonDefaultValue("")]
191193
public BsonString valueString { get; set; }
192194
[BsonSerializer(typeof(BsonDoubleSerializer)), BsonDefaultValue(0.0)]
193195
public BsonDouble value;
@@ -207,13 +209,13 @@ public static rtData newRealtimeDoc(OPC_Value ov, double _id, double commandOfSu
207209
case "bytestring":
208210
case "localeid":
209211
case "localizedtext":
210-
case "nodeid":
211-
case "expandednodeid":
212212
case "xmlelement":
213213
case "qualifiedname":
214214
case "guid":
215215
type = "string";
216216
break;
217+
case "nodeid":
218+
case "expandednodeid":
217219
case "extensionobject":
218220
type = "json";
219221
break;
@@ -483,6 +485,7 @@ public static rtData newRealtimeDoc(OPC_Value ov, double _id, double commandOfSu
483485
type = type,
484486
value = 0.0,
485487
valueString = ov.valueString,
488+
valueJson = ov.valueJson,
486489

487490
alarmDisabled = false,
488491
alerted = false,

0 commit comments

Comments
 (0)