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

Represents a Phone Camera or MX barcode reader. More...

#import <CMBReaderDevice.h>

Inheritance diagram for CMBReaderDevice:

Instance Methods

(void) - setCameraPreviewContainer:completion:
 Sets the container where the camera preview will be placed. More...
 
(void) - getCameraExposureCompensationRangeWithCompletion:
 Get camera exposure compensation range (0: lower value, 1: upper value, 2: step) in the completion block. More...
 
(void) - setCameraExposureCompensation:completion:
 Sets the camera exposure compensation value. More...
 
(void) - loadCameraConfig:
 Load config from app data if exist Method is only supported for Phone Camera. More...
 
(void) - connectWithCompletion:
 Connects to the barcode reader. More...
 
(void) - disconnect
 Disconnects from a connected barcode reader.
 
(void) - startScanning
 Starts triggering.
 
(void) - stopScanning
 Stops triggering.
 
(void) - getDeviceBatteryLevelWithCompletion:
 Retrieves the current battery percentage level of the reader. More...
 
(void) - setSymbology:enabled:completion:
 Enable or disable the provided symbology on the reader. More...
 
(void) - isSymbologyEnabled:completion:
 Retrieves whether the specified symbology is enabled or disabled. More...
 
(void) - setLightsON:completion:
 Turns on or off all internal lights of the reader. More...
 
(void) - getLightsStateWithCompletion:
 Retrieves whether all lights of the barcode reader are turned on or off. More...
 
(void) - resetConfigWithCompletion:
 Resets the reader configurations to factory default. More...
 
(void) - beep
 Plays a beep on the reader.
 
(CDMDataManSystem *_Nonnull) - dataManSystem
 Returns the DataManSystem instance for this CMBReaderDevice. More...
 

Class Methods

(instancetype _Nonnull) + readerOfMXDevice
 Creates a CMBReaderDevice object for a connected MX barcode reader. More...
 
(instancetype _Nonnull) + readerOfBluetoothPeripheralUUID:psm:
 Creates a CMBReaderDevice object for a Bluetooth barcode reader. More...
 
(instancetype _Nonnull) + readerOfDeviceCameraWithCameraMode:previewOptions:
 Creates a CMBReaderDevice object for a Phone Camera barcode reader. More...
 
(instancetype _Nonnull) + readerOfDeviceCameraWithCameraMode:previewOptions:previewView:
 Creates a CMBReaderDevice object for a Phone Camera barcode reader. More...
 
(instancetype _Nonnull) + readerOfDeviceCameraWithCameraMode:previewOptions:previewView:registrationKey:
 Creates a CMBReaderDevice object for a Phone Camera barcode reader. More...
 
(instancetype _Nonnull) + readerOfDeviceCameraWithCameraMode:previewOptions:previewView:registrationKey:customData:
 Creates a CMBReaderDevice object for a Phone Camera barcode reader. More...
 

Properties

DataManDeviceClass deviceClass
 Tells the connection type of the CMBReaderDevice object.
 
CMBReaderAvailibility availability
 Returns the availability of the reader. More...
 
CMBConnectionState connectionState
 Returns the current connection state of the reader. More...
 
BOOL imageResultEnabled
 Enable or disable image results from reader.
 
BOOL SVGResultEnabled
 Enable or disable SVG image graphics results from reader.
 
CMBResultParser parser
 Optionally set a CMBResultParser to be applied to a successful read result that is parsable with the specified setting. More...
 
CMBReadStringEncoding readStringEncoding
 Set the CMBReadStringEncoding that is used to decode Read String from base64 result. More...
 
id< CMBReaderDeviceDelegate > _Nullable delegate
 Delegate object to receive events from the CMBReaderDevice object. More...
 

Detailed Description

Represents a Phone Camera or MX barcode reader.

You should instantiate this class using readerOfDeviceCameraWithCameraMode:previewOptions:previewView: (CMBReaderDevice) or readerOfMXDevice (CMBReaderDevice) class level methods.

Method Documentation

◆ connectWithCompletion:

- (void) connectWithCompletion: (void(^)(NSError *_Nullable error))  completionBlock

Connects to the barcode reader.

