示例#1
0
 internal static Opc.Dx.DXConnection[] GetDXConnections(ref IntPtr pInput, int count, bool deallocate)
 {
     Opc.Dx.DXConnection[] connectionArray = null;
     if ((pInput != IntPtr.Zero) && (count > 0))
     {
         connectionArray = new Opc.Dx.DXConnection[count];
         IntPtr ptr = pInput;
         for (int i = 0; i < count; i++)
         {
             OpcRcw.Dx.DXConnection input = (OpcRcw.Dx.DXConnection)Marshal.PtrToStructure(ptr, typeof(OpcRcw.Dx.DXConnection));
             connectionArray[i] = GetDXConnection(input, deallocate);
             if (deallocate)
             {
                 Marshal.DestroyStructure(ptr, typeof(OpcRcw.Dx.DXConnection));
             }
             ptr = (IntPtr)(ptr.ToInt32() + Marshal.SizeOf(typeof(OpcRcw.Dx.DXConnection)));
         }
         if (deallocate)
         {
             Marshal.FreeCoTaskMem(pInput);
             pInput = IntPtr.Zero;
         }
     }
     return(connectionArray);
 }
示例#2
0
        public GeneralResponse CopyDXConnectionDefaultAttributes(bool configToStatus, string browsePath, Opc.Dx.DXConnection[] connectionMasks, bool recursive, out ResultID[] errors)
        {
            lock (this)
            {
                if (m_server == null)
                {
                    throw new NotConnectedException();
                }

                try
                {
                    OpcRcw.Dx.DXConnection[] array = Interop.GetDXConnections(connectionMasks);
                    if (array == null)
                    {
                        array = new OpcRcw.Dx.DXConnection[0];
                    }

                    IntPtr ppErrors = IntPtr.Zero;
                    ((IOPCConfiguration)m_server).CopyDXConnectionDefaultAttributes(configToStatus ? 1 : 0, (browsePath != null) ? browsePath : "", array.Length, array, recursive ? 1 : 0, out ppErrors, out DXGeneralResponse pResponse);
                    errors = Interop.GetResultIDs(ref ppErrors, array.Length, deallocate: true);
                    return(Interop.GetGeneralResponse(pResponse, deallocate: true));
                }
                catch (Exception e)
                {
                    throw OpcCom.Interop.CreateException("IOPCConfiguration.CopyDXConnectionDefaultAttributes", e);
                }
            }
        }
示例#3
0
        public GeneralResponse ModifyDXConnections(Opc.Dx.DXConnection[] connections)
        {
            lock (this)
            {
                if (m_server == null)
                {
                    throw new NotConnectedException();
                }

                try
                {
                    OpcRcw.Dx.DXConnection[] array = Interop.GetDXConnections(connections);
                    if (array == null)
                    {
                        array = new OpcRcw.Dx.DXConnection[0];
                    }

                    ((IOPCConfiguration)m_server).ModifyDXConnections(array.Length, array, out DXGeneralResponse pResponse);
                    return(Interop.GetGeneralResponse(pResponse, deallocate: true));
                }
                catch (Exception e)
                {
                    throw OpcCom.Interop.CreateException("IOPCConfiguration.ModifyDXConnections", e);
                }
            }
        }
示例#4
0
        public Opc.Dx.DXConnection[] QueryDXConnections(string browsePath, Opc.Dx.DXConnection[] connectionMasks, bool recursive, out ResultID[] errors)
        {
            lock (this)
            {
                if (m_server == null)
                {
                    throw new NotConnectedException();
                }

                try
                {
                    OpcRcw.Dx.DXConnection[] array = Interop.GetDXConnections(connectionMasks);
                    if (array == null)
                    {
                        array = new OpcRcw.Dx.DXConnection[0];
                    }

                    int    pdwCount      = 0;
                    IntPtr ppErrors      = IntPtr.Zero;
                    IntPtr ppConnections = IntPtr.Zero;
                    ((IOPCConfiguration)m_server).QueryDXConnections((browsePath != null) ? browsePath : "", array.Length, array, recursive ? 1 : 0, out ppErrors, out pdwCount, out ppConnections);
                    errors = Interop.GetResultIDs(ref ppErrors, array.Length, deallocate: true);
                    return(Interop.GetDXConnections(ref ppConnections, pdwCount, deallocate: true));
                }
                catch (Exception e)
                {
                    throw OpcCom.Interop.CreateException("IOPCConfiguration.QueryDXConnections", e);
                }
            }
        }
