0

モノタッチ アプリで Star Micronics TSP650II プリンターを使用してラベルを印刷しようとしています。

問題は、session.OutputStream.HasSpaceAvailable()常に false を返すことです。私は何が欠けていますか?

私が持っているC#コードは次のようになります(簡単にするためにカットされています):

    var manager = EAAccessoryManager.SharedAccessoryManager;
            var starPrinter = manager.ConnectedAccessories.FirstOrDefault (p => p.Name.IndexOf ("Star") >= 0); // this does find the EAAccessory correctly

    var session = new EASession (starPrinter, starPrinter.ProtocolStrings [0]); // the second parameter resolves to "jp.star-m.starpro"
    session.OutputStream.Schedule (NSRunLoop.Current, "kCFRunLoopDefaultMode"); 
    session.OutputStream.Open ();

    byte[] toSend = GetInitData(); // this comes from another project where the same printer with ethernet cable was used in a windows environment and worked, not null for sure

   if (session.OutputStream.HasSpaceAvailable()) {
       int bytesWritten = session.OutputStream.Write (toSend, (uint)stillToSend.Length);  
       if (bytesWritten < 0) { 
           Debug.WriteLine ("ERROR WRITING DATA"); 
        } else {
             Debug.WriteLine("Some data written, ignoring the rest, just a test");
        } 
   } else
       Debug.WriteLine ("NO SPACE"); // THIS ALWAYS PRINTS, the output stream is never ready to take any output

更新: Star Micronics iOS SDK をプロジェクトにバインドすることでこの問題を回避できましたが、そのバインドなしで動作するはずのパッケージに 700K を追加するため、理想的とは言えません。

更新 2: バインディング コードのリクエストを受け取りました。Bluetooth接続を理解しようとすることを強くお勧めしますが、バインディングを使用しないでください.

4

2 に答える 2

0

あなたは言うthis does find the EAAccessory correctly

OutputStreamセッションが実際にnullの場合、これがfalseを返す理由でしょうか?

よろしくお願いします、

スターサポート

于 2013-05-13T13:02:15.913 に答える