.NET MAUI API

void StartDiscovery()

Starts the Bluetooth Low Energy AND the Wi-Fi discovery scans in the background to find all supported Brady Printers in your area. All device names get stored internally and are retrieved using the "Printers" property. You will pass one of these names into the ConnectToPrinter method to connect to the device.

iOS Only Note: Devices discovered over Wifi will include the string ".local." concatenated to the end of the printer's name.

void StopPrinterDiscovery()

Stops all discovery scans that are currently running in the background.

Task<bool> ConnectToPrinterAsync(DiscoveredPrinterInformation? printer)

Used to make a connection to the DiscoveredPrinterInformation object that was discovered. Passing in "null" will automatically connect to the last printer that was used. The "LastConnectedPrinter" property will be useful when deciding when to intentionally pass in "null". Returns a boolean representing the success of the connection.

DiscoveredPrinterInformation is a custom object that is returned by the PrinterDiscoveredEvent as a callback. You must subscribe to the callback and save all printers that are received. One of these printers will then be passed into this method. This object simply stores the Name, Printer Model, and ConnectionType.

ConnectionType is a custom enum and one of the properties of DiscoveredPrinterInformation. This specifies how this printer was discovered and how it must be connected to. Please note that the same printer can be sent by the PrinterDiscoveredEvent. One could be of the "BLE" ConnectionType and one could be of the "Wifi" ConnectionType. This demonstrates how a user may specify which protocol will be used to connect to a printer.

Task<PrinterStatus> DisconnectAsync()

Attempts to disconnect from a connected printer and releases ownership if the printer is an M211 or M610. Return a PrinterStatus enum representing the result of the disconnect.

PrinterStatus may be: NoPrinter, Disconnected, Connecting, Connected, Warning, and Error. Refer to the PrinterStatus.swift page for documentation about these values.

Task<PrinterStatus> DisconnectWithoutForgetAsync()

Disconnects from the current printer without forgetting it internally or releasing ownership if the printer is an M211 or M610. It is suggested to use this method when the app life cycle is "paused" (backgrounding the app). Calling this immediately before ForgetLastConnectedPrinter() will result in the same functionality as calling the normal "DisconnectAsync" method.

PrinterStatus may be: NoPrinter, Disconnected, Connecting, Connected, Warning, and Error. Refer to the PrinterStatus.swift page for documentation about these values.

void ForgetLastConnectedPrinter()

Forgets the printer that has been stored internally. This will always be the printer the user most previously connected to successfully. Therefore, calling this method will always result in the LastConnectedPrinter property returning null afterwards until another printer is successfully connected to.

Task<bool> FeedAsync()

Attempts to send a "feed" printer operation to the printer. This makes the printer feed exactly one label's worth in length. Calling this will do nothing on an M611 because this operation is available directly on the M611's LED screen.

Only applicable on an M211 or M511

Task<bool> CutAsync()

Attempts to send a "cut" printer operation to the printer. This makes the printer cut any label that has recently been fed. A noise will be heard from the printer. Calling this will do nothing on an M611 because this operation is available directly on the M611's LED screen.

Only applicable on an M211 or M511

Task<bool> SetAutomaticShutdownTimeAsync(int minutes)

Attempts to set the "automatic shutdown time" of the connected printer. Returns a boolean representing the success of the operation.

Only applicable on an M211 or M511

void SetTemplateWithFilePath(string filePath)

Sets a BWT file or bitmap as the current item to print. This string must be a valid path to a MAUI Asset in order to be successful. To successfully set a valid BWT template, it must be embedded inside the MAUI Resource>>Raw folder and the Build Action must be set to "MauiAsset".

void SetTemplateWithBase64(string value, bool isTemplate)

Sets a BWT file or bitmap as the current item to print. The "value" parameter must be a Base64 string of an image or BWT file (see example below). The "isTemplate" parameter specifies if the passed-in Base64 string is derived from a template or an image file (.png, .jpg. etc.).

string path = @"my_template.BWT";
byte[] byteData = File.ReadAllBytes(path);
string base64 = Convert.ToBase64String(byteData);
theSdk.Template = base64;

void SetPlaceholderValue(string placeholderName, string placeholderValue)

Sets a value to the desired placeholder of the current template. You may find the names of all valid placeholders by using the "TemplateDataNames" property.

