tspl 重置打印机命令_68、TSPL指令集(标签打印机)

1 packagecom.huofu.speechundecrypt;2

3 importandroid.app.Activity;4 importandroid.content.Context;5 importandroid.os.Bundle;6 importandroid.os.StrictMode;7 importandroid.util.Log;8 importandroid.view.Menu;9 importandroid.view.View;10 importandroid.widget.Button;11 importandroid.widget.TextView;12

13 importjava.io.FileInputStream;14 importjava.io.IOException;15 importjava.io.InputStream;16 importjava.io.OutputStream;17 importjava.net.Socket;18

19 /**

20 * author: Created by zzl on 15/12/25.21 */

22

23 public class TscWifiActivity extendsActivity {24 private static final String TAG = "THINBTCLIENT";25 private static final boolean D = true;26 private InputStream InStream = null;27 private OutputStream OutStream = null;28 private Socket socket = null;29 private String printerstatus = "";30 private int last_bytes = 0;31 private byte[] buffer = new byte[1024];32 private byte[] readBuf = new byte[1024];33 private Button connect = null;34 private Button closeport = null;35 private Button sendfile = null;36 private Button status = null;37 private TextView tv1 = null;38

39 publicTscWifiActivity() {40 }41

42 public voidonCreate(Bundle savedInstanceState) {43 super.onCreate(savedInstanceState);44 this.setContentView(2130903040);45 this.tv1 = (TextView) this.findViewById(2131165187);46 this.connect = (Button) this.findViewById(2131165184);47 this.connect.setOnClickListener(newView.OnClickListener() {48 public voidonClick(View v) {49 TscWifiActivity.this.openport("192.168.1.40", 9100);50 TscWifiActivity.this.sendcommand("SIZE 3,1\n");51 TscWifiActivity.this.sendcommand("PRINT 5\n");52 }53 });54 this.closeport = (Button) this.findViewById(2131165185);55 this.closeport.setOnClickListener(newView.OnClickListener() {56 public voidonClick(View v) {57 TscWifiActivity.this.closeport();58 }59 });60 this.sendfile = (Button) this.findViewById(2131165186);61 this.sendfile.setOnClickListener(newView.OnClickListener() {62 public voidonClick(View v) {63 TscWifiActivity.this.openport("192.168.1.58", 9100);64 TscWifiActivity.this.downloadpcx("UL.PCX");65 TscWifiActivity.this.downloadbmp("Triangle.bmp");66 TscWifiActivity.this.downloadttf("ARIAL.TTF");67 TscWifiActivity.this.setup(70, 110, 4, 4, 0, 0, 0);68 TscWifiActivity.this.clearbuffer();69 TscWifiActivity.this.sendcommand("SET TEAR ON\n");70 TscWifiActivity.this.sendcommand("SET COUNTER @1 1\n");71 TscWifiActivity.this.sendcommand("@1 = \"0001\"\n");72 TscWifiActivity.this.sendcommand("TEXT 100,300,\"3\",0,1,1,@1\n");73 TscWifiActivity.this.sendcommand("PUTPCX 100,300,\"UL.PCX\"\n");74 TscWifiActivity.this.sendcommand("PUTBMP 100,520,\"Triangle.bmp\"\n");75 TscWifiActivity.this.sendcommand("TEXT 100,760,\"ARIAL.TTF\",0,15,15,\"THIS IS ARIAL FONT\"\n");76 TscWifiActivity.this.barcode(100, 100, "128", 100, 1, 0, 3, 3, "123456789");77 TscWifiActivity.this.printerfont(100, 250, "3", 0, 1, 1, "987654321");78 TscWifiActivity.this.printlabel(10, 1);79 TscWifiActivity.this.sendfile("zpl.txt");80 TscWifiActivity.this.closeport();81 }82 });83 this.status = (Button) this.findViewById(2131165188);84 this.status.setOnClickListener(newView.OnClickListener() {85 public voidonClick(View v) {86 String QQ = TscWifiActivity.this.batch();87 TscWifiActivity.this.tv1.setText(QQ);88 }89 });90 }91

92 public voidonStart() {93 super.onStart();94 Log.e("THINBTCLIENT", "++ ON START ++");95 }96

97 public voidonResume() {98 super.onResume();99 Log.e("THINBTCLIENT", "+ ON RESUME +");100 Log.e("THINBTCLIENT", "+ ABOUT TO ATTEMPT CLIENT CONNECT +");101 }102

103 public voidonPause() {104 super.onPause();105 Log.e("THINBTCLIENT", "- ON PAUSE -");106 if (this.OutStream != null) {107 try{108 this.OutStream.flush();109 } catch(IOException var3) {110 Log.e("THINBTCLIENT", "ON PAUSE: Couldn\'t flush output stream.", var3);111 }112 }113

114 try{115 this.socket.close();116 } catch(IOException var2

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值