File BradyPrintSdkConnection.h
FileList > BradyPrintSdkConnection.h
Go to the source code of this file
Connection management functions for the Brady Desktop Print SDK. More...
#include "BradyPrintSdkCore.h"
Public Types
| Type | Name |
|---|---|
| typedef void(* | UsbEnumerationCallback Defines the callback function signature for USB device enumeration. This function will be called by the SDK for each matching device found. |
Public Functions
| Type | Name |
|---|---|
| BRADY_SDK_EXPORT BradySdkStatus | ConnectTcpPrinter (PrinterHandle printer, const char * ipAddress, int port) Connects to a TCP printer. The printer must not already be connected. Call DisconnectPrinter first if switching to a different connection. |
| BRADY_SDK_EXPORT BradySdkStatus | ConnectUsbPrinter (PrinterHandle printer, const char * devicePath) Connects to a USB printer. The printer must not already be connected. Call DisconnectPrinter first if switching to a different connection. |
| BRADY_SDK_EXPORT BradySdkStatus | DisconnectPrinter (PrinterHandle printer) Disconnects a connected printer, releasing its connection resources. Active print jobs are preserved and can be sent after reconnecting. Stored connection parameters are preserved for use with ReconnectPrinter. |
| BRADY_SDK_EXPORT BradySdkStatus | EnumerateUsbDevices (const char * printerModel, UsbEnumerationCallback callback, void * userData) Enumerates connected USB devices and invokes a callback for each one found. |
| BRADY_SDK_EXPORT BradySdkStatus | IsPrinterConnected (PrinterHandle printer, bool * connected) Checks whether the printer is currently reachable. This function probes the underlying transport connection to determine if the printer can still be communicated with. |
| BRADY_SDK_EXPORT BradySdkStatus | ReconnectPrinter (PrinterHandle printer) Reconnects a previously connected printer using its stored connection parameters. The printer must have been connected at least once via ConnectTcpPrinter or ConnectUsbPrinter before this function can be used. If the printer is already connected, the existing connection is automatically disconnected before reconnecting. |
Detailed Description
This header provides functions for connecting to printers via TCP/IP and USB, checking connection status, disconnecting, and reconnecting.
Public Types Documentation
typedef UsbEnumerationCallback
Defines the callback function signature for USB device enumeration. This function will be called by the SDK for each matching device found.
typedef void(* UsbEnumerationCallback) (const char *serialNumber, const char *devicePath, const char *usbPortInfo, void *userData);
Parameters:
serialNumberThe serial number of the found device.devicePathA unique, platform-specific identifier for the device instance.usbPortInfoA platform specific string describing the physical USB port the discovered device is connected to.userDataA pointer to user-defined data, passed through from the Enumerate call.
See also: EnumerateUsbDevices
Public Functions Documentation
function ConnectTcpPrinter
Connects to a TCP printer. The printer must not already be connected. Call DisconnectPrinter first if switching to a different connection.
BRADY_SDK_EXPORT BradySdkStatus ConnectTcpPrinter (
PrinterHandle printer,
const char * ipAddress,
int port
)
Parameters:
printerThe handle to the printer instance.ipAddressThe IP address of the printer to connect to.portThe port number to connect to on the printer. In most cases this will be 9100, but some printers allow customizing the print port.
Returns:
BRADY_SDK_SUCCESS if the connection was successful. BRADY_SDK_ERROR_EXISTING_CONNECTION if the printer was previously connected.
See also: DisconnectPrinter
See also: BradySdkStatus
function ConnectUsbPrinter
Connects to a USB printer. The printer must not already be connected. Call DisconnectPrinter first if switching to a different connection.
BRADY_SDK_EXPORT BradySdkStatus ConnectUsbPrinter (
PrinterHandle printer,
const char * devicePath
)
Parameters:
printerThe handle to the printer instance.devicePathThe device path of the USB printer to connect to. Provided to the UsbEnumerationCallback during EnumerateUsbDevices.
Returns:
BRADY_SDK_SUCCESS if the connection was successful. BRADY_SDK_ERROR_EXISTING_CONNECTION if the printer was previously connected.
See also: EnumerateUsbDevices
See also: DisconnectPrinter
See also: BradySdkStatus
function DisconnectPrinter
Disconnects a connected printer, releasing its connection resources. Active print jobs are preserved and can be sent after reconnecting. Stored connection parameters are preserved for use with ReconnectPrinter.
BRADY_SDK_EXPORT BradySdkStatus DisconnectPrinter (
PrinterHandle printer
)
Parameters:
printerThe handle to the connected printer instance.
Returns:
BRADY_SDK_SUCCESS if the printer was disconnected successfully. BRADY_SDK_ERROR_NO_CONNECTION if the printer is not currently connected.
See also: ReconnectPrinter
See also: BradySdkStatus
function EnumerateUsbDevices
Enumerates connected USB devices and invokes a callback for each one found.
BRADY_SDK_EXPORT BradySdkStatus EnumerateUsbDevices (
const char * printerModel,
UsbEnumerationCallback callback,
void * userData
)
Parameters:
printerModelA UTF-8 encoded string identifying the printer model to search for (IE: "i7500")callbackA pointer to a function that will be called for each discovered device.userDataAn optional user-defined pointer that will be passed to the callback function.
Returns:
BRADY_SDK_SUCCESS if the enumeration process completed.
See also: BradySdkStatus
function IsPrinterConnected
Checks whether the printer is currently reachable. This function probes the underlying transport connection to determine if the printer can still be communicated with.
BRADY_SDK_EXPORT BradySdkStatus IsPrinterConnected (
PrinterHandle printer,
bool * connected
)
Parameters:
printerThe handle to the printer instance.connectedA pointer to a boolean that will receive the result. True if the printer is reachable, false otherwise.
Returns:
BRADY_SDK_SUCCESS if the check was successful.
See also: BradySdkStatus
function ReconnectPrinter
Reconnects a previously connected printer using its stored connection parameters. The printer must have been connected at least once via ConnectTcpPrinter or ConnectUsbPrinter before this function can be used. If the printer is already connected, the existing connection is automatically disconnected before reconnecting.
BRADY_SDK_EXPORT BradySdkStatus ReconnectPrinter (
PrinterHandle printer
)
Parameters:
printerThe handle to the printer instance.
Returns:
BRADY_SDK_SUCCESS if the reconnection was successful. BRADY_SDK_ERROR_NO_CONNECTION if the printer was never previously connected. BRADY_SDK_ERROR_CONNECTION_FAILED if the reconnection attempt failed.
See also: DisconnectPrinter
See also: BradySdkStatus
The documentation for this class was generated from the following file BradyPrintSdkConnection.h