/* * Copyright (C) 2008 Manish Pandya, [manish at meetamanish dot com] * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * */ package org.hooliguns.ninja.telnet.phiPiMod; import org.hooliguns.ninja.telnet.ValueOutOfRangeException; /** * Wait for all motion to cease, then pause for tenths of a second. * Pauses can range from 0 to 6553.5 seconds. P100, for example, pauses for ten * seconds. * * @author Manish Pandya (July 1 2008) * */ public class Pause extends CommandIntParam { /** * 65535 (6553.5 seconds) */ public static final int PAUSE_MAX = 65535; /** * 0 (no pause) */ public static final int PAUSE_MIN = 0; /** * Creates a Pause command with desired interval (in one tenth of a second) * * @param interval * desired interval (in one tenth of a second) * @throws ValueOutOfRangeException * when desired interval is out of range */ public Pause(int interval) throws ValueOutOfRangeException { if (interval < PAUSE_MIN || interval > PAUSE_MAX) { throw new ValueOutOfRangeException( "Y (altitude) must fall within the range of " + PAUSE_MIN + " (far down) to " + PAUSE_MAX + " (far up) as per PhiPi firmware; You requested " + interval); } command = "p"; this.paramVal = interval; } /* * (non-Javadoc) * * @see org.hooliguns.ninja.telnet.Command#getHumanName() */ public String getHumanName() { return "Pause command"; } }