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 
144 #import <Foundation/Foundation.h>
145 #import <ExternalAccessory/ExternalAccessory.h>
147 
148 
152 typedef NS_ENUM(NSInteger, CDMImageSize)
153 {
170 };
171 
175 typedef NS_ENUM(NSInteger, CDMImageQuality)
176 {
189 };
190 
194 typedef NS_ENUM(NSInteger, CDMImageFormat)
195 {
204 };
205 
209 typedef NS_OPTIONS(NSInteger, CDMResultTypes)
210 {
214  kCDMResultTypeNone = 0,
218  kCDMResultTypeReadString = 1,
222  kCDMResultTypeReadXml = 2,
226  kCDMResultTypeXmlStatistics = 4,
230  kCDMResultTypeImage = 8,
234  kCDMResultTypeImageGraphics = 16,
238  kCDMResultTypeTrainingResults = 32,
242  kCDMResultTypeCodeQualityData = 64
243 };
244 
248 typedef NS_ENUM(NSInteger, CDMConnectionState) {
253 };
254 
258 typedef enum : NSUInteger {
263 
267 @interface CDMDataManSystem : NSObject
268 
272 @property (readonly) DataManDeviceClass deviceClass;
273 
277 @property (readonly) CDMConnectionState connectionState;
278 
283 @property (weak) id<CDMDataManSystemDelegate> delegate;
284 
288 @property (nonatomic) CDMResultTypes resultTypes;
289 
293 @property (readonly, getter = isHeartbeatEnabled) BOOL heartbeatEnabled;
294 
298 @property (readonly, getter = isLiveImageEnabled) BOOL liveImageEnabled;
299 
303 @property (nonatomic) NSTimeInterval timeout;
304 
308 @property (readonly, getter = isConnected) BOOL connected;
309 
314 + (NSString *)getVersion;
315 
328 + (CDMDataManSystem *)dataManSystemWithHostname:(NSString *)hostname port:(int)port delegate:(id<CDMDataManSystemDelegate>)delegate;
329 
338 + (CDMDataManSystem *)dataManSystemWithAccessory:(EAAccessory*)accessory delegate:(id<CDMDataManSystemDelegate>)delegate;
339 
347 + (CDMDataManSystem *)dataManSystemOfExternalAccessoryWithDelegate:(id<CDMDataManSystemDelegate>)delegate;
348 
352 typedef NS_ENUM(NSInteger, CDMCameraMode)
353 {
370 };
371 
377 typedef NS_OPTIONS(NSInteger, CDMPreviewOption)
378 {
382  kCDMPreviewOptionDefaults = 0,
386  kCDMPreviewOptionNoZoomBtn = 1,
390  kCDMPreviewOptionNoIllumBtn = 2,
394  kCDMPreviewOptionHwTrigger = 4,
398  kCDMPreviewOptionPaused = 8,
402  kCDMPreviewOptionAlwaysShow = 16
403 };
404 
413 + (CDMDataManSystem *)dataManSystemWithCameraMode:(CDMCameraMode)cameraMode
414  previewOptions:(CDMPreviewOption)previewOptions
415  nullablePreviewView:(UIView*)previewView
416  delegate:(id<CDMDataManSystemDelegate>)delegate;
417 
418 - (void) setPreviewContainer:(UIView*) previewContainer;
419 
423 
427 - (BOOL)connect;
428 
436 - (BOOL)connectWithUsername:(NSString*)username password:(NSString*)password;
437 
441 - (void)disconnect;
442 
448 - (BOOL)sendCommand:(NSString *)command;
449 
478 - (BOOL)sendCommand:(NSString *)command withCallback:(void(^)(CDMResponse *response))callback;
479 
489 - (BOOL)sendCommand:(NSString *)command withData:(NSData *)data timeout:(NSTimeInterval)timeout expectBinaryResponse:(BOOL)expectBinaryResponse callback:(void(^)(CDMResponse *response))callback;
490 
497 - (BOOL)sendBatchCommands:(NSArray *)commands completed:(void(^)())complete;
498 
503 - (void)acceptIncomingConnection:(BOOL)accept;
504 
509 - (void)enableHeartbeatWithInterval:(NSTimeInterval)interval;
510 
514 - (void)disableHeartbeat;
515 
524 - (void)enableLiveImageWithFormat:(CDMImageFormat)imageFormat imageSize:(CDMImageSize)imageSize imageQuality:(CDMImageQuality)quality callback:(void(^)(UIImage* image, CDMResponse* response))callback;
525 
529 - (void)disableLiveImage;
530 
531 @end
CDMConnectionState
Specifies the connection states, that the DataManSystem can have.
Definition: CDMDataManSystem.h:248
BOOL connect()
Connects to a remote system without authentication.
Definition: CDMDataManSystem.m:187
typedef NS_OPTIONS(NSInteger, CDMPreviewOption)
Controls the preview/scanning options when using the Mobile device camera.
Definition: CDMDataManSystem.h:377
Definition: CDMDataManSystem.h:250
Represents a remote DataMan system.
Definition: CDMDataManSystem.h:267
Use camera with no aimer.
Definition: CDMDataManSystem.h:357
Represents a DMCC response sent by a remote system.
Definition: CDMResponse.h:35
BOOL heartbeatEnabled
Read-only state of the heartbeat function.
Definition: CDMDataManSystem.h:293
id< CDMDataManSystemDelegate > delegate
Sets or gets the delegate where the messages will be sent to.
Definition: CDMDataManSystem.h:283
CDMResultTypes resultTypes
Sets which result types the application wants to receive.
Definition: CDMDataManSystem.h:288
Low image quality for jpeg format.
Definition: CDMDataManSystem.h:180
BOOL connected
Read-only connection state of the system.
Definition: CDMDataManSystem.h:308
Use camera with a basic aimer (e.g., StingRay).
Definition: CDMDataManSystem.h:361
Image scaled down by 1/4.
Definition: CDMDataManSystem.h:161
CDMImageQuality
Image quality used when getting live image or process monitor images.
Definition: CDMDataManSystem.h:175
void disconnect()
Disconnects from the remote system.
Definition: CDMDataManSystem.m:229
Definition: CDMDataManSystem.h:261
Bitmap format.
Definition: CDMDataManSystem.h:199
Jpeg format.
Definition: CDMDataManSystem.h:203
High image quality for jpeg format.
Definition: CDMDataManSystem.h:188
Definition: CDMDataManSystem.h:252
CDMCameraMode
Specifies the preview/illumination mode when using the Mobile device camera.
Definition: CDMDataManSystem.h:352
Definition: CDMDataManSystem.h:251
typedef NS_OPTIONS(NSInteger, CDMResultTypes)
Specifies the result types, that the application can receive.
Definition: CDMDataManSystem.h:209
Image scaled down by 1/16.
Definition: CDMDataManSystem.h:165
void disableHeartbeat()
Disables the heartbeat when enabled.
Definition: CDMDataManSystem.m:318
Definition: CDMDataManSystem.h:260
Full sized image.
Definition: CDMDataManSystem.h:157
Definition: CDMDataManSystem.h:259
CDMImageSize
Image size.
Definition: CDMDataManSystem.h:152
Image scaled down by 1/64.
Definition: CDMDataManSystem.h:169
Definition: CDMDataManSystem.h:249
CDMImageFormat
Indicates the image format type for live displays or process monitor images.
Definition: CDMDataManSystem.h:194
BOOL liveImageEnabled
Read-only state of live image mode.
Definition: CDMDataManSystem.h:298
CDMConnectionState connectionState
Gets the current connection state of the CDMDataManSystem instance.
Definition: CDMDataManSystem.h:277
NSTimeInterval timeout
Timeout for commands and connection, default value is 5 sec.
Definition: CDMDataManSystem.h:303
Medium image quality for jpeg format.
Definition: CDMDataManSystem.h:184
void disableLiveImage()
Stops a pending live image retrieval operation.
Definition: CDMDataManSystem.m:347
DataManDeviceClass deviceClass
Gets the device type of the CDMDataManSystem instance.
Definition: CDMDataManSystem.h:272
DataManDeviceClass
Specifies the device types a CDMDataManSystem instance.
Definition: CDMDataManSystem.h:258
Use mobile device front camera.
Definition: CDMDataManSystem.h:369
NSString * getVersion()
Returns the current version of the library.
Definition: CDMDataManSystem.m:67
Use camera with an active aimer (e.g., MX-100).
Definition: CDMDataManSystem.h:365