示例#5
0
        public GeneralResponse CopyDXConnectionDefaultAttributes(bool configToStatus, string browsePath, Opc.Dx.DXConnection[] connectionMasks, bool recursive, out ResultID[] errors)
        {
            GeneralResponse generalResponse;

            lock (this)
            {
                if (base.m_server == null)
                {
                    throw new NotConnectedException();
                }
                try
                {
                    DXGeneralResponse        response;
                    OpcRcw.Dx.DXConnection[] dXConnections = OpcCom.Dx.Interop.GetDXConnections(connectionMasks);
                    if (dXConnections == null)
                    {
                        dXConnections = new OpcRcw.Dx.DXConnection[0];
                    }
                    IntPtr zero = IntPtr.Zero;
                    ((IOPCConfiguration)base.m_server).CopyDXConnectionDefaultAttributes(configToStatus ? 1 : 0, (browsePath != null) ? browsePath : "", dXConnections.Length, dXConnections, recursive ? 1 : 0, out zero, out response);
                    errors          = OpcCom.Dx.Interop.GetResultIDs(ref zero, dXConnections.Length, true);
                    generalResponse = OpcCom.Dx.Interop.GetGeneralResponse(response, true);
                }
                catch (Exception exception)
                {
                    throw OpcCom.Interop.CreateException("IOPCConfiguration.CopyDXConnectionDefaultAttributes", exception);
                }
            }
            return(generalResponse);
        }
示例#6
0
 public Opc.Dx.DXConnection[] QueryDXConnections(string browsePath, Opc.Dx.DXConnection[] connectionMasks, bool recursive, out ResultID[] errors)
 {
     Opc.Dx.DXConnection[] connectionArray2;
     lock (this)
     {
         if (base.m_server == null)
         {
             throw new NotConnectedException();
         }
         try
         {
             OpcRcw.Dx.DXConnection[] dXConnections = OpcCom.Dx.Interop.GetDXConnections(connectionMasks);
             if (dXConnections == null)
             {
                 dXConnections = new OpcRcw.Dx.DXConnection[0];
             }
             int    pdwCount      = 0;
             IntPtr zero          = IntPtr.Zero;
             IntPtr ppConnections = IntPtr.Zero;
             ((IOPCConfiguration)base.m_server).QueryDXConnections((browsePath != null) ? browsePath : "", dXConnections.Length, dXConnections, recursive ? 1 : 0, out zero, out pdwCount, out ppConnections);
             errors           = OpcCom.Dx.Interop.GetResultIDs(ref zero, dXConnections.Length, true);
             connectionArray2 = OpcCom.Dx.Interop.GetDXConnections(ref ppConnections, pdwCount, true);
         }
         catch (Exception exception)
         {
             throw OpcCom.Interop.CreateException("IOPCConfiguration.QueryDXConnections", exception);
         }
     }
     return(connectionArray2);
 }
示例#7
0
        public GeneralResponse ModifyDXConnections(Opc.Dx.DXConnection[] connections)
        {
            GeneralResponse generalResponse;

            lock (this)
            {
                if (base.m_server == null)
                {
                    throw new NotConnectedException();
                }
                try
                {
                    DXGeneralResponse        response;
                    OpcRcw.Dx.DXConnection[] dXConnections = OpcCom.Dx.Interop.GetDXConnections(connections);
                    if (dXConnections == null)
                    {
                        dXConnections = new OpcRcw.Dx.DXConnection[0];
                    }
                    ((IOPCConfiguration)base.m_server).ModifyDXConnections(dXConnections.Length, dXConnections, out response);
                    generalResponse = OpcCom.Dx.Interop.GetGeneralResponse(response, true);
                }
                catch (Exception exception)
                {
                    throw OpcCom.Interop.CreateException("IOPCConfiguration.ModifyDXConnections", exception);
                }
            }
            return(generalResponse);
        }
示例#8
0
 internal static OpcRcw.Dx.DXConnection[] GetDXConnections(Opc.Dx.DXConnection[] input)
 {
     OpcRcw.Dx.DXConnection[] connectionArray = null;
     if ((input != null) && (input.Length > 0))
     {
         connectionArray = new OpcRcw.Dx.DXConnection[input.Length];
         for (int i = 0; i < input.Length; i++)
         {
             connectionArray[i] = GetDXConnection(input[i]);
         }
     }
     return(connectionArray);
 }
