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
22typedef NS_ENUM(NSInteger, CDMImageSize)
23{
40};
41
45typedef NS_ENUM(NSInteger, CDMImageQuality)
46{
59};
60
64typedef NS_ENUM(NSInteger, CDMImageFormat)
65{
74};
75
79typedef NS_OPTIONS(NSInteger, CDMResultTypes)
80{
118
122typedef NS_ENUM(NSInteger, CDMConnectionState) {
128
132typedef enum : NSUInteger {
138
142typedef NS_ENUM(NSInteger, CDMCameraMode)
143{
157
163typedef NS_OPTIONS(NSInteger, CDMPreviewOption)
164{
206
210@interface CDMDataManSystem : NSObject
211
215@property (readonly) DataManDeviceClass deviceClass;
216
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
Specifies the connection states, that the DataManSystem can have.
Definition: CDMDataManSystem.h:122
@ kCDMConnectionStateDisconnecting
Definition: CDMDataManSystem.h:126
@ kCDMConnectionStateConnecting
Definition: CDMDataManSystem.h:124
@ kCDMConnectionStateConnected
Definition: CDMDataManSystem.h:125
@ kCDMConnectionStateDisconnected
Definition: CDMDataManSystem.h:123
CDMCameraMode
Specifies the preview/illumination mode when using the Mobile device camera.
Definition: CDMDataManSystem.h:143
@ kCDMCameraModePassiveAimer
Use camera with a basic aimer (e.g., StingRay).
Definition: CDMDataManSystem.h:151
@ kCDMCameraModeNoAimer
Use camera with no aimer.
Definition: CDMDataManSystem.h:147
@ kCDMCameraModeFrontCamera
Use mobile device front camera.
Definition: CDMDataManSystem.h:155
CDMImageQuality
Image quality used when getting live image or process monitor images.
Definition: CDMDataManSystem.h:46
@ kCDMImageQualityLow
Low image quality for jpeg format.
Definition: CDMDataManSystem.h:50
@ kCDMImageQualityMedium
Medium image quality for jpeg format.
Definition: CDMDataManSystem.h:54
@ kCDMImageQualityHigh
High image quality for jpeg format.
Definition: CDMDataManSystem.h:58
CDMPreviewOption
Controls the preview/scanning options when using the Mobile device camera.
Definition: CDMDataManSystem.h:164
@ kCDMPreviewOptionNoZoomBtn
Disable zoom feature (removes zoom button from preview).
Definition: CDMDataManSystem.h:172
@ kCDMPreviewOptionHighResolution
Use higher resolution if the device supports it.
Definition: CDMDataManSystem.h:192
@ kCDMPreviewOptionPaused
When scanning starts, the preview is displayed but decoding is paused until a trigger (either the on ...
Definition: CDMDataManSystem.h:184
@ kCDMPreviewOptionHighFrameRate
Use higher framerate if the device supports it.
Definition: CDMDataManSystem.h:196
@ kCDMPreviewOptionAlwaysShow
Force the preview to be displayed, even if off by default (e.g., when using kCDMCameraModePassiveAime...
Definition: CDMDataManSystem.h:188
@ kCDMPreviewOptionShowCloseBtn
Show close button in partial view.
Definition: CDMDataManSystem.h:200
@ kCDMPreviewOptionHwTrigger
Enables the simulated hardware trigger (the volume down button).
Definition: CDMDataManSystem.h:180
@ kCDMPreviewOptionKeepPreviewInPausedState
Keep the preview in paused state after read.
Definition: CDMDataManSystem.h:204
@ kCDMPreviewOptionNoIllumBtn
Disable illumination (removes illumination button from preview).
Definition: CDMDataManSystem.h:176
@ kCDMPreviewOptionDefaults
Use defaults (no overrides).
Definition: CDMDataManSystem.h:168
CDMImageFormat
Indicates the image format type for live displays or process monitor images.
Definition: CDMDataManSystem.h:65
@ kCDMImageFormatJpeg
Jpeg format.
Definition: CDMDataManSystem.h:73
@ kCDMImageFormatBitmap
Bitmap format.
Definition: CDMDataManSystem.h:69
DataManDeviceClass
Specifies the device types of a CDMDataManSystem instance.
Definition: CDMDataManSystem.h:132
@ DataManDeviceClass_BT_L2CAP
Definition: CDMDataManSystem.h:136
@ DataManDeviceClass_Network
Definition: CDMDataManSystem.h:134
@ DataManDeviceClass_MX
Definition: CDMDataManSystem.h:133
@ DataManDeviceClass_PhoneCamera
Definition: CDMDataManSystem.h:135
CDMImageSize
Image size.
Definition: CDMDataManSystem.h:23
@ kCDMImageSizeSixtyFourth
Image scaled down by 1/64.
Definition: CDMDataManSystem.h:39
@ kCDMImageSizeFull
Full sized image.
Definition: CDMDataManSystem.h:27
@ kCDMImageSizeQuarter
Image scaled down by 1/4.
Definition: CDMDataManSystem.h:31
@ kCDMImageSizeSixteenth
Image scaled down by 1/16.
Definition: CDMDataManSystem.h:35
CDMResultTypes
Specifies the result types, that the application can receive.
Definition: CDMDataManSystem.h:80
@ kCDMResultTypeXmlStatistics
Represents read statistics in xml format.
Definition: CDMDataManSystem.h:96
@ kCDMResultTypeXmlContent
Represents code content information in xml format.
Definition: CDMDataManSystem.h:116
@ kCDMResultTypeReadString
Represents a simple read result string.
Definition: CDMDataManSystem.h:88
@ kCDMResultTypeImageGraphics
Represent an image graphics xml.
Definition: CDMDataManSystem.h:104
@ kCDMResultTypeNone
No results of any kind are requested from the reader.
Definition: CDMDataManSystem.h:84
@ kCDMResultTypeCodeQualityData
Represents code quality information in xml format.
Definition: CDMDataManSystem.h:112
@ kCDMResultTypeReadXml
Represents a read result in xml format.
Definition: CDMDataManSystem.h:92
@ kCDMResultTypeTrainingResults
Represents training results in xml format.
Definition: CDMDataManSystem.h:108
@ kCDMResultTypeImage
Represents a read image.
Definition: CDMDataManSystem.h:100
Represents a remote DataMan system.
Definition: CDMDataManSystem.h:211
MDMAuthCredentials *_Nullable defaultMDMAuthCredentials
Default credentials for MDM communication.
Definition: CDMDataManSystem.h:251
void disableLiveImage()
Stops a pending live image retrieval operation.
BOOL MDMReportingEnabled
Enables reporting properties of the connected MX device to an MDM system.
Definition: CDMDataManSystem.h:256
BOOL connected
Read-only connection state of the system.
Definition: CDMDataManSystem.h:261
BOOL liveImageEnabled
Read-only state of live image mode.
Definition: CDMDataManSystem.h:241
BOOL heartbeatEnabled
Read-only state of the heartbeat function.
Definition: CDMDataManSystem.h:236
void disableHeartbeat()
Disables the heartbeat when enabled.
DataManDeviceClass deviceClass
Gets the device type of the CDMDataManSystem instance.
Definition: CDMDataManSystem.h:215
CDMResultTypes resultTypes
Sets which result types the application wants to receive.
Definition: CDMDataManSystem.h:231
void disconnect()
Disconnects from the remote system.
CDMConnectionState connectionState
Gets the current connection state of the CDMDataManSystem instance.
Definition: CDMDataManSystem.h:220
NSTimeInterval timeout
Timeout for commands and connection, default value is 6 sec.
Definition: CDMDataManSystem.h:246
NSString *_Nonnull getVersion()
Returns the current version of the library.
id< CDMDataManSystemDelegate > _Nullable delegate
Sets or gets the delegate where the messages will be sent to.
Definition: CDMDataManSystem.h:226
BOOL connect()
Connects to a remote system without authentication.
Represents a DMCC response sent by a remote system.
Definition: CDMResponse.h:37
DataMan system delegate protocol.
Definition: CDMDataManSystemDelegate.h:25