bonus-material-app/nativeplugins/Mpaas-Scan/ios/TBScanSDK.framework/Headers/TBScanViewController.h

469 lines
11 KiB
C
Raw Normal View History

2024-12-20 09:23:59 +08:00
//
// TBScanViewController.h
// TBScanSDK
//
// Created by Tom on 15/7/24.
// Copyright (c) 2015 Taobao.com. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <TBDecodeSDK/tbItf.h>
#import <TBScanSDK/TBScanMacros.h>
extern NSString * const TBScanVCInitConfigMultipleQueueStartCamera;
extern NSString * const TBScanVCInitConfigSubClassDelegate;
@class TBScanResult;
@class TBScanPlugin;
@class AVCaptureVideoPreviewLayer;
enum{
TorchState_On = 1,//闪光灯开
TorchState_Off,//闪光灯关闭
TorchState_Disable,//没有闪光灯ipad,ipod
};
typedef int TorchState;// 闪光灯状态
// 扫码SDK会弹出的UIAlertView的tag
enum{
AlertType_LocalPhoto = 1688,
AlertType_CameraDisable,
};
typedef int AlertType;
enum{
ImageType_DidFind = 1000,
ImageType_AIDetectedQR
};
typedef int ImageType;
@protocol TBScanViewControllerTorchDelegate <NSObject>
/**
:; ,
线:; ,
@param yesOrNo
@param yesOrNo
*/
- (void)showTorchView:(BOOL)yesOrNo shouldTurnOn:(BOOL)shouldTurnOn;
/**
*
* @discussion UI
*
* @param bState
*
*/
-(void)setTorchState:(TorchState)bState;
@end
@protocol TBScanViewControllerDelegate <NSObject>
@required
/**
*
* @discussion
*
* @param result TBScanResult类
*
*/
-(void)didFind:(NSArray<TBScanResult*>*)resultArray;
@optional
/**
访
*/
-(void)cameraPermissionDenied;
/**
*
* @discussion
*
*/
-(void)cameraDidStart;
/**
*/
-(void)frameDidReceived;
/**
*
* @discussion
*
*/
-(void)cameraStartFail;
/**
*/
-(void)releaseByMemoryWarning;
/**
*
* @discussion
*
*/
-(void)scanPhotoFailed;
/////////////////////////// 新特性 ////////////////////////////
/**
* bStableStatusMonitorEnable YES
* @discussion
*
* @param isStable YES NO
* @param scanFrameCount
*
*/
- (void)stableStatusChanged:(BOOL)isStable AtScanFrameCount:(NSInteger)scanFrameCount;
/**
AI bAIQRImageDetectEnable bAIQRCVDetectEnable true,
*/
- (NSURL *)mlmodelcURLForAIDetect;
/**
AI
*/
-(void)detectedQRByAIAtScanFrameCount:(NSInteger)frmaeCount;
///////////////////////////////埋点接口//////////////////////////////
/**
*
* @discussion
*
*/
-(void)userTrack:(NSString*)name;
/**
*
* @discussion ,
*
*/
-(void)userTrack:(NSString*)name args:(NSDictionary*)data;
/**
Alipay用于关键路径记录线
*/
-(void)alipayLog:(NSString*)content;
/**
@param >
@return
*/
-(NSArray<TBScanResult*>*)handleResultArray:(NSArray<TBScanResult*>*)resultArray;
/**
needSaveFrameASImageWhenDidFind needSaveFrameASImageWhenAIDetectedQR ture
*/
-(void)handleImage:(UIImage *)image WithImageType:(ImageType)imageType;
///////////////////////////////iPad相关回调/////////////////////////
/**
*
* @discussion iPad识别本地相册图片失败时会调用该方法
*
*/
-(void)scanPadPhotoFailed;
/**
* @discussion popover
*/
-(void)dismissPopover;
////////////////////////////////定制
/**
*/
-(void)buildContainerView:(UIView*)containerView;
/**
*/
-(void)buildCustomAlbum;
/**
*/
-(void)buildCustomCameraPermissionAlert;
@end
@interface TBScanViewController : UIViewController <UIAlertViewDelegate>
- (instancetype)initWithConfig:(NSDictionary *)config;
@property (nonatomic,weak) id<TBScanViewControllerDelegate> delegate;
@property (nonatomic,weak) id<TBScanViewControllerTorchDelegate> torchDelegate;
/**
*
* @discussion scanType ScanType定义
* 使使ScanType_BarcodeQR码则使用ScanType_QRCode
* QR码则使用ScanType_Barcode|ScanType_QRCode使ScanType_All_Code类型
*
*/
@property (nonatomic,assign) ScanType scanType;
/**
*
* @discussion rectOfInterest SDK会默认一个裁剪区域
*
*/
@property (nonatomic,assign) CGRect rectOfInterest;
/**
*
* @discussion cameraWidthPercent 0.4~1.00.74
*
*/
@property (nonatomic,assign) CGFloat cameraWidthPercent;
/**
*
* @discussion bPlaySound YES播放NO不播放YES
*
*/
@property (nonatomic,assign) BOOL bPlaySound;
/**
*
* @discussion bPreciseScan YES能扫描很难识别的条码二维码NO对很复杂的条码二维码识别不了NO
*
*/
@property (nonatomic,assign) BOOL bPreciseScan;
/**
*
* @discussion bResumeScanAtViewAppear viewAppear的时候是否自动恢复扫描NO时不恢复需要手动调用resumeScan来恢复YES
*
*/
@property (nonatomic,assign) BOOL bResumeScanAtViewAppear;
/**
size做放大缩小YES
*/
@property (nonatomic,assign,setter=setBAutoZoomEnable:) BOOL bAutoZoomEnable; ///< 逐步淘汰掉这种以下面渐进式的为主
/**
size YES
*/
@property (nonatomic,assign) BOOL bGraduallyAutoZoomEnable;
/**
near
*/
@property (nonatomic,assign) BOOL bAutoFocusRangeNearEnable;
/**
35
*/
@property (nonatomic,assign) int autoZoomDelayFrameCount;
/**
,YES
*/
@property (nonatomic,assign) BOOL bGestureEnable;
/**
, NO YES - (void)stableStatusUpdate: AtScanCount:
*/
@property (nonatomic,assign) BOOL bStableStatusMonitorEnable;
/**
NO
*/
@property (nonatomic,assign) BOOL shouldReleaseByMemoryWarning;
//////////////////////////////// 新特性 AI 相关 /////////////////////////////////////
/**
*/
@property (nonatomic,assign) CGRect animationRect;
/**
*/
@property (nonatomic,assign) CGFloat flashOnBrightnessThreshold;
/**
*/
@property (nonatomic,assign) CGFloat flashOffBrightnessThreshold;
/**
true
*/
@property (nonatomic,assign) BOOL bKeepTorchModeWhenPauseScan;
/////////////////////// 保存帧图像 ////////////////
/**
did find , delegate 线 NO
*/
@property (nonatomic,assign) BOOL needSaveFrameASImageWhenDidFind;
/**
*
* @discussion bImpactFeedBack YES播放NO不播放YES
*
*/
@property (nonatomic,assign) BOOL bImpactFeedBack;
////////////////////////////自定义UIAlertView的文案/////////////////////////////////
// 无摄像头权限时的AlertView的title
@property (nonatomic,strong) NSString *cameraPermissionDeniedTitle;
// 无摄像头权限时的AlertView的提示信息
@property (nonatomic,strong) NSString *cameraPermissionDeniedMsg;
// 无摄像头权限时的AlertView取消按钮的title
@property (nonatomic,strong) NSString *cameraPermissionDeniedCancelTitle;
// 相册识别失败时的AlertView的提示信息
@property (nonatomic,strong) NSString *scanPhotoFailedMsg;
// 相册识别失败时AlertView取消按钮的title
@property (nonatomic,strong) NSString *scanPhotoFailedCancelTitle;
@property (nonatomic, assign) BOOL supportSaveColorfullImage; ///配置是否支持保存彩色图片
/**
*
* @discussion
*
*/
-(void)exitScan;
/**
*
* @discussion
*
*/
-(void)scanPhotoLibrary;
/**
*/
-(void)scanPhotoImage:(UIImage*)image;
/**
*
* @discussion -(void)setTorchState:(TorchState)bStatebState来判断当前闪光灯的状态从而实现对应的UI
*
*/
-(void)onTorch;
/**
*
*/
-(TorchState)torchMode;
/**
*
* @discussion
*
*/
-(void)pauseScan;
/**
*
* @discussion
*
*/
-(void)resumeScan;
/**
*
* @discussion ,()
*
*/
-(void)pauseCaptureSession;
/**
*
* @discussion
*
*/
-(void)resumeCaptureSession;
/**
*
* @discussion ,, Session 便 resume
*
*/
-(void)pauseScanAndPreView;
/**
*
* @discussion ,
*
*/
-(void)resumeScanAndPreView;
/**
*
* @discussion ScanType可以注册自定义的Plugin
*
*/
-(void)registerPlugin:(TBScanPlugin*)inPlugin withType:(ScanType)type;
/**
*
* @discussion
*
*/
- (void)startCameraWithConfig:(NSDictionary *)config;
/**
*
* @discussion , nil
*/
- (NSDictionary *)getDecodeDetailInfo;
///////////////////////////////下面两个接口只在iPad下有效/////////////////////////
/**
*
* @discussion iPad相册取图弹出框有定制要求的可以使用这个接口来替换通用的相册取图scanPhotoLibrary接口
*
* @param rect
*
* @param arrowDirections
*
* @param arrowColor nil为白色
*
*/
-(void)scanPhotoLibrary:(CGRect)rect permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections with:(UIColor*)arrowColor;
@end
@interface TBScanViewController(CaptureManager)
/**
*
* @discussion SessionPreset
*
*/
-(BOOL)canSetSession:(NSString *)sessionPreset;
// 判断当前是否在使用前置摄像头
-(BOOL)isUsingFrontCamera;
-(void)setCameraCaptureFocusPoint:(CGPoint)point;
-(void)updateCodeDetectStatus;
@end