phyphox/phyphox-android

Wrong result after trying to set invalid value to buffer via REST API

ladorum opened this issue · 1 comments

Hi,
if one tires to set (or more accurate append) a value to a buffer, which can not be parsed into a double, {"result": true} is returned. That seems to be unintended, as the content of the buffer was not modified.

https://github.com/phyphox/phyphox-android/blob/720caa56d391b316f3732c1fdf5531efea5b25ae/app/src/main/java/de/rwth_aachen/phyphox/RemoteServer.java#L770:L776

Great app; love the project.

edit: larger code excerpt

True, that is an obvious mistake and a simple fix.

There are two things I would like to explain, though:

  1. "set" was originally only meant as an interface for the "remote access" web front-end, so a value entered into an "edit" view could be sent to phyphox. That's why it is called "set" and not append. Since there is no proper "append" I often recommend "set" as a work-around, but I should probably just offer an "append", too.
  2. "set" is not a perfect substitution for append as it is very inefficient for multiple values and it does not accept "NaN", which might be a problem in some scenarios. If you need to send larger amounts of data to phyphox, out "network connections" (https://phyphox.org/wiki/index.php/Network_Connections) might be an interesting alternative. Using these, you reverse the relationship as phyphox acts as a client (using either http or mqtt at the time of writing) and can exchange entire JSON objects. It is a bit harder to set up, though, as it is used as part of our experiment configuration file format, which makes it a bit more complicated for those who implement the communication, but it also makes it easier to deploy to multiple users.