Search in sources :

Example 1 with GetUUIDRequest

use of cl.smartcities.isci.transportinspector.serverConnection.requests.pullRequests.GetUUIDRequest in project androidApp by InspectorIncognito.

the class ServerSentBus method createBus.

public static void createBus(final String licensePlate, final String service, final ConstructorListener listener) {
    Request.RequestListener<String> requestListener = new Request.RequestListener<String>() {

        @Override
        public void onRequestError() {
        }

        @Override
        public void onRequestResult(@NonNull String machineUUID) {
            int color = new ServiceHelper(TranSappApplication.getAppContext()).getColorId(service);
            listener.busConstructed(new ServerSentBus("left", service, "", machineUUID, "", licensePlate, 0, 0, 0, color, 0, "", new ArrayList<ServerSentEvent>()));
        }
    };
    Request<String> request = new GetUUIDRequest(requestListener, licensePlate);
    ServerController.sendRequest(request, null);
}
Also used : NonNull(android.support.annotation.NonNull) Request(cl.smartcities.isci.transportinspector.serverConnection.requests.Request) GetUUIDRequest(cl.smartcities.isci.transportinspector.serverConnection.requests.pullRequests.GetUUIDRequest) ArrayList(java.util.ArrayList) ServiceHelper(cl.smartcities.isci.transportinspector.database.ServiceHelper) GetUUIDRequest(cl.smartcities.isci.transportinspector.serverConnection.requests.pullRequests.GetUUIDRequest)

Example 2 with GetUUIDRequest

use of cl.smartcities.isci.transportinspector.serverConnection.requests.pullRequests.GetUUIDRequest in project androidApp by InspectorIncognito.

the class Bus method createBus.

private static void createBus(final String licensePlate, final String service, final ConstructorListener listener) {
    Request.RequestListener<String> requestListener = new Request.RequestListener<String>() {

        @Override
        public void onRequestError() {
        }

        @Override
        public void onRequestResult(@NonNull String response) {
            try {
                listener.busConstructed(new Bus(service, licensePlate, response));
            } catch (JSONException ignored) {
            }
        }
    };
    Request<String> request = new GetUUIDRequest(requestListener, licensePlate);
    ServerController.sendRequest(request, null);
}
Also used : ServerSentBus(cl.smartcities.isci.transportinspector.model.gson.ServerSentBus) NonNull(android.support.annotation.NonNull) Request(cl.smartcities.isci.transportinspector.serverConnection.requests.Request) GetUUIDRequest(cl.smartcities.isci.transportinspector.serverConnection.requests.pullRequests.GetUUIDRequest) JSONException(org.json.JSONException) GetUUIDRequest(cl.smartcities.isci.transportinspector.serverConnection.requests.pullRequests.GetUUIDRequest)

Aggregations

NonNull (android.support.annotation.NonNull)2 Request (cl.smartcities.isci.transportinspector.serverConnection.requests.Request)2 GetUUIDRequest (cl.smartcities.isci.transportinspector.serverConnection.requests.pullRequests.GetUUIDRequest)2 ServiceHelper (cl.smartcities.isci.transportinspector.database.ServiceHelper)1 ServerSentBus (cl.smartcities.isci.transportinspector.model.gson.ServerSentBus)1 ArrayList (java.util.ArrayList)1 JSONException (org.json.JSONException)1