string? GetPreview(int elementSize)

Retrieves a print preview image in the form of a base64 string. Must pass-in the desired image size.

Task<PrintingStatus> PrintAsync(int copies, CutOption cutOption, bool isCollated, bool printTrailer)

Attempts to print the previous template or bitmap that was set using the "Template" property. Returns a the PrintingStatus enumeration representing the success or failure of the print. Please reference the "PrintingOptions.swift" page for further documentation about copies, cutAfterEachLabel, isCollated, and printTrailer.

CutOption can be: EndOfJob, EndOfLabel, CutAfterRow, UsePrinterSettings, Never. Refer to the "CutOptions.swift" page for documentation on these values.

Task<PrintingStatus> PrintAsync(double bitmapWidth, double labelLength, int copies, CutOption cutOption, bool isCollated, bool printTrailer)

Attempts to print the previous bitmap that was set using the "Template" property. Returns a boolean representing the success or failure of the print. Please reference the "PrintingOptions.swift" page for further documentation about copies, cutAfterEachLabel, isCollated, and printTrailer.

bitmapWidth - The width in inches of the bitmap once it prints out.

labelLength - The length in inches of the label once it prints out. Currently, M611 continuous parts 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 of the physical part.

CutOption can be: EndOfJob, EndOfLabel, CutAfterRow, UsePrinterSettings, Never. Refer to the "CutOptions.swift" page for documentation on these values.

string GetPrinterDetails()

Returns a formatted string of all printer details and their values. This is convenient to use instead of handling all printer details properties separately.


Printer Properties


int? AutomaticShutdownTime { get; }

Gets the automatic shutdown time value for the printer in minutes. Will return "null" if the connected printer is not an M211 or M511.

string? LastConnectedPrinterName { get; }

Returns the printer name of the last printer that was successfully connected to. The printer's other information is stored internally and will only be cleared after calling "DisconnectAsync()" or "ForgetLastConnectedPrinter()". Even when closing the application, this information will always be retrievable. This is used for automatic connection capabilities.

Automatic Connection Example:

  • If "LastConnectedPrinterName" returns a printer name, you may simply pass in "null" to the "ConnectToPrinterAsync" method.

  • If "LastConnectedPrinterName" is null, you must start discovery to connect to an available printer. This will take longer than the option above.

bool? HasOwnership { get; }

This method is only applicable when using an M211 and M610. Returns true if your mobile device has claimed ownership of the M211. This DOES NOT necessarily mean you are connected. The blue light on the printer should turn solid blue when you gain ownership regardless if you are connected or not. This light will stay solid blue only until the Disconnect method is called. Even when the app is closed and the printer disconnects, the light should stay solid blue.

List<DiscoveredPrinterInformation> Printers { get; }

Gets the list of printers discovered during the last discovery session.

PrinterStatus PrinterStatus { get; }

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

string? PrinterStatusMessage { get; }

Returns a String that represents the body of a printer error message.

string? PrinterStatusMessageTitle { get; }

Returns a String that represents the title of the printer error.

string? PrinterStatusRemedyExplanationMessage { get; }

Returns a String that represents the remedy to a printer error.

string? PrinterStatusErrorSeverity { get; }

Returns a String that represents the printer error severity. Could be "Warning", "Error", or "Information".

string? PrinterName { get; }

Returns a String that represents the name of the connected printer.

PrinterModel? PrinterModel { get; }

Returns a PrinterModel enumeration value that represents the model of the connected printer.

PrinterModel is a custom enumeration whose values represent the supported printers. These values are M211, M511, M611, M610, M710, S3700, i5300, i7500.

ConnectionType? ConnectionType { get; }

Returns a ConnectionType enumeration value that represents the protocol the current printer was connected with. Can be "BLE", "Wifi", or "Bluetooth".

ConnectionType is a custom enum and one of the properties of DiscoveredPrinterInformation. This specifies how this printer was discovered and how it must be connected to. Please note that the same printer can be sent by the PrinterDiscoveredEvent. One could be of the "BLE" ConnectionType and one could be of the "Wifi" ConnectionType. This demonstrates how a user may specify which protocol will be used to connect to a printer.

int? BatteryLevelPercentage { get; }

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

bool? isAcConnected { get; }

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

string? SupplyName { get; }

