UniPRT SDK v2.0.0.0
 
Loading...
Searching...
No Matches
JsonConfig Class Reference

A class for managing configuration through JSON communication. More...

#include <JsonConfig.h>

Inheritance diagram for JsonConfig:

Instance Methods

(instancetype) - initWithTcpComm:usingDataPort:
 Must pass an opened TcpComm connection that can remain opened if listening for unsolicited messages from printer.
 
(instancetype) - initWithBtComm:usingDataPort:
 Initializes with an opened BtComm connection.
 
(instancetype) - initWithBleComm:usingDataPort:
 Initializes with an opened BleComm connection.
 
(instancetype) - initWithUsbComm:usingDataPort:
 Initializes with an opened UsbComm connection.
 
(instancetype) - initWithJsonComm:
 Initializes a new instance with the given JSON communication object.
 
(instancetype) - initWithCommDescriptor:
 Constructor called when creating a connection managed by the SDK.
 
(NSArray< Config * > *) - getAllConfigWithTimeout:
 Destructor for the JsonConfig object.
 
(Config *) - getConfigWithNumber:timeout:
 Gets the configuration with the specified number.
 
(BOOL) - setConfig:pCfg:
 Sets the specified configuration.
 

Detailed Description

A class for managing configuration through JSON communication.

Method Documentation

◆ getAllConfigWithTimeout:

- (NSArray< Config * > *) getAllConfigWithTimeout: (int) timeout

Destructor for the JsonConfig object.

Gets all configurations with a timeout.

This method retrieves all available configuration objects from the device within the specified timeout period.

Parameters
timeoutThe maximum time to wait (in milliseconds).
Returns
An array of Config objects representing all configurations.

◆ getConfigWithNumber:timeout:

- (Config *) getConfigWithNumber: (int) cfgNumber
timeout: (int) timeout 

Gets the configuration with the specified number.

This method retrieves the configuration object corresponding to the given number within the specified timeout.

Parameters
cfgNumberThe number of the configuration to retrieve.
timeoutThe maximum time to wait (in milliseconds).
Returns
The configuration object with the specified number, or nil if not found.

◆ initWithBleComm:usingDataPort:

- (instancetype) initWithBleComm: (BleComm *) connection
usingDataPort: (BOOL) usingDataPort 

Initializes with an opened BleComm connection.

Parameters
connectionThe BLE communication object.
usingDataPortWhether to use data port for communication.
Returns
An initialized instance of JsonConfig.

◆ initWithBtComm:usingDataPort:

- (instancetype) initWithBtComm: (BtComm *) connection
usingDataPort: (BOOL) usingDataPort 

Initializes with an opened BtComm connection.

Parameters
connectionThe Bluetooth communication object.
usingDataPortWhether to use data port for communication.
Returns
An initialized instance of JsonConfig.

◆ initWithCommDescriptor:

- (instancetype) initWithCommDescriptor: (NSString *) commDescriptor

Constructor called when creating a connection managed by the SDK.

Parameters
commDescriptorDescriptor for the communication used to connect with printer, TCP descriptor format: "ip" or "ip:port" e.g. "127.0.0.1" or "127.0.0.1:3007". If port is not provided, default value is used.
Returns
An initialized instance of JsonConfig, or nil if the object could not be created.

◆ initWithJsonComm:

- (instancetype) initWithJsonComm: (JsonComm *) mgmtComm

Initializes a new instance with the given JSON communication object.

Parameters
mgmtCommThe JSON communication object.
Returns
An initialized instance of JsonConfig, or nil if the object could not be created.

◆ initWithTcpComm:usingDataPort:

- (instancetype) initWithTcpComm: (TcpComm *) connection
usingDataPort: (BOOL) usingDataPort 

Must pass an opened TcpComm connection that can remain opened if listening for unsolicited messages from printer.

Parameters
connectionThe TCP communication object.
usingDataPortWhether to use data port for communication.
Returns
An initialized instance of JsonConfig, or nil if the object could not be created.

◆ initWithUsbComm:usingDataPort:

- (instancetype) initWithUsbComm: (UsbComm *) connection
usingDataPort: (BOOL) usingDataPort 

Initializes with an opened UsbComm connection.

Parameters
connectionThe USB communication object.
usingDataPortWhether to use data port for communication.
Returns
An initialized instance of JsonConfig.

◆ setConfig:pCfg:

- (BOOL) setConfig: (Config *)
pCfg: (int) timeout 

Sets the specified configuration.

This method updates the device with the given configuration object within the specified timeout.

Parameters
pCfgThe Config object representing the configuration to set.
timeoutThe maximum time to wait (in milliseconds).
Returns
YES if the configuration was successfully set, NO otherwise.

The documentation for this class was generated from the following file: