public byte ReadPort1(IController c, bool left_mode, bool update_wheel)
 {
     if (update_wheel)
     {
         wheel1 = Port1.Update_Wheel(c, wheel1);
     }
     return(Port1.Read(c, left_mode, wheel1));
 }
Example #2
0
        private void Port1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
        {
            if (e.EventType == System.IO.Ports.SerialData.Chars)
            {
                byte[] buff = new byte[Port1.ReadBufferSize];
                int    reads;
                string str = "";

                reads = Port1.Read(buff, 0, Port1.ReadBufferSize);
                //eCon.Text += buff.ToString().Trim();

                if (cbHexRead.Checked)
                {
                    str = "<" + reads.ToString() + "> ";
                    for (int i = 0; i < reads; i++)
                    {
                        str += buff[i].ToString("X2") + " ";
                    }
                    str += Environment.NewLine;
                }
                else
                {
                    for (int i = 0; i < reads; i++)
                    {
                        // check if character is convertable to ascii codes
                        if ((buff[i] > 0x1f && buff[i] < 0x80) || (buff[i] == 0x0d || buff[i] == 0x0a))
                        {
                            str += Convert.ToChar(buff[i]);
                        }
                        else
                        {
                            str += "<0x" + buff[i].ToString("X2") + ">";
                        }
                    }
                }
                AddConText(str);
            }
        }
 public byte ReadPort1(IController c)
 {
     return(Port1.Read(c));
 }
        public byte ReadPort1(IController c, bool leftMode, bool updateWheel)
        {
            wheel1 = Port1.UpdateWheel(c);

            return(Port1.Read(c, leftMode, updateWheel, temp_wheel1));
        }
Example #5
0
 public byte ReadPort1(IController c, bool left_mode)
 {
     return(Port1.Read(c, left_mode));
 }