2012-08-17 4 views

답변

2

예, 동일한 애플리케이션 경험이 있습니다. InputStreamOutputStream 클래스의 StreamConnection 클래스를 사용해야합니다.

먼저 Bluetooth 주소를 사용하여 Bluetooth 프린터에 연결해야하고 OutputStream 클래스를 사용하여 인쇄 할 문자를 보내야합니다.

문자를 가져올 때 프린터 측에서 직접 인쇄를 시작합니다.

private StreamConnection bConn = null; 
private DataOutputStream dos = null; 

try 
{ 
    bConn = (StreamConnection) Connector.open(PrinterURL); 
    dos = (DataOutputStream)bConn.openDataOutputStream(); 
    dos.writeUTF("\r\n"); 
    dos.writeUTF("===============================");dos.writeUTF("\r\n"); 
    dos.writeUTF("   GSECL Bill"); dos.writeUTF("\r\n"); 
    dos.writeUTF("===============================");dos.writeUTF("\r\n"); 
    } 
    catch (Exception e) { System.out.println "Server Error: " + e.toString()); 

finally 
{ 
    try 
     { 
     dos.close(); 
    bConn.close(); 
    } 
    catch (Exception e) { } 
    } 
+1

블루투스 프린터의 블루투스 주소를 어떻게 얻을 수 있습니까? –

+0

블루투스 장치를 감지하는 샘플 프로젝트를 만들고 그 것으로부터 찾을 수 있습니다. :) – Lucifer

+0

새 질문을하는 것이 좋습니다. 다른 사람에게도 도움이 될 수 있습니다. – Lucifer

관련 문제