public EventLogLoader(AsynchSerialPort AsynchSerialPort, ushort BlockCount, ushort StartDataAddr, ushort LoadEventAddr, ushort EventCount)
 {
     blockCount    = BlockCount;
     startDataAddr = StartDataAddr;
     loadEventAddr = LoadEventAddr;
     eventCount    = EventCount;
     serialPort    = AsynchSerialPort;
     loadEventLine = new ushort[blockCount * 32];
 }
Beispiel #2
0
 public LoadScopeForm(AppTexts AppTexts, AsynchSerialPort AsynchSerialPort)
 {
     InitializeComponent();
     serialPort = AsynchSerialPort;
     Texts      = AppTexts;
     Text       = AppTexts.ParameterName(39);
     setupButton.ToolTipText  = AppTexts.ParameterName(43);
     recordButton.ToolTipText = AppTexts.ParameterName(44);
 }
Beispiel #3
0
 public LoadOscDataForm(AsynchSerialPort AsynchSerialPort, string Titl, ScopeConfig ScopeConfig, int LoadOscNum, AppTexts AppTexts)
 {
     InitializeComponent();
     serialPort       = AsynchSerialPort;
     this.Text        = Titl;
     this.scopeConfig = ScopeConfig;
     loadOscNum       = LoadOscNum;
     InitLoadOscillAsynch();
     button1.Text = AppTexts.ParameterName(27);
 }
Beispiel #4
0
 public EventLogForm(AppTexts AppTexts, AsynchSerialPort AsynchSerialPort, SystemConfiguration SystemConfiguration)
 {
     InitializeComponent();
     this.Text                      = AppTexts.ParameterName(99);
     loadEventButton.Text           = AppTexts.ParameterName(100);
     openFileButton.ToolTipText     = AppTexts.ParameterName(105);
     loadSensorPanelBtn.ToolTipText = AppTexts.ParameterName(109);
     appTexts            = AppTexts;
     serialPort          = AsynchSerialPort;
     systemConfiguration = SystemConfiguration;
 }
 public DownloadSYMForm(AsynchSerialPort AsynchSerialPort, AppTexts AppTexts)
 {
     InitializeComponent();
     serialPort   = AsynchSerialPort;
     appTexts     = AppTexts;
     Text         = appTexts.ParameterName(17);
     label1.Text  = appTexts.ParameterName(54);
     label2.Text  = appTexts.ParameterName(55);
     button1.Text = appTexts.ParameterName(56);
     button2.Text = appTexts.ParameterName(57);
     button3.Text = appTexts.ParameterName(58);
 }
 public FloatDirectAccessForm(AsynchSerialPort AsynchSerialPort, List <string> Texts)
 {
     InitializeComponent();
     serialPort      = AsynchSerialPort;
     texts           = Texts;
     Text            = texts[0];
     label1.Text     = texts[1];
     label2.Text     = texts[2];
     label3.Text     = texts[3];
     readButton.Text = texts[4];
     writeBtn.Text   = texts[5];
 }
 public AngleForm(AsynchSerialPort AsynchSerialPort, AppTexts AppTexts)
 {
     //toolStripStatusLabel1.Text = "";
     InitializeComponent();
     appTexts         = AppTexts;
     serialPort       = AsynchSerialPort;
     Text             = appTexts.ParameterName(120);
     writeBtn1.Text   = appTexts.ParameterName(117);
     curLabel.Text    = appTexts.ParameterName(115);
     newLabel.Text    = appTexts.ParameterName(116);
     paramLabel1.Text = appTexts.ParameterName(121);
 }
