Example #1
0
 internal ModbusSensorAttribute(ModbusSensorAttribute Other)
 {
     this.m_device    = Other.m_device;
     this.Value       = Other.Value;
     this.Annotations = Other.Annotations;
     this.Access      = Other.Access;
     this.COVBehavior = Other.COVBehavior;
 }
Example #2
0
        internal ModbusSensorProperty(ModbusSensorProperty Other)
        {
            this.m_device      = Other.m_device;
            this.Name          = Other.Name;
            this.InterfaceHint = Other.InterfaceHint;

            try
            {
                this.Attributes = new List <IAdapterAttribute>(Other.Attributes);
            }
            catch (OutOfMemoryException ex)
            {
                throw;
            }
        }
Example #3
0
        internal ModbusSensorProperty(ModbusSensorDevice ParentDevice, string ObjectName, string IfHint)
        {
            this.m_device      = ParentDevice;
            this.Name          = ObjectName;
            this.InterfaceHint = IfHint;

            try
            {
                this.Attributes = new List <IAdapterAttribute>();
            }
            catch (OutOfMemoryException ex)
            {
                throw;
            }
        }
Example #4
0
 internal ModbusSensorAttribute(ModbusSensorDevice ParentDevice, string ObjectName, object DefaultData, E_ACCESS_TYPE access = E_ACCESS_TYPE.ACCESS_READ)
 {
     try
     {
         this.m_device    = ParentDevice;
         this.Value       = new AdapterValue(ObjectName, DefaultData);
         this.Annotations = new Dictionary <string, string>();
         this.Access      = access;
         this.COVBehavior = SignalBehavior.Never;
     }
     catch (OutOfMemoryException ex)
     {
         throw;
     }
 }
Example #5
0
        internal ModbusSensorMethod(ModbusSensorMethod Other)
        {
            this.m_device    = Other.m_device;
            this.Name        = Other.Name;
            this.Description = Other.Description;
            this.HResult     = Other.HResult;

            try
            {
                this.InputParams  = new List <IAdapterValue>(Other.InputParams);
                this.OutputParams = new List <IAdapterValue>(Other.OutputParams);
            }
            catch (OutOfMemoryException ex)
            {
                throw;
            }
        }
Example #6
0
        internal ModbusSensorDevice(ModbusSensorDevice Other)
        {
            this.Gateway         = Other.Gateway;
            this.Name            = Other.Name;
            this.Vendor          = Other.Vendor;
            this.Model           = Other.Model;
            this.Version         = Other.Version;
            this.FirmwareVersion = Other.FirmwareVersion;
            this.SerialNumber    = Other.SerialNumber;
            this.Description     = Other.Description;
            this.AttributeMap    = Other.AttributeMap;

            try
            {
                this.Properties = new List <IAdapterProperty>(Other.Properties);
                this.Methods    = new List <IAdapterMethod>(Other.Methods);
                this.Signals    = new List <IAdapterSignal>(Other.Signals);
            }
            catch (OutOfMemoryException ex)
            {
                throw;
            }
        }
Example #7
0
        internal ModbusSensorMethod(
            ModbusSensorDevice ParentDevice,
            string ObjectName,
            string Description,
            string targetAttributeName,
            int ReturnValue)
        {
            this.m_device        = ParentDevice;
            this.Name            = ObjectName;
            this.Description     = Description;
            this.m_attributeName = targetAttributeName;
            this.HResult         = ReturnValue;

            try
            {
                this.InputParams  = new List <IAdapterValue>();
                this.OutputParams = new List <IAdapterValue>();
            }
            catch (OutOfMemoryException ex)
            {
                throw;
            }
        }
Example #8
0
        public uint Initialize()
        {
            uint status;

            //Initialize a Modbus Gateway
            m_gateway.InitializeAsync().Wait();

            if (m_gateway.isConnected)
            {
                //Initialize a Modbus Sensor Device
                ModbusSensorDevice newDevice = new ModbusSensorDevice(m_gateway, "Modbus Sensor", this.Vendor, "T/H/CO2 Sensor", this.Version, "150515-0057", "Modbus T/H/CO2 Sensor");
                status = newDevice.Initialize();

                if (status == ERROR_SUCCESS)
                {
                    devices.Add(newDevice);
                }
                return(ERROR_SUCCESS);
            }

            // Initialization Failed
            return(ERROR_MODBUS_INI_FAILED);
        }