CMB SDK iOS
CDMDataManSystem Class Reference

#import <CDMDataManSystem.h>

Inheritance diagram for CDMDataManSystem:

Instance Methods

(typedef) - NS_ENUM
 
(typedef) - NS_OPTIONS
 
(void) - setPreviewContainer:
 
Instance methods


(BOOL) - connect
 
(BOOL) - connectWithUsername:password:
 
(void) - disconnect
 
(BOOL) - sendCommand:
 
(BOOL) - sendCommand:withCallback:
 
(BOOL) - sendCommand:withData:timeout:expectBinaryResponse:callback:
 
(BOOL) - sendBatchCommands:completed:
 
(void) - acceptIncomingConnection:
 
(void) - enableHeartbeatWithInterval:
 
(void) - disableHeartbeat
 
(void) - enableLiveImageWithFormat:imageSize:imageQuality:callback:
 
(void) - disableLiveImage
 

Class Methods

(NSString *) + getVersion
 
(CDMDataManSystem *) + dataManSystemWithHostname:port:delegate:
 
(CDMDataManSystem *) + dataManSystemWithAccessory:delegate:
 
(CDMDataManSystem *) + dataManSystemOfExternalAccessoryWithDelegate:
 
(CDMDataManSystem *) + dataManSystemWithCameraMode:previewOptions:nullablePreviewView:delegate:
 

Properties

DataManDeviceClass deviceClass
 
CDMConnectionState connectionState
 
id< CDMDataManSystemDelegate > delegate
 
CDMResultTypes resultTypes
 
BOOL heartbeatEnabled
 
BOOL liveImageEnabled
 
NSTimeInterval timeout
 
BOOL connected
 

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: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
previewViewCamera preview will be attached on that view, can be null (in which case, camera preview will be streamed in the image delegate).
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

◆ 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

◆ NS_ENUM()

- (typedef) NS_ENUM (NSInteger) 
(CDMCameraMode)   

Specifies the preview/illumination mode when using the Mobile device camera.

Use camera with no aimer. Preview is on, illumination is available.

Use camera with a basic aimer (e.g., StingRay). Preview is off, illumination is not available.

Use camera with an active aimer (e.g., MX-100). Preview is off, illumination is available.

Use mobile device front camera. Preview is on, illumination is not available.

◆ NS_OPTIONS()

- (typedef) NS_OPTIONS (NSInteger) 
(CDMPreviewOption)   

Controls the preview/scanning options when using the Mobile device camera. Preview defaults are set by the CDMCameraMode but can be overridden. Multiple options can be OR'd together.

Use defaults (no overrides).

Disable zoom feature (removes zoom button from preview).

Disable illumination (removes illumination button from preview).

Enables the simulated hardware trigger (the volume down button).

When scanning starts, the preview is displayed but decoding is paused until a trigger (either the on screen button or the volume down button, if enabled) is pressed.

Force the preview to be displayed, even if off by default (e.g., when using kCDMCameraModePassiveAimer or kCDMCameraModeActiveAimer).

◆ sendBatchCommands:completed:()

- (BOOL) sendBatchCommands: (NSArray *)  commands
completed: (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

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 file: