The Brady iOS SDK API


Templates

Template related objects include:

  • TemplateFactory
  • Template
  • TemplateObjectData
  • TemplateObjectType

TemplateFactory

The Brady SDK TemplateFactory is the only way for a user to get a Template object.

.getTemplate

TemplateFactory.getTemplate(template: InputStream) -> Template?

getTemplate returns a nullable Template object.

  • template: an InputStream object from the user-chosen template in their local directory. (See Example below).
//"selection" is a String representing the template's file name.
let filePath = URL(fileReferenceLiteralResourceName: selection)
let templateData: Data = try Data(contentsOf: filePath)
let iStream: InputStream = InputStream(data: templateData)

Template

  • The Brady SDK Template object allows the user to:
    • Retrieve a list of a .BWT file's data.
    • Retrieve a Bitmap of the template used to preview the template in a UI.
    • Retrieve the name of the .BWT file's label part.

.getTemplateData

getTemplateData() throws -> [TemplateObjectData]

getTemplateData returns a list of TemplateObjectData that the user may iterate through. This will hold information about the physical elements and objects on a Brady Workstation Template. (Reference TemplateObjectData)

.getPreview

getPreview(labelNumber: Int, dpi: Double, maxPixelWidthAndHeight: Double, printerDetails: PrinterDetails?) throws -> CGImage

getPreview returns a CGImage object (similar to Bitmap) of the chosen template. To set the CGImage to our UI, we could then call something like:

Image(uiImage: UIImage(cgImage: template?.getPreview(labelNumber: 1, dpi: 96, maxPixelWidthAndHeight: 200)!, printerDetails: nil)).resizable()
  • labelNumber: an Integer that represents which label in the print job to get a preview of. (Currently we only support 1 print job at a time so this will always be 0).

  • dpi: a Double that represents the preview's "Dots Per Inch". This is usually 96 for most phones.

  • maxPixelWidthAndHeight: a Double that represents the dimension with the highest value. (See example above).

  • printerDetails: a PrinterDetails object that represents all information about the printer the mobile device is currently connected to. If nil, the preview will not reflect an accurate print preview. If not nil, the preview will reflect the color of the label supply and ribbon color.

.getSupplyName

getSupplyName() throws -> String

getSupplyName returns a String representing the name of the template's label part. In Brady Workstation, when we design a template, we always have to set a specific part. This could be useful information when validating a templates part or when comparing a connected printer's part.


TemplateObjectData

The Brady SDK TemplateObjectData object allows the user to retrieve an object on a Brady Workstation Template.

.getName

getName() -> String

getName gets a String representing the TemplateObjectData's set name.

.getValue

getValue() throws -> String

getValue gets a String representing the TemplateObjectData's set value.

.setValue

setValue(value: String) throws

setValue take's a String representing a new value that a user wants to set to the object. This is how a user may set the value of a Placeholder element on a Brady Workstation Template.

.getTemplateObjectType

getTemplateObjectType() -> TemplateObjectType

getTemplateObjectType gets a TemplateObjectType representing the type of object the instance is.


TemplateObjectType

TemplateObjectType is an enumeration that holds the types of objects on a Brady Workstation Template.

  • StaticText: Text that cannot have it's value set by a user.
  • Text: Text that was designed as a placeholder. Users can change the text's value with TemplateObjectData.setValue(value: newValue). DateTimeObjects are considered Text that can be set to anything (even text that isn't in date time format).
  • Rectangle: A static rectangle that was drawn on the template.
  • Barcode: Any Barcode object that was used to design the template. Barcodes can have human readable text attached to them as well. A change to the value will change both the human readable text and the barcode itself.
  • Image: An image view that was placed on the template.
  • PolyPolyLine: A type of static shape or line that was drawn on the template.
  • Other: An type of object type that the SDK does not support yet.

Discovery

Discovery related objects include:

  • PrinterDiscoveryFactory
  • PrinterDiscovery
  • PrinterDiscoveryListener
  • DiscoveredPrinterInformation

PrinterDiscoveryFactory

The Brady SDK PrinterDiscoveryFactory is the only way for a user to get a PrinterDiscovery object

.getPrinterDiscovery

PrinterDiscoveryFactory.getPrinterDiscovery(listeners: [PrinterDiscoveryListener]) -> PrinterDiscovery

getPrintDiscovery returns a PrinterDiscovery object


PrinterDiscovery

The Brady SDK PrinterDiscovery object allows the user to start discovery, stop discovery, and get information about discovered printers.

.startBlePrinterDiscovery

startBlePrinterDiscovery()

startBlePrinterDiscovery starts discovering nearby printers through Bluetooth Low Energy.

.startWifiPrinterDiscovery

startWifiPrinterDiscovery()

startWifiPrinterDiscovery starts discovering nearby printers on the same internet connection as your device.

.stopBlePrinterDiscovery

stopBlePrinterDiscovery()

stopPrinterDiscovery stops any discovery scan that is currently running.

.connectToDiscoveredPrinter

connectToDiscoveredPrinter(printerSelected: DiscoveredPrinterInformation, listeners: Array[PrinterUpdateListener]) async throws -> PrinterDetails?

connectToDiscoveredPrinter returns a PrinterDetails object holding all information about the connected printer and it's connection status.

  • printerSelected: The DiscoveredPrinterInformation object that we are trying to connect to.
  • listeners: A list of PrinterUpdateListener objects that will be notified if a change is made to a connected printer.

.forgetLastConnectedPrinter

forgetLastConnectedPrinter()

forgetLastConnectedPrinter clears the internally stored printer. This printer will always be the one that was successfully connected to last. Calling this method will always result in getLastConnectedPrinter() returning null.

.getLastConnectedPrinterName

getLastConnectedPrinterName() -> String?

getLastConnectedPrinterName returns a nullable String that represents the name of the most recent printer that was successfully connected to.

.getHaveOwnership

getHaveOwnership() -> Bool?

getHaveOwnership returns a boolean representing the ownership the device has to the Bluetooth Low Energy printer. Ownership is a concept on the M211 and M511 only. Depending on the result that is returned, you might want to display messages to the user in the form of a Toast or Snackbar.

IF TRUE: Your device has claimed ownership of the printer. This means no other mobile device can connect to the printer. The blue Bluetooth light on the printer goes solid when somebody has ownership. You may hold the power button for 5 seconds to release ownership. However, just because the blue light is solid DOES NOT mean you are currently connected. These are two completely separate things. The only way they relate is that you must attempt to connect at least once to claim ownership. Even if this connection fails, you might still gain ownership successfully.

IF FALSE: You attempted to claim ownership at one point and were rejected because somebody else already as ownership. This doesn't necessarily have to be another device. With the same phone, if you connect to an M211 in the Brady Express Labels app, close the app to disconnect, open your app using the SDK, and attempt to connect, you will be rejected ownership.

IF NIL: The ownership of the desired printer is unknown because your device has not successfully "made contact" with the printer yet. This might be due to a ConnectionTimeout error or some other unrelated error that cause the connection to exit early.


PrinterDiscoveryListener

PrinterDiscoveryListener is implemented by a user in a UI class to catch when new printers are discovered. The class that implements PrinterDiscoveryListener can also start and stop printer discovery.

.printerDiscovered

printerDiscovered(discoveredPrinterInformation: DiscoveredPrinterInformation)

printerDiscovered triggers when a user implements this interface into their front end and a printer is discovered.

  • discoveredPrinterInformation: the printer information that is discovered.

.printerRemoved

printerRemoved(discoveredPrinterInformation: DiscoveredPrinterInformation)

printerRemoved triggers when a BLE printer has not been seen for 10 seconds. This method only applies to Bluetooth Low Energy scans.

  • discoveredPrinterInformation: the printer information that is discovered.

.printerDiscoveryStarted

printerDiscoveryStarted()

