I am trying to sent ESC commands to the default bluetooth printer.
So far I can get the default printer Device Info
string printerInterfaceClass = "{0ecef634-6ef0-472a-8085-5ad023ecbccd}";
string selector = "System.Devices.InterfaceClassGuid:="" + printerInterfaceClass + """;
string containerIdField = "System.Devices.ContainerId";
string AepId = "System.Devices.Aep.AepId";
string protocolId = "System.Devices.Aep.ProtocolId";
string[] propertiesToRetrieve = [containerIdField, AepId, protocolId];
// Asynchronously find all printer devices.
DeviceInformationCollection deviceInfoCollection = await DeviceInformation.FindAllAsync(selector, propertiesToRetrieve);
return deviceInfoCollection.FirstOrDefault(x => x.IsDefault == true);
next I need to obtain the serial Device info ! how to i obtain this from the device information of the printer? I windows you can see the com port for the printer but i cant fathom how to actually get a SerialDevice from the DeviceInformation.
this gets me the serial devices (which does contain my printers com port and i can send ESC commands to it successfully. BUT how to i get the Serial Device?
DeviceInformationCollection serialDeviceInfos = await DeviceInformation.FindAllAsync(SerialDevice.GetDeviceSelector());
Most posts suggest this, but that returns null for obvious reasons !
SerialDevice serialDevice = await SerialDevice.FromIdAsync(defaultPrinterDeviceInfo.Id))
Stuck.
Thanks