Search in sources :

Example 11 with Connection

use of im.tny.segvault.subway.Connection in project underlx by underlx.

the class MainService method dumpDebugInfo.

// DEBUG:
public String dumpDebugInfo() {
    String s = "Service created on " + creationDate.toString();
    s += (wfc.isScanning() ? String.format(". WFC scanning every %d s", wfc.getScanInterval() / 1000) : ". WFC not scanning") + "\n";
    for (Network n : getNetworks()) {
        S2LS loc;
        synchronized (lock) {
            loc = locServices.get(n.getId());
        }
        s += "Network " + n.getNames("en")[0] + "\n";
        s += "State machine: " + loc.getState().toString() + "\n";
        s += String.format("\tIn network? %b\n\tNear network? %b\n", loc.inNetwork(), loc.nearNetwork());
        if (loc.getState() instanceof InNetworkState) {
            s += "\tPossible stops:\n";
            for (Stop stop : loc.getLocation().vertexSet()) {
                s += String.format("\t\t%s (%s)\n", stop.getStation().getName(), stop.getLine().getNames("en")[0]);
            }
            s += "\tPath:\n";
            if (loc.getCurrentTrip() != null) {
                for (Connection c : loc.getCurrentTrip().getEdgeList()) {
                    s += String.format("\t\t%s -> %s\n", c.getSource().toString(), c.getTarget().toString());
                }
                if (loc.getCurrentTargetRoute() != null) {
                    s += String.format("\t\tCurrent path complies? %b\n", loc.getCurrentTargetRoute().checkPathCompliance(loc.getCurrentTrip()));
                }
            }
        }
    }
    try {
        API.AuthTest authTest = API.getInstance().getAuthTest();
        s += "API auth test result: " + authTest.result + "\n";
        s += "API key as perceived by server: " + authTest.key + "\n";
    } catch (APIException e) {
        e.printStackTrace();
        s += "Error testing API authentication\n";
    }
    synchronizer.attemptSync();
    return s;
}
Also used : S2LS(im.tny.segvault.s2ls.S2LS) APIException(im.tny.segvault.disturbances.exception.APIException) Stop(im.tny.segvault.subway.Stop) Network(im.tny.segvault.subway.Network) Connection(im.tny.segvault.subway.Connection) SpannableString(android.text.SpannableString) InNetworkState(im.tny.segvault.s2ls.InNetworkState)

Aggregations

Connection (im.tny.segvault.subway.Connection)11 Stop (im.tny.segvault.subway.Stop)6 Line (im.tny.segvault.subway.Line)5 Transfer (im.tny.segvault.subway.Transfer)5 Intent (android.content.Intent)3 View (android.view.View)3 FrameLayout (android.widget.FrameLayout)3 ImageView (android.widget.ImageView)3 TextView (android.widget.TextView)3 Network (im.tny.segvault.subway.Network)3 Station (im.tny.segvault.subway.Station)3 Date (java.util.Date)3 LeastHopsWeighter (im.tny.segvault.s2ls.routing.LeastHopsWeighter)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 ServiceConnection (android.content.ServiceConnection)1 SharedPreferences (android.content.SharedPreferences)1 Drawable (android.graphics.drawable.Drawable)1 GradientDrawable (android.graphics.drawable.GradientDrawable)1 SpannableString (android.text.SpannableString)1