CMB SDK iOS
CDMDataManSystem.h
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>
146 #import "CDMDataManSystemDelegate.h"
147 
148 
152 typedef NS_ENUM(NSInteger, CDMImageSize)
153 {
157  kCDMImageSizeFull,
161  kCDMImageSizeQuarter,
165  kCDMImageSizeSixteenth,
169  kCDMImageSizeSixtyFourth
170 };
171 
175 typedef NS_ENUM(NSInteger, CDMImageQuality)
176 {
180  kCDMImageQualityLow = 10,
184  kCDMImageQualityMedium = 50,
188  kCDMImageQualityHigh = 90
189 };
190 
194 typedef NS_ENUM(NSInteger, CDMImageFormat)
195 {
199  kCDMImageFormatBitmap = 0,
203  kCDMImageFormatJpeg = 1
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) {
249  kCDMConnectionStateDisconnected = 0,
250  kCDMConnectionStateConnecting = 1,
251  kCDMConnectionStateConnected = 2,
252  kCDMConnectionStateDisconnecting = 3
253 };
254 
258 typedef enum : NSUInteger {
259  DataManDeviceClass_MX,
260  DataManDeviceClass_Network,
261  DataManDeviceClass_PhoneCamera
262 } DataManDeviceClass;
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 {
357  kCDMCameraModeNoAimer = 0,
361  kCDMCameraModePassiveAimer = 1,
365  kCDMCameraModeActiveAimer = 2,
369  kCDMCameraModeFrontCamera = 3
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
typedef NS_OPTIONS(NSInteger, CDMPreviewOption)
Definition: CDMDataManSystem.h:377
Definition: CDMDataManSystem.h:267
Definition: CDMResponse.h:35
BOOL heartbeatEnabled
Definition: CDMDataManSystem.h:293
id< CDMDataManSystemDelegate > delegate
Definition: CDMDataManSystem.h:283
CDMResultTypes resultTypes
Definition: CDMDataManSystem.h:288
BOOL connected
Definition: CDMDataManSystem.h:308
typedef NS_ENUM(NSInteger, CDMCameraMode)
Definition: CDMDataManSystem.h:352
BOOL liveImageEnabled
Definition: CDMDataManSystem.h:298
CDMConnectionState connectionState
Definition: CDMDataManSystem.h:277
NSTimeInterval timeout
Definition: CDMDataManSystem.h:303
DataManDeviceClass deviceClass
Definition: CDMDataManSystem.h:272
NSString * getVersion()