Writing a stream client app
Posted: Wed Nov 08, 2023 4:23 am
Hi everybody,
I am working on a stream client application for my StemLab125-14 and I would like to know the format of the packets sent by the stream server. I was given the the link https://github.com/RedPitaya/RedPitaya/ ... ng_manager which includes the sources files for the rpsa_client app. Unfortunately, I believe the C++ language used there is many versions newer than what I am familiar with, plus I use a different development environment, so it would not be easy for me to step through the code to see what it does.
On the other hand, Alan Lee wrote a streaming client in python (https://github.com/awmlee/red_pitaya_st ... ent_python), according to which, the first packet sent by the server (as soon as the client connects) is made of 52 bytes, which breaks down as follows (values in parentheses are those I receive from the board):
- 16 bytes - header (00 00 00 00 a0 a0 a0 a0 ff ff ff ff a0 a0 a0 a0)
- UInt64 - index (56)
- UInt64 - lost_rate
- UInt32 - rate (this in the Rate value set in the stream server app)
- UInt32 - buffer_size (0)
- UInt32 - Chan1_size (16)
- UInt32 - Chan2_Size (0)
- UInt32 - Resolution (65536 if Both channels are selected, otherwise 32768)
This initial packet is (according to Alan's code) followed by Chan1_size bytes with the samples from channel 1 and Chan2_size bytes with the samples from channel 2.
I thought that with this information I was good to go, however, either I don't understand Alan's python code (definitely possible) or his app refers to an older version of the stream server. The one on my board (OS version STEMlab_124-xx_OS_1.04-28_beta) seems to have an additional 88 bytes in the initial packet.
Of these the first 18 are always (ff ff ff ff 0a 0a 0a 0a ff ff ff ff 0a 0a 0a 0a 58 80), and the remaining ones are, except for 2 of them) all 00. After that I finally receive the samples from channel 1.
Can anybody help me properly decode the information in the initial packet sent from the server?
Thanks!!
I am working on a stream client application for my StemLab125-14 and I would like to know the format of the packets sent by the stream server. I was given the the link https://github.com/RedPitaya/RedPitaya/ ... ng_manager which includes the sources files for the rpsa_client app. Unfortunately, I believe the C++ language used there is many versions newer than what I am familiar with, plus I use a different development environment, so it would not be easy for me to step through the code to see what it does.
On the other hand, Alan Lee wrote a streaming client in python (https://github.com/awmlee/red_pitaya_st ... ent_python), according to which, the first packet sent by the server (as soon as the client connects) is made of 52 bytes, which breaks down as follows (values in parentheses are those I receive from the board):
- 16 bytes - header (00 00 00 00 a0 a0 a0 a0 ff ff ff ff a0 a0 a0 a0)
- UInt64 - index (56)
- UInt64 - lost_rate
- UInt32 - rate (this in the Rate value set in the stream server app)
- UInt32 - buffer_size (0)
- UInt32 - Chan1_size (16)
- UInt32 - Chan2_Size (0)
- UInt32 - Resolution (65536 if Both channels are selected, otherwise 32768)
This initial packet is (according to Alan's code) followed by Chan1_size bytes with the samples from channel 1 and Chan2_size bytes with the samples from channel 2.
I thought that with this information I was good to go, however, either I don't understand Alan's python code (definitely possible) or his app refers to an older version of the stream server. The one on my board (OS version STEMlab_124-xx_OS_1.04-28_beta) seems to have an additional 88 bytes in the initial packet.
Of these the first 18 are always (ff ff ff ff 0a 0a 0a 0a ff ff ff ff 0a 0a 0a 0a 58 80), and the remaining ones are, except for 2 of them) all 00. After that I finally receive the samples from channel 1.
Can anybody help me properly decode the information in the initial packet sent from the server?
Thanks!!