printerDiscoveryStarted triggers when a discovery scan is started in the SDK's code.

.printerDiscoveryStopped

printerDiscoveryStopped()

printerDiscoveryStopped triggers when a discovery scan is stopped in the SDK's code.nterDiscoveryStopped is where the user can call stopPrinterDiscovery() to stop a discovery scan.


DiscoveredPrinterInformation

The Brady SDK DiscoveredPrinterInformation object is returned when a nearby printer is discovered. It only allows the user to get the printer's name because the SDK handles everything else related to the printer's discovery.

.getName

getName() -> String

getName gets a String that represents the discovered printer's name. This is later used to connect to the same printer.

.getModel

getModel() -> String

getModel gets a String that represents the discovered printer's model.

.getConnectionType

getConnectionType() -> ConnectionType

getConnectionType gets a ConnectionType object that represents the protocol used to discover this printer object.


Connection

Connection related objects include:

  • PrinterDetails
  • PrinterUpdateListener
  • PrinterProperties
  • PrinterStatus
  • ConnectionType

PrinterDetails

The Brady SDK PrinterDetails object is returned after attempting a connection to a printer. It holds all of the information about the printer that the user may need.

.reconnect

reconnect() async throws -> Bool

reconnect allows the user to reconnect to a recently disconnected printer. Returns a boolean that represents if the reconnect was successful. This method will only be successful if disconnectWithoutForget was called prior. Calling disconnect instead will forget the printer disabling the SDK from reconnecting.

.disconnect

disconnect() async throws -> Bool

disconnect allows the user to disconnect from the connected printer.

.disconnectWithoutForget

disconnectWithoutForget() async throws -> Bool

disconnectWithoutForget disconnects from the current printer without forgetting it internally allowing future auto-connects. Calling this immediately before PrinterDetails.forgetLastConnectedPrinter() will result in the same functionality as calling the normal "disconnect" method. Therefore, disconnectWithoutForget + forgetLastConnectedPrinter = disconnect.

print(template: Template, printingOptions: PrintingOptions, dontPrintTrailerFlag: Bool) async throws -> PrintingStatus

print allows the user to print a selected template to the connected printer using PrintingOptions to do so. Returns the PrintingStatus when finished.

  • template: The Template object that we want to print.
  • printingOptions: The PrintingOptions object that holds the information of how to print.
  • dontPrintTrailerFlag: A Boolean flag. Pass in false if the connected printer is not an M211.
    • If true, don't print a trailer on the end of a label during the print.
    • If false, print a trailer on the end of a label during the print.

print(image: UIImage, printingOptions: PrintingOptions, dontPrintTrailerFlag: Bool) async throws -> PrintingStatus

print allows the user to print a selected image file to the connected printer using PrintingOptions to do so. Returns the PrintingStatus when finished.

  • image: The UIImage object that we want to print.
  • printingOptions: The PrintingOptions object that holds the information of how to print.
  • dontPrintTrailerFlag: A Boolean flag. Pass in false if the connected printer is not an M211.
    • If true, don't print a trailer on the end of a label during the print.
    • If false, print a trailer on the end of a label during the print.

print(image: UIImage, imageWidth: Double, labelLength: Double, printingOptions: PrintingOptions, dontPrintTrailerFlag: Bool) async throws -> PrintingStatus

print allows the user to instead specify the width of the image and the length of the label in inches in order to print an image. The purpose of this method is to allow a user to resize how the image appears on the label if they are unhappy with the defaulted outcome. Returns the PrintingStatus when finished.

