5

I'm sending a byte array to a bluetooth socket and I get a response from the bluetooth printer, but I'm not getting a correct sending acknowledgement for image data.

I write the byte array to outputstream the following way:

byte[] queryData = new byte[]{
    0x1B, 0x2A, 0x43, 0x41,
    0x00, 0x00, 0x00, 0x00,
    0x01, 0x27, 0x5E,
    0x01, 0x00, 0x00, 0x00, 0x00
};
outputStream.write(queryData);
outputStream.flush();

Is there any other way to write binary data to outputstream?

I'm stuck and opened to any suggestion.

Gilles
  • 9,269
  • 4
  • 34
  • 53
Bhavesh Desai
  • 239
  • 2
  • 13
  • 1
    http://stackoverflow.com/questions/31399382/make-a-bytes-packet-and-send-to-external-accessory-device-for-print-using-blueto – Nitesh Oct 17 '15 at 11:22
  • A2A iT WILL HELP YOU : http://androidnutts.blogspot.in/2013/09/print-receipt-using-bluetooth-with.html – Sanket Prabhu Dec 01 '15 at 12:02
  • 2
    @Sanket Prabhu In my problem i have to send image size before sending image, after send this the printer have to give me proper ACK to send image. then i can send image data. i can use your solution after that ACK receive, i already done with code after ACK receive. – Bhavesh Desai Dec 02 '15 at 06:07
  • After sending the data, why don't you check with InputStream? – Nigam Patro Dec 03 '15 at 05:50
  • You can refer this link http://stackoverflow.com/questions/13450406/how-to-receive-serial-data-using-android-bluetooth may be this will be helpful – Nigam Patro Dec 03 '15 at 06:06
  • @BhaveshDesai Make sure your are sending bytes as per guidelines of printer manufacturer – Jaiprakash Soni Dec 08 '15 at 07:27
  • Yes i am sending same way as in manufacturer's documentation given. – Bhavesh Desai Dec 08 '15 at 11:05

0 Answers0