Changeset 2
- Timestamp:
- 2010-02-28 03:37:02 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified L_sPhoneUI.lua ¶
r1 r2 11 11 luup.register_handler("lug_sPhoneRequest_job_status","sPhone_job_status") 12 12 luup.register_handler("lug_sPhoneRequest_camimg","sPhone_camimg") 13 luup.register_handler("lug_sPhoneRequest_camstream","sPhone_camstream")14 13 luup.register_handler("lug_sPhoneRequest_action_js","sPhone_action_js") 15 14 … … 257 256 function lug_sPhoneRequest_sensor(lul_device,lul_description,lul_js) 258 257 local lul_Armed = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Armed",lul_device) 258 lul_Tripped = luup.variable_get("urn:micasaverde-com:serviceId:SecuritySensor1","Tripped",lul_device) 259 260 if( lul_Tripped~="1") then 261 status_tripped='green' 262 else 263 status_tripped='red' 264 end 259 265 260 266 if( lul_Armed~="1") then … … 267 273 268 274 lul_html_no_js = '<img src="/cmh/iphone_file/icons/security.gif" alt="" width="44" height="43" align="absmiddle" class="icon" />' .. lul_description .. '<br>\n' .. 275 '<a href="data_request?id=lu_variableset&DeviceNum=' .. tostring(lul_device) .. '&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Tripped&time=' .. tostring(os.clock()) .. '"><img src="/cmh/images/' .. status_tripped .. '_circle.gif" alt="" border="0"/></a> ' .. 269 276 '<a href="data_request?id=lu_variableset&DeviceNum=' .. tostring(lul_device) .. '&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Armed&Value=1&time=' .. tostring(os.clock()) .. '"><img src="/cmh/iphone_file/buttons/arm' .. status_arm .. '.gif" alt="" border="0"/></a> ' .. 270 277 '<a href="data_request?id=lu_variableset&DeviceNum=' .. tostring(lul_device) .. '&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Armed&Value=0&time=' .. tostring(os.clock()) .. '"><img src="/cmh/iphone_file/buttons/bypass' .. status_bypass .. '.gif" alt="" border="0"/></a> ' … … 273 280 local lul_html_js = '<img src="/cmh/iphone_file/icons/security.gif" alt="" width="44" height="43" align="absmiddle" class="icon" id="pic_device_' .. tostring(lul_device) .. '" />' .. lul_description .. '<br>\n' .. 274 281 '<img src="/cmh/images/spacer.gif" border="0" width="20" height="20" id="action_icon_' .. tostring(lul_device) .. '">' .. 282 '<a href="javascript:void(0);" onClick="set_device_icon(' .. tostring(lul_device) .. ',1);send_command(\'data_request?id=lu_variableset&DeviceNum=' .. tostring(lul_device) .. '&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Tripped&Value=1&time=' .. tostring(os.clock()) .. '\',' .. tostring(lul_device) .. ')"><img src="/cmh/images/' .. status_tripped .. '_circle.gif" alt="" border="0"/></a> ' .. 275 283 '<a href="javascript:void(0);" onClick="set_device_icon(' .. tostring(lul_device) .. ',1);send_command(\'data_request?id=lu_variableset&DeviceNum=' .. tostring(lul_device) .. '&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Armed&Value=1&time=' .. tostring(os.clock()) .. '\',' .. tostring(lul_device) .. ')"><img src="/cmh/iphone_file/buttons/arm' .. status_arm .. '.gif" alt="" border="0"/></a> ' .. 276 284 '<a href="javascript:void(0);" onClick="set_device_icon(' .. tostring(lul_device) .. ',1);send_command(\'data_request?id=lu_variableset&DeviceNum=' .. tostring(lul_device) .. '&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&Variable=Armed&Value=0&time=' .. tostring(os.clock()) .. '\',' .. tostring(lul_device) .. ')"><img src="/cmh/iphone_file/buttons/bypass' .. status_bypass .. '.gif" alt="" border="0"/></a> ' … … 509 517 ' <tr>' .. 510 518 ' <td></td>' .. 511 ' <td><img src="/cmh/images/set_deasupra.gif" border="0" onClick="set_device_icon(' .. tostring(lul_device) .. ',1);send_command(\'data_request?id=lr_sPhone_action_js&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&device=' .. tostring(lul_device) .. '&service=urn:micasaverde-com:serviceId:DoorLock1&action=SetPin&UserCodeName=\'+document.getElementById(\'UserCodeName_' .. tostring(lul_device) .. '\').value+\'&newPin=\'+document.getElementById(\' newPin_' .. tostring(lul_device) .. '\').value+\'&time=' .. tostring(os.clock()) .. '\',' .. tostring(lul_device) .. ')"></td>' ..519 ' <td><img src="/cmh/images/set_deasupra.gif" border="0" onClick="set_device_icon(' .. tostring(lul_device) .. ',1);send_command(\'data_request?id=lr_sPhone_action_js&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&device=' .. tostring(lul_device) .. '&service=urn:micasaverde-com:serviceId:DoorLock1&action=SetPin&UserCodeName=\'+document.getElementById(\'UserCodeName_' .. tostring(lul_device) .. '\').value+\'&newPin=\'+document.getElementById(\'UserCodeName_' .. tostring(lul_device) .. '\').value+\'&time=' .. tostring(os.clock()) .. '\',' .. tostring(lul_device) .. ')"></td>' .. 512 520 ' </tr>' .. 513 521 '</table>' .. … … 529 537 lul_js = 0; 530 538 end 531 532 local lul_streaming,lul_vtime = luup.variable_get("urn:micasaverde-com:serviceId:Camera1","DirectStreamingURL",tonumber(lul_device)) 533 539 534 540 local lul_html_no_js = '<div id="toolbar" class="toolbar"> <a href="data_request?id=lr_sPhone_room&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&time=' .. tostring(os.clock()) .. '"><img src="/cmh/iphone_file/images/backButton.gif" border="0"></a> </div>' .. 535 541 '<div align="center">View camera <br/>' .. … … 554 560 '<a href="javascript:void(0)" onClick="sp_move_camera(' .. lul_device .. ',\'ZoomOut\');"><img src="/cmh/images/buminusdeasupra.gif" border="0"></a>' .. 555 561 '<br><a href="data_request?id=lr_sPhone_camimg&device=' .. lul_device .. '&js=' .. lul_js .. '&time=' .. tostring(os.clock()) .. '&js=' .. lul_js ..'">Refresh</a> ' 556 557 if( lul_streaming~=nill and #lul_streaming>1 ) then558 lul_html_no_js = lul_html_no_js .. '<a href="data_request?id=lr_sPhone_camstream&device=' .. lul_device .. '&time=' .. tostring(os.clock()) .. '&js=' .. lul_js ..'">Stream</a>'559 end560 561 if( lul_js=='1' ) then562 return html_header .. lul_html_js .. html_footer563 else564 return html_header .. lul_html_no_js .. html_footer565 end566 567 end568 569 function lug_sPhoneRequest_camstream(lul_request,lul_parameters,lul_outputformat)570 local lul_device = lul_parameters["device"]571 local lul_js = lul_parameters["js"]572 if( lul_js==nill or tonumber(lul_js)==0 ) then573 lul_js = 0;574 end575 576 local lul_streaming,lul_vtime = luup.variable_get("urn:micasaverde-com:serviceId:Camera1","DirectStreamingURL",tonumber(lul_device))577 local lul_user,lul_vtime = luup.variable_get("urn:micasaverde-com:serviceId:Camera1","Username",tonumber(lul_device))578 local lul_pass,lul_vtime = luup.variable_get("urn:micasaverde-com:serviceId:Camera1","Password",tonumber(lul_device))579 local lul_ip = luup.devices[tonumber(lul_device)].ip580 581 local lul_html_no_js = '<div id="toolbar" class="toolbar"> <a href="data_request?id=lr_sPhone_room&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&time=' .. tostring(os.clock()) .. '"><img src="/cmh/iphone_file/images/backButton.gif" border="0"></a> </div>' ..582 '<div align="center">View camera <br/>' ..583 '<img src="http://' .. lul_user .. ':' .. lul_pass .. '@' .. lul_ip .. lul_streaming .. '"><br>' ..584 '<a href="data_request?id=lr_sPhone_action&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&device=' .. lul_device .. '&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=MoveUp"><img src="/cmh/images/buupdeasupra.gif" border="0"></a>' ..585 '<a href="data_request?id=lr_sPhone_action&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&device=' .. lul_device .. '&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=MoveDown"><img src="/cmh/images/budowndeasupra.gif" border="0"></a>' ..586 '<a href="data_request?id=lr_sPhone_action&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&device=' .. lul_device .. '&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=MoveLeft"><img src="/cmh/images/buldeasupra.gif" border="0"></a>' ..587 '<a href="data_request?id=lr_sPhone_action&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&device=' .. lul_device .. '&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=MoveRight"><img src="/cmh/images/burdeasupra.gif" border="0"></a>' ..588 '<a href="data_request?id=lr_sPhone_action&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&device=' .. lul_device .. '&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=ZoomIn"><img src="/cmh/images/buplusdeasupra.gif" border="0"></a>' ..589 '<a href="data_request?id=lr_sPhone_action&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&device=' .. lul_device .. '&service=urn:micasaverde-com:serviceId:PanTiltZoom1&action=ZoomOut"><img src="/cmh/images/buminusdeasupra.gif" border="0"></a>' ..590 '<br><a href="data_request?id=lr_sPhone_camimg&device=' .. lul_device .. '&time=' .. tostring(os.clock()) .. '&js=' .. lul_js ..'">Still Image</a> '591 592 local lul_html_js = '<div id="toolbar" class="toolbar"> <a href="data_request?id=lr_sPhone_room&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&time=' .. tostring(os.clock()) .. '"><img src="/cmh/iphone_file/images/backButton.gif" border="0"></a> </div>' ..593 '<div align="center">View camera <br/>' ..594 '<img src="data_request?id=cam_image&Device_Num=' .. lul_device .. '&room=' .. luup.devices[tonumber(lul_device)].room_num .. '&time=' .. tostring(os.clock()) .. '" id="view_' .. tostring(lul_device) .. '"><br>' ..595 '<img src="/cmh/images/spacer.gif" border="0" width="20" height="20" id="action_icon_' .. tostring(lul_device) .. '"><br>' ..596 '<a href="javascript:void(0)" onClick="sp_move_camera(' .. lul_device .. ',\'MoveUp\');"><img src="/cmh/images/buupdeasupra.gif" border="0"></a>' ..597 '<a href="javascript:void(0)" onClick="sp_move_camera(' .. lul_device .. ',\'MoveDown\');"><img src="/cmh/images/budowndeasupra.gif" border="0"></a>' ..598 '<a href="javascript:void(0)" onClick="sp_move_camera(' .. lul_device .. ',\'MoveLeft\');"><img src="/cmh/images/buldeasupra.gif" border="0"></a>' ..599 '<a href="javascript:void(0)" onClick="sp_move_camera(' .. lul_device .. ',\'MoveRight\');"><img src="/cmh/images/burdeasupra.gif" border="0"></a>' ..600 '<a href="javascript:void(0)" onClick="sp_move_camera(' .. lul_device .. ',\'ZoomIn\');"><img src="/cmh/images/buplusdeasupra.gif" border="0"></a>' ..601 '<a href="javascript:void(0)" onClick="sp_move_camera(' .. lul_device .. ',\'ZoomOut\');"><img src="/cmh/images/buminusdeasupra.gif" border="0"></a>' ..602 '<br><a href="data_request?id=lr_sPhone_camimg&device=' .. lul_device .. '&js=' .. lul_js .. '&time=' .. tostring(os.clock()) .. '&js=' .. lul_js ..'">Still Image</a> '603 562 604 563 if( lul_js=='1' ) then
Note: See TracChangeset
for help on using the changeset viewer.