| package org.eclipse.apogy.addons.sensors.gps.state; |
| /******************************************************************************* |
| * 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 - initial API and implementation |
| * Regent L'Archeveque, |
| * Sebastien Gemme |
| * |
| * SPDX-License-Identifier: EPL-1.0 |
| *******************************************************************************/ |
| |
| import org.eclipse.apogy.addons.sensors.gps.GPS; |
| import org.eclipse.apogy.addons.sensors.gps.GPSStatus; |
| |
| public abstract class GPSState { |
| |
| private final GPS gps; |
| |
| public GPSState(GPS gps) { |
| |
| if (gps == null) { |
| throw new IllegalArgumentException(); |
| } |
| |
| this.gps = gps; |
| } |
| |
| public GPS getGPS() { |
| return this.gps; |
| } |
| |
| public void start() throws IllegalStateException { |
| throw new IllegalStateException(); |
| } |
| |
| public void stop() throws IllegalStateException { |
| throw new IllegalStateException(); |
| } |
| |
| public void reset() throws IllegalStateException { |
| getGPS().setStatus(GPSStatus.STOPPED); |
| getGPS().setLastFailure(null); |
| } |
| |
| public void updateGPS() throws IllegalStateException { |
| throw new IllegalStateException(); |
| } |
| |
| public boolean isRunning() { |
| return false; |
| } |
| |
| public boolean reconnect() throws IllegalStateException { |
| throw new IllegalStateException(); |
| } |
| |
| public void failure(Exception e) { |
| getGPS().setLastFailure(e); |
| } |
| |
| } |