コード例 #1
0
ファイル: ModbusSensorDevice.cs プロジェクト: alljoyn/dsb
 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;
 }
コード例 #2
0
ファイル: ModbusSensorDevice.cs プロジェクト: alljoyn/dsb
        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;
            }
        }
コード例 #3
0
ファイル: ModbusSensorDevice.cs プロジェクト: alljoyn/dsb
        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;
            }
        }
コード例 #4
0
ファイル: ModbusSensorDevice.cs プロジェクト: alljoyn/dsb
 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;
     }
 }
コード例 #5
0
ファイル: ModbusSensorDevice.cs プロジェクト: alljoyn/dsb
        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;
            }
        }
コード例 #6
0
ファイル: ModbusSensorDevice.cs プロジェクト: alljoyn/dsb
        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;
            }
        }
コード例 #7
0
ファイル: ModbusSensorDevice.cs プロジェクト: alljoyn/dsb
        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;
            }
        }
コード例 #8
0
ファイル: Adapter.cs プロジェクト: alljoyn/dsb
        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);
        }