For example: This method is useful if the desired image to print is not square. Since the physical supply width cannot change, increasing the labelLength value might begin to eliminate wasted space on a label since the image will have more room to grow to fit. Vice versa, if the image does not entirely fit on a label, you may decrease the imageWidth value to shrink the image to fit on the label fully.

  • context: A Context object that represents a UI context
  • image: the image that we want to print.
  • imageWidth: allows the user to customize the width (in inches) of the image once it prints instead of using the default.
  • labelLength: allows the user to customize the length (in inches) of the label instead of using the default. Currently, M611 continuous supply have a length of 0.5 inches before being overrided according to the information we receive from the printer. The width (in inches) will always be stated on the physical supply.
  • printingOptions: the PrintingOptions object that holds the information of how to print.
  • dontPrintTrailerFlag: If true, don't print trailer white space after the printed label. If false, print one.

print(images: [UIImage], printingOptions: PrintingOptions, dontPrintTrailerFlag: Bool) async throws -> PrintingStatus

print allows the user to print a selected image file to the connected printer using PrintingOptions to do so. Returns the PrintingStatus when finished.

  • images: The UIImage objects that we want to print.
  • printingOptions: The PrintingOptions object that holds the information of how to print.
  • dontPrintTrailerFlag: A Boolean flag. Pass in false if the connected printer is not an M211.
    • If true, don't print a trailer on the end of a label during the print.
    • If false, print a trailer on the end of a label during the print.

print(images: [UIImage], imageWidth: Double, labelLength: Double, printingOptions: PrintingOptions, dontPrintTrailerFlag: Bool) async throws -> PrintingStatus

print allows the user to instead specify the width of the image and the length of the label in inches in order to print an image. The purpose of this method is to allow a user to resize how the image appears on the label if they are unhappy with the defaulted outcome. Returns the PrintingStatus when finished.

For example: This method is useful if the desired image to print is not square. Since the physical supply width cannot change, increasing the labelLength value might begin to eliminate wasted space on a label since the image will have more room to grow to fit. Vice versa, if the image does not entirely fit on a label, you may decrease the imageWidth value to shrink the image to fit on the label fully.

  • context: A Context object that represents a UI context
  • images: the UIImage objects that we want to print.
  • imageWidth: allows the user to customize the width (in inches) of the image once it prints instead of using the default.
  • labelLength: allows the user to customize the length (in inches) of the label instead of using the default. Currently, M611 continuous supply have a length of 0.5 inches before being overrided according to the information we receive from the printer. The width (in inches) will always be stated on the physical supply.
  • printingOptions: the PrintingOptions object that holds the information of how to print.
  • dontPrintTrailerFlag: If true, don't print trailer white space after the printed label. If false, print one.

.printPDF

printPDF(fileData: Data, rotationDegrees: Int, printingOptions: PrintingOptions, dontPrintTrailerFlag: Bool) async throws -> PrintingStatus

printPDF allows the user to print a PDF to the connected printer and returns the PrintingStatus. If using the standard 8.5 in x 11 in PDF size, results may be poor if using a small label. To fix quality issues, please resize the PDF to an aspect ratio that would fit the printable area on the installed label.

  • fileData: a PDF file in the form of a Data object
  • rotationDegrees: the degrees to rotate the PDF page content before printing (0, 90, 180, 270)
  • printingOptions: the PrintingOptions object that holds the information of how to print.
  • dontPrintTrailerFlag: If true, don't print trailer white space after the printed label. If false, print one.

.checkForSupplyMismatch

checkForSupplyMismatch(template: Template) throws -> Bool

checkForSupplyMismatch compares the supply in the connected printer to the supply used to create the template. Returns true if the supplies match, false if they are different. Can also throw errors.

  • template: The template object to compare.

.getPrinterStatus

getPrinterStatus() -> PrinterStatus

getPrinterStatus returns the PrinterStatus enumeration that describes the state of the printer's connection.

.getPrinterName

getPrinterName() -> String

getPrinterName returns a String that represents the name of the connected printer.

.getPrinterModel

getPrinterModel() -> String

getPrinterModel returns a String that represents the model of the connected printer.

.getConnectionType

getConnectionType() -> ConnectionType

getConnectionType returns the ConnectionType enumeration that describes how we are connected to the printer.

.getBatteryLevelPercentage

getBatteryLevelPercentage() -> Int

