适用于gp-3120tu机型通过蓝牙协议与android app的对接, 用的是TSC指令.
package com.freestyle.demo;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Handler;
import android.os.HandlerThread;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.freestyle.R;
import com.freestyle.common.btprinter.SharedPreferencesUtil;
import com.gprinter.command.EscCommand;
import com.gprinter.command.LabelCommand;
import com.freestyle.common.btprinter.BTPrinterUtil;
import com.freestyle.common.btprinter.DeviceConnFactoryManager;
import com.freestyle.common.btprinter.PrinterCommand;
import com.freestyle.common.btprinter.ThreadPool;
import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.ViewById;
import java.util.Vector;
@EActivity(R.layout.activity_main)
public class MainActivity extends AppCompatActivity implements BTPrinterUtil.BTPrinterInterface {
BTPrinterUtil mUtil;
@ViewById
protected View disconnectBtn;
@ViewById
protected TextView info;
private SharedPreferencesUtil mSetting;
//private ThreadPool threadPool;
private String mLastDeviceMac = null;
HandlerThread mBgThread=null;
Handler mPrintHandler=null;
final static String mTitle=”佳博蓝牙打印机SDK演示”;
@Click
protected void connectBtn() {
mUtil.selectDevice();
}
@Click
protected void dis