Forum Xamarin.Android


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Android SerialPort

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


  • delfinomoralesdelfinomorales Member ✭✭

    @YessineMAMA Saludos amigo, crees que me puedas orientar, necesito enviar datos a la pc, he buscado informacion pero no logro decifrar como hacer esto.

Sign In or Register to comment.