Cognex Mobile Barcode SDK
SDK for supporting communication with Cognex Barcode Reader devices
CDMDataManSystem Class Reference

Represents a remote DataMan system. More...

#import <CDMDataManSystem.h>

Inheritance diagram for CDMDataManSystem:

Instance Methods

(void) - setCameraPreviewContainer:completion:
 
Sets the container where the camera preview will be placed. More...
 
Instance methods


(BOOL) - connect
 Connects to a remote system without authentication. More...
 
(BOOL) - connectWithUsername:password:
 
Connects to a remote system, authenticating with the specified username and password. More...
 
(void) - disconnect
 Disconnects from the remote system. More...
 
(BOOL) - sendCommand:
 Sends the specified command to the connected remote system. More...
 
(BOOL) - sendCommand:withCallback:
 
Sends the specified command to the connected remote system More...
 
(BOOL) - sendCommand:withData:timeout:expectBinaryResponse:callback:
 Sends the specified command to the connected remote system. More...
 
(BOOL) - sendBatchCommands:completed:
 Sends the specified commands array to the connected remote system. More...
 
(void) - acceptIncomingConnection:
 
Changes whether the DataMan system accepts incoming messages or not. More...
 
(void) - enableHeartbeatWithInterval:
 
Enables heartbeat function and sets its interval. More...
 
(void) - disableHeartbeat
 Disables the heartbeat when enabled. More...
 
(void) - enableLiveImageWithFormat:imageSize:imageQuality:callback:
 Begins getting the latest image from the connected remote system in live display mode. More...
 
(void) - disableLiveImage
 Stops a pending live image retrieval operation. More...
 

Class Methods

(NSString *) + getVersion
 Returns the current version of the library. More...
 
(CDMDataManSystem *) + dataManSystemWithHostname:port:delegate:
 Constructs a DataMan system with hostname and port. More...
 
(CDMDataManSystem *) + dataManSystemWithAccessory:delegate:
 
Constructs a DataMan system with accessory connector. More...
 
(CDMDataManSystem *) + dataManSystemOfExternalAccessoryWithDelegate:
 
Constructs a DataMan system with accessory connector. More...
 
(CDMDataManSystem *) + dataManSystemWithCameraMode:previewOptions:nullablePreviewView:delegate:
 
Constructs a DataMan system with iOS camera. More...
 
(CDMDataManSystem *) + dataManSystemWithCameraMode:previewOptions:delegate:
 
Constructs a DataMan system with iOS camera. More...
 
(CDMDataManSystem *) + dataManSystemWithCameraMode:previewOptions:nullablePreviewView:registrationKey:delegate:
 
Constructs a DataMan system with iOS camera. More...
 
(CDMDataManSystem *) + dataManSystemWithCameraMode:previewOptions:nullablePreviewView:registrationKey:customData:delegate:
 
Constructs a DataMan system with iOS camera. More...
 

Properties

DataManDeviceClass deviceClass
 Gets the device type of the CDMDataManSystem instance. More...
 
CDMConnectionState connectionState
 Gets the current connection state of the CDMDataManSystem instance. More...
 
id< CDMDataManSystemDelegate > delegate
 Sets or gets the delegate where the messages will be sent to. More...
 
CDMResultTypes resultTypes
 Sets which result types the application wants to receive. More...
 
BOOL heartbeatEnabled
 Read-only state of the heartbeat function. More...
 
BOOL liveImageEnabled
 Read-only state of live image mode. More...
 
NSTimeInterval timeout
 Timeout for commands and connection, default value is 5 sec. More...
 
BOOL connected
 Read-only connection state of the system. More...
 

Detailed Description

Represents a remote DataMan system.

Method Documentation

◆ acceptIncomingConnection:()

- (void) acceptIncomingConnection: (BOOL)  accept


Changes whether the DataMan system accepts incoming messages or not.

It does not effect an already connected device.

Parameters
acceptFlag to signal whether the incoming connection is accepted or not

◆ connect()

- (BOOL) connect

Connects to a remote system without authentication.

◆ connectWithUsername:password:()

- (BOOL) connectWithUsername: (NSString*)  username
password: (NSString*)  password 


Connects to a remote system, authenticating with the specified username and password.

If the password is specified but the username is not, the username will be "admin" by default.

