Bluetooth
|
The BluetoothDiscoverer type exposes the following members.
Name | Description | |
---|---|---|
BluetoothDiscoverer | Initializes a new instance of the BluetoothDiscoverer class |
Name | Description | |
---|---|---|
Dispose | Releases all resources used by the BluetoothDiscoverer | |
Equals | (Inherited from Object) | |
FindPrinters(DiscoveryHandler) | Find Bluetooth® devices that are discoverable. | |
FindPrinters(Context, DiscoveryHandler) | Find Bluetooth® devices that are discoverable. | |
FindPrinters(DiscoveryHandler, Int32) | Find Bluetooth® devices that are discoverable. | |
FindPrinters(DiscoveryHandler, DeviceFilter) | Find Bluetooth® devices that are discoverable. | |
FindPrinters(Context, DiscoveryHandler, DeviceFilter) | Find Bluetooth® devices that are discoverable. | |
FindPrinters(DiscoveryHandler, DeviceFilter, Int32) | Find Bluetooth® devices that are discoverable. | |
FindServices(String, ServiceDiscoveryHandler) | Find services (ConnectionChannels) that are supported by the device at macAddress. | |
FindServices(Context, String, ServiceDiscoveryHandler) | Find services(ConnectionChannels) that are supported by the device at macAddress. | |
GetHashCode | (Inherited from Object) | |
GetType | (Inherited from Object) | |
ToString | (Inherited from Object) |
using System; using System.Collections.Generic; using Zebra.Sdk.Printer.Discovery; class BluetoothDiscovererExample { public static void Main(string[] args) { try { Console.WriteLine("Starting printer discovery."); BluetoothDiscoveryHandler discoveryHandler = new BluetoothDiscoveryHandler(); BluetoothDiscoverer.FindPrinters(discoveryHandler); while (!discoveryHandler.DiscoveryComplete) { System.Threading.Thread.Sleep(10); } } catch (DiscoveryException e) { Console.WriteLine(e.ToString()); } } private class BluetoothDiscoveryHandler : DiscoveryHandler { private bool discoveryComplete = false; List<DiscoveredPrinter> printers = new List<DiscoveredPrinter>(); public void DiscoveryError(string message) { Console.WriteLine($"An error occurred during discovery: {message}."); discoveryComplete = true; } public void DiscoveryFinished() { foreach (DiscoveredPrinter printer in printers) { Console.WriteLine(printer); } Console.WriteLine($"Discovered {printers.Count} Bluetooth printers."); discoveryComplete = true; } public void FoundPrinter(DiscoveredPrinter printer) { printers.Add(printer); } public bool DiscoveryComplete { get => discoveryComplete; } } }