xcqwan / BlueToothPrint

use blue tooth transpond POS message
6 stars 4 forks source link

How to send command to open cash drawer? #1

Open PemmasaniRajesh opened 7 years ago

PemmasaniRajesh commented 7 years ago

My cash drawer is connected to printer. How to send signal to printer, so that it will open my cash drawer?

xcqwan commented 7 years ago

send command (27 112 0 5 0) or (16 20 1 0 1),if not work, please see printer command document

PemmasaniRajesh commented 7 years ago

How do i send this command, like

                String str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n0123456789\n";        
        byte[] tmp1 = { 27, 112, 0,5,0 };
        byte[] buf = DataUtils.byteArraysToBytes(new byte[][] { 
                str.getBytes(), tmp1 });

                             Bundle data = new Bundle();
            data.putByteArray(Global.BYTESPARA1, buf);
            data.putInt(Global.INTPARA1, 0);
            data.putInt(Global.INTPARA2, buf.length);
            WorkService.workThread.handleCmd(Global.CMD_WRITE, data);

Is the above format correct or not?

PemmasaniRajesh commented 7 years ago

Could you please tell me how to send this command to printer? I know how to send text to printer. But this is new to me.

On Sat, Apr 8, 2017 at 2:17 PM, Thanks notifications@github.com wrote:

send command (27 112 0 5 0) or (16 20 1 0 1),if not work, please see printer command document

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xcqwan/BlueToothPrint/issues/1#issuecomment-292704594, or mute the thread https://github.com/notifications/unsubscribe-auth/AJz3ZfqFCKHu7Blb_zW8UMzDCD7XYK9vks5rt0mpgaJpZM4M3mhF .

PemmasaniRajesh commented 7 years ago

I got this done....

JayGajjar commented 4 years ago

@PemmasaniRajesh how did you get it done ?