// Copyright (c) 2006 Industrial Video & Control Co. LLC. All rights reserved. // request relay server commands function requestPointClick(feedId, width, height, pointX, pointY) { requestCommand(createPointClickCommand(feedId, width, height, pointX, pointY)); } function requestPanLeft(feedId, dist, unit) { requestCommand(createPanLeftCommand(feedId, dist, unit)); } function requestPanRight(feedId, dist, unit) { requestCommand(createPanRightCommand(feedId, dist, unit)); } function requestTiltUp(feedId, dist, unit) { requestCommand(createTiltUpCommand(feedId, dist, unit)); } function requestTiltDown(feedId, dist, unit) { requestCommand(createTiltDownCommand(feedId, dist, unit)); } function requestZoom(feedId, zoomLevel) { requestCommand(createZoomCommand(feedId, zoomLevel)); } function requestFocus(feedId, focusValue) { requestCommand(createFocusCommand(feedId, focusValue)); } function requestIris(feedId, irisValue) { requestCommand(createIrisCommand(feedId, irisValue)); } function requestPreset(feedId, presetNum) { requestCommand(createPresetCommand(feedId, presetNum)); } function requestPanPreset(feedId, panoramaNum, width, height, posX, posY) { requestCommand(createPanPresetCommand(feedId, panoramaNum, width, height, posX, posY)); } function requestCommand(command) { var oXmlHttp = createRequest(); if (oXmlHttp != null) { oXmlHttp.open("get", command, true); oXmlHttp.setRequestHeader("Cache-Control", "no-cache"); oXmlHttp.setRequestHeader("If-Modified-Since", "Thur, 1 Jan 1970 00:00:00 GMT"); oXmlHttp.send(null); } } function createPointClickCommand(feedId, width, height, pointX, pointY) { return ("/control/" + feedId + "/cmd=point&iheight=" + height + "&iwidth=" + width + "?" + pointX + "," + pointY); } function createPanLeftCommand(feedId, dist, unit) { return createDirectionalControlCommand(feedId, dist, unit, "l"); } function createPanRightCommand(feedId, dist, unit) { return createDirectionalControlCommand(feedId, dist, unit, "r"); } function createTiltUpCommand(feedId, dist, unit) { return createDirectionalControlCommand(feedId, dist, unit, "u"); } function createTiltDownCommand(feedId, dist, unit) { return createDirectionalControlCommand(feedId, dist, unit, "d"); } function createPresetCommand(feedId, presetNum) { return ("/control/" + feedId + "/cmd=dir&dir=p&presetnumber=" + presetNum); } function createZoomCommand(feedId, zoomLevel) { return createDirectionalControlCommand(feedId, zoomLevel, "", "z"); } function createFocusCommand(feedId, focusValue) { return ("/control/" + feedId + "/cmd=video&function=focus&focusvalue=" + focusValue); } function createIrisCommand(feedId, irisValue) { return ("/control/" + feedId + "/cmd=video&function=iris&irisValue=" + irisValue); } function createPanPresetCommand(feedId, panoramaNum, width, height, posX, posY) { return ("/control/" + feedId + "/cmd=pan&panpresetnumber=" + panoramaNum + "&iheight=" + height + "&iwidth=" + width + "?" + posX + "," + posY); } function createDirectionalControlCommand(feedId, dist, unit, dir) { var command = "/control/" + feedId + "/cmd=dir&dir=" + dir + "&dist=" + dist; if (unit.length > 0) command += "&unit=" + unit; return command; }