Need help: Feedback from GET-request

Forum to ask for any help
Post Reply
rostislav
Posts: 2
Joined: Wed Jan 24, 2018 4:22 pm

Need help: Feedback from GET-request

Post by rostislav » Mon Apr 23, 2018 1:06 am

I have various IoT devices that are controlled by GET requests and give feedback. But I have a problem getting this feedback in Demopad.
For example, the temperature request from the temperature sensor is performed as follows:

Code: Select all

GET /sensors/ HTTP/1.1\x0D\x0A
Feedback is:

HTTP/1.1 200 OK#CR#LF
Content-Length: 31 #CR#LF
Server: lwIP/1.4.0#CR#LF
Content-type: text/html#CR#LF
Connection: close #CR#LF
Expires: Fri, 10 Apr 2008 14:00:00 GMT#CR#LF
Pragma: no-cache#CR#LF#CR#LF
hostname:RS-21-PRO-1;dsw1:25.2;

I have a problem - I can not get the necessary data from the Feedback (25.2) in Demopad, since they are not in 1st line.
Use "Feedback matches specific data" is impossible, because the feedback is always different (date, time, temperature change).
If I use "Feedback matches a pattern", it reads from the first line. So the sample (.*) displays only "HTTP/1.1 200 OK".
Tell me, please, is there any opportunity to get the right information in feedback?

I also found one bug.
If I send quickly two GET-requests using the pattern

Code: Select all

dsw1:(.*);
and assigning the feedback to the same label (if these requests are sent to different devices of the same type that use the same Feedback pattern), then after the second request, I get the data in feedback (25.2), but from the first request.
So, if the first request is the temperature of the 1st sensor, and the second request is the temperature of the 2nd sensor, the temperature of the first sensor will be assigned to the label after the execution of the second request!

Sorry for my bad English))

cv27
Posts: 228
Joined: Sat Nov 24, 2012 10:15 pm
Location: Montréal, QC, Canada

Re: Need help: Feedback from GET-request

Post by cv27 » Mon Apr 23, 2018 6:10 pm

I suspect your 2-way feedback specifies the default \0D response terminator. The last line you're interested in ends with a ';' and no CrLf as with the other lines, so DemoPad won't tackle that last line until a \0D si detected.

If you only need to react to lines that end with ';' then change the response terminator to ';'.

If you need to also react to lines that end with CrLf, the only suggestion I have to offer, and not tested, would be to define another duplicate device with a response terminator of ';' but you need to ensure in all cases that semicolons won't appear elsewhere in the stream.

I faced the same issue but I was lucky enough to have the sender pad the buffer with something more standard like \0D.

rostislav
Posts: 2
Joined: Wed Jan 24, 2018 4:22 pm

Re: Need help: Feedback from GET-request

Post by rostislav » Tue Apr 24, 2018 4:30 pm

Thank you very much!
I received the necessary information in feedback! I changed the response terminator to ';'

Post Reply