Пример #1
0
        /// <summary>
        /// Recieve ip settings of ethernet switchport slave.
        /// </summary>
        /// <param name="slaveIndex">Slave index.</param>
        /// <param name="port">Slave port.</param>
        /// <param name="eoeParam">Object containing relevant ip configuration settings.</param>
        /// <param name="timeout">Timeout in us</param>
        /// <returns>True if operation was successful, false otherwise.</returns>
        public bool GetEthernetIpSettings(int slaveIndex, byte port, out eoe_param_t eoeParam, int timeout = 700000)
        {
            IntPtr outPtr      = IntPtr.Zero;
            int    workCounter = EcEoE.ecx_EOEgetIp(this.Context, (ushort)slaveIndex, port, outPtr, timeout);

            eoeParam = Marshal.PtrToStructure <eoe_param_t>(outPtr);
            return(workCounter > 0);
        }
Пример #2
0
        /// <summary>
        /// Configure ip settings of ethernet switchport slave.
        /// </summary>
        /// <param name="slaveIndex">Slave index.</param>
        /// <param name="port">Slave port.</param>
        /// <param name="eoeParam">Object containing relevant ip configuration settings.</param>
        /// <param name="timeout">Timeout in us</param>
        /// <returns>True if operation was successful, false otherwise.</returns>
        public bool SetEthernetIpSettings(int slaveIndex, byte port, eoe_param_t eoeParam, int timeout = 700000)
        {
            IntPtr inPtr = Marshal.AllocHGlobal(Marshal.SizeOf(eoeParam));

            Marshal.StructureToPtr(eoeParam, inPtr, false);

            int workCounter = EcEoE.ecx_EOEsetIp(this.Context, (ushort)slaveIndex, port, inPtr, timeout);

            return(workCounter > 0);
        }