Parameters
completionBlockthe block to invoke as the connection process is completed.

◆ dataManSystem

- (CDMDataManSystem *_Nonnull) dataManSystem

Returns the DataManSystem instance for this CMBReaderDevice.

Returns
CDMDataManSystem instance

◆ getCameraExposureCompensationRangeWithCompletion:

- (void) getCameraExposureCompensationRangeWithCompletion: (void(^)(NSArray< NSNumber * > *_Nullable range, NSError *_Nullable error))  completionBlock

Get camera exposure compensation range (0: lower value, 1: upper value, 2: step) in the completion block.

Camera must to be opened before

Parameters
completionBlockThe block will contain an array with the minimum and maximum exposure values, or an error when used on connector other than the Phone Camera The camera needs to be started within cmbSDK at least once to get the camera exposure compensation range

◆ getDeviceBatteryLevelWithCompletion:

- (void) getDeviceBatteryLevelWithCompletion: (void(^)(int batteryLevel, NSError *_Nullable error))  completionBlock

Retrieves the current battery percentage level of the reader.

Parameters
completionBlockThe block to be called as the information is available

◆ getLightsStateWithCompletion:

- (void) getLightsStateWithCompletion: (void(^)(BOOL enabled, NSError *_Nullable error))  completionBlock

Retrieves whether all lights of the barcode reader are turned on or off.

Parameters
completionBlockThe block to be invoked as the result is available

◆ isSymbologyEnabled:completion:

