ConnectAsync¶
Overloads
| Name | Description |
|---|---|
| ConnectAsync(SIISLP800Printer printer) | Starts a connection to the printer using the specified printer information. |
| ConnectAsync(string address) | Starts a connection to the printer using the specified address. |
| ConnectAsync(string address, bool secure) | Starts a connection to the printer using the specified address, with optional secure mode for Bluetooth. |
ConnectAsync(SIISLP800Printer printer)¶
Description
Starts a connection to the printer using the specified printer information.
Call this method before using other SIISLP800PrinterManager methods.
Syntax
public Task ConnectAsync(SIISLP800Printer printer)
Warning
This method returns a Task. To ensure that the operation completes and any potential exceptions are properly captured, always call it with await. Omitting await may result in the operation being terminated midway or errors may go undetected.
Parameter
printer
The SIISLP800Printer instance retrieved from GetFoundPrinter().
Note
A concurrent connection from multiple apps to one printer is not supported.
ConnectAsync(string address)¶
Description
Starts a connection to the printer using the specified address.
The method connects to a Bluetooth printer when a Bluetooth device address is supplied, and to a USB printer when a USB device path is supplied.
Call this method before using other SIISLP800PrinterManager methods.
Syntax
public Task ConnectAsync(string address)
Warning
This method returns a Task. To ensure that the operation completes and any potential exceptions are properly captured, always call it with await. Omitting await may result in the operation being terminated midway or errors may go undetected.
Parameter
addressSpecify one of the following:
-
USB device path (for USB connection)
Example:"/dev/bus/usb/001/002" -
Bluetooth device address (for Bluetooth connection)
Example:"00:11:22:AA:BB:CC"
Sample
var printerManager = new SIISLP800PrinterManager(context);
try
{
await printerManager.ConnectAsync("00:11:22:AA:BB:CC");
}
catch (SIISLP800PrinterException e)
{
System.Diagnostics.Debug.WriteLine($"[MyApp] {e.HResult}");
}
Note
A concurrent connection from multiple apps to one printer is not supported.
ConnectAsync(string address, bool secure)¶
Description
Starts a connection to the printer using the specified address.
For Bluetooth connections, secure mode is enabled when `secure` is true.
For USB connections, the `secure` parameter is ignored.
Call this method before using other SIISLP800PrinterManager methods.
Syntax
public Task ConnectAsync(string address, bool secure)
Warning
This method returns a Task. To ensure that the operation completes and any potential exceptions are properly captured, always call it with await. Omitting await may result in the operation being terminated midway or errors may go undetected.
Parameter
addressSpecify one of the following:
-
USB device path (for USB connection)
Example:"/dev/bus/usb/001/002" -
Bluetooth device address (for Bluetooth connection)
Example:"00:11:22:AA:BB:CC"
secureSpecifies whether Bluetooth secure mode is used.
- true: Connects in secure mode
- false: Connects in non‑secure mode
This parameter applies only to Bluetooth connections.
Secure mode is generally recommended for normal operation.
Sample
var printerManager = new SIISLP800PrinterManager(context);
try
{
await printerManager.ConnectAsync("00:11:22:AA:BB:CC", true);
}
catch (SIISLP800PrinterException e)
{
System.Diagnostics.Debug.WriteLine($"[MyApp] {e.HResult}");
}
Note
A concurrent connection from multiple apps to one printer is not supported.