2012-07-29 2 views
0

내가 원하는 것은 QR 코드를 스캔 한 다음 관련 웹 페이지를 자동으로로드하는 것입니다. Redlaser SDK를 다운로드하여 내가 할 수있는 한 최대한 많이 살펴 보았습니다. 이해할 수없는 한 가지는 SDK의 실제 메소드가있는 곳입니다. ZBar로 이동하기 전에이 간단한 작업을 어떻게 수행 할 수 있는지 알고 싶습니다. 방법의 실제 시체가 발견된다 - iOS Redlaser SDK : 결과를 다르게 처리하는 방법을 이해하려고 시도합니다.

/******************************************************************************* 
    RedLaserSDK.h 

    (c) 2009-2011 eBay Inc. 

    This is the public API for the RedLaser SDK. 
*/ 
#ifdef __cplusplus 
extern "C" { 
#endif 

// Barcode Symbologies 
#define kBarcodeTypeEAN13   0x1 
#define kBarcodeTypeUPCE   0x2 
#define kBarcodeTypeEAN8   0x4 
#define kBarcodeTypeSTICKY   0x8 
#define kBarcodeTypeQRCODE   0x10 
#define kBarcodeTypeCODE128   0x20 
#define kBarcodeTypeCODE39   0x40 
#define kBarcodeTypeDATAMATRIX  0x80 
#define kBarcodeTypeITF    0x100 
#define kBarcodeTypeEAN5   0x200 
#define kBarcodeTypeEAN2   0x400 
#define kBarcodeTypeCodabar   0x800 

typedef enum 
{ 
    RLState_EvalModeReady = 1, 
    RLState_LicensedModeReady = 2, 

    RLState_MissingOSLibraries = -1, 
    RLState_NoCamera = -2, 
    RLState_BadLicense = -3, 
    RLState_ScanLimitReached = -4, 
} RedLaserStatus; 

#if TARGET_OS_MAC 

/******************************************************************************* 
    RL_GetRedLaserSDKVersion() 

    This function returns the version of the RedLaser SDK, as a NSString. 
    The primary purpose of this function is checking which SDK version you're 
    linking against, to compare that version against the most recent version 
    on redlaser.com. 
*/ 
NSString *RL_GetRedLaserSDKVersion(); 

/******************************************************************************* 
    RL_CheckReadyStatus() 

    This function returns information about whether the SDK can be used. It 
    doesn't give dynamic state information about what the SDK is currently doing. 

    Generally, positive values mean you can scan, negative values mean you 
    can't. The returned value *can* change from one call to the next. 

    If this function returns a negative value, it's usually best to design your 
    app so that it won't attempt to scan at all. If this function returns 
    MissingOSLibraries this is especially important, as the SDK will probably 
    crash if used. See the documentation. 
*/ 
RedLaserStatus RL_CheckReadyStatus(); 


#import <Foundation/Foundation.h> 

@class BarcodePickerController; 

/******************************************************************************* 
    BarcodeResult 

    The return type of the recognizer is a NSSet of Barcode objects.  
*/ 
@interface BarcodeResult : NSObject <NSCoding> { } 

@property (readonly) int     barcodeType; 
@property (readonly, retain) NSString  *barcodeString; 
@property (readonly, copy) NSString   *extendedBarcodeString; 
@property (readonly) BarcodeResult   *associatedBarcode; 

@property (readonly, retain) NSDate   *firstScanTime; 
@property (readonly, retain) NSDate   *mostRecentScanTime; 
@property (readonly, retain) NSMutableArray *barcodeLocation; 
@end 

/******************************************************************************* 
    BarcodePickerControllerDelegate 

    The delegate receives messages about the results of a scan. This method 
    gets called when a scan session completes. 
*/ 
@protocol BarcodePickerControllerDelegate <NSObject> 
@optional 
- (void) barcodePickerController:(BarcodePickerController*)picker 
     returnResults:(NSSet *)results; 
@end 

#if TARGET_OS_IPHONE 

/******************************************************************************* 
    FindBarcodesInUIImage 

    Searches the given image for barcodes, and returns information on all barcodes 
    that it finds. This performs an exhaustive search, which can take several 
    seconds to perform. This method searches for all barcode types. The intent 
    of this method is to allow for barcode searching in photos from the photo library. 
*/ 
NSSet *FindBarcodesInUIImage(UIImage *inputImage); 


/******************************************************************************* 
    CameraOverlayViewController 

    An optional overlay view that is placed on top of the camera view. 
    This view controller receives status updates about the scanning state, and 
    can update the user interface. 
*/ 
@interface CameraOverlayViewController : UIViewController { } 

@property (readonly, assign) BarcodePickerController *parentPicker; 

- (void)barcodePickerController:(BarcodePickerController*)picker 
     statusUpdated:(NSDictionary*)status; 
@end 


/******************************************************************************* 
    BarcodePickerController 

    This ViewController subclass runs the RedLaser scanner, detects barcodes, and 
    notifies its delegate of what it found. 
*/ 
@interface BarcodePickerController : UIViewController { } 

- (void) pauseScanning; 
- (void) resumeScanning; 
- (void) prepareToScan; 
- (void) clearResultsSet; 
- (void) doneScanning; 
- (BOOL) hasFlash; 
- (void) turnFlash:(BOOL)value; 
- (void) requestCameraSnapshot; 

@property (nonatomic, retain) CameraOverlayViewController *overlay; 
@property (nonatomic, assign) id <BarcodePickerControllerDelegate> delegate; 
@property (nonatomic, assign) BOOL scanUPCE; 
@property (nonatomic, assign) BOOL scanEAN8; 
@property (nonatomic, assign) BOOL scanEAN13; 
@property (nonatomic, assign) BOOL scanSTICKY; 
@property (nonatomic, assign) BOOL scanQRCODE; 
@property (nonatomic, assign) BOOL scanCODE128; 
@property (nonatomic, assign) BOOL scanCODE39; 
@property (nonatomic, assign) BOOL scanDATAMATRIX; 
@property (nonatomic, assign) BOOL scanITF; 
@property (nonatomic, assign) BOOL scanEAN5; 
@property (nonatomic, assign) BOOL scanEAN2; 
@property (nonatomic, assign) BOOL scanCODABAR; 
@property (nonatomic, assign) CGRect activeRegion; 
@property (nonatomic, assign) UIImageOrientation orientation; 
@property (nonatomic, assign) BOOL torchState; 
@property (readonly, assign) BOOL isFocusing; 
@property (nonatomic, assign) BOOL useFrontCamera; 

@end 

#endif 
#endif 

#ifdef __cplusplus 
} 
#endif 
이 문제의 방법은 doneScanning 방법