Parameters
usernamethe username for the authentication
passwordthe password for the given user
Returns
YES, if the system has successfully started the connection process. (it may return NO mostly with EA devices if the session can't be opened)

◆ dataManSystemOfExternalAccessoryWithDelegate:()

+ (CDMDataManSystem *) dataManSystemOfExternalAccessoryWithDelegate: (id<CDMDataManSystemDelegate>)  delegate


Constructs a DataMan system with accessory connector.

To properly detect and connect to the device, be sure to declare UISupportedExternalAccessoryProtocols key with Cognex DMCC protocol (com.cognex.dmcc) item in Info.plist.

Parameters
delegateThe delegate where the messages will be sent to
Returns
DataMan system with external accessory connection configured or nil, if there is no supported accessory connected
See also
CDMDataManSystemDelegate

◆ dataManSystemWithAccessory:delegate:()

+ (CDMDataManSystem *) dataManSystemWithAccessory: (EAAccessory*)  accessory
delegate: (id<CDMDataManSystemDelegate>)  delegate 


Constructs a DataMan system with accessory connector.

To properly detect and connect to the device, be sure to declare UISupportedExternalAccessoryProtocols key with Cognex DMCC protocol (com.cognex.dmcc) item in Info.plist.

Parameters
accessoryThe EAAccessory object with information about the connected device
delegateThe delegate where the messages will be sent to
Returns
DataMan system with external accessory connection configured or nil, if the accessory is not a CDM device
See also
CDMDataManSystemDelegate

◆ dataManSystemWithCameraMode:previewOptions:delegate:()

+ (CDMDataManSystem *) dataManSystemWithCameraMode: (CDMCameraMode cameraMode
previewOptions: (CDMPreviewOption previewOptions
delegate: (id<CDMDataManSystemDelegate>)  delegate 


Constructs a DataMan system with iOS camera.

To properly detect and connect to the device, be sure to declare NSCameraUsageDescription key with Cognex DMCC protocol (com.cognex.dmcc) item in Info.plist.

Parameters
cameraModeCheck CDMCameraMode for possible values.
previewOptionsCheck CDMPreviewOption for possible values.
delegateThe delegate where the messages will be sent to
Returns
DataMan system using the devices built in camera
See also
CDMDataManSystemDelegate

◆ dataManSystemWithCameraMode:previewOptions:nullablePreviewView:delegate:()

+ (CDMDataManSystem *) dataManSystemWithCameraMode: (CDMCameraMode cameraMode
previewOptions: (CDMPreviewOption previewOptions
nullablePreviewView: (UIView*)  previewView
delegate: (id<CDMDataManSystemDelegate>)  delegate 


Constructs a DataMan system with iOS camera.

To properly detect and connect to the device, be sure to declare NSCameraUsageDescription key with Cognex DMCC protocol (com.cognex.dmcc) item in Info.plist.

Parameters
cameraModeCheck CDMCameraMode for possible values.
previewOptionsCheck CDMPreviewOption for possible values.
previewViewCamera preview will be attached on that view, can be null (in which case, camera preview will be in full screen).
delegateThe delegate where the messages will be sent to
Returns
DataMan system using the devices built in camera
See also
CDMDataManSystemDelegate

◆ dataManSystemWithCameraMode:previewOptions:nullablePreviewView:registrationKey:customData:delegate:()

+ (CDMDataManSystem *) dataManSystemWithCameraMode: (CDMCameraMode cameraMode
previewOptions: (CDMPreviewOption previewOptions
nullablePreviewView: (UIView*)  previewView
registrationKey: (NSString*)  registrationKey
customData: (NSString*)  customData
delegate: (id<CDMDataManSystemDelegate>)  delegate 


Constructs a DataMan system with iOS camera.

To properly detect and connect to the device, be sure to declare NSCameraUsageDescription key with Cognex DMCC protocol (com.cognex.dmcc) item in Info.plist.

Parameters
cameraModeCheck CDMCameraMode for possible values.
previewOptionsCheck CDMPreviewOption for possible values.
previewViewCamera preview will be attached on that view, can be null (in which case, camera preview will be in full screen).
registrationKeyThe license key for registering the camera scanner.
customDataCustom string to be send to the licensing server for tracking purposes.
delegateThe delegate where the messages will be sent to
Returns
DataMan system using the devices built in camera
See also
CDMDataManSystemDelegate

◆ dataManSystemWithCameraMode:previewOptions:nullablePreviewView:registrationKey:delegate:()

+ (CDMDataManSystem *) dataManSystemWithCameraMode: (CDMCameraMode cameraMode
previewOptions: (CDMPreviewOption previewOptions
nullablePreviewView: (UIView*)  previewView
registrationKey: (NSString*)  registrationKey
delegate: (id<CDMDataManSystemDelegate>)  delegate 


Constructs a DataMan system with iOS camera.

To properly detect and connect to the device, be sure to declare NSCameraUsageDescription key with Cognex DMCC protocol (com.cognex.dmcc) item in Info.plist.

Parameters
cameraModeCheck CDMCameraMode for possible values.
previewOptionsCheck CDMPreviewOption for possible values.
previewViewCamera preview will be attached on that view, can be null (in which case, camera preview will be in full screen).
registrationKeyThe license key for registering the camera scanner.
delegateThe delegate where the messages will be sent to
Returns
DataMan system using the devices built in camera
See also
CDMDataManSystemDelegate

◆ dataManSystemWithHostname:port:delegate:()

+ (CDMDataManSystem *) dataManSystemWithHostname: (NSString *)  hostname
port: (int)  port
delegate: (id<CDMDataManSystemDelegate>)  delegate 

Constructs a DataMan system with hostname and port.

This factory method constructs a new DataMan system with an ethernet connector configured inside.

Parameters
hostnameThe hostname of the remote system
portThe port of the remote system
delegateThe delegate where the messages will be sent to
Returns
DataMan system with ethernet connection configured
See also
CDMDataManSystemDelegate

◆ disableHeartbeat()

- (void) disableHeartbeat

Disables the heartbeat when enabled.

◆ disableLiveImage()

- (void) disableLiveImage

Stops a pending live image retrieval operation.

◆ disconnect()

- (void) disconnect

Disconnects from the remote system.

◆ enableHeartbeatWithInterval:()

- (void) enableHeartbeatWithInterval: (NSTimeInterval)  interval


Enables heartbeat function and sets its interval.

Parameters
intervalSpecifies heartbeat interval in seconds

◆ enableLiveImageWithFormat:imageSize:imageQuality:callback:()

- (void) enableLiveImageWithFormat: (CDMImageFormat imageFormat
imageSize: (CDMImageSize imageSize
imageQuality: (CDMImageQuality quality
callback: (void(^)(UIImage* image, CDMResponse* response))  callback 

Begins getting the latest image from the connected remote system in live display mode.

Parameters
imageFormatImage format
imageSizeImage size
qualityImage quality
callbackCallback block with image to be called when operation completes

◆ getVersion()

+ (NSString *) getVersion

Returns the current version of the library.

Returns
current DataMan SDK version

◆ sendBatchCommands:completed:()

- (BOOL) sendBatchCommands: (NSArray *)  commands
completed: (void(^)(void))  complete 

Sends the specified commands array to the connected remote system.

Parameters
commandsThe array of commands to send to the remote system
completeA callback that will be called when all the commands are sent
Returns
YES, if the system is connected and the command can be sent, NO otherwise

◆ sendCommand:()

- (BOOL) sendCommand: (NSString *)  command

Sends the specified command to the connected remote system.

Parameters
commandThe command to send to the remote system
Returns
YES, if the system is connected and the command can be sent, NO otherwise

◆ sendCommand:withCallback:()

- (BOOL) sendCommand: (NSString *)  command
withCallback: (void(^)(CDMResponse *response))  callback 


Sends the specified command to the connected remote system

Code samples:

[self.dataManSystem sendCommand:@"TRIGGER ON" withCallback:^(CDMResponse *response){
if (response.status == DMCC_STATUS_NO_ERROR) {
// command has succeed.
} else {
// handle error
}
}];
[self.dataManSystem sendCommand:@"GET TRAINED-CODE.INFO" withCallback:^(CDMResponse *response){
if (response.status == DMCC_STATUS_NO_ERROR) {
if ([response.payload isEqualToString:@"Untrained"]) {
// device is untrained
} else {
// device is trained
}
}
}];
Parameters
commandThe command to send to the remote system
callbackA callback that will be called when the command is completed
Returns
YES, if the system is connected and the command can be sent, NO otherwise

◆ sendCommand:withData:timeout:expectBinaryResponse:callback:()

- (BOOL) sendCommand: (NSString *)  command
withData: (NSData *)  data
timeout: (NSTimeInterval)  timeout
expectBinaryResponse: (BOOL)  expectBinaryResponse
callback: (void(^)(CDMResponse *response))  callback 

Sends the specified command to the connected remote system.

Parameters
commandThe command to send to the remote system
dataAdditional data to send to the remote system
timeoutTimeout for the command
expectBinaryResponseFlag to signal if we expect binary response
callbackA callback that will be called when the command is completed
Returns
YES, if the system is connected and the command can be sent, NO otherwise

◆ setCameraPreviewContainer:completion:()

- (void) setCameraPreviewContainer: (UIView*)  previewContainer
completion: (void(^)(NSError *error))  completionBlock 


Sets the container where the camera preview will be placed.

Parameters
previewContainerThe container where the camera preview will be placed.
completionBlockThe block will contain an error when used on connector other than the Phone Camera Method is only supported for Phone Camera

Property Documentation

◆ connected

- (BOOL) connected
readatomicassign

Read-only connection state of the system.

◆ connectionState

- (CDMConnectionState) connectionState
readatomicassign

Gets the current connection state of the CDMDataManSystem instance.

◆ delegate

- (id<CDMDataManSystemDelegate>) delegate
readwriteatomicweak

Sets or gets the delegate where the messages will be sent to.

See also
CDMDataManSystemDelegate

◆ deviceClass

- (DataManDeviceClass) deviceClass
readatomicassign

Gets the device type of the CDMDataManSystem instance.

◆ heartbeatEnabled

- (BOOL) heartbeatEnabled
readatomicassign

Read-only state of the heartbeat function.

◆ liveImageEnabled

- (BOOL) liveImageEnabled
readatomicassign

Read-only state of live image mode.

◆ resultTypes

- (CDMResultTypes) resultTypes
readwritenonatomicassign

Sets which result types the application wants to receive.

◆ timeout

- (NSTimeInterval) timeout
readwritenonatomicassign

Timeout for commands and connection, default value is 5 sec.


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