package com.miya.print;

import android.content.Context;
import android.graphics.Bitmap;

/**
 * 打印基类
 */
public abstract class BasePrinter implements IPrinter {

    /**
     * 80mm打印纸允许打印的最大图片的宽度,此为经验值
     */
    final static int MAX_IMG_WIDTH_80MM = 570;

    /**
     * 初始化调用者的引用
     */
    Context context;

    /**
     * 当前状态码，具体值参考全局状态码
     */
    int status;

    /**
     * 打印机器名称
     */
    String name;

    /**
     * 对齐方式
     * 0：居左对齐
     * 1：居中对齐
     * 2：居右对齐
     * 其它值：走当前配置对齐方式
     */
    int align = 0;

    @Override
    public boolean init(Context context) {
        this.context = context;
        return false;
    }

    @Override
    public boolean release() {
        return false;
    }

    @Override
    public int printText(int align, int size, String content, boolean isFeed) {
        return PrinterStatusEnum.CODE_SUCCESS.status;
    }

    @Override
    public int printBarcode(int align, String content, boolean isFeed) {
        return 0;
    }

    @Override
    public int printQrcode(int align, String content, boolean isFeed) {
        return 0;
    }

    @Override
    public int printImage(int align, Bitmap bm, boolean isFeed) {
        return 0;
    }

    @Override
    public int cutPaper() {
        return 0;
    }

    @Override
    public int setAlign(int align) {
        return 0;
    }

    @Override
    public int feedPaper() {
        return 0;
    }

    @Override
    public int getPrinterStatus() {
        return 0;
    }

    @Override
    public int excuteCmd(String cmd) {
        return 0;
    }

    @Override
    public int beginPrint() {
        return 0;
    }

    @Override
    public int endPrint() {
        return 0;
    }

    @Override
    public void setPrinterName(String name) {
        this.name = name;
    }

    @Override
    public String getPrinterName() {
        return this.name;
    }

    @Override
    public int printText(String content) {
        return printText(-1, 0, content, true);
    }

    @Override
    public int printImageFast(Bitmap bm) {
        return 0;
    }

    @Override
    public int printImage(Bitmap bm) {
        return printImage(-1, bm, true);
    }

    @Override
    public int printBarcode(String content) {
        return printBarcode(-1, content, true);
    }

    @Override
    public int printQrcode(String content) {
        return printQrcode(-1, content, true);
    }
}
