Click or drag to resize

Profile Class

Interface to access the contents of a .zprofile file.
Inheritance Hierarchy
SystemObject
  Zebra.Sdk.DeviceProfile

Namespace:  Zebra.Sdk.Device
Assembly:  SdkApi_Core (in SdkApi_Core.dll) Version: 2.14.1869
Syntax
public class Profile : Device, SettingsProvider, 
	FileUtil, FontUtil, AlertProvider, FileUtilLinkOs, GraphicsUtil

The Profile type exposes the following members.

Constructors
  NameDescription
Public methodProfile
Create a Profile object backed by an existing .zprofile file.
Top
Methods
  NameDescription
Public methodAddFirmware(String)
Adds a firmware file to an existing printer profile.
Public methodAddFirmware(String, Byte)
Adds a firmware file to an existing printer profile.
Public methodAddSupplement
Adds data to supplement an existing printer profile.
Public methodConfigureAlert
Configures an alert to be triggered when the alert's condition occurs or becomes resolved.
Public methodConfigureAlerts
Configures a list of alerts to be triggered when their conditions occur or become resolved.
Public methodDeleteFile
Deletes the file from the profile. The filePath may also contain wildcards.
Public methodDownloadTteFont(Stream, String)
Adds a TrueType® font to a profile and stores it at the specified path as a TrueType® extension (TTE).
Public methodDownloadTteFont(String, String)
Adds a TrueType® font file to a profile and stores it at the specified path as a TrueType® extension (TTE).
Public methodDownloadTtfFont(Stream, String)
Adds a TrueType® font file to a profile and stores it at the specified path as a TTF.
Public methodDownloadTtfFont(String, String)
Adds a TrueType® font file to a profile and stores it at the specified path as a TTF.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetAllSettings
Retrieve all settings and their attributes.
Public methodGetAllSettingValues
Retrieves all of the profile's setting values.
Public methodGetArchivableSettingValues
Retrieve the values of all the settings that are archivable.
Public methodGetAvailableSettings
Retrieve all of the setting identifiers for a profile.
Public methodGetClonableSettingValues
Retrieve the values of all the settings that are clonable.
Public methodGetConfiguredAlerts
A list of objects detailing the alert configurations in a profile.
Public methodGetFirmwareFilename
Returns the file name of the firmware file within the profile.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetObjectFromPrinter(String)
Retrieves a file from the profile and returns the contents of that file as a byte array.
Public methodGetObjectFromPrinter(Stream, String)
Retrieves a file from the printer's file system and writes the contents of that file to destinationStream.
Public methodGetObjectFromPrinterViaFtp(String, String)
This method is not valid for a profile.
Public methodGetObjectFromPrinterViaFtp(Stream, String, String)
This method is not valid for a profile.
Public methodGetPrinterDownloadableObjectFromPrinter
Retrieves a file from the profile and returns the contents of that file as a byte array including all necessary file wrappers for re-downloading to a Zebra printer.
Public methodGetSetting
Retrieves the profile's Setting for a setting id.
Public methodGetSettingRange
Retrieves the allowable range for a setting.
Public methodGetSettingsValues
Retrieves the profile's setting values for a list of setting ids.
Public methodGetSettingType
Returns the data type of the setting.
Public methodGetSettingValue
Retrieves the profile's setting value for a setting id.
Public methodGetStorageInfo
This method is not valid for a profile.
Public methodGetSupplement
Returns the supplement data within the profile.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIsSettingReadOnly
Returns true if the setting is read only.
Public methodIsSettingValid
Returns true if value is valid for the given setting.
Public methodIsSettingWriteOnly
Returns true if the setting is write only.
Public methodPrintImage(String, Int32, Int32)
Prints an image from the connecting device file system to the connected device as a monochrome image.
Public methodPrintImage(String, Int32, Int32, Int32, Int32, Boolean)
Prints an image from the connecting device file system to the connected device as a monochrome image.
Public methodPrintImage(ZebraImageI, Int32, Int32, Int32, Int32, Boolean)
Prints an image to the connected device as a monochrome image.
Public methodProcessSettingsViaMap
Change or retrieve settings in the profile.
Public methodRemoveAlert
Removes a configured alert from a profile.
Public methodRemoveAllAlerts
Removes all alerts currently in a profile.
Public methodRemoveFirmware
Removes the firmware file from the profile.
Public methodRetrieveFileNames
Retrieves the names of the files which are in the profile.
Public methodRetrieveFileNames(String)
Retrieves the names of the files which are stored on the device.
Public methodRetrieveObjectsProperties
Retrieves the properties of the objects which are stored on the device.
Public methodSendContents
Adds a file to the profile named fileNameOnPrinter with the file contents from fileContents.
Public methodSendFileContents(String)
This method is not valid for a profile.
Public methodSendFileContents(String, ProgressMonitor)
This method is not valid for a profile.
Public methodSetAllSettings
Change settings in the profile.
Public methodSetSetting(String, String)
Change the value of the setting in the profile to the given value.
Public methodSetSetting(String, Setting)
Change the setting in the profile.
Public methodSetSettings
Set more than one setting.
Public methodStoreFileOnPrinter(String)
Stores the file in the profile using any required file wrappers.
Public methodStoreFileOnPrinter(Byte, String)
Stores a file in the profile named fileNameOnPrinter with the file contents from fileContents using any required file wrappers.
Public methodStoreFileOnPrinter(String, String)
Stores the file in the profile at the specified location and name using any required file wrappers.
Public methodStoreImage(String, String, Int32, Int32)
Stores the specified image to the connected printer as a monochrome image.
Public methodStoreImage(String, ZebraImageI, Int32, Int32)
Stores the specified image to the connected printer as a monochrome image.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Examples
using System;
using System.IO;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Device;
using Zebra.Sdk.Printer;
using Zebra.Sdk.Settings;

