System.IO.Ports read port com3 type of data received Wiegand 26, c # read

1

Hello, you could support me with this topic I am reading through a terminal a proximity card, which tells me its documentation that its output is a wiegand 26bits format

when using the method ReadExisting () it returns a string to which I do not understand anything. unfortunately I can not put the chain because they would fire me

Looking for information on the internet I come across these rules. that are supposed to be for that format wiegand26

The first Bit, B0, is the Parity Pair of the first 12 transmitted bits (B1: 12).    - The next 8, B1: B8 are a Byte, an 8-bit Integer, which they call the Facility Code.    - The following 16: B9: B24 are two Bytes, a 16 bit Integer, which is called User Code    - The last bit, B25, is the Odd Parity of the last 12 bits transmitted (B13: 24).

private void Form1_Load(object sender, EventArgs e)
{
    this.serialPort1.Close();
    this.serialPort1.Open();
    this.serialPort1.Parity = System.IO.Ports.Parity.Mark;
}

Here I try to get the values but I do not achieve it

private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
    {

        string texto = this.serialPort1.BytesToRead.ToString();
        string texto2 = this.serialPort1.BytesToWrite.ToString();
        string texto3 = this.serialPort1.DataBits.ToString();
        string texto5 = this.serialPort1.ReadExisting();

        List<byte> tipos = new List<byte>();
        //creo una cadena en donde se guardarán todas las tramas
        foreach (char caracterc in texto5)  //la cadena o trama que creé y he recibido
        {
           // string r = this.ConvertHex(caracterc);
            byte byteCaracter = (byte)caracterc;
            tipos.Add(byteCaracter);
        }

        string result = this.ConvertHex(texto5);

        string pru = System.Text.Encoding.ASCII.GetString(tipos.ToArray());




        textBox1.Text = "";
        this.serialPort1.DiscardInBuffer();
        this.serialPort1.Close();
        textBox1.Invoke(new MethodInvoker(() => { textBox1.Text = texto5; }));
        //textBox1.Text = texto;
    }

I put the Parity in parity.mark because as I read the first bit is the parity but I really need a lot and I can not find the north, I hope and they can help me

Thank you in advance

    
asked by Niqel504 06.07.2018 в 02:55
source

0 answers