Search in sources :

Example 6 with S2LS

use of im.tny.segvault.s2ls.S2LS 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

S2LS (im.tny.segvault.s2ls.S2LS)6 Station (im.tny.segvault.subway.Station)3 Stop (im.tny.segvault.subway.Stop)3 SpannableString (android.text.SpannableString)2 View (android.view.View)2 TextView (android.widget.TextView)2 Network (im.tny.segvault.subway.Network)2 Intent (android.content.Intent)1 IntentFilter (android.content.IntentFilter)1 SharedPreferences (android.content.SharedPreferences)1 LocalBroadcastManager (android.support.v4.content.LocalBroadcastManager)1 CardView (android.support.v7.widget.CardView)1 CompoundButton (android.widget.CompoundButton)1 ImageView (android.widget.ImageView)1 MainService (im.tny.segvault.disturbances.MainService)1 APIException (im.tny.segvault.disturbances.exception.APIException)1 CacheException (im.tny.segvault.disturbances.exception.CacheException)1 RStation (im.tny.segvault.disturbances.model.RStation)1 StationActivity (im.tny.segvault.disturbances.ui.activity.StationActivity)1 StationPickerView (im.tny.segvault.disturbances.ui.widget.StationPickerView)1