root / mobile / src / com / gonnatrak / mobile / GonnatrakMidlet.java @ 1

View | Annotate | Download

1
/**
2
 * Created by Andrey Khalzov
3
 * 14.08.2008 23:28:35
4
 */
5
package com.gonnatrak.mobile;
6
7
import com.gonnatrak.mobile.controller.Controller;
8
import com.gonnatrak.mobile.view.DeviceAuthForm;
9
import com.gonnatrak.mobile.view.GpsDevicesList;
10
import com.gonnatrak.mobile.view.SplashCanvas;
11
import com.gonnatrak.mobile.view.DebugForm;
12
13
import javax.microedition.lcdui.Display;
14
import javax.microedition.midlet.MIDlet;
15
import javax.microedition.midlet.MIDletStateChangeException;
16
17
public class GonnatrakMidlet extends MIDlet {
18
    public static final String URL = "http://www.gdebox.ru/device/";
19
20
    private Controller controller;
21
    
22
    public GonnatrakMidlet() {
23
        this.controller = new Controller(this);
24
        final Display display = Display.getDisplay(this);
25
26
        if (!controller.hasDeviceId()) {
27
            display.setCurrent(new DeviceAuthForm(controller));
28
        } else if (!controller.hasDeviceAddress()) {
29
            display.setCurrent(new GpsDevicesList(controller));
30
        } else {
31
            controller.sendLogs();
32
            controller.initLog();
33
            controller.startTrak();
34
        }
35
    }
36
37
    protected void startApp() throws MIDletStateChangeException {
38
    }
39
40
    protected void pauseApp() {
41
    }
42
43
    protected void destroyApp(boolean b) throws MIDletStateChangeException {
44
        controller.saveLogs();
45
    }
46
}