MET-ECOM live snapshot
Joe Hebert
Posts: 2,159
in AMX Hardware
Is there a way to grab a live snapshot from a MET-ECOM via code?
Thanks.
Thanks.
0
Comments
What I did get is a path to the stream and I figured out an acceptable workaround to extract one frame from it. Here’s how if anyone is interested:
This is the path to the stream:
Open an IP connection to the Met-Ecom and in the ONLINE: handler send a GET for the stream.
In the STRING: handler -
Look for a valid header which is terminated by a CRLF CRLF and looks like this:
Look for the next CRLF CRLF which describes the first boundary and looks like this:
From that you get the length of the first frame of the stream, 11007 in this case.
Let your buffer fill until it has enough bytes to complete the image.
Close the IP connection to the Met-Ecom.
In the OFFLINE: handler -
Lop off any extra data that will most likely get in the buffer before the faucet turns off.
Then you can save the .jpg to flash for future use like as an attachment in an email or text or for whatever.
It would be easier and faster to just ask for a snapshot and get everything done in the ONLINE: and OFFLINE: handlers without having to parse through the data as it comes in and then close the IP connection manually but the method described above gets the job done so life is good.
Directions:
1) Compile and download to the master
2) Enable Diagnostics
3) Push button 1 to take a snapshot
After you push button 1:
1) The diagnostics window will show you the progress of the data retrieval.
2) When transmission is complete a live snapshot from the Met-Ecom will be stored on the master in the form of a jpg.
3) Also saved to flash will be the raw contents retrieved from the HTTP GET.
I wonder what's significant about - Tue Feb 17 01:45:00 1981. That’s the date and time that the web server of the Met-Ecom initializes to after a reboot.
Thanx... I can try this next week on site.
Thanx for the example!
Regards,
Niels