function RelayServerCommandActionClass() { this.feedNumber = 1; this.canPTZConcurrently = true; this.repetitionAllowance = 3; this.repetition = 0; this.isPanTilting = false; this.zooming = 0; this.focusing = 0; this.setTarget = function(feedNumber,canPTZConcurrently) { this.feedNumber = feedNumber; this.canPTZConcurrently = canPTZConcurrently; } this.gotoPreset = function(p) { //alert("gotoPreset(" + p + ")"); requestPreset(this.feedNumber, p); this.repetition = 0; this.isPanTilting = false; this.zooming = 0; this.focusing = 0; } this.startPanTilt = function(x,y) { //alert("startPanTilt(" + x + "," + y + ")"); requestContinuousMoveCommand(this.feedNumber, "xy", x + "," + y); this.repetition = 0; this.isPanTilting = true; if (!this.canPTZConcurrently) { this.zooming = 0; this.focusing = 0; } } this.stopPanTilt = function() { if (this.isPanTilting) { this.repetition = 0; } else { ++ this.repetition; } if (this.repetition <= this.repetitionAllowance) { requestContinuousMoveCommand(this.feedNumber, "xy", 0 + "," + 0); this.isPanTilting = false; if (!this.canPTZConcurrently) { this.zooming = 0; this.focusing = 0; } } } this.startZoomIn = function(z) { if(this.zooming != z) { this.repetition = 0; } else { ++ this.repetition; } if (this.repetition <= this.repetitionAllowance) { requestContinuousMoveCommand(this.feedNumber, "z", eval("-" + z)); this.zooming = -z; if (!this.canPTZConcurrently) { this.isPanTilting = false; this.focusing = 0; } } } this.startZoomOut = function(z) { if(this.zooming != z) { this.repetition = 0; } else { ++ this.repetition; } if (this.repetition <= this.repetitionAllowance) { requestContinuousMoveCommand(this.feedNumber, "z", z); this.zooming = z; if (!this.canPTZConcurrently) { this.isPanTilting = false; this.focusing = 0; } } } this.stopZoom = function() { if(0 != this.zooming) { this.repetition = 0; } else { ++ this.repetition; } if (this.repetition <= this.repetitionAllowance) { requestContinuousMoveCommand(this.feedNumber, "z", 0); this.zooming = 0; if (!this.canPTZConcurrently) { this.isPanTilting = false; this.focusing = 0; } } } this.startZoom = function(z) { if (0 > z) { this.startZoomIn(Math.abs(z)); } else if (0 < z) { this.startZoomOut(z); } else { this.stopZoom(); } } this.autoFocus = function() { requestFocus(this.feedNumber, 0); this.repetition = 0; this.focusing = 0; if (!this.canPTZConcurrently) { this.isPanTilting = false; this.zooming = 0; } } this.startFocusNear = function(f) { if(this.focusing != f) { this.repetition = 0; } else { ++ this.repetition; } if (this.repetition <= this.repetitionAllowance) { requestContinuousMoveCommand(this.feedNumber, "f", eval("-" + f)); this.focusing = -f; if (!this.canPTZConcurrently) { this.isPanTilting = false; this.zooming = 0; } } } this.startFocusFar = function(f) { if(this.focusing != f) { this.repetition = 0; } else { ++ this.repetition; } if (this.repetition <= this.repetitionAllowance) { requestContinuousMoveCommand(this.feedNumber, "f", f); this.isFocusing = f; if (!this.canPTZConcurrently) { this.isPanTilting = false; this.zooming = 0; } } } this.stopFocus = function() { if(0 != this.focusing) { this.repetition = 0; } else { ++ this.repetition; } if (this.repetition <= this.repetitionAllowance) { requestContinuousMoveCommand(this.feedNumber, "f", 0); this.focusing = 0; if (!this.canPTZConcurrently) { this.isPanTilting = false; this.zooming = 0; } } } this.startFocus = function(f) { if (0 > f) { this.startFocusNear(Math.abs(f)); } else if (0 < f) { this.startFocusFar(f); } else { this.stopFocus(); } } }