| /******************************************************************************* |
| * Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Pierre Allard, |
| * Regent L'Archeveque - initial API and implementation |
| * |
| * SPDX-License-Identifier: EPL-1.0 |
| *******************************************************************************/ |
| package org.eclipse.apogy.examples.camera.impl; |
| |
| import org.slf4j.Logger; |
| import org.slf4j.LoggerFactory; |
| |
| public class PTUCameraStubCustomImpl extends PTUCameraStubImpl { |
| |
| private static final Logger Logger = LoggerFactory.getLogger(PTUCameraStubImpl.class); |
| |
| // FIXME Should be centralized. |
| /** |
| * This is the degree symbol, as expressed in unicode |
| */ |
| private static final String DEGREE_SYM = "\u00b0"; |
| |
| @Override |
| public boolean init() { |
| // As this is a stub, just indicate that the PTU camera would have been |
| // initialized. |
| Logger.info("Just a stub - " + "the necessary initialization for the PTU " + "camera would have taken place."); |
| |
| // Just indicate the operation would have succeeded |
| return true; |
| } |
| |
| @Override |
| public double getMaximumPanAngle() { |
| // As this is a stub, just indicate that the largest-allowed pan |
| // angle (in radians) for the camera would have been returned. |
| Logger.info("Just a stub - " + "the largest allowed pan angle would have been returned."); |
| |
| // Just return the current pan angle |
| return this.getCurrentPanAngle(); |
| } |
| |
| @Override |
| public double getMinimumPanAngle() { |
| // Generate the message and log it |
| // As this is a stub, just indicate that the smallest-allowed pan |
| // angle (in radians) for the camera would have been returned. |
| Logger.info(".getMinimumPanAngle(): Just a stub - " |
| + "the smallest allowed pan angle would have been returned."); |
| |
| // Just return the current pan angle |
| return this.getCurrentPanAngle(); |
| } |
| |
| @Override |
| public double getMaximumTiltAngle() { |
| // As this is a stub, just indicate that the largest-allowed tilt |
| // angle (in radians) for the camera would have been returned. |
| Logger.info("Just a stub - " + "the largest allowed tilt angle would have been returned."); |
| |
| // Just return the current tilt angle |
| return this.getCurrentTiltAngle(); |
| } |
| |
| @Override |
| public double getMinimumTiltAngle() { |
| // As this is a stub, just indicate that the smallest-allowed tilt |
| // angle (in radians) for the camera would have been returned. |
| Logger.info("Just a stub - " + "the smallest allowed tilt angle would have been returned."); |
| |
| // Just return the current tilt angle |
| return this.getCurrentTiltAngle(); |
| } |
| |
| @Override |
| public boolean moveToPanTilt(double panAngle, double tiltAngle) { |
| // As this is a stub, just indicate that the camera's PTU would |
| // have moved to the specified pan and tilt angles. |
| Logger.info("moveToPanTilt(" + Math.toDegrees(panAngle) + DEGREE_SYM + ", " + Math.toDegrees(tiltAngle) |
| + DEGREE_SYM + "): Just a stub - " + "the camera's PTU would have moved " |
| + "to the specified pan and tilt angles."); |
| |
| // Just return true |
| return true; |
| } |
| |
| @Override |
| public boolean moveToPan(double panAngle) { |
| // As this is a stub, just indicate that the camera's PTU would |
| // have moved to the specified pan angle. |
| Logger.info("moveToPan(" + Math.toDegrees(panAngle) + DEGREE_SYM + "): Just a stub - " |
| + "the camera's PTU would have moved to the specified pan angle."); |
| |
| // Just return true |
| return true; |
| } |
| |
| @Override |
| public boolean moveToTilt(double tiltAngle) { |
| // As this is a stub, just indicate that the camera's PTU would |
| // have moved to the specified tilt angle. |
| Logger.info("moveToTilt(" + Math.toDegrees(tiltAngle) + DEGREE_SYM + "): Just a stub - " |
| + "the camera's PTU would have moved to the specified tilt angle."); |
| |
| // Just return true |
| return true; |
| } |
| |
| @Override |
| public boolean moveByPanTilt(double panAngleDelta, double tiltAngleDelta) { |
| // As this is a stub, just indicate that the pan and tilt angles |
| // of the camera's PTU would have moved by the specified amounts. |
| Logger.info("moveByPanTilt(" + Math.toDegrees(panAngleDelta) + DEGREE_SYM + ", " |
| + Math.toDegrees(tiltAngleDelta) + DEGREE_SYM + "): Just a stub - " |
| + "the pan and tilt angles of the camera's PTU" + "would have moved by the specified amounts."); |
| |
| // Just return true |
| return true; |
| } |
| |
| @Override |
| public boolean moveByPan(double panAngleDelta) { |
| // As this a stub, just indicate that the pan angle of the camera's |
| // PTU would have moved by the specified amount. |
| Logger.info("moveByPan(" + Math.toDegrees(panAngleDelta) + DEGREE_SYM |
| + "): Just a stub - the pan angle of the camera's " + "PTU would have moved by the specified amount."); |
| |
| // Just return true |
| return true; |
| } |
| |
| @Override |
| public boolean moveByTilt(double tiltAngleDelta) { |
| // As this a stub, just indicate that the tilt angle of the camera's |
| // PTU would have moved by the specified amount. |
| Logger.info("moveByTilt(" + Math.toDegrees(tiltAngleDelta) + DEGREE_SYM |
| + "): Just a stub - the tilt angle of the camera's " + "PTU would have moved by the specified amount."); |
| |
| // Just return true |
| return true; |
| } |
| |
| @Override |
| public boolean stopMotion() { |
| // As this is a stub, just indicate that the camera's PTU |
| // would have stopped moving, if it had, in fact, been moving. |
| Logger.info("stopMotion(): Just a stub - " + "had the camera's PTU been moving, " |
| + "it have stopped doing so, regardless of " + "whether or not the desired move was completed."); |
| |
| // Just return true |
| return true; |
| } |
| |
| } // PTUCameraStubImpl |