Returns a String that represents the full name of the part loaded in the connected printer.

string? SupplyRemainingPercentage { get; }

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

double? SupplyWidth { get; }

Returns a Double that represents the Width in inches of the supply installed in the printer

double? SupplyHeight { get; }

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

Color? SupplyColor { get; }

Returns a Color object that represents the color of the supply installed in the connected printer.

Color? RibbonColor { get; }

Returns a Color object that represents the color of the ribbon installed in the connected printer.

bool? IsSupplyPreSized { get; }

Returns a Boolean that represents if the installed part in the connected printer is a pre-sized part. If false, the part could be continuous or another part not categorized as die-cut

bool? IsSupplyDirectThermal { get; }

Returns a Boolean that represents if the installed part in the connected printer is a direct thermal part. These only exist for the i7500 printer at the moment.

int? DotsPerInch { get; }

Returns an integer that represents the dots per inch capability of the connected printer. This will default to 300 since the M211 is the only supported printer that is different (203 dpi).

PostPrintAccessoryType PostPrintAccessoryType { get; }

Returns a PostPrintAccessoryType enumeration value that represents the name of the post print accessory that is installed on the connected printer. This property is only supported by the i7500 printer.

Refer to the "PostPrintAccessoryType.swift" for documentation on all possible values.

bool? SuppliesMatch { get; }

Compares the part in the connected printer to the part used to create the template. Returns true if the parts match, false if they are different. If a Template has not been set, this property will return false as well.

bool? IsSupplyValid { get; }

Gets a value indicating whether the supply is pre-sized. If not, the supply installed in the connected printer is continuous.

string? YNumber { get; }

Returns a string representing the installed supply's unique Y Number.

string? RibbonName { get; }

Returns a string representing the name of the installed ribbon. Will always return an empty string for printers that are not applicable (M211 and M511).

bool? IsRibbonValid { get; }

Gets a value indicating whether the installed ribbon in the connected printer is valid for printing.

int? RibbonRemainingPercentage { get; }

Returns an int representing the percentage of ribbon remaining inside the connected printer.

int? RibbonColor { get; }

Returns an int representing the color of the ribbon installed in the connected printer.

string? TemplateSupplyName { get; }

Returns a string that represents information about the part that was selected when designing the current template.

Dictionary<string, string>? TemplateDataNames { get; }

Returns a Dictionary where the keys represent the object names on the currently set template and where the values represent the type of object they are.

event EventHandler<DiscoveredPrinterInformation>? PrinterDiscoveredEvent

Must subscribe to this event for it to trigger. For example: bradySdk.PrinterDiscoveredEvent += HandlePrinterDiscovery; where "HandlePrinterDiscovery" is a function defined like "private void HandlePrinterDiscovery(object? sender, DiscoveredPrinterInformation printer){}"

This callback will trigger and provide a new DiscoveredPrinterInformation object whenever the Brady Print SDK discovers a printer. It is suggested to save each of these objects to a local list.

event EventHandler<DiscoveredPrinterInformation>? PrinterRemovedEvent

Must subscribe to this event for it to trigger. For example: bradySdk.PrinterRemovedEvent += HandlePrinterRemoval; where "HandlePrinterRemoval" is a function defined like "private void HandlePrinterRemoval(object? sender, DiscoveredPrinterInformation printer){}"

This callback will trigger and provide a DiscoveredPrinterInformation object whenever the Brady Print SDK "loses sight" of a discovered printer. Internally, if the SDK no longer discovers a past printer for 30 seconds, this callback will trigger. It is suggested to remove this object from the local "discovered printers" list (read PrinterDiscoveredEvent docs above).

event EventHandler<IEnumerable<PrinterProperties>>? PrinterUpdateEvent

Must subscribe to this event for it to trigger. For example: bradySdk.PrinterUpdateEvent += HandlePrinterUpdates; where "HandlePrinterUpdates" is a function defined like "private void HandlePrinterUpdates(object? sender, IEnumerable<PrinterProperties> updates){}"

This callback will trigger and provide PrinterProperties whenever a change occurs with the connected printer. It is suggested to iterate through this IEnumerable and save the value of the property with the same name.

For example, if an item in the returned IEnumerable is "PrinterStatus", the IBradySdk.PrinterStatus should be called because the SDK is notifying the app that this value has changed.