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 that you accept these cookies being set.

Epiphan recording
#1
Hi, 

I have a customer that want to start and stop recording from a http request, and even feedback. 

Got these url from the manager,
Code:
Start recording   http://192.168.0.5/admin/channel1/set_params.cgi?publish_enabled=on



Stop recording;  http://192.168.0.5/admin/channel1/set_params.cgi?publish_enabled=off





Feedback that shows if it on or off :    http://192.168.0.5/admin/channel1/get_params.cgi?publish_enabled=on 


I want to have a button that turn on/off the recording and a feedback object. 

Code:
require('socket.http')
socket.http.TIMEOUT = 15
value = event.getvalue()
if value == false then
   socket.http.request('http://192.168.0.5/admin/channel1/set_params.cgi?publish_enabled=off')
else value == true then
   socket.http.request('http://192.168.0.5/admin/channel1/set_params.cgi?publish_enabled=on')
end


Is is the right way to do it? 

How can i get feedback to a 1bit object that shows 1 or 0?
Reply
#2
Event script can be simplified a bit:
Code:
http = require('socket.http')

value = event.getvalue()
param = value and 'on' or 'off'

http.TIMEOUT = 15
http.request('http://192.168.0.5/admin/channel1/set_params.cgi?publish_enabled=' .. param)

You will need a resident script for polling the status (with non-zero sleep time):
Code:
http = require('socket.http')
http.TIMEOUT = 15
res = http.request('http://192.168.0.5/admin/channel1/get_params.cgi')
log(res)

Post what you get in LM Logs tabs when running this script.
Reply


Forum Jump: