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

CDMDataManSystem.h
Go to the documentation of this file.
1//
2// CDMDataManSystem.h
3//
4// Copyright (c) 2014 Cognex Corporation. All rights reserved.
5//
6
13#import <Foundation/Foundation.h>
14#import <ExternalAccessory/ExternalAccessory.h>
15#import <cmbSDK/CDMDataManSystemDelegate.h>
16#import <CoreBluetooth/CoreBluetooth.h>
17@class MDMAuthCredentials;
18
22 typedef NS_ENUM(NSInteger, CDMImageSize)
23{
27 kCDMImageSizeFull,
31 kCDMImageSizeQuarter,
35 kCDMImageSizeSixteenth,
39 kCDMImageSizeSixtyFourth
40};
41
45 typedef NS_ENUM(NSInteger, CDMImageQuality)
46{
50 kCDMImageQualityLow = 10,
54 kCDMImageQualityMedium = 50,
58 kCDMImageQualityHigh = 90
59};
60
64 typedef NS_ENUM(NSInteger, CDMImageFormat)
65{
69 kCDMImageFormatBitmap = 0,
73 kCDMImageFormatJpeg = 1
74};
75
79 typedef NS_OPTIONS(NSInteger, CDMResultTypes)
80{
84 kCDMResultTypeNone = 0,
88 kCDMResultTypeReadString = 1,
92 kCDMResultTypeReadXml = 2,
96 kCDMResultTypeXmlStatistics = 4,
100 kCDMResultTypeImage = 8,
104 kCDMResultTypeImageGraphics = 16,
108 kCDMResultTypeTrainingResults = 32,
112 kCDMResultTypeCodeQualityData = 64,
116 kCDMResultTypeXmlContent = 128
117};
118
122 typedef NS_ENUM(NSInteger, CDMConnectionState) {
123 kCDMConnectionStateDisconnected = 0,
124 kCDMConnectionStateConnecting = 1,
125 kCDMConnectionStateConnected = 2,
126 kCDMConnectionStateDisconnecting = 3
127};
128
132 typedef enum : NSUInteger {
133 DataManDeviceClass_MX,
134 DataManDeviceClass_Network,
135 DataManDeviceClass_PhoneCamera,
136 DataManDeviceClass_BT_L2CAP
137} DataManDeviceClass;
138
142 typedef NS_ENUM(NSInteger, CDMCameraMode)
143{
147 kCDMCameraModeNoAimer,
151 kCDMCameraModePassiveAimer,
155 kCDMCameraModeFrontCamera
156};
157
163 typedef NS_OPTIONS(NSInteger, CDMPreviewOption)
164{
168 kCDMPreviewOptionDefaults = 0,
172 kCDMPreviewOptionNoZoomBtn = 1,
176 kCDMPreviewOptionNoIllumBtn = 2,
180 kCDMPreviewOptionHwTrigger = 4,
184 kCDMPreviewOptionPaused = 8,
188 kCDMPreviewOptionAlwaysShow = 16,
192 kCDMPreviewOptionHighResolution = 32,
196 kCDMPreviewOptionHighFrameRate = 64,
200 kCDMPreviewOptionShowCloseBtn = 128,
204 kCDMPreviewOptionKeepPreviewInPausedState = 256
205};
206
210@interface CDMDataManSystem : NSObject
211
215@property (readonly) DataManDeviceClass deviceClass;
216
220@property (readonly) CDMConnectionState connectionState;
221
226@property (weak) id<CDMDataManSystemDelegate> _Nullable delegate;
227
231@property (nonatomic) CDMResultTypes resultTypes;
232
236@property (readonly, getter = isHeartbeatEnabled) BOOL heartbeatEnabled;
237
241@property (readonly, getter = isLiveImageEnabled) BOOL liveImageEnabled;
242
246@property (nonatomic) NSTimeInterval timeout;
247
251@property (nonatomic) MDMAuthCredentials * _Nullable defaultMDMAuthCredentials;
252
256@property (nonatomic) BOOL MDMReportingEnabled;
257
261@property (readonly, getter = isConnected) BOOL connected;
262
267+ (NSString *_Nonnull)getVersion;
268
281+ (CDMDataManSystem *_Nonnull)dataManSystemWithHostname:(NSString * _Nonnull)hostname port:(int)port delegate:(id<CDMDataManSystemDelegate>_Nonnull)delegate;
282
291+ (CDMDataManSystem *_Nonnull)dataManSystemWithAccessory:(EAAccessory*_Nullable)accessory delegate:(id<CDMDataManSystemDelegate>_Nonnull)delegate;
292
300+ (CDMDataManSystem *_Nonnull)dataManSystemOfExternalAccessoryWithDelegate:(id<CDMDataManSystemDelegate>_Nonnull)delegate;
301
312+ (CDMDataManSystem *_Nonnull)dataManSystemWithCameraMode:(CDMCameraMode)cameraMode
313 previewOptions:(CDMPreviewOption)previewOptions
314 nullablePreviewView:(UIView*_Nullable)previewView
315 delegate:(id<CDMDataManSystemDelegate>_Nonnull)delegate;
316
326+ (CDMDataManSystem *_Nonnull)dataManSystemWithCameraMode:(CDMCameraMode)cameraMode
327 previewOptions:(CDMPreviewOption)previewOptions
328 delegate:(id<CDMDataManSystemDelegate>_Nonnull)delegate;
329
341+ (CDMDataManSystem *_Nonnull)dataManSystemWithCameraMode:(CDMCameraMode)cameraMode
342 previewOptions:(CDMPreviewOption)previewOptions
343 nullablePreviewView:(UIView*_Nullable)previewView
344 registrationKey:(NSString*_Nullable)registrationKey
345 delegate:(id<CDMDataManSystemDelegate>_Nonnull)delegate;
346
359+ (CDMDataManSystem *_Nonnull)dataManSystemWithCameraMode:(CDMCameraMode)cameraMode
360 previewOptions:(CDMPreviewOption)previewOptions
361 nullablePreviewView:(UIView*_Nullable)previewView
362 registrationKey:(NSString*_Nullable)registrationKey
363 customData:(NSString*_Nullable)customData
364 delegate:(id<CDMDataManSystemDelegate>_Nonnull)delegate;
365
375+ (CDMDataManSystem *_Nonnull)datamanSystemWithBluetoothPeripheralUUID:(NSUUID *_Nonnull)peripheralUUID
376 psm:(CBL2CAPPSM)psm
377 delegate:(id<CDMDataManSystemDelegate>_Nonnull)delegate API_AVAILABLE(ios(11));
384- (void)setCameraPreviewContainer:(UIView*_Nullable) previewContainer completion:(void (^_Nullable)(NSError * _Nullable error))completionBlock;
385
391- (void)getCameraExposureCompensationRangeWithCompletion:(void (^_Nonnull)(NSArray<NSNumber *>*_Nullable range, NSError *_Nullable error))completionBlock;
392
398- (void)setCameraExposureCompensation:(float)exposureCompensation completion:(void (^_Nullable)(NSError * _Nullable error))completionBlock;
399
405- (void)loadCameraConfig:(void (^_Nullable)(NSError * _Nullable error))completionBlock;
406
410
414- (BOOL)connect;
415
423- (BOOL)connectWithUsername:(NSString*_Nullable)username password:(NSString*_Nullable)password;
424
428- (void)disconnect;
429
435- (BOOL)sendCommand:(NSString *_Nonnull)command;
436
465- (BOOL)sendCommand:(NSString *_Nonnull)command withCallback:(void(^_Nullable)(CDMResponse * _Nonnull response))callback;
466
476- (BOOL)sendCommand:(NSString *_Nonnull)command withData:(NSData *_Nullable)data timeout:(NSTimeInterval)timeout expectBinaryResponse:(BOOL)expectBinaryResponse callback:(void(^_Nullable)(CDMResponse *_Nonnull response))callback;
477
484- (BOOL)sendBatchCommands:(NSArray *_Nonnull)commands completed:(void(^_Nonnull)(void))complete;
485
490- (void)acceptIncomingConnection:(BOOL)accept;
491
496- (void)enableHeartbeatWithInterval:(NSTimeInterval)interval;
497
501- (void)disableHeartbeat;
502
511- (void)enableLiveImageWithFormat:(CDMImageFormat)imageFormat imageSize:(CDMImageSize)imageSize imageQuality:(CDMImageQuality)quality callback:(void(^_Nullable)(UIImage*_Nullable image, CDMResponse*_Nonnull response))callback;
512
516- (void)disableLiveImage;
517
518@end
CDMConnectionState
CDMConnectionState
Specifies the connection states, that the DataManSystem can have.
Definition: CDMDataManSystem.h:122
kCDMConnectionStateDisconnecting
@ kCDMConnectionStateDisconnecting
Definition: CDMDataManSystem.h:126
kCDMConnectionStateConnecting
@ kCDMConnectionStateConnecting
Definition: CDMDataManSystem.h:124
kCDMConnectionStateConnected
@ kCDMConnectionStateConnected
Definition: CDMDataManSystem.h:125
kCDMConnectionStateDisconnected
@ kCDMConnectionStateDisconnected
Definition: CDMDataManSystem.h:123
CDMCameraMode
CDMCameraMode
Specifies the preview/illumination mode when using the Mobile device camera.
Definition: CDMDataManSystem.h:143
kCDMCameraModePassiveAimer
@ kCDMCameraModePassiveAimer
Use camera with a basic aimer (e.g., StingRay).
Definition: CDMDataManSystem.h:151
kCDMCameraModeNoAimer
@ kCDMCameraModeNoAimer
Use camera with no aimer.
Definition: CDMDataManSystem.h:147
kCDMCameraModeFrontCamera
@ kCDMCameraModeFrontCamera
Use mobile device front camera.
Definition: CDMDataManSystem.h:155
CDMImageQuality
CDMImageQuality
Image quality used when getting live image or process monitor images.
Definition: CDMDataManSystem.h:46
kCDMImageQualityLow
@ kCDMImageQualityLow
Low image quality for jpeg format.
Definition: CDMDataManSystem.h:50
kCDMImageQualityMedium
@ kCDMImageQualityMedium
Medium image quality for jpeg format.
Definition: CDMDataManSystem.h:54
kCDMImageQualityHigh
@ kCDMImageQualityHigh
High image quality for jpeg format.
Definition: CDMDataManSystem.h:58
CDMPreviewOption
CDMPreviewOption
Controls the preview/scanning options when using the Mobile device camera.
Definition: CDMDataManSystem.h:164
kCDMPreviewOptionNoZoomBtn
@ kCDMPreviewOptionNoZoomBtn
Disable zoom feature (removes zoom button from preview).
Definition: CDMDataManSystem.h:172
kCDMPreviewOptionHighResolution
@ kCDMPreviewOptionHighResolution
Use higher resolution if the device supports it.
Definition: CDMDataManSystem.h:192
kCDMPreviewOptionPaused
@ kCDMPreviewOptionPaused
When scanning starts, the preview is displayed but decoding is paused until a trigger (either the on ...
Definition: CDMDataManSystem.h:184
kCDMPreviewOptionHighFrameRate
@ kCDMPreviewOptionHighFrameRate
Use higher framerate if the device supports it.
Definition: CDMDataManSystem.h:196
kCDMPreviewOptionAlwaysShow
@ kCDMPreviewOptionAlwaysShow
Force the preview to be displayed, even if off by default (e.g., when using kCDMCameraModePassiveAime...
Definition: CDMDataManSystem.h:188
kCDMPreviewOptionShowCloseBtn
@ kCDMPreviewOptionShowCloseBtn
Show close button in partial view.
Definition: CDMDataManSystem.h:200
kCDMPreviewOptionHwTrigger
@ kCDMPreviewOptionHwTrigger
Enables the simulated hardware trigger (the volume down button).
Definition: CDMDataManSystem.h:180
kCDMPreviewOptionKeepPreviewInPausedState
@ kCDMPreviewOptionKeepPreviewInPausedState
Keep the preview in paused state after read.
Definition: CDMDataManSystem.h:204
kCDMPreviewOptionNoIllumBtn
@ kCDMPreviewOptionNoIllumBtn
Disable illumination (removes illumination button from preview).
Definition: CDMDataManSystem.h:176
kCDMPreviewOptionDefaults
@ kCDMPreviewOptionDefaults
Use defaults (no overrides).
Definition: CDMDataManSystem.h:168
CDMImageFormat
CDMImageFormat
Indicates the image format type for live displays or process monitor images.
Definition: CDMDataManSystem.h:65
kCDMImageFormatJpeg
@ kCDMImageFormatJpeg
Jpeg format.
Definition: CDMDataManSystem.h:73
kCDMImageFormatBitmap
@ kCDMImageFormatBitmap
Bitmap format.
Definition: CDMDataManSystem.h:69
DataManDeviceClass
DataManDeviceClass
Specifies the device types of a CDMDataManSystem instance.
Definition: CDMDataManSystem.h:132
DataManDeviceClass_BT_L2CAP
@ DataManDeviceClass_BT_L2CAP
Definition: CDMDataManSystem.h:136
DataManDeviceClass_Network
@ DataManDeviceClass_Network
Definition: CDMDataManSystem.h:134
DataManDeviceClass_MX
@ DataManDeviceClass_MX
Definition: CDMDataManSystem.h:133
DataManDeviceClass_PhoneCamera
@ DataManDeviceClass_PhoneCamera
Definition: CDMDataManSystem.h:135
CDMImageSize
CDMImageSize
Image size.
Definition: CDMDataManSystem.h:23
kCDMImageSizeSixtyFourth
@ kCDMImageSizeSixtyFourth
Image scaled down by 1/64.
Definition: CDMDataManSystem.h:39
kCDMImageSizeFull
@ kCDMImageSizeFull
Full sized image.
Definition: CDMDataManSystem.h:27
kCDMImageSizeQuarter
@ kCDMImageSizeQuarter
Image scaled down by 1/4.
Definition: CDMDataManSystem.h:31
kCDMImageSizeSixteenth
@ kCDMImageSizeSixteenth
Image scaled down by 1/16.
Definition: CDMDataManSystem.h:35
CDMResultTypes
CDMResultTypes
Specifies the result types, that the application can receive.
Definition: CDMDataManSystem.h:80
kCDMResultTypeXmlStatistics
@ kCDMResultTypeXmlStatistics
Represents read statistics in xml format.
Definition: CDMDataManSystem.h:96
kCDMResultTypeXmlContent
@ kCDMResultTypeXmlContent
Represents code content information in xml format.
Definition: CDMDataManSystem.h:116
kCDMResultTypeReadString
@ kCDMResultTypeReadString
Represents a simple read result string.
Definition: CDMDataManSystem.h:88
kCDMResultTypeImageGraphics
@ kCDMResultTypeImageGraphics
Represent an image graphics xml.
Definition: CDMDataManSystem.h:104
kCDMResultTypeNone
@ kCDMResultTypeNone
No results of any kind are requested from the reader.
Definition: CDMDataManSystem.h:84
kCDMResultTypeCodeQualityData
@ kCDMResultTypeCodeQualityData
Represents code quality information in xml format.
Definition: CDMDataManSystem.h:112
kCDMResultTypeReadXml
@ kCDMResultTypeReadXml
Represents a read result in xml format.
Definition: CDMDataManSystem.h:92
kCDMResultTypeTrainingResults
@ kCDMResultTypeTrainingResults
Represents training results in xml format.
Definition: CDMDataManSystem.h:108
kCDMResultTypeImage
@ kCDMResultTypeImage
Represents a read image.
Definition: CDMDataManSystem.h:100
CDMDataManSystem
Represents a remote DataMan system.
Definition: CDMDataManSystem.h:211
CDMDataManSystem::defaultMDMAuthCredentials
MDMAuthCredentials *_Nullable defaultMDMAuthCredentials
Default credentials for MDM communication.
Definition: CDMDataManSystem.h:251
-[CDMDataManSystem disableLiveImage]
void disableLiveImage()
Stops a pending live image retrieval operation.
CDMDataManSystem::MDMReportingEnabled
BOOL MDMReportingEnabled
Enables reporting properties of the connected MX device to an MDM system.
Definition: CDMDataManSystem.h:256
CDMDataManSystem::connected
BOOL connected
Read-only connection state of the system.
Definition: CDMDataManSystem.h:261
CDMDataManSystem::liveImageEnabled
BOOL liveImageEnabled
Read-only state of live image mode.
Definition: CDMDataManSystem.h:241
CDMDataManSystem::heartbeatEnabled
BOOL heartbeatEnabled
Read-only state of the heartbeat function.
Definition: CDMDataManSystem.h:236
-[CDMDataManSystem disableHeartbeat]
void disableHeartbeat()
Disables the heartbeat when enabled.
CDMDataManSystem::deviceClass
DataManDeviceClass deviceClass
Gets the device type of the CDMDataManSystem instance.
Definition: CDMDataManSystem.h:215
CDMDataManSystem::resultTypes
CDMResultTypes resultTypes
Sets which result types the application wants to receive.
Definition: CDMDataManSystem.h:231
-[CDMDataManSystem disconnect]
void disconnect()
Disconnects from the remote system.
CDMDataManSystem::connectionState
CDMConnectionState connectionState
Gets the current connection state of the CDMDataManSystem instance.
Definition: CDMDataManSystem.h:220
CDMDataManSystem::timeout
NSTimeInterval timeout
Timeout for commands and connection, default value is 6 sec.
Definition: CDMDataManSystem.h:246
+[CDMDataManSystem getVersion]
NSString *_Nonnull getVersion()
Returns the current version of the library.
CDMDataManSystem::delegate
id< CDMDataManSystemDelegate > _Nullable delegate
Sets or gets the delegate where the messages will be sent to.
Definition: CDMDataManSystem.h:226
-[CDMDataManSystem connect]
BOOL connect()
Connects to a remote system without authentication.
CDMResponse
Represents a DMCC response sent by a remote system.
Definition: CDMResponse.h:37
CDMDataManSystemDelegate-p
DataMan system delegate protocol.
Definition: CDMDataManSystemDelegate.h:25