01: /*
02: *
03: *
04: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License version
09: * 2 only, as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful, but
12: * WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * General Public License version 2 for more details (a copy is
15: * included at /legal/license.txt).
16: *
17: * You should have received a copy of the GNU General Public License
18: * version 2 along with this work; if not, write to the Free Software
19: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA
21: *
22: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
23: * Clara, CA 95054 or visit www.sun.com if you need additional
24: * information or have any questions.
25: */
26:
27: package com.sun.j2me.location;
28:
29: import javax.microedition.location.*;
30:
31: /**
32: *
33: * This class contains the simplified code for testing the JSR179
34: * implementation.
35: */
36: public class StubLocationListener implements LocationListener {
37:
38: /** Received location from listener */
39: private Location currLocation = null;
40:
41: /** Received location provider state from listener */
42: private int currState;
43:
44: /**
45: * Return the current state.
46: * @return current state
47: */
48: public int getCurrState() {
49: return currState;
50: }
51:
52: /**
53: * Sets the current state.
54: * @param newState new state value
55: */
56: public void setCurrState(int newState) {
57: currState = newState;
58: }
59:
60: /**
61: * Return the current location.
62: * @return current location
63: */
64: public Location getCurrLocation() {
65: return currLocation;
66: }
67:
68: /**
69: * Sets the current location.
70: * @param newLocation new location for setting
71: */
72: public void setCurrLocation(Location newLocation) {
73: currLocation = newLocation;
74: }
75:
76: /**
77: * locationUpdated implementation.
78: * @param provider the source of the event
79: * @param location the location to which the
80: * event relates, i.e. the new position
81: */
82: public void locationUpdated(LocationProvider provider,
83: Location location) {
84: currLocation = location; // save the location
85: }
86:
87: /**
88: * providerStateChanged implementation.
89: * @param provider the source of the event
90: * @param newState the new state of the LocationProvider.
91: */
92: public void providerStateChanged(LocationProvider provider,
93: int newState) {
94: currState = newState; // save the location
95: }
96: }
|