- (void) isSymbologyEnabled: (CMBSymbology symbology
completion: (void(^)(BOOL enabled, NSError *_Nullable error))  completionBlock 

Retrieves whether the specified symbology is enabled or disabled.

Parameters
symbologyThe CMBSymbology to check
completionBlockThe block to be invoked as the information is available

◆ loadCameraConfig:

- (void) loadCameraConfig: (void(^)(NSError *_Nullable error))  completionBlock

Load config from app data if exist Method is only supported for Phone Camera.

Parameters
completionBlockThe block will contain an error when used on connector other than the Phone Camera

◆ readerOfBluetoothPeripheralUUID:psm:

+ (instancetype _Nonnull) readerOfBluetoothPeripheralUUID: (NSUUID *_Nonnull)  peripheralUUID
psm: (ios(11))  API_AVAILABLE 

Creates a CMBReaderDevice object for a Bluetooth barcode reader.

You should first scan for a Bluetooth device or load its saved UUID to connect.

Parameters
peripheralUUIDThe UUID of the CBPeripheral object you want to connect to.
psmThe default value is 192.
Returns
The newly created CMBReaderDevice object.

◆ readerOfDeviceCameraWithCameraMode:previewOptions:

+ (instancetype _Nonnull) readerOfDeviceCameraWithCameraMode: (CDMCameraMode cameraMode
previewOptions: (CDMPreviewOption previewOptions 

Creates a CMBReaderDevice object for a Phone Camera barcode reader.

Parameters
cameraModeThe CDMDataManSystem::CDMCameraMode when using the Mobile device camera.
previewOptionsThe CDMPreviewOption when using the Mobile device camera.
Returns
The newly created CMBReaderDevice object.

◆ readerOfDeviceCameraWithCameraMode:previewOptions:previewView:

+ (instancetype _Nonnull) readerOfDeviceCameraWithCameraMode: (CDMCameraMode cameraMode
previewOptions: (CDMPreviewOption previewOptions
previewView: (UIView *_Nullable)  previewContainer 

Creates a CMBReaderDevice object for a Phone Camera barcode reader.

Parameters
cameraModeThe CDMDataManSystem::CDMCameraMode when using the Mobile device camera.
previewOptionsThe CDMPreviewOption when using the Mobile device camera.
previewContainerThe container where the camera preview will be placed.
Returns
The newly created CMBReaderDevice object.

◆ readerOfDeviceCameraWithCameraMode:previewOptions:previewView:registrationKey:

+ (instancetype _Nonnull) readerOfDeviceCameraWithCameraMode: (CDMCameraMode cameraMode
previewOptions: (CDMPreviewOption previewOptions
previewView: (UIView *_Nullable)  previewContainer
registrationKey: (NSString *_Nullable)  registrationKey 

Creates a CMBReaderDevice object for a Phone Camera barcode reader.

Parameters
cameraModeThe CDMDataManSystem::CDMCameraMode when using the Mobile device camera.
previewOptionsThe CDMPreviewOption when using the Mobile device camera.
previewContainerThe container where the camera preview will be placed.
registrationKeyThe registration key for the Phone Camera license.
Returns
The newly created CMBReaderDevice object.

◆ readerOfDeviceCameraWithCameraMode:previewOptions:previewView:registrationKey:customData:

+ (instancetype _Nonnull) readerOfDeviceCameraWithCameraMode: (CDMCameraMode cameraMode
previewOptions: (CDMPreviewOption previewOptions
previewView: (UIView *_Nullable)  previewContainer
registrationKey: (NSString *_Nullable)  registrationKey
customData: (NSString *_Nullable)  customData 

Creates a CMBReaderDevice object for a Phone Camera barcode reader.

Parameters
cameraModeThe CDMDataManSystem::CDMCameraMode when using the Mobile device camera.
previewOptionsThe CDMPreviewOption when using the Mobile device camera.
previewContainerThe container where the camera preview will be placed.
registrationKeyThe registration key for the Phone Camera license.
customDataThe custom data used when licensing for custom tracking.
Returns
The newly created CMBReaderDevice object.

◆ readerOfMXDevice

+ (instancetype _Nonnull) readerOfMXDevice

Creates a CMBReaderDevice object for a connected MX barcode reader.

Returns
The newly created CMBReaderDevice object.

◆ resetConfigWithCompletion:

- (void) resetConfigWithCompletion: (void(^)(NSError *_Nullable error))  completionBlock

Resets the reader configurations to factory default.

Parameters
completionBlockThe block to be invoked as the operation completes

◆ setCameraExposureCompensation:completion:

- (void) setCameraExposureCompensation: (float)  exposureCompensation
completion: (void(^)(NSError *_Nullable error))  completionBlock 

Sets the camera exposure compensation value.

Parameters
exposureCompensationFloat value that will be set as exposure compensation
completionBlockThe block will contain an error when used on connector other than the Phone Camera

◆ setCameraPreviewContainer:completion:

- (void) setCameraPreviewContainer: (UIView *_Nullable)  previewContainer
completion: (void(^)(NSError *_Nullable 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

◆ setLightsON:completion:

- (void) setLightsON: (bool)  on
completion: (void(^)(NSError *_Nullable error))  completionBlock 

Turns on or off all internal lights of the reader.

Parameters
ontrue, to turn on the lights, false to turn off the lights
completionBlockThe block to be invoked as the method completes

◆ setSymbology:enabled:completion:

- (void) setSymbology: (CMBSymbology symbology
enabled: (bool)  enabled
completion: (void(^)(NSError *_Nullable error))  completionBlock 

Enable or disable the provided symbology on the reader.

Parameters
symbologyThe CMBSymbology to enable or disable
enabledtrue to enable, false to disable
completionBlockThe block to be called as the setting completes

Property Documentation

◆ availability

- (CMBReaderAvailibility) availability
readatomicassign

Returns the availability of the reader.

Returns
CMBReaderAvailibility state of the reader
See also
CMBReaderAvailibility

◆ connectionState

- (CMBConnectionState) connectionState
readatomicassign

Returns the current connection state of the reader.

Returns
the current CMBConnectionState of the reader
See also
CMBConnectionState

◆ delegate

- (id<CMBReaderDeviceDelegate> _Nullable) delegate
readwriteatomicweak

Delegate object to receive events from the CMBReaderDevice object.

See also
CMBReaderDeviceDelegate

◆ parser

- (CMBResultParser) parser
readwriteatomicassign

Optionally set a CMBResultParser to be applied to a successful read result that is parsable with the specified setting.

See also
CMBResultParser

◆ readStringEncoding

- (CMBReadStringEncoding) readStringEncoding
readwriteatomicassign

Set the CMBReadStringEncoding that is used to decode Read String from base64 result.

See also
CMBReadStringEncoding

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