// Path: PrintClient/app/src/main/java/com/tinkerlog/printclient/model/Command.java
// public class Command {
// 
//     protected String request;
//     protected String response;
//     public ResponseHandler handler;
// 
//     public Command(String request, ResponseHandler handler) {
//         this.request = request;
//         this.handler = handler;
//     }
// 
//     public void setResponse(String response) {
//         this.response = response;
//     }
// 
//     public String getResponse() {
//         return response;
//     }
// 
//     public String getRequest() {
//         return request;
//     }
// 
//     public byte[] getPayload() {
//         return request.getBytes();
//     }
// }


import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import com.tinkerlog.printclient.model.Command;
package com.tinkerlog.printclient.util;



public class ResponseHandler extends Handler {

    private static final String TAG = "ResponseHandler";

    public static final int OK = 1;
    public static final int ERROR = 2;

    public ResponseHandler() {
        super();
    }

    public ResponseHandler(Callback callback) {
        super(callback);
    }

    public ResponseHandler(Looper looper) {
        super(looper);
    }

    public ResponseHandler(Looper looper, Callback callback) {
        super(looper, callback);
    }

    @Override
    public void handleMessage(Message msg) {
        switch (msg.what) {
            case OK:
// Path: PrintClient/app/src/main/java/com/tinkerlog/printclient/model/Command.java
// public class Command {
// 
//     protected String request;
//     protected String response;
//     public ResponseHandler handler;
// 
//     public Command(String request, ResponseHandler handler) {
//         this.request = request;
//         this.handler = handler;
//     }
// 
//     public void setResponse(String response) {
//         this.response = response;
//     }
// 
//     public String getResponse() {
//         return response;
//     }
// 
//     public String getRequest() {
//         return request;
//     }
// 
//     public byte[] getPayload() {
//         return request.getBytes();
//     }
// }


// Path: PrintClient/app/src/main/java/com/tinkerlog/printclient/util/ResponseHandler.java
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import com.tinkerlog.printclient.model.Command;

package com.tinkerlog.printclient.util;



public class ResponseHandler extends Handler {

    private static final String TAG = "ResponseHandler";

    public static final int OK = 1;
    public static final int ERROR = 2;

    public ResponseHandler() {
        super();
    }

    public ResponseHandler(Callback callback) {
        super(callback);
    }

    public ResponseHandler(Looper looper) {
        super(looper);
    }

    public ResponseHandler(Looper looper, Callback callback) {
        super(looper, callback);
    }

    @Override
    public void handleMessage(Message msg) {
        switch (msg.what) {
            case OK:
                handleSuccess((Command)msg.obj);