ZSDK_API
1.4.957
|
A utility class used to wrap and send SGD commands to a connection. More...
#import <SGD.h>
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. | |
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];
+ (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.
setting | The SGD setting. |
value | The setting's value. |
printerConnection | The connection to send the command to. |
error | Will be set to the error that occured. |
+ (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.
setting | The SGD setting. |
value | The setting's value. |
printerConnection | The connection to send the command to. |
maxTimeoutForRead | The maximum time, in milliseconds, to wait for a response from the printer. |
timeToWaitForMoreData | The maximum time, in milliseconds, to wait in between reads after the initial data is received. |
error | Will be set to the error that occured. |
+ (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.
setting | The SGD setting. |
printerConnection | The connection to send the command to. |
error | Will be set to the error that occured. |
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.
setting | The SGD setting. |
printerConnection | The connection to send the command to. |
maxTimeoutForRead | The maximum time, in milliseconds, to wait for a response from the printer. |
timeToWaitForMoreData | The maximum time, in milliseconds, to wait in between reads after the initial data |
error | Will be set to the error that occured. |
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.
setting | The SGD setting. |
value | The setting's value. |
printerConnection | The connection to send the command to. |
error | Will be set to the error that occured. |
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.
setting | The SGD setting. |
value | The setting's value. |
printerConnection | The connection to send the command to. |
error | Will be set to the error that occured. |
NO
if there was an error sending the SGD.