입니다

:

이것은 SDK.h 파일입니다? 내가 말할 수있는 SDK의 소스 파일이 없으며 이것이 내 응용 프로그램에서 편집해야 할 방법입니다.

답변

0

SDK의 실제 메소드는 정적 라이브러리로 컴파일됩니다. 이 라이브러리는 "RedLaser SDK Files/libRedLaserSDK.a"의 SDK 아카이브에 있습니다. 이 라이브러리를 응용 프로그램에 포함시켜야합니다. 우리는 RedLaser SDK에 소스를 제공하지 않습니다. doneScanning 또는 다른 SDK 메소드를 편집 할 필요가 없습니다.

SDK에 포함 된 샘플 응용 프로그램은 기본적인 사용법의 좋은 예입니다. QR 코드를 스캔하고 웹 페이지를 열려면 statusUpdated : 메서드를 재정의하는 CameraOverlayViewController 클래스를 작성하면됩니다. 이 방법은 상태 사전을 통해 전달 된 스캔 한 QR 코드를보고 QR 코드에 URL이 실제로 텍스트로 포함되어 있는지 확인해야합니다 (많은 QR 코드는 URL이지만 사양에는 필요하지 않으며 모든 텍스트가 될 수 있음) 문자열)을 호출하고 유효한 코드를 찾으면 doneScanning()을 호출하여 스캔 세션을 종료합니다. 아마도 URL을 사용하여 WebView를 열 것입니다.

샘플 앱의 "OverlayController.m"파일에는이를 설정하는 방법에 대한 예의 바른 예가 있습니다.

관련 문제