So i'm trying to develop a program integrating a raspberry pi with a fingerprint reader using a USB adapter.
My problem is that the fingerprint reader requires a custom data package for the handshake process.
I need to send a data array of: Header [2], Adress[4], Indentifier[1], Data Lenght[2],Command[1], control[1], checksum[0].
My code looks something like this
byte[] array = new byte[13];
byte[] start;
start = BitConverter.GetBytes(0xEF01);
var lenght = BitConverter.GetBytes(0007);
var adress = BitConverter.GetBytes(0xFFFFFFFF);
var checksum = BitConverter.GetBytes(0x0D);
array[0] = start[0];
array[1] = start[1];
array[2] = adress[0];
array[3] = adress[1];
array[4] = adress[2];
array[5] = adress[3];
array[6] = 01;
array[7] = lenght[0];
array[8] = lenght[0];
array[9] = 17;
array[10] = 0;
array[11] = checksum[0];
array[12] = checksum[0];
foreach(var bit in array)
{
DataWriterObject.WriteByte(bit);
}
await DataWriterObject.StoreAsync();
bytesRead = await DataReaderObject.LoadAsync(15).AsTask(ReadCancellationTokenSource.Token); //Wait until buffer is full
My USB adapter lights up the TX led when the StoreAsync func runs. But my program gets timed out when waiting for the repply.
Ì think that the DataWriter is sending the data not in the right order and the fingerprint sensor is not respoing right.
Is there anyway to know if i`m sending it the right way?