Beispiel #8
0
        public ScopeSetupForm(ScopeConfig NewScopeConfig, AsynchSerialPort AsynchSerialPort)
        {
            InitializeComponent();
            ScopeConfig = NewScopeConfig;
            serialPort  = AsynchSerialPort;

            InitPossiblePanel();
            InitChannelCount();
            InitScopeCount();
            InitOscilFreq();
            InitHystory();
            InitCurrentParams();
        }
 public static void SendReadTimeRequest(byte SlaveAddr, AsynchSerialPort SerialPort, AsynchSerialPort.DataRecievedRTU DataRecieved, TimeConfig CurrentConfig)
 {
     if (CurrentConfig.TimeFormat == TimeFormats.STMFormat)
     {
         SerialPort.GetDataRTU(SlaveAddr, CurrentConfig.STMProcAddr1, 4, DataRecieved, RequestPriority.Normal);
     }
     else if (CurrentConfig.TimeFormat == TimeFormats.ADSPFormat)
     {
         SerialPort.GetDataRTU(SlaveAddr, CurrentConfig.ReadAddr, 7, DataRecieved, RequestPriority.Normal);
     }
     else if (CurrentConfig.TimeFormat == TimeFormats.RTCFormat)
     {
         SerialPort.GetDataRTU(SlaveAddr, CurrentConfig.ReadAddr, 4, DataRecieved, RequestPriority.Normal);
     }
 }
        public ScopeConfigLoader(AsynchSerialPort AsynchSerialPort)
        {
            serialPort  = AsynchSerialPort;
            scopeConfig = new ScopeConfig();

            if (serialPort == null)
            {
                throw new Exception("Invalid serial port!");
            }

            if (!serialPort.IsOpen)
            {
                throw new Exception("Serial port not open!");
            }

            StartLoading();
        }
        public ScopeStatusesLoader(AsynchSerialPort AsynchSerialPort, ScopeConfig ScopeConfig)
        {
            serialPort = AsynchSerialPort;

            if (serialPort == null)
            {
                throw new Exception("Invalid serial port!");
            }

            if (!serialPort.IsOpen)
            {
                throw new Exception("Serial port not open!");
            }

            scopeConfig = ScopeConfig;
            StartLoading();
        }
