Can anybody help me with a very frustrating problem I am having trying to stream data to a Bluetooth printer using 32feet.
The Bluetooth connectivity definitely appears to be working as not only does 32feet think the BluetoothClient is connected, but the printer also displays "pairing", "connecting" and then "connected" on its screen. However, when
I attempt to stream any data to the printer, it usually does not work (it does work on occasion, but 99% of the time it does not). The VB.Net commands I am using are as follows:
dim BTPrinter as new BluetoothClient 'create client variable
BluetoothSecurity.PairRequest(deviceaddress, PrinterPIN) 'Pair devices (successful)
peer.SetServiceState(BTGUID, True, True) 'update registry (successful)
BTPrinter.SetPin(PrinterPIN) 'not sure if this is needed or not
BTPrinter.Authenticate = True
BTPrinter.Encrypt = True
BTPrinter.Connect(New BluetoothEndPoint(deviceaddress, BTGUID)) 'successful
dim BTPrinterStream as System.Net.Sockets.NetworkStream = BTPrinter.GetStream()
I am writing valid printer commands into txtPrint (and have proven this by opening the printer as a serial port and then writing the same commands to the serial port and the printer prints the output correctly every time). Unfortunately the Stream.Write command
does not throw any sort of exception, so I have no idea why this isn't working. I keep reading that 32feet works reliably by streaming data over a BluetoothClient rather than using virtual serial ports, but I'm really struggling to get this to work. Can anybody
I think I might have fixed it by using a StreamWriter.WriteLine instead of just Write. Because it's an intermittent problem I will have to monitor, but it looks better at the moment!