Beispiel #1
0
 internal static OpcDaItemValue[] Create(OpcDaGroup opcDaGroup, int dwCount, int[] phClientItems,
                                         object[] pvValues,
                                         short[] pwQualities, FILETIME[] pftTimeStamps, HRESULT[] pErrors)
 {
     try
     {
         var values = new OpcDaItemValue[dwCount];
         for (var i = 0; i < values.Length; i++)
         {
             values[i] = new OpcDaItemValue
             {
                 Value     = pvValues[i],
                 Item      = opcDaGroup.GetItem(phClientItems[i]),
                 Quality   = pwQualities[i],
                 Timestamp = FileTimeConverter.FromFileTime(pftTimeStamps[i]),
                 Error     = pErrors[i]
             };
         }
         return(values);
     }
     catch (Exception ex)
     {
         Log.Error("Cannot create OpcDaItemValue object.", ex);
         return(new OpcDaItemValue[0]);
     }
 }
Beispiel #2
0
 internal static OpcDaItemValue[] Create(OpcDaGroup opcDaGroup, OPCITEMSTATE[] ppItemValues,
                                         HRESULT[] ppErrors)
 {
     try
     {
         var result = new OpcDaItemValue[ppItemValues.Length];
         for (var i = 0; i < result.Length; i++)
         {
             result[i] = new OpcDaItemValue
             {
                 Timestamp = FileTimeConverter.FromFileTime(ppItemValues[i].ftTimeStamp),
                 Value     = ppItemValues[i].vDataValue,
                 Quality   = ppItemValues[i].wQuality,
                 Error     = ppErrors[i],
                 Item      = opcDaGroup.GetItem(ppItemValues[i].hClient)
             };
         }
         return(result);
     }
     catch (Exception ex)
     {
         Log.Error("Cannot create OpcDaItemValue object.", ex);
         return(new OpcDaItemValue[0]);
     }
 }