@@ -23,6 +23,7 @@ const {
2323 OPCUAServer,
2424 Variant,
2525 DataType,
26+ DataValue,
2627 StatusCodes,
2728 VariantArrayType,
2829 AccessLevelFlag,
@@ -657,21 +658,42 @@ process.on('uncaughtException', (err) =>
657658 ? AccessLevelFlag . CurrentWrite
658659 : writeFlag ) ,
659660 ...cmdWriteProp ,
661+ value : {
662+ timestamped_get : ( ) =>
663+ new DataValue ( {
664+ statusCode : element . invalid
665+ ? StatusCodes . Bad
666+ : StatusCodes . Good ,
667+ sourceTimestamp :
668+ ! ( 'timeTagAtSource' in element ) ||
669+ element . timeTagAtSource === null
670+ ? new Date ( 0 )
671+ : element . timeTagAtSource ,
672+ serverTimestamp : element . timeTag ,
673+ value : new Variant ( {
674+ dataType : v . dataType ,
675+ ...( v . arrayType ? { arrayType : v . arrayType } : { } ) ,
676+ value : v . value ,
677+ } ) ,
678+ } ) ,
679+ } ,
660680 } )
661- if ( element . origin !== 'command' ) {
662- server . _metrics [ element . tag ] . setValueFromSource (
663- {
664- dataType : v . dataType ,
665- ...( v . arrayType ? { arrayType : v . arrayType } : { } ) ,
666- value : v . value ,
667- } ,
668- element . invalid ? StatusCodes . Bad : StatusCodes . Good ,
669- ! ( 'timeTagAtSource' in element ) ||
670- element . timeTagAtSource === null
671- ? new Date ( 1970 , 0 , 1 )
672- : element . timeTagAtSource
673- )
674- }
681+ //if (element.origin !== 'command') {
682+ // server._metrics[element.tag].serverTimestamp =
683+ // element.timeTag
684+ // server._metrics[element.tag].setValueFromSource(
685+ // {
686+ // dataType: v.dataType,
687+ // ...(v.arrayType ? { arrayType: v.arrayType } : {}),
688+ // value: v.value,
689+ // },
690+ // element.invalid ? StatusCodes.Bad : StatusCodes.Good,
691+ // !('timeTagAtSource' in element) ||
692+ // element.timeTagAtSource === null
693+ // ? new Date(0)
694+ // : element.timeTagAtSource
695+ // )
696+ //}
675697 }
676698 } catch ( e ) {
677699 Log . log (
@@ -760,7 +782,7 @@ process.on('uncaughtException', (err) =>
760782 : StatusCodes . Good ,
761783 ! ( 'timeTagAtSource' in change . fullDocument ) ||
762784 change . fullDocument . timeTagAtSource === null
763- ? new Date ( 1970 , 0 , 1 )
785+ ? new Date ( 0 )
764786 : change . fullDocument . timeTagAtSource
765787 )
766788
0 commit comments