public class ProfileExample {

    public static void Main(string[] args) {
        string pathToProfile = "C:\\MyNewProfile.zprofile";
        string printerToClone = "1.2.3.4";
        string targetPrinter = "192.168.1.33";
        string darknessSettingId = "print.tone";
        string newDarknessValue = "10.0";

        TcpConnection connection = new TcpConnection(printerToClone, TcpConnection.DEFAULT_ZPL_TCP_PORT);
        TcpConnection targetPrinterConnection = new TcpConnection(targetPrinter, TcpConnection.DEFAULT_ZPL_TCP_PORT);

        try {
            connection.Open();
            ZebraPrinter genericPrinter = ZebraPrinterFactory.GetInstance(connection);
            ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.CreateLinkOsPrinter(genericPrinter);
            if (linkOsPrinter != null) {
                Console.WriteLine("Start profile operation");

                // Create a profile containing the settings from printerToClone.
                linkOsPrinter.CreateProfile(pathToProfile);
                Console.WriteLine("Done");
            }
            connection.Close();

            // Change the darkness in the profile.
            Profile profileForCloning = new Profile(pathToProfile);

            if (profileForCloning.GetAvailableSettings().Contains(darknessSettingId) &&
                profileForCloning.IsSettingValid(darknessSettingId, newDarknessValue) &&
                profileForCloning.IsSettingReadOnly(darknessSettingId) == false) {

                profileForCloning.SetSetting(darknessSettingId, newDarknessValue);
            }

            targetPrinterConnection.Open();
            ZebraPrinter genericTargetPrinter = ZebraPrinterFactory.GetInstance(targetPrinterConnection);
            ZebraPrinterLinkOs linkOsTargetPrinter = ZebraPrinterFactory.CreateLinkOsPrinter(genericTargetPrinter);
            if (linkOsTargetPrinter != null) {
                Console.WriteLine("Start cloning operation");

                // Clone the profile to targetPrinter
                linkOsTargetPrinter.LoadProfile(pathToProfile);
                Console.WriteLine("Done");
            }
        } catch (ConnectionException e) {
            Console.WriteLine("Could not use connection");
            Console.WriteLine(e.ToString());
        } catch (ZebraPrinterLanguageUnknownException e) {
            Console.WriteLine("Could not recognize Zebra printer");
            Console.WriteLine(e.ToString());
        } catch (ZebraIllegalArgumentException e) {
            Console.WriteLine("Unexpected response from Zebra printer");
            Console.WriteLine(e.ToString());
        } catch (IOException e) {
            Console.WriteLine("Could not write to " + pathToProfile);
            Console.WriteLine(e.ToString());
        } catch (SettingsException e) {
            Console.WriteLine("Could not access " + darknessSettingId);
            Console.WriteLine(e.ToString());
        } finally {
            connection.Close();
            targetPrinterConnection.Close();
        }
    }
}
See Also