In Xamarin.Android the BluetoothSocket.InputStream and BluetoothSocket.OutputStream properties are by design automatically converted to System.IO.Stream. In case of so called interactive communication protocol, when server responds only when client talks to it, System.IO.Stream is not good because it has no method or property to get the number of available response bytes before reading the response.
Parameter | Details |
---|---|
socket | An instance of BluetoothSocket object. Socket must be opened before call this method. |
cmd | Command as a byte array to send to BT device. |
_mx | Since this method uses a hardware resource, it is better to call it from a separate worker thread. This parameter is an instance of System.Threading.Mutex object and is used to synchronize the thread with other threads optionally calling this method. |
timeOut | Wait time in milliseconds between Write and Read operations. |