getBatteryLevelPercentage returns an Integer that represents roughly the battery life percentage of the printer.

.getIsAcConnected

getIsAcConnected() -> Bool

getIsAcConnected returns a Boolean that represents whether this printer is plugged into an outlet and on AC power.

.getPrinterStatusMessage

**getPrinterStatusMessage() -> String

getPrinterStatusMessage returns a String that represents the body of a printer error message.

.getPrinterStatusRemedyExplanationMessage

getPrinterStatusRemedyExplanationMessage() -> String

getPrinterStatusRemedyExplanationMessage returns a String that represents the remedy to a printer error.

.getPrinterStatusMessageTitle

getPrinterStatusMessageTitle() -> String

getPrinterStatusMessageTitle returns a String that represents the title of the printer error.

.getSupplyName

getSupplyName() -> String

getSupplyName returns a String that represents the full name of the supply loaded in the connected printer.

.getSupplyRemainingPercentage

getSupplyRemainingPercentage() -> Int

getSupplyRemainingPercentage returns an Integer that represents the percentage of remaining supply in the connected printer.

.getSupplyDimensions

getSupplyDimensions() -> String

getSupplyDimensions returns a String that represents the supply dimensions (width and height).

.getSupplyWidth

getSupplyWidth() -> Double

getSupplyWidth returns a Double that represents the Width in inches of the supply installed in the printer.

.getSupplyHeight

getSupplyHeight() -> Double

getSupplyHeight return a Double that represents the Height in inches of the supply installed in the printer.

.getSupplyColor

getSupplyColor() -> CGColor

getSupplyColor returns a CGColor that represents the physical color of the label (supply tape) installed in the connected printer. This will be the background color of the printed out label.

.getSupplyLeftOffset

getSupplyLeftOffset() -> Double

getSupplyLeftOffset returns a Double that represents the left offset of the label in inches.

.getSupplyVerticalOffset

getSupplyVerticalOffset() -> Double

getSupplyVerticalOffset returns a Double that represents the vertical offset of the label in inches.

.isSupplyValid

isSupplyValid() -> Bool

isSupplyValid returns a Boolean that represents the validity of the installed supply

.getIsSupplyPreSized

getIsSupplyPreSized() -> Bool

getIsSupplyPreSized returns a Boolean that represents if the installed supply is a pre-sized supply

.cutSupply

cutSupply() async throws -> Bool

cutSupply sends the cut printer operation to the printer to cut a label. This operation is asynchronous and returns a nullable Boolean representing if the operation was successful or not.

.feedSupply

feedSupply() async throws -> Bool

feedSupply sends the feed operation to the printer to feed a label. This operation is asynchronous and returns a nullable Boolean representing if the operation was successful or not.

.getYNumber

getYNumber() -> String

getYNumber returns a String that represents the unique Y Number of the installed supply.

.getRibbonName() -> String

getRibbonName() -> String

getRibbonName returns a String that represents the ribbon installed in the printer (will return empty string if there is no ribbon). Only the M611 and M710 support ribbons.

.getRibbonRemainingPercentage

getRibbonRemainingPercentage() -> String

getRibbonRemainingPercentage returns a String that represents the percentage of ribbon remaining in the connected printer (will return 0 if there is no ribbon). Only the M611 and M710 support ribbons.

.getRibbonColor

getRibbonColor() -> CGColor

getRibbonColor returns a CGColor that represents the physical color of the Ribbon installed in the connected printer. This will be the color of everything printed on the label.

.isRibbonValid

**isRibbonValid() -> Bool

isRibbonValid returns a Boolean that represents the validity of the installed ribbon

.getAutomaticShutdownTime

getAutomaticShutdownTime() -> Int?

getAutomaticShutdownTime returns the automatic shutdown time in minutes on the printer (only applicable on the M211 & M511).

.setAutomaticShutoffTime

setAutomaticShutoffTime(timeInMinutes: Int) async throws -> Bool

