package com.kozen.printerlibrary;

import android.content.ComponentName;
import android.content.ServiceConnection;
import android.os.IBinder;

import com.xcheng.printerservice.IPrinterService;

public abstract class InnerPrinterCallback implements ServiceConnection {

    protected abstract void onConnected(IPrinterService service);

    protected abstract void onDisconnected();

    @Override
    public void onServiceConnected(ComponentName name, IBinder service) {
        if(service != null){
            IPrinterService proxy = IPrinterService.Stub.asInterface(service);
            onConnected(proxy);
        }
    }

    @Override
    public void onServiceDisconnected(ComponentName name) {
        onDisconnected();
    }
}
