// Path: src/main/java/com/emal/android/transport/spb/VehicleType.java
// public enum VehicleType {
//     BUS("vehicle_bus", "0", "A", false, Color.BLUE),
//     TROLLEY("vehicle_trolley", "1", "Ш", true, Color.GREEN),
//     TRAM("vehicle_tram", "2", "T", false, Color.RED),
//     SHIP("vehicle_ship", "46", "S", false, Color.YELLOW);
// 
//     private String code;
//     private String id;
//     private String letter;
//     private boolean upsideDown;
//     private int color;
// 
//     private VehicleType(String code, String id, String letter, boolean upsideDown, int color) {
//         this.code = code;
//         this.id = id;
//         this.letter = letter;
//         this.color = color;
//         this.upsideDown = upsideDown;
//     }
// 
//     public String getCode() {
//         return code;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public String getLetter() {
//         return letter;
//     }
// 
//     public int getColor() {
//         return color;
//     }
// 
//     public boolean isUpsideDown() {
//         return upsideDown;
//     }
// 
//     public static VehicleType getType(String value) {
//         if ("bus".equals(value)) {
//             return BUS;
//         }
//         if ("tram".equals(value)) {
//             return TRAM;
//         }
//         if ("trolley".equals(value)) {
//             return TROLLEY;
//         }
//         if ("ship".equals(value)) {
//             return SHIP;
//         }
//         throw new IllegalStateException("Wrong vehicle type");
//     }
// }


import android.util.Log;
import com.emal.android.transport.spb.VehicleType;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpVersion;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.params.ConnManagerPNames;
import org.apache.http.conn.params.ConnPerRouteBean;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.entity.BufferedHttpEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.*;
import org.codehaus.jackson.map.ObjectMapper;
import java.io.*;
import java.net.URI;
import java.net.URLEncoder;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
            formparams.add(new BasicNameValuePair("transport-type", type.getId()));
        }

        if (routerNumber != null && routerNumber.length() > 0) {
            formparams.add(new BasicNameValuePair("route-number", routerNumber));
        }

        return new UrlEncodedFormEntity(formparams, "UTF-8");
    }

    private static UrlEncodedFormEntity getStopsFormParams() throws UnsupportedEncodingException {

        List<NameValuePair> formparams = new ArrayList<NameValuePair>();

        formparams.add(new BasicNameValuePair("sEcho", "3"));
        formparams.add(new BasicNameValuePair("iColumns", "7"));
        formparams.add(new BasicNameValuePair("sColumns", "id,transportType,name,nearestStreets,lonLat"));
        formparams.add(new BasicNameValuePair("iDisplayStart", "0"));
        formparams.add(new BasicNameValuePair("iDisplayLength", String.valueOf(Integer.MAX_VALUE)));
//        formparams.add(new BasicNameValuePair("iDisplayLength", "50"));

        formparams.add(new BasicNameValuePair("sNames", "id,transportType,name,nearestStreets,lonLat"));
        formparams.add(new BasicNameValuePair("iSortingCols", "1"));
        formparams.add(new BasicNameValuePair("iSortCol_0", "0"));
        formparams.add(new BasicNameValuePair("sSortDir_0", "asc"));
        formparams.add(new BasicNameValuePair("bSortable_0", "true"));
        formparams.add(new BasicNameValuePair("bSortable_1", "true"));
        formparams.add(new BasicNameValuePair("bSortable_2", "true"));
        formparams.add(new BasicNameValuePair("bSortable_3", "false"));
        formparams.add(new BasicNameValuePair("bSortable_4", "true"));
// Path: src/main/java/com/emal/android/transport/spb/VehicleType.java
// public enum VehicleType {
//     BUS("vehicle_bus", "0", "A", false, Color.BLUE),
//     TROLLEY("vehicle_trolley", "1", "Ш", true, Color.GREEN),
//     TRAM("vehicle_tram", "2", "T", false, Color.RED),
//     SHIP("vehicle_ship", "46", "S", false, Color.YELLOW);
// 
//     private String code;
//     private String id;
//     private String letter;
//     private boolean upsideDown;
//     private int color;
// 
//     private VehicleType(String code, String id, String letter, boolean upsideDown, int color) {
//         this.code = code;
//         this.id = id;
//         this.letter = letter;
//         this.color = color;
//         this.upsideDown = upsideDown;
//     }
// 
//     public String getCode() {
//         return code;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public String getLetter() {
//         return letter;
//     }
// 
//     public int getColor() {
//         return color;
//     }
// 
//     public boolean isUpsideDown() {
//         return upsideDown;
//     }
// 
//     public static VehicleType getType(String value) {
//         if ("bus".equals(value)) {
//             return BUS;
//         }
//         if ("tram".equals(value)) {
//             return TRAM;
//         }
//         if ("trolley".equals(value)) {
//             return TROLLEY;
//         }
//         if ("ship".equals(value)) {
//             return SHIP;
//         }
//         throw new IllegalStateException("Wrong vehicle type");
//     }
// }


// Path: src/main/java/com/emal/android/transport/spb/portal/PortalClient.java
import android.util.Log;
import com.emal.android.transport.spb.VehicleType;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpVersion;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.params.ConnManagerPNames;
import org.apache.http.conn.params.ConnPerRouteBean;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.entity.BufferedHttpEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.*;
import org.codehaus.jackson.map.ObjectMapper;
import java.io.*;
import java.net.URI;
import java.net.URLEncoder;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

            formparams.add(new BasicNameValuePair("transport-type", type.getId()));
        }

        if (routerNumber != null && routerNumber.length() > 0) {
            formparams.add(new BasicNameValuePair("route-number", routerNumber));
        }

        return new UrlEncodedFormEntity(formparams, "UTF-8");
    }

    private static UrlEncodedFormEntity getStopsFormParams() throws UnsupportedEncodingException {

        List<NameValuePair> formparams = new ArrayList<NameValuePair>();

        formparams.add(new BasicNameValuePair("sEcho", "3"));
        formparams.add(new BasicNameValuePair("iColumns", "7"));
        formparams.add(new BasicNameValuePair("sColumns", "id,transportType,name,nearestStreets,lonLat"));
        formparams.add(new BasicNameValuePair("iDisplayStart", "0"));
        formparams.add(new BasicNameValuePair("iDisplayLength", String.valueOf(Integer.MAX_VALUE)));
//        formparams.add(new BasicNameValuePair("iDisplayLength", "50"));

        formparams.add(new BasicNameValuePair("sNames", "id,transportType,name,nearestStreets,lonLat"));
        formparams.add(new BasicNameValuePair("iSortingCols", "1"));
        formparams.add(new BasicNameValuePair("iSortCol_0", "0"));
        formparams.add(new BasicNameValuePair("sSortDir_0", "asc"));
        formparams.add(new BasicNameValuePair("bSortable_0", "true"));
        formparams.add(new BasicNameValuePair("bSortable_1", "true"));
        formparams.add(new BasicNameValuePair("bSortable_2", "true"));
        formparams.add(new BasicNameValuePair("bSortable_3", "false"));
        formparams.add(new BasicNameValuePair("bSortable_4", "true"));
        formparams.add(new BasicNameValuePair("bSortable_5", "false"));