This code had been working for about 6 months:
EASession session = new EASession(accessory, "com.bluebamboo.p25i"); session.OutputStream.Delegate = this; session.OutputStream.Schedule(NSRunLoop.Current, NSRunLoop.NSDefaultRunLoopMode); session.OutputStream.Open(); session.InputStream.Delegate = this; session.InputStream.Schedule(NSRunLoop.Current, NSRunLoop.NSDefaultRunLoopMode); session.InputStream.Open(); byte temp = new byte[data.Length + 5]; Array.Copy(data, 0, temp, 5, data.Length); temp = 0x55; temp = 0x66; temp = 0x77; temp = 0x88; temp = 0x44; session.OutputStream.Write(temp, (uint) temp.Length); Thread.Sleep(1000); session.OutputStream.Close(); session.OutputStream.Unschedule(NSRunLoop.Current, "kCFRunLoopDefaultMode"); //NSRunLoop.NSDefaultRunLoopMode); session.OutputStream.Delegate = null; session.InputStream.Close(); session.InputStream.Unschedule(NSRunLoop.Current, "kCFRunLoopDefaultMode"); //NSRunLoop.NSDefaultRunLoopMode); session.InputStream.Delegate = null; session.Dispose(); accessory.Dispose();
But now, it outputs an error stating the output stream has no space available. Checking HasSpaceAvailable at any time in code shows it's false, and obviously nothing will print to the Bluetooth printer any more, and I have no idea what needs to be done to "make space".
Is this a Xamarin bug, or an iOS bug? It might only be latter versions of iOS, but I only have 6.1.2 and 6.1.3 available to me, and both have this same problem.