This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

sending data to a web server
#8
(02-06-2023, 08:40 PM)Jens Noritzsch Wrote: I am wondering if the thread at https://phyphox.org/forums/showthread.php?tid=1640 has solved a similar issue (sending data only once)…?

Hello,

Thank you for looking at my problem Jens. It does not answer my questions, unfortunately. If I understand correctly, the blutooth output is executed after each analysis cycle. Dominiks solution is to ensure that the buffer that is supposed to be sent by bluettoth is always empty, except when he wants it to be sent. Hence the play with the button and the flag buffer.

I am playing with the network connexion, and it is executed only at certain moments, based on the time. So Dominik solution would not work as it is.

Just to be clear, I have a program that works (maybe I should have begun with this). My solution to check for the restart cycle is to compare the time between two analysis cylcles, and if the elapsed time is larger than the arbitrary value of 0.5 s, it means that this is the first cycle after a pause (the experiment has been restarted - I am using timed run experiments). When I detect that the experiment is restarted, I just empty the buffer that is sent through the network connexion, and an empty data is sent. On the server side, I just ignore empty data. I  find this solution a bit messy, and I was wondering if the clear=true attribute in the <network><connection><send> block could help me to write a better program. When I begun to play with this attribure, I found what I believe is a bug: when the clear=true attribute is added, no data is ever sent (or rather, only empty datas are sent - see the example of my first message).

Actually, I have two questions I guess :
- is the clear=true attribute of the send block in the network connexion working properly? I have the impression that it is not, but I would like a confirmation.
- is there an easy way to detect a restart of an experiment? I am currently comparing the value of the timer between each analysis cycle, and it works, but it is not elegant.

If someone wants to play a bit, I attach to this message a program that sends a single data trough the network after 5s, and that supports a restart of the experiment. The address of the network connexion is blank and should be adapted to your server.

Thank you,

Fred

----

Ah, I did not see that Sebastian jumped in, my reply does not take in account his messages, sorry. I will read them now.

(02-07-2023, 05:34 PM)Sebastian Staacks Wrote: In any case, without knowing the exact experiment, I would recomment not to use the play/pause button for this, but use a button that triggers the submission.

thank you for your answer, Sebastian.

OK, so the clear attribute is indeed not behaving nicely, that is fine, I will wait for the next version. I was just wondering if I was missing something.

Using a button to trigger the submission, and having the network aknowledging the data are things I plan to work on, it seems very promising indeed! However, for this precise usage, I do not want to do so. Some context: I plan to use such experiments in front of an non-scientist audience that will have little knowledge of phyphox. I want to simplify as much as possible the manipulation. This is why I want to use a TimedRun experiment : the users press play, and it runs for 5s, and then it stops. If I want to do another experiment, the users press play again, and that is all. I do have an experiment that does what i need, I was just wondering whether a more elegant solution exists... From what you say, I guess that for the moment, my ugly time calculation is the only way. That is fine, it works!

Thank you again, I may come back with more questions,

Cheers,

Fred


Attached Files
.phyphox   test single envoy after 5s.phyphox (Size: 3.01 KB / Downloads: 119)
Reply


Messages In This Thread
sending data to a web server - by fbouquet - 10-31-2022, 05:03 PM
RE: sending data to a web server - by fbouquet - 11-03-2022, 04:05 PM
RE: sending data to a web server - by fbouquet - 02-06-2023, 04:51 PM
RE: sending data to a web server - by fbouquet - 02-07-2023, 06:34 PM
RE: sending data to a web server - by fbouquet - 10-17-2023, 04:40 PM
RE: sending data to a web server - by fbouquet - 10-18-2023, 01:32 PM

Forum Jump: