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

CMBReaderDevice.h
Go to the documentation of this file.
1//
2// CMBReaderDevice.h
3// MX_SDK_FW
4//
5// Created by Gyula Hatalyak on 09/01/17.
6// Copyright © 2017 Gyula Hatalyak. All rights reserved.
7//
8
9#import <Foundation/Foundation.h>
10#import <UIKit/UIKit.h>
11#import <cmbSDK/CMBReadResults.h>
12#import <cmbSDK/CDMDataManSystem.h>
13#import <CoreBluetooth/CoreBluetooth.h>
14
18 typedef enum : NSUInteger {
22 CMBConnectionStateDisconnected,
26 CMBConnectionStateConnecting,
30 CMBConnectionStateConnected,
34 CMBConnectionStateDisconnecting,
38 CMBConnectionStateUnavailable
39} CMBConnectionState;
40
44 typedef enum : NSUInteger {
45 CMBReaderAvailibilityUnknown,
46 CMBReaderAvailibilityAvailable,
47 CMBReaderAvailibilityUnavailable
48} CMBReaderAvailibility;
49
50@class CMBReaderDevice;
51
55 typedef enum : NSUInteger {
56 CMBResultParserNone,
57 CMBResultParserAuto,
58 CMBResultParserAAMVA,
59 CMBResultParserGS1,
60 CMBResultParserHIBC,
61 CMBResultParserISBT128,
62 CMBResultParserIUID,
63 CMBResultParserSCM
64} CMBResultParser;
65
69 typedef enum : NSUInteger {
70 CMBReadStringEncodingAuto,
71 CMBReadStringEncodingUTF_8,
72 CMBReadStringEncodingUTF_16,
73 CMBReadStringEncodingUTF_32,
74 CMBReadStringEncodingISO_8859_1,
75 CMBReadStringEncodingISO_8859_2,
76 CMBReadStringEncodingShift_JIS,
77 CMBReadStringEncodingUS_ASCII,
78 CMBReadStringEncodingUS_ASCII_SHOW_NON_PRINTABLE
79} CMBReadStringEncoding;
80
84@protocol CMBReaderDeviceDelegate <NSObject>
85
86@optional
87
92- (void)availabilityDidChangeOfReader:(CMBReaderDevice *_Nonnull)reader;
97- (void)connectionStateDidChangeOfReader:(CMBReaderDevice *_Nonnull)reader;
98
104- (void)didReceiveReadResultFromReader:(CMBReaderDevice *_Nonnull)reader results:(CMBReadResults *_Nonnull)readResults;
105
106@end
107
112@interface CMBReaderDevice : NSObject
113
117@property (readonly) DataManDeviceClass deviceClass;
118
124@property (readonly) CMBReaderAvailibility availability;
125
131@property (readonly) CMBConnectionState connectionState;
132
136@property (readwrite) BOOL imageResultEnabled;
137
141@property (readwrite) BOOL SVGResultEnabled;
142
147@property (readwrite) CMBResultParser parser;
148
153@property (readwrite) CMBReadStringEncoding readStringEncoding;
154
159@property (weak) id<CMBReaderDeviceDelegate> _Nullable delegate;
160
165+ (instancetype _Nonnull) readerOfMXDevice;
166
173+ (instancetype _Nonnull) readerOfBluetoothPeripheralUUID:(NSUUID *_Nonnull)peripheralUUID psm:(CBL2CAPPSM)psm API_AVAILABLE(ios(11));
174
181+ (instancetype _Nonnull) readerOfDeviceCameraWithCameraMode:(CDMCameraMode)cameraMode
182 previewOptions:(CDMPreviewOption)previewOptions;
183
191+ (instancetype _Nonnull) readerOfDeviceCameraWithCameraMode:(CDMCameraMode)cameraMode
192 previewOptions:(CDMPreviewOption)previewOptions
193 previewView:(UIView*_Nullable)previewContainer;
194
203+ (instancetype _Nonnull) readerOfDeviceCameraWithCameraMode:(CDMCameraMode)cameraMode
204 previewOptions:(CDMPreviewOption)previewOptions
205 previewView:(UIView*_Nullable)previewContainer
206 registrationKey:(NSString*_Nullable)registrationKey;
207
217+ (instancetype _Nonnull ) readerOfDeviceCameraWithCameraMode:(CDMCameraMode)cameraMode
218 previewOptions:(CDMPreviewOption)previewOptions
219 previewView:(UIView*_Nullable)previewContainer
220 registrationKey:(NSString*_Nullable)registrationKey
221 customData:(NSString*_Nullable)customData;
228- (void)setCameraPreviewContainer:(UIView*_Nullable) previewContainer completion:(void (^_Nullable)(NSError *_Nullable error))completionBlock;
229
235- (void)getCameraExposureCompensationRangeWithCompletion:(void (^_Nonnull)(NSArray<NSNumber *>*_Nullable range, NSError *_Nullable error))completionBlock;
236
242- (void)setCameraExposureCompensation:(float)exposureCompensation completion:(void (^_Nullable)(NSError * _Nullable error))completionBlock;
243
249- (void)loadCameraConfig:(void (^_Nullable)(NSError * _Nullable error))completionBlock;
250
255- (void) connectWithCompletion:(void (^_Nullable)(NSError *_Nullable error))completionBlock;
256
260- (void) disconnect;
261
265- (void) startScanning;
266
270- (void) stopScanning;
271
276- (void) getDeviceBatteryLevelWithCompletion:(void (^_Nonnull)(int batteryLevel, NSError * _Nullable error))completionBlock;
277
284- (void) setSymbology:(CMBSymbology)symbology
285 enabled:(bool)enabled
286 completion:(void (^_Nullable)(NSError *_Nullable error))completionBlock;
287
293- (void) isSymbologyEnabled:(CMBSymbology)symbology
294 completion:(void (^_Nonnull)(BOOL enabled, NSError *_Nullable error))completionBlock;
295
301- (void) setLightsON:(bool)on completion:(void (^_Nonnull)(NSError *_Nullable error))completionBlock;
302
307- (void) getLightsStateWithCompletion:(void (^_Nonnull)(BOOL enabled, NSError *_Nullable error))completionBlock;
308
313- (void) resetConfigWithCompletion:(void (^_Nonnull)(NSError *_Nullable error))completionBlock;
314
318- (void) beep;
319
324- (CDMDataManSystem *_Nonnull)dataManSystem;
325
326@end
CDMCameraMode
CDMCameraMode
Specifies the preview/illumination mode when using the Mobile device camera.
Definition: CDMDataManSystem.h:143
CDMPreviewOption
CDMPreviewOption
Controls the preview/scanning options when using the Mobile device camera.
Definition: CDMDataManSystem.h:164
DataManDeviceClass
DataManDeviceClass
Specifies the device types of a CDMDataManSystem instance.
Definition: CDMDataManSystem.h:132
CMBReadStringEncoding
CMBReadStringEncoding
Possible values of Read String encoding for CMBReaderDevice.
Definition: CMBReaderDevice.h:69
CMBReadStringEncodingUS_ASCII_SHOW_NON_PRINTABLE
@ CMBReadStringEncodingUS_ASCII_SHOW_NON_PRINTABLE
Definition: CMBReaderDevice.h:78
CMBReadStringEncodingAuto
@ CMBReadStringEncodingAuto
Definition: CMBReaderDevice.h:70
CMBReadStringEncodingShift_JIS
@ CMBReadStringEncodingShift_JIS
Definition: CMBReaderDevice.h:76
CMBReadStringEncodingUTF_8
@ CMBReadStringEncodingUTF_8
Definition: CMBReaderDevice.h:71
CMBReadStringEncodingUTF_16
@ CMBReadStringEncodingUTF_16
Definition: CMBReaderDevice.h:72
CMBReadStringEncodingUS_ASCII
@ CMBReadStringEncodingUS_ASCII
Definition: CMBReaderDevice.h:77
CMBReadStringEncodingISO_8859_1
@ CMBReadStringEncodingISO_8859_1
Definition: CMBReaderDevice.h:74
CMBReadStringEncodingUTF_32
@ CMBReadStringEncodingUTF_32
Definition: CMBReaderDevice.h:73
CMBReadStringEncodingISO_8859_2
@ CMBReadStringEncodingISO_8859_2
Definition: CMBReaderDevice.h:75
CMBReaderAvailibility
CMBReaderAvailibility
Enum values for CMBReaderDevice availability.
Definition: CMBReaderDevice.h:44
CMBReaderAvailibilityUnavailable
@ CMBReaderAvailibilityUnavailable
Definition: CMBReaderDevice.h:47
CMBReaderAvailibilityUnknown
@ CMBReaderAvailibilityUnknown
Definition: CMBReaderDevice.h:45
CMBReaderAvailibilityAvailable
@ CMBReaderAvailibilityAvailable
Definition: CMBReaderDevice.h:46
CMBResultParser
CMBResultParser
Enum values for CMBReaderDevice parser.
Definition: CMBReaderDevice.h:55
CMBResultParserAAMVA
@ CMBResultParserAAMVA
Definition: CMBReaderDevice.h:58
CMBResultParserHIBC
@ CMBResultParserHIBC
Definition: CMBReaderDevice.h:60
CMBResultParserGS1
@ CMBResultParserGS1
Definition: CMBReaderDevice.h:59
CMBResultParserAuto
@ CMBResultParserAuto
Definition: CMBReaderDevice.h:57
CMBResultParserNone
@ CMBResultParserNone
Definition: CMBReaderDevice.h:56
CMBResultParserSCM
@ CMBResultParserSCM
Definition: CMBReaderDevice.h:63
CMBResultParserIUID
@ CMBResultParserIUID
Definition: CMBReaderDevice.h:62
CMBResultParserISBT128
@ CMBResultParserISBT128
Definition: CMBReaderDevice.h:61
CMBConnectionState
CMBConnectionState
Indicates the connection state of a CDMDataManSystem object.
Definition: CMBReaderDevice.h:18
CMBConnectionStateUnavailable
@ CMBConnectionStateUnavailable
The CDMDataManSystem object's connection state is unavailable.
Definition: CMBReaderDevice.h:38
CMBConnectionStateConnected
@ CMBConnectionStateConnected
The CDMDataManSystem object is connected to a remote system.
Definition: CMBReaderDevice.h:30
CMBConnectionStateDisconnecting
@ CMBConnectionStateDisconnecting
The CDMDataManSystem object is in the process of disconnecting from a remote system.
Definition: CMBReaderDevice.h:34
CMBConnectionStateConnecting
@ CMBConnectionStateConnecting
The CDMDataManSystem object is in the process of establishing a connection to a remote system.
Definition: CMBReaderDevice.h:26
CMBConnectionStateDisconnected
@ CMBConnectionStateDisconnected
The CDMDataManSystem object is not connected to any remote system.
Definition: CMBReaderDevice.h:22
CMBSymbology
CMBSymbology
Enum values for supported barcode symbologies.
Definition: CMBSymbology.h:15
CDMDataManSystem
Represents a remote DataMan system.
Definition: CDMDataManSystem.h:211
CMBReadResults
Represents a list of read results.
Definition: CMBReadResults.h:16
CMBReaderDevice
Represents a Phone Camera or MX barcode reader.
Definition: CMBReaderDevice.h:113
-[CMBReaderDevice beep]
void beep()
Plays a beep on the reader.
CMBReaderDevice::SVGResultEnabled
BOOL SVGResultEnabled
Enable or disable SVG image graphics results from reader.
Definition: CMBReaderDevice.h:141
CMBReaderDevice::deviceClass
DataManDeviceClass deviceClass
Tells the connection type of the CMBReaderDevice object.
Definition: CMBReaderDevice.h:117
CMBReaderDevice::parser
CMBResultParser parser
Optionally set a CMBResultParser to be applied to a successful read result that is parsable with the ...
Definition: CMBReaderDevice.h:147
CMBReaderDevice::delegate
id< CMBReaderDeviceDelegate > _Nullable delegate
Delegate object to receive events from the CMBReaderDevice object.
Definition: CMBReaderDevice.h:159
-[CMBReaderDevice disconnect]
void disconnect()
Disconnects from a connected barcode reader.
-[CMBReaderDevice startScanning]
void startScanning()
Starts triggering.
CMBReaderDevice::availability
CMBReaderAvailibility availability
Returns the availability of the reader.
Definition: CMBReaderDevice.h:124
CMBReaderDevice::readStringEncoding
CMBReadStringEncoding readStringEncoding
Set the CMBReadStringEncoding that is used to decode Read String from base64 result.
Definition: CMBReaderDevice.h:153
+[CMBReaderDevice readerOfMXDevice]
instancetype _Nonnull readerOfMXDevice()
Creates a CMBReaderDevice object for a connected MX barcode reader.
CMBReaderDevice::imageResultEnabled
BOOL imageResultEnabled
Enable or disable image results from reader.
Definition: CMBReaderDevice.h:136
CMBReaderDevice::connectionState
CMBConnectionState connectionState
Returns the current connection state of the reader.
Definition: CMBReaderDevice.h:131
-[CMBReaderDevice stopScanning]
void stopScanning()
Stops triggering.
-[CMBReaderDevice dataManSystem]
CDMDataManSystem *_Nonnull dataManSystem()
Returns the DataManSystem instance for this CMBReaderDevice.
CMBReaderDeviceDelegate-p
Delagate protocol for receiving events from a CMBReaderDevice object.
Definition: CMBReaderDevice.h:84