示例#9
0
 internal static Opc.Dx.DXConnection GetDXConnection(OpcRcw.Dx.DXConnection input, bool deallocate)
 {
     Opc.Dx.DXConnection connection = new Opc.Dx.DXConnection {
         ItemPath = null,
         ItemName = null,
         Version  = null
     };
     connection.BrowsePaths.Clear();
     connection.Name        = null;
     connection.Description = null;
     connection.Keyword     = null;
     connection.DefaultSourceItemConnected          = false;
     connection.DefaultSourceItemConnectedSpecified = false;
     connection.DefaultTargetItemConnected          = false;
     connection.DefaultTargetItemConnectedSpecified = false;
     connection.DefaultOverridden              = false;
     connection.DefaultOverriddenSpecified     = false;
     connection.DefaultOverrideValue           = null;
     connection.SubstituteValue                = null;
     connection.EnableSubstituteValue          = false;
     connection.EnableSubstituteValueSpecified = false;
     connection.TargetItemPath               = null;
     connection.TargetItemName               = null;
     connection.SourceServerName             = null;
     connection.SourceItemPath               = null;
     connection.SourceItemName               = null;
     connection.SourceItemQueueSize          = 0;
     connection.SourceItemQueueSizeSpecified = false;
     connection.UpdateRate          = 0;
     connection.UpdateRateSpecified = false;
     connection.Deadband            = 0f;
     connection.DeadbandSpecified   = false;
     connection.VendorData          = null;
     if ((input.dwMask & 2) != 0)
     {
         connection.ItemName = input.szItemName;
     }
     if ((input.dwMask & 1) != 0)
     {
         connection.ItemPath = input.szItemPath;
     }
     if ((input.dwMask & 4) != 0)
     {
         connection.Version = input.szVersion;
     }
     if ((input.dwMask & 8) != 0)
     {
         string[] c = OpcCom.Interop.GetUnicodeStrings(ref input.pszBrowsePaths, input.dwBrowsePathCount, deallocate);
         if (c != null)
         {
             connection.BrowsePaths.AddRange(c);
         }
     }
     if ((input.dwMask & 0x10) != 0)
     {
         connection.Name = input.szName;
     }
     if ((input.dwMask & 0x20) != 0)
     {
         connection.Description = input.szDescription;
     }
     if ((input.dwMask & 0x40) != 0)
     {
         connection.Keyword = input.szKeyword;
     }
     if ((input.dwMask & 0x80) != 0)
     {
         connection.DefaultSourceItemConnected          = input.bDefaultSourceItemConnected != 0;
         connection.DefaultSourceItemConnectedSpecified = true;
     }
     if ((input.dwMask & 0x100) != 0)
     {
         connection.DefaultTargetItemConnected          = input.bDefaultTargetItemConnected != 0;
         connection.DefaultTargetItemConnectedSpecified = true;
     }
     if ((input.dwMask & 0x200) != 0)
     {
         connection.DefaultOverridden          = input.bDefaultOverridden != 0;
         connection.DefaultOverriddenSpecified = true;
     }
     if ((input.dwMask & 0x400) != 0)
     {
         connection.DefaultOverrideValue = input.vDefaultOverrideValue;
     }
     if ((input.dwMask & 0x800) != 0)
     {
         connection.SubstituteValue = input.vSubstituteValue;
     }
     if ((input.dwMask & 0x1000) != 0)
     {
         connection.EnableSubstituteValue          = input.bEnableSubstituteValue != 0;
         connection.EnableSubstituteValueSpecified = true;
     }
     if ((input.dwMask & 0x4000) != 0)
     {
         connection.TargetItemName = input.szTargetItemName;
     }
     if ((input.dwMask & 0x2000) != 0)
     {
         connection.TargetItemPath = input.szTargetItemPath;
     }
     if ((input.dwMask & 0x8000) != 0)
     {
         connection.SourceServerName = input.szSourceServerName;
     }
     if ((input.dwMask & 0x20000) != 0)
     {
         connection.SourceItemName = input.szSourceItemName;
     }
     if ((input.dwMask & 0x10000) != 0)
     {
         connection.SourceItemPath = input.szSourceItemPath;
     }
     if ((input.dwMask & 0x40000) != 0)
     {
         connection.SourceItemQueueSize          = input.dwSourceItemQueueSize;
         connection.SourceItemQueueSizeSpecified = true;
     }
     if ((input.dwMask & 0x80000) != 0)
     {
         connection.UpdateRate          = input.dwUpdateRate;
         connection.UpdateRateSpecified = true;
     }
     if ((input.dwMask & 0x100000) != 0)
     {
         connection.Deadband          = input.fltDeadBand;
         connection.DeadbandSpecified = true;
     }
     if ((input.dwMask & 0x200000) != 0)
     {
         connection.VendorData = input.szVendorData;
     }
     return(connection);
 }
