Example #1
0
        public string csvString()
        {
            string word = ID.ToString() + ',' + ChannelID.ToString() + ',' + Name.Replace(',', '-') + ',' + AlarmTypeID.ToString() + ',' + Severity.ToString() + ',' + High.ToString() + ',' + Low.ToString() + ',' + RangeInclusive.ToString() + ','
                          + PerUnit.ToString() + ',' + Enabled.ToString() + ',' + MeasurementType + ',' + MeasurementTypeID.ToString() + ',' + MeasurementCharacteristic + ',' + MeasurementCharacteristicID.ToString() + ',' +
                          Phase + ',' + PhaseID.ToString() + ',' + HarmonicGroup.ToString() + ',' + IsDefault.ToString();

            return(word);
        }
Example #2
0
        private void ChannelDialog_Load(object sender, EventArgs e)
        {
            okButton.DialogResult     = DialogResult.OK;
            cancelButton.DialogResult = DialogResult.Cancel;

            // if the channelID is greater than 0, then set the current record = to the channelID.
            // I shouldn't have to do this ... its already set in the properties. Any ideas as to why this didn't "take" the first time?
            folderBindingSource.DataSource = rssDataSet;
            folderBindingSource.DataMember = "Folder";
            folderBindingSource.ResetBindings(true);

            folderComboBox.SelectedValue = FolderID;

            if (ChannelID > 0)
            {
                // I shouldn't have to do this ... its already set in the properties. Any ideas as to why this didn't "take" the first time?
                channelBindingSource.DataSource = rssDataSet;
                channelBindingSource.DataMember = "Channel";
                channelBindingSource.Filter     = "ChannelID = " + ChannelID.ToString();
                channelBindingSource.ResetBindings(true);
            }
        }
        public void EnableChannel(ChannelID Channel)
        {
            if (Channel.ToString().Contains("Digital"))
            {
                if (Data.Analog0 != null)
                {
                    int ActualChannelID = (int)Channel - 7;
                    int Command         = CurrentDigitalStates;

                    int BitPosition = 1;
                    for (int i = 1; i < ActualChannelID; i++)
                    {
                        BitPosition *= 2;
                    }

                    Command = (byte)(Command & BitPosition);
                    if (Command < 128)
                    {
                        Write($"dout {Command}");
                    }
                }
            }
        }
        public void DisableChannel(ChannelID Channel)
        {
            if (Channel.ToString().Contains("Digital"))
            {
                if (Data.Analog0 != null)
                {
                    int ActualChannelID = (int)Channel - 7;


                    int BitPosition = 1;
                    for (int i = 1; i < ActualChannelID; i++)
                    {
                        BitPosition *= 2;
                    }

                    if (BitPosition < CurrentDigitalStates)
                    {
                        int Command = CurrentDigitalStates - BitPosition;

                        Write("dout " + Command);
                    }
                }
            }
        }
Example #5
0
 public override string ToString()
 {
     return(ChannelID.ToString().PadLeft(3, '0'));
 }
Example #6
0
        public void Connect()
        {
            var task1 = Task.Run(async() => { await Client.Channel2Async(ChannelID); });

            task1.Wait();



            string ws_url = Client.BaseUrl.Replace("http:", "ws:").Replace("https:", "wss:").TrimEnd('/') + "/ws/" + ChannelID.ToString();

            var task2 = Task.Run(async() => { await openWebSocket(new Uri(ws_url)); });

            //TODO: check if this is the reason for AB#168 (or AB#167 too...)
            task2.Wait();

            ReceiveTask = Task.Run(async() => { await Receive(webSocketClient); });
        }