Beispiel #12
0
        public ScopeLoader(AsynchSerialPort AsynchSerialPort, ScopeConfig ScopeConfig, int LoadOscNum, RequestPriority RequestPriority)
        {
            serialPort      = AsynchSerialPort;
            requestPriority = RequestPriority;
            if (serialPort == null)
            {
                throw new Exception("Invalid serial port!");
            }

            if (!serialPort.IsOpen)
            {
                throw new Exception("Serial port not open!");
            }

            loadOscNum  = LoadOscNum;
            scopeConfig = ScopeConfig;
            StartLoading();
        }
 public DigitPlateForm(AsynchSerialPort AsynchSerialPort, AppTexts AppTexts, DigitPlate DigitPlate, bool EnableForce = true)
 {
     InitializeComponent();
     CreateLampLabels();
     CreateNameLabels(DigitPlate);
     if (true)
     {
         CreateCheckBoxs();
     }
     this.Text      = DigitPlate.Titl;
     startAddr      = DigitPlate.StartAddr;
     serialPort     = AsynchSerialPort;
     invert         = DigitPlate.Invert;
     label1.Text    = label3.Text = AppTexts.ParameterName(73);
     label2.Text    = label4.Text = AppTexts.ParameterName(74);
     label1.Visible = label2.Visible = label3.Visible = label4.Visible = (orCheckBoxs[0] != null);
     if (DigitPlate.DigitType == DigitType.DigOutput)
     {
         this.BackColor = Color.White;
     }
 }
        public DirectAccessForm(AsynchSerialPort AsynchSerialPort, AppTexts AppTexts)
        {
            InitializeComponent();
            appTexts            = AppTexts;
            serialPort          = AsynchSerialPort;
            Text                = appTexts.ParameterName(45);
            writeBtn.Text       = appTexts.ParameterName(9);
            readBtn.Text        = appTexts.ParameterName(8);
            addrLabel.Text      = appTexts.ParameterName(5);
            valueHexLabel.Text  = appTexts.ParameterName(46);
            i160ValueLabel.Text = appTexts.ParameterName(48);
            u160ValueLabel.Text = appTexts.ParameterName(47);

            formatComboBox.Items.Clear();

            for (int i = 0; i < (int)ConvertFormats.FormatCount; i++)
            {
                formatComboBox.Items.Add(((ConvertFormats)i).ToString());
            }

            formatComboBox.SelectedIndex = 0;
        }
        public static void SendSetTimeRequest(byte SlaveAddr, AsynchSerialPort SerialPort, TimeConfig CurrentConfig, int Hour, int Min, int Sec, int Day, int Month, int Year)
        {
            if (CurrentConfig.TimeFormat == TimeFormats.STMFormat)
            {
                ushort[] paramRTU = new ushort[4];
                paramRTU[0] = (ushort)(((Month.ToBCD() & 0x1F) << 8) | (Day.ToBCD() & 0x3F));
                paramRTU[1] = (ushort)Year.ToBCD();
                paramRTU[2] = (ushort)(((Min.ToBCD() & 0xFF) << 8) | (Sec.ToBCD() & 0xFF));
                paramRTU[3] = (ushort)(Hour.ToBCD() | 0x0100);
                SerialPort.SetDataRTU(SlaveAddr, CurrentConfig.STMProcAddr1_1, null, RequestPriority.Normal, paramRTU);
            }
            else if (CurrentConfig.TimeFormat == TimeFormats.ADSPFormat)
            {
                ushort[] paramRTU = new ushort[3];
                paramRTU[0] = Sec.ToBCD();
                paramRTU[1] = Min.ToBCD();
                paramRTU[2] = Hour.ToBCD();
                SerialPort.SetDataRTU(SlaveAddr, CurrentConfig.SetAddr, null, RequestPriority.Normal, paramRTU);

                paramRTU[0] = Day.ToBCD();
                paramRTU[1] = Month.ToBCD();
                paramRTU[2] = Year.ToBCD();
                SerialPort.SetDataRTU(SlaveAddr, (ushort)(CurrentConfig.SetAddr + 4), null, RequestPriority.Normal, paramRTU);

                SerialPort.SetDataRTU(SlaveAddr, CurrentConfig.AddrSetTime, null, RequestPriority.Normal, 1);
            }
            if (CurrentConfig.TimeFormat == TimeFormats.RTCFormat)
            {
                ushort[] paramRTU = new ushort[4];
                paramRTU[0] = (ushort)(((Month.ToBCD() & 0x1F) << 8) | (Day.ToBCD() & 0x3F));
                paramRTU[1] = (ushort)Year.ToBCD();
                paramRTU[2] = (ushort)(((Min.ToBCD() & 0x7F) << 8) | (Sec.ToBCD() & 0x7F));
                paramRTU[3] = (ushort)(Hour.ToBCD() & 0x3F);
                SerialPort.SetDataRTU(SlaveAddr, CurrentConfig.SetAddr, null, RequestPriority.Normal, paramRTU);
            }
        }
        public ComSetForm(AsynchSerialPort AsynchSerialPort, List <string> Texts)
        {
            InitializeComponent();
            serialPort = AsynchSerialPort;
            texts      = Texts;

            //foreach (string portName in SerialPort.GetPortNames())
            //{
            //    portsComboBox.Items.Add(portName.ToString());
            //}
            string[] portNames = SerialPort.GetPortNames();
            portsComboBox.Items.Clear();
            portsComboBox.Items.AddRange(portNames);

            if (portsComboBox.Items.Count != 0)
            {
                portsComboBox.SelectedIndex = 0;
                for (int i = 0; i < portsComboBox.Items.Count; i++)
                {
                    string str = portsComboBox.Items[i].ToString();
                    if (str == serialPort.PortName)
                    {
                        portsComboBox.SelectedIndex = i;
                    }
                }
            }

            for (int i = 1; i < 256; i++)
            {
                addrsComboBox.Items.Add(i.ToString());
            }
            addrsComboBox.SelectedIndex = serialPort.SlaveAddr - 1;

            speedComboBox.SelectedIndex = 0;
            for (int i = 0; i < speedComboBox.Items.Count; i++)
            {
                string str = speedComboBox.Items[i].ToString();
                if (str == serialPort.BaudRate.ToString())
                {
                    speedComboBox.SelectedIndex = i;
                }
            }

            if ((serialPort.Parity == Parity.Even) && (serialPort.StopBits == StopBits.One))
            {
                parityComboBox.SelectedIndex = 1;
            }
            else if ((serialPort.Parity == Parity.None) && (serialPort.StopBits == StopBits.Two))
            {
                parityComboBox.SelectedIndex = 2;
            }
            else
            {
                parityComboBox.SelectedIndex = 0;
            }

            ipTextBox.Text      = serialPort.IpAddress;
            portNumTextBox.Text = serialPort.PortNum.ToString();
            if (serialPort.SerialPortMode == SerialPortModes.RSMode)
            {
                radioButton2.Checked = true;
            }
            else
            {
                radioButton1.Checked = true;
            }
        }
 public VerificationForm(AsynchSerialPort asynchSerialPort)
 {
     InitializeComponent();
     _serialPort = asynchSerialPort;
     SetGrid(_status1, false);
 }