コード例 #1
0
        protected ModbusPoll modbusPoll;   // implements device polling


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public DevModbusLogic(ICommContext commContext, ILineContext lineContext, DeviceConfig deviceConfig)
            : base(commContext, lineContext, deviceConfig)
        {
            transMode   = TransMode.RTU;
            deviceModel = null;
            modbusPoll  = null;
        }
コード例 #2
0
ファイル: DeviceLogic.cs プロジェクト: newbienewbie/scada-v6
        private Connection connection;    // the device connection


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public DeviceLogic(ICommContext commContext, ILineContext lineContext, DeviceConfig deviceConfig)
        {
            CommContext    = commContext ?? throw new ArgumentNullException(nameof(commContext));
            LineContext    = lineContext ?? throw new ArgumentNullException(nameof(lineContext));
            DeviceConfig   = deviceConfig ?? throw new ArgumentNullException(nameof(deviceConfig));
            AppDirs        = commContext.AppDirs;
            Log            = lineContext.LineConfig.LineOptions.DetailedLog ? lineContext.Log : new LogStub();
            LastRequestOK  = false;
            IsBound        = lineContext.LineConfig.IsBound && deviceConfig.IsBound;
            DeviceNum      = deviceConfig.DeviceNum;
            Title          = CommUtils.GetDeviceTitle(DeviceNum, deviceConfig.Name);
            NumAddress     = deviceConfig.NumAddress;
            StrAddress     = deviceConfig.StrAddress;
            PollingOptions = deviceConfig.PollingOptions;
            ReqRetries     = lineContext.LineConfig.LineOptions.ReqRetries;

            CanSendCommands    = false;
            ConnectionRequired = false;
            LastSessionTime    = DateTime.MinValue;
            LastCommandTime    = DateTime.MinValue;
            DeviceTags         = new DeviceTags();
            DeviceData         = new DeviceData();

            terminated = false;
            connection = null;
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public ChannelLogic(ILineContext lineContext, ChannelConfig channelConfig)
 {
     LineContext   = lineContext ?? throw new ArgumentNullException(nameof(lineContext));
     ChannelConfig = channelConfig ?? throw new ArgumentNullException(nameof(channelConfig));
     Log           = lineContext.Log;
     Title         = channelConfig.TypeName;
 }
コード例 #4
0
        private int lastInfoLength;       // the last info text length


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public DeviceLogic(ICommContext commContext, ILineContext lineContext, DeviceConfig deviceConfig)
        {
            CommContext  = commContext ?? throw new ArgumentNullException(nameof(commContext));
            LineContext  = lineContext ?? throw new ArgumentNullException(nameof(lineContext));
            DeviceConfig = deviceConfig ?? throw new ArgumentNullException(nameof(deviceConfig));
            AppDirs      = commContext.AppDirs;
            Log          = lineContext.LineConfig.LineOptions.DetailedLog ? lineContext.Log : LogStub.Instance;
            AssemblyName asmName = GetType().Assembly.GetName();

            DriverName         = ScadaUtils.RemoveFileNameSuffixes(asmName.Name) + " " + asmName.Version;
            LastRequestOK      = false;
            ReqRetries         = lineContext.LineConfig.LineOptions.ReqRetries;
            IsBound            = lineContext.LineConfig.IsBound && deviceConfig.IsBound;
            DeviceNum          = deviceConfig.DeviceNum;
            Title              = CommUtils.GetDeviceTitle(DeviceNum, deviceConfig.Name);
            NumAddress         = deviceConfig.NumAddress;
            StrAddress         = deviceConfig.StrAddress;
            PollingOptions     = deviceConfig.PollingOptions;
            CanSendCommands    = false;
            ConnectionRequired = false;
            DeviceStatus       = DeviceStatus.Undefined;
            LastSessionTime    = DateTime.MinValue;
            LastCommandTime    = DateTime.MinValue;
            DeviceTags         = new DeviceTags();
            DeviceData         = new DeviceData(deviceConfig.DeviceNum);
            DeviceStats        = new DeviceStats();

            terminated     = false;
            connection     = null;
            lastInfoLength = 0;
        }
コード例 #5
0
 public ParameterDeclaration(ILineContext context, ASTType type, string internalName, string externalName) : base(context)
 {
     Type = type;
     InternalName = internalName;
     ExternalName = externalName;
     DefaultValue = null;
     InOut = false;
     NoConstant = false;
 }
コード例 #6
0
        protected volatile bool terminated;                 // necessary to stop the thread


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public SerialChannelLogic(ILineContext lineContext, ChannelConfig channelConfig)
            : base(lineContext, channelConfig)
        {
            options     = new SerialChannelOptions(channelConfig.CustomOptions);
            requestArgs = new IncomingRequestArgs();

            serialConn = null;
            thread     = null;
            terminated = false;
        }
コード例 #7
0
        /// <summary>
        /// Creates a new communication channel.
        /// </summary>
        public override ChannelLogic CreateChannel(ILineContext lineContext, ChannelConfig channelConfig)
        {
            switch (channelConfig.TypeName)
            {
            case ChannelTypeName.Serial:
                return(new SerialChannelLogic(lineContext, channelConfig));

            default:
                return(null);
            }
        }
コード例 #8
0
ファイル: TcpClientChannel.cs プロジェクト: wuchang/scada-v6
        protected volatile bool terminated;                 // necessary to stop the thread


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public TcpClientChannel(ILineContext lineContext, ChannelConfig channelConfig)
            : base(lineContext, channelConfig)
        {
            options = new TcpClientChannelOptions(channelConfig.CustomOptions);

            indivConnList = null;
            sharedConn    = null;
            currentConn   = null;
            thread        = null;
            terminated    = false;
        }
コード例 #9
0
ファイル: DevTesterLogic.cs プロジェクト: RapidScada/scada-v6
        private readonly TextStopCondition textStopCond; // the stop condition for reading text


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public DevTesterLogic(ICommContext commContext, ILineContext lineContext, DeviceConfig deviceConfig)
            : base(commContext, lineContext, deviceConfig)
        {
            options      = new TesterOptions(deviceConfig.PollingOptions.CustomOptions);
            inBuf        = new byte[options.BufferLength];
            binStopCond  = options.BinStopCode > 0 ? new BinStopCondition(options.BinStopCode) : null;
            textStopCond = string.IsNullOrEmpty(options.StopEnding) ?
                           TextStopCondition.OneLine : new TextStopCondition(options.StopEnding);

            CanSendCommands = true;
        }
コード例 #10
0
        protected volatile bool terminated;                 // necessary to stop receiving data


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public UdpChannelLogic(ILineContext lineContext, ChannelConfig channelConfig)
            : base(lineContext, channelConfig)
        {
            options     = new UdpChannelOptions(channelConfig.CustomOptions);
            requestArgs = new IncomingRequestArgs();
            deviceLock  = new object();

            masterConn = null;
            slaveConn  = null;
            deviceDict = null;
            terminated = false;
        }
コード例 #11
0
ファイル: DevEmailLogic.cs プロジェクト: RapidScada/scada-v6
        private bool loggingFlag;                  // indicates that a ready message should be logged


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public DevEmailLogic(ICommContext commContext, ILineContext lineContext, DeviceConfig deviceConfig)
            : base(commContext, lineContext, deviceConfig)
        {
            CanSendCommands    = true;
            ConnectionRequired = false;

            config      = new EmailDeviceConfig();
            smtpClient  = new SmtpClient();
            addressBook = null;
            isReady     = false;
            loggingFlag = false;
        }
コード例 #12
0
 public ParameterDeclaration(ILineContext context, ASTType type, string name, bool sameInternalExternalName) : base(context)
 {
     Type = type;
     InternalName = name;
     if (sameInternalExternalName)
         ExternalName = name;
     else
         ExternalName = null;
     DefaultValue = null;
     InOut = false;
     NoConstant = false;
 }
コード例 #13
0
        protected volatile bool terminated;                 // necessary to stop the thread


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public TcpServerChannel(ILineContext lineContext, ChannelConfig channelConfig)
            : base(lineContext, channelConfig)
        {
            options     = new TcpServerChannelOptions(channelConfig.CustomOptions);
            requestArgs = new IncomingRequestArgs();
            inBuf       = new byte[InBufferLenght];
            connList    = new List <TcpConnection>();

            tcpListener = null;
            currentConn = null;
            deviceDict  = null;
            thread      = null;
            terminated  = false;
        }
コード例 #14
0
        private bool loggingFlag;                  // indicates that a ready message should be logged


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public DevHttpNotifLogic(ICommContext commContext, ILineContext lineContext, DeviceConfig deviceConfig)
            : base(commContext, lineContext, deviceConfig)
        {
            CanSendCommands    = true;
            ConnectionRequired = false;

            stopwatch    = new Stopwatch();
            config       = new NotifDeviceConfig();
            addressBook  = null;
            paramUri     = null;
            paramContent = null;
            httpClient   = null;
            isReady      = false;
            loggingFlag  = false;
        }
コード例 #15
0
        private Dictionary <string, CommandConfig> cmdByCode;  // the commands accessed by code


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public DevOpcUaLogic(ICommContext commContext, ILineContext lineContext, DeviceConfig deviceConfig)
            : base(commContext, lineContext, deviceConfig)
        {
            opcLock          = new object();
            opcDeviceConfig  = null;
            connected        = false;
            connAttemptDT    = DateTime.MinValue;
            opcSession       = null;
            reconnectHandler = null;
            subscrByID       = null;
            cmdByNum         = null;
            cmdByCode        = null;

            CanSendCommands    = true;
            ConnectionRequired = false;
        }
コード例 #16
0
        /// <summary>
        /// Creates a new communication channel.
        /// </summary>
        public override ChannelLogic CreateChannel(ILineContext lineContext, ChannelConfig channelConfig)
        {
            switch (channelConfig.TypeCode)
            {
            case ChannelTypeCode.SerialPort:
                return(new SerialPortChannelLogic(lineContext, channelConfig));

            case ChannelTypeCode.TcpClient:
                return(new TcpClientChannelLogic(lineContext, channelConfig));

            case ChannelTypeCode.TcpServer:
                return(new TcpServerChannelLogic(lineContext, channelConfig));

            case ChannelTypeCode.Udp:
                return(new UdpChannelLogic(lineContext, channelConfig));

            default:
                return(null);
            }
        }
コード例 #17
0
 public HexaLiteral(ILineContext context, string value) : base(context, value)
 {
 }
コード例 #18
0
ファイル: DriverLogic.cs プロジェクト: jdsxhz/scada-v6
 /// <summary>
 /// Creates a new device.
 /// </summary>
 public virtual DeviceLogic CreateDevice(ILineContext lineContext, DeviceConfig deviceConfig)
 {
     return(null);
 }
コード例 #19
0
 public TupleElement(ILineContext context, ASTType type, string name) : base(context)
 {
     Type = type;
     Name = name;
 }
コード例 #20
0
 public BitwiseNotExp(ILineContext context, Exp e1, Exp e2) : base(context, e1, e2)
 {
 }
コード例 #21
0
 public StringElement(ILineContext context, string quotedTextItem) : base(context)
 {
     ElementType = Global.ElementTypes.quotedTextItem;
     QuotedTextItem = quotedTextItem;
 }
コード例 #22
0
 public OctalLiteral(ILineContext context, string value) : base(context, value)
 {
 }
コード例 #23
0
ファイル: OrExp.cs プロジェクト: jverbraeken/Swift-Compiler
 public OrExp(ILineContext context, Exp e1, Exp e2) : base(context, e1, e2)
 {
 }
コード例 #24
0
ファイル: Literal.cs プロジェクト: jverbraeken/Swift-Compiler
 public Literal(ILineContext context, string value) : base(context)
 {
     Value = value;
 }
コード例 #25
0
 public FunctionCallExp(ILineContext context) : base(context)
 {
     Args = new List<ParameterCall>();
 }
コード例 #26
0
 public BinaryLiteral(ILineContext context, string value) : base(context, value)
 {
 }
コード例 #27
0
ファイル: Literal.cs プロジェクト: jverbraeken/Swift-Compiler
 public Literal(ILineContext context) : base(context)
 {
 }
コード例 #28
0
 public IncompatibleTypesException(ILineContext context, string message = "the types of the left-hand and right-hand side of the assignment don't match") : base(context, message) { }
コード例 #29
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public DevSimulatorLogic(ICommContext commContext, ILineContext lineContext, DeviceConfig deviceConfig)
     : base(commContext, lineContext, deviceConfig)
 {
     CanSendCommands = true;
 }
コード例 #30
0
 public ConstantReassignmentException(ILineContext context, string message = "the value of constants cannot be changed") : base(context, message) { }
コード例 #31
0
 public StringLiteral(ILineContext context) : base(context)
 {
     Elements = new List<IStringElement>();
 }
コード例 #32
0
 /// <summary>
 /// Creates a new device.
 /// </summary>
 public override DeviceLogic CreateDevice(ILineContext lineContext, DeviceConfig deviceConfig)
 {
     return(new DevOpcUaLogic(CommContext, lineContext, deviceConfig));
 }
コード例 #33
0
 public TupleElement(ILineContext context, ASTType type) : base(context)
 {
     Type = type;
     Name = null;
 }
コード例 #34
0
 public ExclamationExp(ILineContext context, Exp e1, Exp e2) : base(context, e1, e2)
 {
 }
コード例 #35
0
ファイル: DriverLogic.cs プロジェクト: jdsxhz/scada-v6
 /// <summary>
 /// Creates a new communication channel.
 /// </summary>
 public virtual ChannelLogic CreateChannel(ILineContext lineContext, ChannelConfig channelConfig)
 {
     return(null);
 }
コード例 #36
0
 public MultiplicationExp(ILineContext context, Exp e1, Exp e2) : base(context, e1, e2)
 {
 }
コード例 #37
0
 public UInt16Literal(ILineContext context, string value) : base(context, value)
 {
 }
コード例 #38
0
 public FloatLiteral(ILineContext context, string value) : base(context, value)
 {
 }
コード例 #39
0
 public Int32Literal(ILineContext context, string value) : base(context, value)
 {
 }
コード例 #40
0
 public DivisionExp(ILineContext context, Exp e1, Exp e2) : base(context, e1, e2)
 {
 }
コード例 #41
0
 public VarDeclaration(ILineContext context) : base(context)
 {
 }
コード例 #42
0
 public StringElement(ILineContext context, Exp expression) : base(context)
 {
     ElementType = Global.ElementTypes.interpolation;
     Expression = expression;
 }
コード例 #43
0
 /// <summary>
 /// Creates a new communication channel.
 /// </summary>
 public override ChannelLogic CreateChannel(ILineContext lineContext, ChannelConfig channelConfig)
 {
     return(channelConfig.TypeCode == "MqttClient"
         ? new MqttClientChannelLogic(lineContext, channelConfig)
         : null);
 }
コード例 #44
0
 public ConstDeclaration(ILineContext context, Exp RHS) : base(context)
 {
     this.RHS = RHS;
 }
コード例 #45
0
 public AssignmentUnknownVariable(ILineContext context, string message = "assignment to unknown variable") : base(context, message) { }
コード例 #46
0
 public StringElement(ILineContext context, Global.EscapedCharacter escapedCharacter) : base(context)
 {
     ElementType = Global.ElementTypes.escapedCharacter;
     EscapedCharacter = escapedCharacter;
 }
コード例 #47
0
 public OverflowSubExp(ILineContext context, Exp e1, Exp e2) : base(context, e1, e2)
 {
 }
コード例 #48
0
 public ModuloExp(ILineContext context, Exp e1, Exp e2) : base(context, e1, e2)
 {
 }
コード例 #49
0
 public BitwiseRightShiftExp(ILineContext context, Exp e1, Exp e2) : base(context, e1, e2)
 {
 }
コード例 #50
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public DevSimulatorLogic(ICommContext commContext, ILineContext lineContext, DeviceConfig deviceConfig)
     : base(commContext, lineContext, deviceConfig)
 {
     CanSendCommands    = true;
     ConnectionRequired = false;
 }