Thursday, November 27, 2014

[Win8.1 Universal app] Bixolon R200II Bluetooth communication socket error and strange UUID

Hi, all,


I'm trying to connect a universal app to a Bixolon R200II SPP printer via Bluetooth. The test machine is a Windows 8.1 up-to-date Lenovo with two Bluetooth dongles (the built in one BT 2.0 and USB Hama BT 4.0+LE adapter), with the first having Lenovo drivers and the second is with native support. The printer is paired to the computer and lists "Serial Port Service" in its Bluetooth services list.


Initially I was not being able to discover the printer at all, despite having "name:serialPort" and "serviceId:00001101-0000-1000-8000-00805f9B34fb" in the app manifest. It turned out that the printer is listed with some strange UUID of "00000000-deca-fade-deca-deafdecacaff". Adding it yielded success into discovering the printer.


The real problem is that for some reason I cannot create the Rfcomm service and connect to the printer on the await RfcommDeviceService.FromIdAsync() call. Reaching this line the code throws a System.Exception exception with message "A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram into was smaller than the datagram itself. (Exception from HRESULT: 0x80072738)".


The code that I use:



RfcommServiceId printerServiceId = RfcommServiceId.FromUuid(new Guid("00000000-deca-fade-deca-deafdecacaff"));
DeviceInformationCollection services = await DeviceInformation.FindAllAsync(RfcommDeviceService.GetDeviceSelector(printerServiceId));

if (services.Count > 0)
{
var service = await RfcommDeviceService.FromIdAsync(services[0].Id);
...
}



Anyone has idea what is wrong?

No comments:

Post a Comment