Ejemplo n.º 1
0
        private void Send_MSG(string MSG)
        {
            int count;

            seqno++;

            CreateRFMessages m = new CreateRFMessages();

            byte[] sendMsg = m.create_framed_packet(System.Convert.ToByte(seqno), 0x04, MSG);

            count = System.Convert.ToInt32(sendMsg[7]) + 10;      // 왜 +10 ???

            if (RS232.IsOpen)
            {
                lock (RS232)
                {
                    RS232.Write(sendMsg, 0, count);
                }
            }
            debugRFMsg(count, sendMsg);
        }
Ejemplo n.º 2
0
        private void Send_MSG(string MSG)
        {
            int count;
            seqno++;

            CreateRFMessages m = new CreateRFMessages();

            byte[] sendMsg = m.create_framed_packet(System.Convert.ToByte(seqno), 0x04, MSG);

            count = System.Convert.ToInt32(sendMsg[7]) + 10;      // 왜 +10 ???

            if (RS232.IsOpen)
            {
                lock (RS232)
                {
                    RS232.Write(sendMsg, 0, count);
                }
            }
            debugRFMsg(count, sendMsg);
        }
Ejemplo n.º 3
0
        //메세지 전송
        private void button_send_Click(object sender, EventArgs e)
        {
            if (chk_usable == false)
            {
                MessageBox.Show("경로 정보를 수신할 장비가 없습니다.");
                return;
            }

            #region 보낼 메세지 수 정하기
            if (combo_Loc1.SelectedIndex == 0)
            {
                MessageBox.Show("첫번째 경로를 지정해 주십시오.");
                return;
            }
            if (combo_Loc2.SelectedIndex == 0)
            {
                Mcount = 1;
            }
            else if (combo_Loc3.SelectedIndex == 0)
            {
                Mcount = 2;
            }
            else
            {
                Mcount = 3;
            }
            #endregion

            #region 전문생성& 경로정보 저장

            DB.Open();

            string tmp = lati_1.Text;
            string tmp2 = grad_1.Text;

            string date = DateTime.Now.ToString("yyMMdd");
            string time = DateTime.Now.ToString("T");
            if (lati_1.Text != "")
            {
                DB.Save_Navi2(tmp, tmp2, 1);
                name1 = DB.Search_Name(tmp, tmp2);
                HRR100 = "010" + Mcount + tmp.Replace(".", "") + tmp2.Replace(".", "");
                if (lati_2.Text == "")
                {
                    DB.Save_Navi(date, time, name1, name2, name3);         //경로 정보 저장
                }
            }
            if (lati_2.Text != "")
            {
                tmp = lati_2.Text;
                tmp2 = grad_2.Text;
                name2 = DB.Search_Name(tmp, tmp2);
                DB.Save_Navi2(tmp, tmp2, 2);
                HRR200 = "020" + Mcount + tmp.Replace(".", "") + tmp2.Replace(".", "");
                if (lati_3.Text == "")
                {
                    DB.Save_Navi(date, time, name1, name2, name3);         //경로 정보 저장
                }
            }
            if (lati_3.Text != "")
            {
                tmp = lati_3.Text;
                tmp2 = grad_3.Text;
                name3 = DB.Search_Name(tmp, tmp2);
                DB.Save_Navi2(tmp, tmp2, 3);
                DB.Save_Navi(date, time, name1, name2, name3);         //경로 정보 저장
                HRR300 = "030" + Mcount + tmp.Replace(".", "") + tmp2.Replace(".", "");
            }
            DB.Dispose();

            #endregion

            int i;
            for (i = 1; i <= Mcount; i++)
            {
                int count;

                switch (i)
                {
                    case 1: RFMsg = HRR100; break;
                    case 2: RFMsg = HRR200; break;
                    case 3: RFMsg = HRR300; break;
                }
                seqno++;

                CreateRFMessages m = new CreateRFMessages();

                byte[] sendMsg = m.create_framed_packet(System.Convert.ToByte(seqno), 0x04, RFMsg);

                count = System.Convert.ToInt32(sendMsg[7]) + 10;      // 왜 +10 ???

                if (RS232.IsOpen)
                {
                    lock (RS232)
                    {
                        RS232.Write(sendMsg, 0, count);
                    }
                }
                debugRFMsg(count, sendMsg);
            }

            chk_usable = false;
        }
Ejemplo n.º 4
0
        //메세지 전송
        private void button_send_Click(object sender, EventArgs e)
        {
            if (chk_usable == false)
            {
                MessageBox.Show("경로 정보를 수신할 장비가 없습니다.");
                return;
            }

            #region 보낼 메세지 수 정하기
            if (combo_Loc1.SelectedIndex == 0)
            {
                MessageBox.Show("첫번째 경로를 지정해 주십시오.");
                return;
            }
            if (combo_Loc2.SelectedIndex == 0)
            {
                Mcount = 1;
            }
            else if (combo_Loc3.SelectedIndex == 0)
            {
                Mcount = 2;
            }
            else
            {
                Mcount = 3;
            }
            #endregion

            #region 전문생성& 경로정보 저장

            DB.Open();

            string tmp  = lati_1.Text;
            string tmp2 = grad_1.Text;

            string date = DateTime.Now.ToString("yyMMdd");
            string time = DateTime.Now.ToString("T");
            if (lati_1.Text != "")
            {
                DB.Save_Navi2(tmp, tmp2, 1);
                name1  = DB.Search_Name(tmp, tmp2);
                HRR100 = "010" + Mcount + tmp.Replace(".", "") + tmp2.Replace(".", "");
                if (lati_2.Text == "")
                {
                    DB.Save_Navi(date, time, name1, name2, name3);         //경로 정보 저장
                }
            }
            if (lati_2.Text != "")
            {
                tmp   = lati_2.Text;
                tmp2  = grad_2.Text;
                name2 = DB.Search_Name(tmp, tmp2);
                DB.Save_Navi2(tmp, tmp2, 2);
                HRR200 = "020" + Mcount + tmp.Replace(".", "") + tmp2.Replace(".", "");
                if (lati_3.Text == "")
                {
                    DB.Save_Navi(date, time, name1, name2, name3);         //경로 정보 저장
                }
            }
            if (lati_3.Text != "")
            {
                tmp   = lati_3.Text;
                tmp2  = grad_3.Text;
                name3 = DB.Search_Name(tmp, tmp2);
                DB.Save_Navi2(tmp, tmp2, 3);
                DB.Save_Navi(date, time, name1, name2, name3);         //경로 정보 저장
                HRR300 = "030" + Mcount + tmp.Replace(".", "") + tmp2.Replace(".", "");
            }
            DB.Dispose();

            #endregion

            int i;
            for (i = 1; i <= Mcount; i++)
            {
                int count;

                switch (i)
                {
                case 1: RFMsg = HRR100; break;

                case 2: RFMsg = HRR200; break;

                case 3: RFMsg = HRR300; break;
                }
                seqno++;

                CreateRFMessages m = new CreateRFMessages();

                byte[] sendMsg = m.create_framed_packet(System.Convert.ToByte(seqno), 0x04, RFMsg);

                count = System.Convert.ToInt32(sendMsg[7]) + 10;      // 왜 +10 ???

                if (RS232.IsOpen)
                {
                    lock (RS232)
                    {
                        RS232.Write(sendMsg, 0, count);
                    }
                }
                debugRFMsg(count, sendMsg);
            }

            chk_usable = false;
        }