예제 #1
0
        private void OnGetRequestData(string rawData)
        {
            var dataObj = (ExpansionValueData[])null;

            if (expansion_type == "expansion_bit")
            {
                dataObj = (AdvantechHttpWebUtility.ParserJsonToObj <ExpansionBitObject>(rawData)).ExpBit;
            }
            else
            {
                dataObj = (AdvantechHttpWebUtility.ParserJsonToObj <ExpansionWordObject>(rawData)).ExpWord;
            }
            //update data grid values
            int    length          = dataObj.Length;
            String evtString       = String.Empty;
            uint   evtWriteOnlyBit = 0;

            for (int i = 0; i < length; i++)
            {
                evtWriteOnlyBit = dataObj[i].Evt >> 7;
                dataObj[i].Evt  = dataObj[i].Evt & 0x7F;//strip bit 7
                evtString       = evtCodeString[dataObj[i].Evt];
                if (evtWriteOnlyBit == 1)
                {
                    dataGridView1.Rows[i].SetValues(new object[] { dataObj[i].Ch, "(Write Only)", evtString, dataObj[i].SID, dataObj[i].Addr, dataObj[i].MAddr });
                }
                else
                {
                    dataGridView1.Rows[i].SetValues(new object[] { dataObj[i].Ch, dataObj[i].Val, evtString, dataObj[i].SID, dataObj[i].Addr, dataObj[i].MAddr });
                }
            }
            SetTextToTextBox(txtJSON, "Response reveived.");
            SetBtnToEnabled(btnSend, true);
        }
예제 #2
0
 public Form1()
 {
     InitializeComponent();
     m_httpRequest                        = new AdvantechHttpWebUtility();
     comboBox1.SelectedIndex              = 0;
     m_httpRequest.ResquestResponded     += this.OnGetRequestData;
     m_httpRequest.ResquestOccurredError += this.OnGetErrorRequest;
 }
예제 #3
0
        public Form1()
        {
            InitializeComponent();
            m_httpRequest                        = new AdvantechHttpWebUtility();
            comboBox1.SelectedIndex              = 0;
            comboBoxUrl1.SelectedIndex           = 0;
            comboBoxUrl2.SelectedIndex           = 0;
            m_httpRequest.ResquestResponded     += this.OnGetRequestData;
            m_httpRequest.ResquestOccurredError += this.OnGetErrorRequest;

            dataGridView1.AllowUserToAddRows    = false;
            dataGridView1.AllowUserToDeleteRows = false;
            //Add default 32 channels in dataGridView
            for (int i = 0; i < MAX_CHANNEL_NUMBER; i++)
            {
                dataGridView1.Rows.Add(i, "", "", "", "", "");
            }
        }