ZSDK_API  1.5.1049
 All Classes Functions Enumerations Enumerator Properties Pages
SGD Class Reference

A utility class used to wrap and send SGD commands to a connection. More...

#import <SGD.h>

Inheritance diagram for SGD:

Class Methods

(BOOL) + SET:withValue:andWithPrinterConnection:error:
 Constructs an SGD SET command and sends it to the printer.
 
(BOOL) + SET:withValueAsInt:andWithPrinterConnection:error:
 Constructs an SGD SET command and sends it to the printer.
 
(NSString *) + GET:withPrinterConnection:error:
 Constructs an SGD GET command and sends it to the printer.
 
(NSString *) + GET:withPrinterConnection:withMaxTimeoutForRead:andWithTimeToWaitForMoreData:error:
 Constructs an SGD GET command and sends it to the printer.
 
(NSString *) + DO:withValue:andWithPrinterConnection:error:
 Constructs an SGD DO command and sends it to the printer.
 
(NSString *) + DO:withValue:withPrinterConnection:withMaxTimeoutForRead:andWithTimeToWaitForMoreData:error:
 Constructs an SGD DO command and sends it to the printer.
 

Detailed Description

A utility class used to wrap and send SGD commands to a connection.

Sets the IP Address of the connection.
@code 

#import "TcpPrinterConnection.h" #import "ZebraPrinter.h" #import "ZebraPrinterFactory.h" #import "SGD.h" #import <UIKit/UIKit.h>

TcpPrinterConnection *zebraPrinterConnection = [[TcpPrinterConnection alloc] initWithAddress:"192.168.1.100" andWithPort:6101]; BOOL success = [zebraPrinterConnection open]; NSError *error = nil; id<ZebraPrinter,NSObject> printer = [ZebraPrinterFactory getInstance:zebraPrinterConnection error:&error]; success = success && [SGD SET:"ip.addr" withValue:@"192.168.1.100" andWithPrinterConnection:zebraPrinterConnection error:&error];

NSString *ipAddress = [SGD GET:"ip.addr" withPrinterConnection:zebraPrinterConnection error:&error]; NSLog(@"The IP address is: %", ipAddress);

[zebraPrinterConnection close]; if (error != nil || printer == nil || success == NO) { UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [errorAlert show]; [errorAlert release]; } [zebraPrinterConnection release];

Method Documentation

+ (NSString*) DO: (NSString *)  setting
withValue: (NSString *)  value
andWithPrinterConnection: (id< ZebraPrinterConnection, NSObject >)  printerConnection
error: (NSError **)  error 

Constructs an SGD DO command and sends it to the printer.

This method waits for a maximum of getMaxTimeoutForRead (ZebraPrinterConnection-p) milliseconds for any data to be received. Once some data has been received it waits until no more data is available within getTimeToWaitForMoreData (ZebraPrinterConnection-p) milliseconds. This method returns the SGD value associated with setting without the surrounding quotes.

Parameters
settingThe SGD setting.
valueThe setting's value.
printerConnectionThe connection to send the command to.
errorWill be set to the error that occured.
Returns
The response from the SGD DO command.
+ (NSString*) DO: (NSString *)  setting
withValue: (NSString *)  value
withPrinterConnection: (id< ZebraPrinterConnection, NSObject >)  printerConnection
withMaxTimeoutForRead: (NSInteger)  maxTimeoutForRead
andWithTimeToWaitForMoreData: (NSInteger)  timeToWaitForMoreData
error: (NSError **)  error 

Constructs an SGD DO command and sends it to the printer.

This method waits for a maximum of maxTimeoutForRead milliseconds for any data to be received. Once some data has been received it waits until no more data is available within timeToWaitForMoreData milliseconds. This method returns the SGD value associated with setting without the surrounding quotes.

Parameters
settingThe SGD setting.
valueThe setting's value.
printerConnectionThe connection to send the command to.
maxTimeoutForReadThe maximum time, in milliseconds, to wait for a response from the printer.
timeToWaitForMoreDataThe maximum time, in milliseconds, to wait in between reads after the initial data is received.
errorWill be set to the error that occured.
Returns
The response from the SGD DO command.
+ (NSString*) GET: (NSString *)  setting
withPrinterConnection: (id< ZebraPrinterConnection, NSObject >)  printerConnection
error: (NSError **)  error 

Constructs an SGD GET command and sends it to the printer.

This method waits for a maximum of getMaxTimeoutForRead (ZebraPrinterConnection-p) milliseconds for any data to be received. Once some data has been received it waits until no more data is available within getTimeToWaitForMoreData (ZebraPrinterConnection-p) milliseconds. This method returns the SGD value associated with setting without the surrounding quotes.

Parameters
settingThe SGD setting.
printerConnectionThe connection to send the command to.
errorWill be set to the error that occured.
Returns
The setting's value or nil if an error occurred.
+ (NSString*) GET: (NSString *)  setting
withPrinterConnection: (id< ZebraPrinterConnection, NSObject >)  printerConnection
withMaxTimeoutForRead: (NSInteger)  maxTimeoutForRead
andWithTimeToWaitForMoreData: (NSInteger)  timeToWaitForMoreData
error: (NSError **)  error 

Constructs an SGD GET command and sends it to the printer.

This method waits for a maximum of maxTimeoutForRead milliseconds for any data to be received. Once some data has been received it waits until no more data is available within timeToWaitForMoreData milliseconds. This method returns the SGD value associated with setting without the surrounding quotes.

Parameters
settingThe SGD setting.
printerConnectionThe connection to send the command to.
maxTimeoutForReadThe maximum time, in milliseconds, to wait for a response from the printer.
timeToWaitForMoreDataThe maximum time, in milliseconds, to wait in between reads after the initial data
errorWill be set to the error that occured.
Returns
The setting's value or nil if an error occurred.
+ (BOOL) SET: (NSString *)  setting
withValue: (NSString *)  value
andWithPrinterConnection: (id< ZebraPrinterConnection, NSObject >)  printerConnection
error: (NSError **)  error 

Constructs an SGD SET command and sends it to the printer.

This method will not wait for a response from the printer. If the SGD SET command returns a response, the caller is responsible for reading the response. If a response is expected, use DO:withValue:andWithPrinterConnection:error: command.

Parameters
settingThe SGD setting.
valueThe setting's value.
printerConnectionThe connection to send the command to.
errorWill be set to the error that occured.
Returns
NO if there was an error sending the SGD.
+ (BOOL) SET: (NSString *)  setting
withValueAsInt: (NSInteger)  value
andWithPrinterConnection: (id< ZebraPrinterConnection, NSObject >)  printerConnection
error: (NSError **)  error 

Constructs an SGD SET command and sends it to the printer.

This method will not wait for a response from the printer. If the SGD SET command returns a response, the caller is responsible for reading the response. If a response is expected, use DO:withValue:andWithPrinterConnection:error: command.

Parameters
settingThe SGD setting.
valueThe setting's value.
printerConnectionThe connection to send the command to.
errorWill be set to the error that occured.
Returns
NO if there was an error sending the SGD.

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