モノタッチ アプリで 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接続を理解しようとすることを強くお勧めしますが、バインディングを使用しないでください.