Cognex Mobile Barcode SDK SDK for supporting communication with Cognex Barcode Reader devices

Instance Methods | Class Methods | Properties | List of all members
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

  completionBlock | the 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

  completionBlock | The 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

  completionBlock | The 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

  completionBlock | The 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

  symbology | The CMBSymbology to check
  completionBlock | The 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

  completionBlock | The 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

  peripheralUUID | The UUID of the CBPeripheral object you want to connect to.
  psm | The 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

  cameraMode | The CDMDataManSystem::CDMCameraMode when using the Mobile device camera.
  previewOptions | The 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

  cameraMode | The CDMDataManSystem::CDMCameraMode when using the Mobile device camera.
  previewOptions | The CDMPreviewOption when using the Mobile device camera.
  previewContainer | The 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

  cameraMode | The CDMDataManSystem::CDMCameraMode when using the Mobile device camera.
  previewOptions | The CDMPreviewOption when using the Mobile device camera.
  previewContainer | The container where the camera preview will be placed.
  registrationKey | The 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

  cameraMode | The CDMDataManSystem::CDMCameraMode when using the Mobile device camera.
  previewOptions | The CDMPreviewOption when using the Mobile device camera.
  previewContainer | The container where the camera preview will be placed.
  registrationKey | The registration key for the Phone Camera license.
  customData | The 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

  completionBlock | The 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

  exposureCompensation | Float value that will be set as exposure compensation
  completionBlock | The 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

  previewContainer | The container where the camera preview will be placed.
  completionBlock | The 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

  on | true, to turn on the lights, false to turn off the lights
  completionBlock | The 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

  symbology | The CMBSymbology to enable or disable
  enabled | true to enable, false to disable
  completionBlock | The block to be called as the setting completes

## Property Documentation

## ◆ availability

- (CMBReaderAvailibility) availability
| read atomic assign

Returns the availability of the reader.

Returns
  CMBReaderAvailibility state of the reader

See also
  CMBReaderAvailibility

## ◆ connectionState

- (CMBConnectionState) connectionState
| read atomic assign

Returns the current connection state of the reader.

Returns
  the current CMBConnectionState of the reader

See also
  CMBConnectionState

## ◆ delegate

- (id<CMBReaderDeviceDelegate> _Nullable) delegate
| read write atomic weak

Delegate object to receive events from the CMBReaderDevice object.

See also
  CMBReaderDeviceDelegate

## ◆ parser

- (CMBResultParser) parser
| read write atomic assign

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
| read write atomic assign

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:

- CMBReaderDevice.h