Android SerialPort

Hello,
im working in android xamarin project , and i want send a string data ("WR11100_r") to serial port, so currently i can find my dvice and i can open it but i cant't send data i think i must set control Trasnfer before sending data, the config of my dvice is :
Baud rate 9600 bits per second
Data bits 8
Stop bit 1
Parity None
Flow control No
so i tried this code, but it dosent work :

        ~~~~string cmd = "WR11100/n";
                    byte[] buff = System.Text.Encoding.ASCII.GetBytes(cmd);


                    deviceConnection.ControlTransfer(0, 0, 0, 0, null, 0, 0);// reset
                    deviceConnection.ControlTransfer(0, 2, 0, 0, null, 0, 0);// flow  control none   
                    deviceConnection.ControlTransfer(UsbAddressing.Out, 3, 16696, 0, null, 0, 0);
                    deviceConnection.ControlTransfer(0, 4, 8, 0, null, 0, 0);


                    deviceConnection.BulkTransfer(usbEndpoint, buff, 0, 8, 0);

when the bulkTransfer instrucion is exectued the buff[0] = 0 and the buff[1] = 96
So i think there is a probleme in my config can someone help me plz

Sign In or Register to comment.