Dear Developers,
I would like to ask you a suggestion on how to proceed in my work, and propose/ask a new method for AsyncStream.
I am using a bluetooth device that sends out a lot of data packets continuously.
Each data packet is composed by a StartOfFrame (a couple of bytes 'AA') and 8 bytes of binary data.
I would like to use the AsyncStreams class to read them, instead of a
Timer.
Reading the manual it seems that I can't use the InitializePrefix function, because AA is not the right number of the following bytes.
I can't use neither the Initialize method since I am not sure that the first 2 bytes corresponds to 'AA' after the bluetooth connection.
So:
FIRST: I would like to ask you if there is a way to "sync" with the 'AA' bytes placing them at the start of the message (for example, taking out some bytes in excess from the serial channel before opening and initializing the stream).
SECOND: It would be useful to have an additional "general purpose" method for initializing the class, in which you can specify:
- the presence of a SOF (start of frame)
- the string eventually corresponding to the start of frame
- the presence of an EOF (end of frame)
- the string eventually corresponding to the end of frame
- the maximum number of chars that can be readed
These second option can be found in a lot of C++ classes used to manage serial communications, for instance the DataPacket class of "AsyncPro".
thank you in advance for your opinion
theos
I would like to ask you a suggestion on how to proceed in my work, and propose/ask a new method for AsyncStream.
I am using a bluetooth device that sends out a lot of data packets continuously.
Each data packet is composed by a StartOfFrame (a couple of bytes 'AA') and 8 bytes of binary data.
I would like to use the AsyncStreams class to read them, instead of a
Timer.
Reading the manual it seems that I can't use the InitializePrefix function, because AA is not the right number of the following bytes.
I can't use neither the Initialize method since I am not sure that the first 2 bytes corresponds to 'AA' after the bluetooth connection.
So:
FIRST: I would like to ask you if there is a way to "sync" with the 'AA' bytes placing them at the start of the message (for example, taking out some bytes in excess from the serial channel before opening and initializing the stream).
SECOND: It would be useful to have an additional "general purpose" method for initializing the class, in which you can specify:
- the presence of a SOF (start of frame)
- the string eventually corresponding to the start of frame
- the presence of an EOF (end of frame)
- the string eventually corresponding to the end of frame
- the maximum number of chars that can be readed
These second option can be found in a lot of C++ classes used to manage serial communications, for instance the DataPacket class of "AsyncPro".
thank you in advance for your opinion
theos