setAutomaticShutoffTime sets the automatic shutdown time of the printer in minutes.

  • timeInMinutes: An Integer that represents the amount of minutes it takes for the connected printer to shut down automatically. If this is set to zero, it will not change the current value.

.getPostPrintAccessoryType

getPostPrintAccessoryType() -> PostPrintAccessoryType

getPostPrintAccessoryType returns a PostPrintAccessoryType that represents the name of the installed post print accessory. This is currently only supported on the i7500 printer. The default value will be "None" while connected to any other printer model.

.getDotsPerInch

getDotsPerInch() -> Int

getDotsPerInch returns an integer that represents the dots per inch capability of the connected printer.

.isDirectThermalSupply

isDirectThermalSupply() -> Bool

isDirectThermalSupply returns a boolean that represents if the connected printer has a direct thermal supply installed.

.isPreprintedSupply

isPreprintedSupply() -> Bool

isPreprintedSupply returns a Boolean that represents if the connected printer has a supply with a preprinted graphic

.getFirmwareVersion

getFirmwareVersion() -> String

getFirmwareVersion returns a String of the connected printer's firmware version

.getLabelLibraryVersion

getLabelLibraryVersion() -> String

getLabelLibraryVersion returns a String of the connected printer's Label Library (YB file) version (applicable to all printer models except the M211 & M511).

.getErrorSeverity

getErrorSeverity() -> String

getErrorSeverity returns a String representing the connected printer's error severity. Will return values such as "Error", "Warning", or "Info". Will not return a value if the printer is not in an error state. For the M211 and M511, this will always be an empty string. Use the Printer Status instead in this case.

.setSupplyDatabase

setSupplyDatabase(supplyDatabase: Data) throws

setSupplyDatabase overrides the embedded supply database with a specified one. This provided Data object must be converted from an original XML or BIN file of the official Brady Parts Database.


PrinterUpdateListener

The Brady SDK PrinterUpdateListener interface can be implemented to an Activity.

PrinterUpdate(list: List[PrinterProperties])

PrinterUpdate(list: List[PrinterProperties])

PrinterUpdate triggers whenever a PrinterProperty changes on the current printer connection.