示例#10
0
 internal static OpcRcw.Dx.DXConnection GetDXConnection(Opc.Dx.DXConnection input)
 {
     OpcRcw.Dx.DXConnection connection = new OpcRcw.Dx.DXConnection {
         dwMask                      = 0,
         szItemPath                  = null,
         szItemName                  = null,
         szVersion                   = null,
         dwBrowsePathCount           = 0,
         pszBrowsePaths              = IntPtr.Zero,
         szName                      = null,
         szDescription               = null,
         szKeyword                   = null,
         bDefaultSourceItemConnected = 0,
         bDefaultTargetItemConnected = 0,
         bDefaultOverridden          = 0,
         vDefaultOverrideValue       = null,
         vSubstituteValue            = null,
         bEnableSubstituteValue      = 0,
         szTargetItemPath            = null,
         szTargetItemName            = null,
         szSourceServerName          = null,
         szSourceItemPath            = null,
         szSourceItemName            = null,
         dwSourceItemQueueSize       = 0,
         dwUpdateRate                = 0,
         fltDeadBand                 = 0f,
         szVendorData                = null
     };
     if (input.ItemName != null)
     {
         connection.dwMask    |= 2;
         connection.szItemName = input.ItemName;
     }
     if (input.ItemPath != null)
     {
         connection.dwMask    |= 1;
         connection.szItemPath = input.ItemPath;
     }
     if (input.Version != null)
     {
         connection.dwMask   |= 4;
         connection.szVersion = input.Version;
     }
     if (input.BrowsePaths.Count > 0)
     {
         connection.dwMask           |= 8;
         connection.dwBrowsePathCount = input.BrowsePaths.Count;
         connection.pszBrowsePaths    = OpcCom.Interop.GetUnicodeStrings(input.BrowsePaths.ToArray());
     }
     if (input.Name != null)
     {
         connection.dwMask |= 0x10;
         connection.szName  = input.Name;
     }
     if (input.Description != null)
     {
         connection.dwMask       |= 0x20;
         connection.szDescription = input.Description;
     }
     if (input.Keyword != null)
     {
         connection.dwMask   |= 0x40;
         connection.szKeyword = input.Keyword;
     }
     if (input.DefaultSourceItemConnectedSpecified)
     {
         connection.dwMask |= 0x80;
         connection.bDefaultSourceItemConnected = input.DefaultSourceItemConnected ? 1 : 0;
     }
     if (input.DefaultTargetItemConnectedSpecified)
     {
         connection.dwMask |= 0x100;
         connection.bDefaultTargetItemConnected = input.DefaultTargetItemConnected ? 1 : 0;
     }
     if (input.DefaultOverriddenSpecified)
     {
         connection.dwMask            |= 0x200;
         connection.bDefaultOverridden = input.DefaultOverridden ? 1 : 0;
     }
     if (input.DefaultOverrideValue != null)
     {
         connection.dwMask |= 0x400;
         connection.vDefaultOverrideValue = input.DefaultOverrideValue;
     }
     if (input.SubstituteValue != null)
     {
         connection.dwMask          |= 0x800;
         connection.vSubstituteValue = input.SubstituteValue;
     }
     if (input.EnableSubstituteValueSpecified)
     {
         connection.dwMask |= 0x1000;
         connection.bEnableSubstituteValue = input.EnableSubstituteValue ? 1 : 0;
     }
     if (input.TargetItemName != null)
     {
         connection.dwMask          |= 0x4000;
         connection.szTargetItemName = input.TargetItemName;
     }
     if (input.TargetItemPath != null)
     {
         connection.dwMask          |= 0x2000;
         connection.szTargetItemPath = input.TargetItemPath;
     }
     if (input.SourceServerName != null)
     {
         connection.dwMask            |= 0x8000;
         connection.szSourceServerName = input.SourceServerName;
     }
     if (input.SourceItemName != null)
     {
         connection.dwMask          |= 0x20000;
         connection.szSourceItemName = input.SourceItemName;
     }
     if (input.SourceItemPath != null)
     {
         connection.dwMask          |= 0x10000;
         connection.szSourceItemPath = input.SourceItemPath;
     }
     if (input.SourceItemQueueSizeSpecified)
     {
         connection.dwMask |= 0x40000;
         connection.dwSourceItemQueueSize = input.SourceItemQueueSize;
     }
     if (input.UpdateRateSpecified)
     {
         connection.dwMask      |= 0x80000;
         connection.dwUpdateRate = input.UpdateRate;
     }
     if (input.DeadbandSpecified)
     {
         connection.dwMask     |= 0x100000;
         connection.fltDeadBand = input.Deadband;
     }
     if (input.VendorData != null)
     {
         connection.dwMask      |= 0x200000;
         connection.szVendorData = input.VendorData;
     }
     return(connection);
 }