For example, if a user changes the part installed in the printer, this function will trigger and "list" will contain "SupplyName", "SupplyYNumber", "SupplyHeight", "SupplyWidth", and "SubstrateRemainingPercent" (assuming the new part isn't the same in dimension).

  • This interface can be implemented to Class on the front end by adding :PrinterUpdateListener in the class header.
    • The PrinterUpdate function is required to be implemented when this is done (even if you leave the function empty).

PrinterProperties

PrinterProperties is an enumeration that represents different properties that describe the connected printer. This can be used to check which components are changed when implementing the PrinterUpdateListener.

  • JobsInQueue: property representing the amount of print jobs in queue.
  • RibbonPartNumber: property prepresenting the connected printer's ribbon part number.
  • RibbonColor: property representing the connected printer's ribbon color.
  • RibbonRemainingPercent: property representing the percentage remaining of the connected printer's ribbon.
  • RibbonIsInvalid: property representing the validity of the connected printer's ribbon.
  • SupplyName: property representing the name of the connected printer's supply part.
  • SupplyYNumber: property representing the Y Number of the current part installed in the connected printer.
  • SupplyWidth: property representing the width of the current supply installed in the connected printer.
  • SupplyHeight: property representing the height of the current supply installed in the connected printer.
  • SupplyRemainingPercent: property representing the percentage remaining of the connected printer's supply.
  • SupplyIsTearoff: property representing if the connected printer's installed supply is tearoff or not.
  • SupplyIsPreSized: If the connected printer's installed part is pre-sized.
  • SupplyLeftOffset: The left offset of the part currently installed in the connected printer.
  • SupplyVerticalOffset: The vertical offset of the part currently installed in the connected printer.
  • SupplyColor: The color of the supply installed in the connected printer.
  • SupplyInvalid: Is the supply installed in the connected printer is valid or not.
  • SupplyIsDirectThermal: Is the supply installed in the connected printer direct thermal or not.
  • PostPrintAccessoryType: The hardware accessory installed on the printer for post-printing actions.
  • DotsPerInch: The dots per inch capabilities of the connected printer.
  • Message: property representing the message body of a printer error.
  • RemedyExplanationMessage: property representing the remedy explanation of a printer error.
  • MessageTitle: property representing the message title of a printer error.
  • CurrentStatus: property representing the current status of the connected printer.
  • FirmwareVersion: property representing the firmware version number of the connected printer.
  • AcConnected: property representing if the connected printer is plugged into an AC power source.
  • BatteryChargePercentage: property representing the percentage of battery left in the connected printer.
  • TotalJobsQueued: property representing the amount of jobs queued to print on the connected printer.
  • AllJobsGroup: property representing the print jobs on the connected printer as a whole.
  • AutoShutoffTime: property representing the time in minutes that it takes the connected printer to shut off automatically.

PrinterStatus

PrinterStatus is an enumeration that represents values of the printer's connection status.

  • NoPrinter: status for when no printer is found when trying to find the printer's status.
  • Disconnected: status for when the printer is disconnected and no longer monitoring.
  • Connecting: status for when the printer is currently attempting to connect to the user's mobile device.
  • Connected: status for when the printer is connected to a user's mobile device and monitoring.
  • Warning: status for when the printer is in a warning state where an error could potentially occur.
  • Error: status for when the printer has an error while connected to the user's mobile device.

ConnectionType

ConnectionType is an enumeration that represents how a given printer was discovered. In turn, this would also be the protocol used to connect to the same printer.

  • Bluetooth: Represents a printer that was discovered using Bluetooth Classic.

  • Wifi: Represents a printer that was discovered over Wifi or Wireless Internet.

  • BLE: Represents a printer that was discovered using Bluetooth Low Energy.


Printing

Objects related to printing are:

  • PrintingStatus
  • PrintingOptions
  • CutOption
  • PostPrintAccessoryType

PrintingStatus

PrintingStatus is an enumeration that consists of values that represent the print job status.

  • Unknown: represents the status not being able to be recognized.
  • Printing: status that represents the currently ongoing printing operation.
  • PrintingSucceeded: status that represents a successful print job after it completes.
  • PrintingFailed: status that represents a failed print job after the attempt to print.

PrintingOptions

The Brady SDK PrintingOptions class is required to be initalized as an object when calling the ".print" method in PrinterDetails. This holds the information that the printer needs to complete a print job.

cutOptions

Getting cutOptions returns a CutOption enumeration value. The default is "EndOfLabel".

Setting cutOptions allows the user to change the value of the cut option.

numberOfCopies

Getting numberOfCopies returns the number of copies the user wants to print. The default is 1.

Setting numberOfCopies allows the user to set the number of copies they want to print.

isCollated

Getting isCollated return a boolean representing if future print jobs will be collated.

Setting isCollated allows the user to toggle collating on and off.

Collated Example: If a single template has 2 different labels designed for it, the collated option becomes available to use. If we are trying to print 2 copies of both labels, the collated version prints them in the order of 1,2,1,2. Alternatively, if the collated flag is set to false, it will print the labels in the order of "1,1,2,2".

cutAfterRowValue

Getting cutAfterRowValue returns an integer that represents how many rows of labels to print before cutting each time.

Setting cutAfterRowValue allows the user to specify how many rows of labels to printer before cutting. - For example, caling "setCutAfterRowValue(2)" will tell the printer to cut after every 2 rows of labels.


CutOptions

The Brady SDK CutOptions object is an enumeration that represents when to perform a cut operation during the print job.

  • EndOfJob: Performs a cut at the end of the entire print job.
  • EndOfLabel: Performs a cut at the end of each label.
  • Never: Never performs a cut operation throughout the print.
  • CutAfterRow: Performs a cut at the end of a specified row of labels.
    • This cut option is only supported on the M611, S3700, i5300, and i7500 printers. An SdkApiException will be thrown if used with an unsupported printer.
    • Must be used with the "PrintingOptions.cutAfterRowValue" method. For example, "printingOptions.cutAfterRowValue = 2" will tell the printer to cut after every 2 labels.
  • UsePrinterSettings: Uses the printer settings configured on the printer to determine when to perform a cut. This cut option is only supported on the i7500 printer. An SdkException will be thrown if used with an unsupported printer.

PostPrintAccessoryType

The Brady SDK PostPrintAccessoryType object is an enumeration that represents the name of the post print accessory installed on the connected printer.

  • TearBar: A TearBar is a jagged-edged attachment that allows a user to tear a label after it prints.
  • AutoCutter: An AutoCutter is an attachment that allows a user to automatically cut a label after it printsbased on the CutOption that is sent in the print job. The CutOption "UsePrinterSetting" will tell the printer to use the cut option that is set on the printer.
  • PeelWithoutLabelTakenSensor: The base Peeler attachment. Currently, the SDK does not support control over this setting. If this is installed on the printer, the CutOption will be defaulted to "UsePrinterSettings".
  • PeelWithLabelTakenSensor: A Peeler attachment that can sense when a label has been taken. Currently, the SDK does not support control over this setting. If this is installed on the printer, the CutOption will be defaulted to "UsePrinterSettings".
  • PerforationCutter: A PerforationCutter attachment that can cut a separator for easy tear off after print. Currently, the SDK does not support control over this setting. If this is installed on the printer, the CutOption will be defaulted to "UsePrinterSettings".
  • None: No post print accessory is installed on the printer. None will also be the default value for printers that do not support post print accessories.

Exceptions

The SDK provides the user a list of exceptions that they may use when calling any of the API's methods. This can come in handy when catching errors that will provide more details that are specific to the Brady SDK.


SdkApiException

This is the base exception that will be extended by more specific exceptions (all listed below). Users are encouraged to catch only this base exception since this will successfully catch all other custom exceptions.

PrinterDiscoveryException

PrinterDiscoveryException(message: String)

Thrown when an error occurs related to printer discovery.

PrinterConnectionException

PrinterConnectionException(message: String)

Thrown when an error occurs related to printer connection.

TemplateNotLoadedException

TemplateNotLoadedException(message: String)

Thown when an error occurs when attempting to load a template.

InvalidPlaceholderDataException

InvalidPlaceholderDataException(message: String)

Thrown when an error is caused by invalid data being set to a template placeholder.

TemplateRenderingException

TemplateRenderingException(message: String)

Thrown when an error occurs while attempting to render template objects during getPreview() or the print() methods.

PrinterOperationException

PrinterOperationException(message: String)

Thrown when an error occurs while attempting a printer operation such as feed, cut, of setAutomaticShutdownTime.

PrintingException

PrintingException(message: String)

Thrown when an error occurs at print time.

DisconnectionException

DisconnectionException(message: String)

Thrown when an error occurs while attempting to disconnect from a printer.

UnsupportedPrinterException

UnsupportedPrinterException(message: String)

Thrown when an error related to an incompatibility issue between the SDK and the connected printer occurs. The SDK might not support this printer.


Analytics

An object that can be configured to control analytics related functionalities.


AnalyticsFactory.getAnalytics

AnalyticsFactory.getAnalytics() -> Analytics

AnalyticsFactory.getAnalytics initializes an Analytics object to allow a user to enable/disable analytics tracking and to see the current tracking status.

.isTrackingEnabled

isTrackingEnabled() -> Bool

isTrackingEnabled returns a Boolean representing if analytics are actively tracking. True, if enabled. False, if disabled.

.setTrackingEnabled

setTrackingEnabled(isTrackingEnabled: Bool)

setTrackingEnabled toggled analytics tracking on and off. Tracking is always defaulted to on at initialization of an app. The only way to turn analytics tracking off is with this method.