diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 00:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 00:06:44 +0000 |
commit | 44cf8ec67278bd1ab6c7f83a9993f7a5686a9541 (patch) | |
tree | 5eec4b0d1a3f163d279c3c27c03324ba49fa235a /iphone/examples/readertest | |
parent | Initial commit. (diff) | |
download | zbar-44cf8ec67278bd1ab6c7f83a9993f7a5686a9541.tar.xz zbar-44cf8ec67278bd1ab6c7f83a9993f7a5686a9541.zip |
Adding upstream version 0.23.93.upstream/0.23.93upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'iphone/examples/readertest')
-rw-r--r-- | iphone/examples/readertest/ZBarSDK | 1 | ||||
-rw-r--r-- | iphone/examples/readertest/build | 1 | ||||
-rw-r--r-- | iphone/examples/readertest/entitlements.plist | 8 | ||||
-rw-r--r-- | iphone/examples/readertest/prefix.pch | 11 | ||||
-rw-r--r-- | iphone/examples/readertest/readertest.m | 991 | ||||
-rw-r--r-- | iphone/examples/readertest/readertest.plist | 28 | ||||
-rw-r--r-- | iphone/examples/readertest/readertest.xcodeproj/project.pbxproj | 351 | ||||
-rw-r--r-- | iphone/examples/readertest/readertest.xcodeproj/xcshareddata/xcschemes/readertest.xcscheme | 76 |
8 files changed, 1467 insertions, 0 deletions
diff --git a/iphone/examples/readertest/ZBarSDK b/iphone/examples/readertest/ZBarSDK new file mode 100644 index 0000000..7a373ea --- /dev/null +++ b/iphone/examples/readertest/ZBarSDK @@ -0,0 +1 @@ +../../build/Debug-iphoneos/ZBarSDK
\ No newline at end of file diff --git a/iphone/examples/readertest/build b/iphone/examples/readertest/build new file mode 100644 index 0000000..bd23a51 --- /dev/null +++ b/iphone/examples/readertest/build @@ -0,0 +1 @@ +/tmp/readertest.build
\ No newline at end of file diff --git a/iphone/examples/readertest/entitlements.plist b/iphone/examples/readertest/entitlements.plist new file mode 100644 index 0000000..ce373e1 --- /dev/null +++ b/iphone/examples/readertest/entitlements.plist @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>get-task-allow</key> + <false/> +</dict> +</plist> diff --git a/iphone/examples/readertest/prefix.pch b/iphone/examples/readertest/prefix.pch new file mode 100644 index 0000000..9efda98 --- /dev/null +++ b/iphone/examples/readertest/prefix.pch @@ -0,0 +1,11 @@ +#ifdef __OBJC__ +# import <Foundation/Foundation.h> +# import <CoreFoundation/CoreFoundation.h> +# import <CoreGraphics/CoreGraphics.h> +# import <UIKit/UIKit.h> +# import <QuartzCore/QuartzCore.h> +# import <AVFoundation/AVFoundation.h> +# import <CoreMedia/CoreMedia.h> +# import <CoreVideo/CoreVideo.h> +# import "ZBarSDK.h" +#endif diff --git a/iphone/examples/readertest/readertest.m b/iphone/examples/readertest/readertest.m new file mode 100644 index 0000000..21ffc28 --- /dev/null +++ b/iphone/examples/readertest/readertest.m @@ -0,0 +1,991 @@ +enum { + CLASS_SECTION = 0, + SOURCE_SECTION, + CAMODE_SECTION, + DEVICE_SECTION, + FLASH_SECTION, + QUALITY_SECTION, + CONFIG_SECTION, + CUSTOM_SECTION, + SYMBOL_SECTION, + RESULT_SECTION, + NUM_SECTIONS +}; + +static NSString* const section_titles[] = { + @"Classes", + @"SourceType", + @"CameraMode", + @"CaptureDevice", + @"CameraFlashMode", + @"VideoQuality", + @"Reader Configuration", + nil, + @"Enabled Symbologies", + @"Decode Results", +}; + +static const CGRect const crop_choices[] = { + { { 0, 0 }, { 1, 1 } }, + { { .125, 0 }, { .75, 1 } }, + { { 0, .3 }, { 1, .4 } }, + { { 0, 0 }, { 0, 0 } } +}; + +static const NSInteger const density_choices[] = { + 3, 2, 1, 0, 4, -1 +}; + +static const CGFloat const zoom_choices[] = { + 1, 10/9., 10/8., 8/6., 10/7., 9/6., 10/6., 7/4., 2, 0, -1 +}; + +@interface AppDelegate + : UITableViewController + < UIApplicationDelegate, + UINavigationControllerDelegate, + UITableViewDelegate, + UITableViewDataSource, + UIActionSheetDelegate, + ZBarReaderDelegate > +{ + UIWindow *window; + UINavigationController *nav; + + NSSet *defaultSymbologies; + CGFloat zoom; + + NSMutableArray *sections, *symbolEnables; + NSInteger xDensity, yDensity; + + BOOL found, paused, continuous; + NSInteger dataHeight; + UILabel *typeLabel, *dataLabel; + UIImageView *imageView; + + ZBarReaderViewController *reader; + UIView *overlay; + UIBarButtonItem *manualBtn; + UILabel *typeOvl, *dataOvl; + NSArray *masks; +} + +@end + + +@implementation AppDelegate + +- (id) init +{ + return([super initWithStyle: UITableViewStyleGrouped]); +} + +- (void) initReader: (NSString*) clsName +{ + [reader release]; + Class cls = [[NSBundle mainBundle] + classNamed: clsName]; + assert(cls); + reader = [cls new]; + assert(reader); + reader.readerDelegate = self; + xDensity = yDensity = 3; + +#if 0 + // apply defaults for demo + ZBarImageScanner *scanner = reader.scanner; + continuous = NO; + zoom = 1; + reader.showsZBarControls = NO; + reader.scanCrop = CGRectMake(0, .35, 1, .3); + + [defaultSymbologies release]; + defaultSymbologies = + [[NSSet alloc] + initWithObjects: + [NSNumber numberWithInteger: ZBAR_CODE128], + nil]; + [scanner setSymbology: 0 + config: ZBAR_CFG_ENABLE + to: 0]; + for(NSNumber *sym in defaultSymbologies) + [scanner setSymbology: sym.integerValue + config: ZBAR_CFG_ENABLE + to: 1]; + + [scanner setSymbology: 0 + config: ZBAR_CFG_X_DENSITY + to: (xDensity = 0)]; + [scanner setSymbology: 0 + config: ZBAR_CFG_Y_DENSITY + to: (yDensity = 1)]; +#endif +} + +- (void) initOverlay +{ + overlay = [[UIView alloc] + initWithFrame: CGRectMake(0, 426, 320, 54)]; + overlay.backgroundColor = [UIColor clearColor]; + + masks = [[NSArray alloc] + initWithObjects: + [[[UIView alloc] + initWithFrame: CGRectMake(0, -426, 320, 0)] + autorelease], + [[[UIView alloc] + initWithFrame: CGRectMake(0, -426, 0, 426)] + autorelease], + [[[UIView alloc] + initWithFrame: CGRectMake(0, 0, 320, 0)] + autorelease], + [[[UIView alloc] + initWithFrame: CGRectMake(320, -426, 0, 426)] + autorelease], + nil]; + for(UIView *mask in masks) { + mask.backgroundColor = [UIColor colorWithWhite: 0 + alpha: .5]; + [overlay addSubview: mask]; + } + + UILabel *label = + [[UILabel alloc] + initWithFrame: CGRectMake(0, -426, 320, 48)]; + label.backgroundColor = [UIColor clearColor]; + label.textColor = [UIColor whiteColor]; + label.font = [UIFont boldSystemFontOfSize: 24]; + label.text = @"Custom Overlay"; + [overlay addSubview: label]; + [label release]; + + typeOvl = [[UILabel alloc] + initWithFrame: CGRectMake(0, -378, 80, 24)]; + typeOvl.backgroundColor = [UIColor clearColor]; + typeOvl.textColor = [UIColor whiteColor]; + typeOvl.font = [UIFont systemFontOfSize: 16]; + typeOvl.textAlignment = UITextAlignmentCenter; + [overlay addSubview: typeOvl]; + + dataOvl = [[UILabel alloc] + initWithFrame: CGRectMake(96, -378, 224, 24)]; + dataOvl.backgroundColor = [UIColor clearColor]; + dataOvl.textColor = [UIColor whiteColor]; + dataOvl.font = [UIFont systemFontOfSize: 16]; + [overlay addSubview: dataOvl]; + + UIToolbar *toolbar = + [[UIToolbar alloc] + initWithFrame: CGRectMake(0, 0, 320, 54)]; + toolbar.tintColor = [UIColor colorWithRed: .5 + green: 0 + blue: 0 + alpha: 1]; + [manualBtn release]; + manualBtn = [[UIBarButtonItem alloc] + initWithBarButtonSystemItem: UIBarButtonSystemItemCamera + target: self + action: @selector(manualCapture)]; + + + UIButton *info = + [UIButton buttonWithType: UIButtonTypeInfoLight]; + [info addTarget: self + action: @selector(info) + forControlEvents: UIControlEventTouchUpInside]; + + toolbar.items = + [NSArray arrayWithObjects: + [[[UIBarButtonItem alloc] + initWithTitle: @"X" + style: UIBarButtonItemStylePlain + target: self + action: @selector(imagePickerControllerDidCancel:)] + autorelease], + [[[UIBarButtonItem alloc] + initWithBarButtonSystemItem: UIBarButtonSystemItemFlexibleSpace + target: nil + action: nil] + autorelease], + manualBtn, + [[[UIBarButtonItem alloc] + initWithBarButtonSystemItem: UIBarButtonSystemItemFlexibleSpace + target: nil + action: nil] + autorelease], + [[[UIBarButtonItem alloc] + initWithBarButtonSystemItem: UIBarButtonSystemItemPause + target: self + action: @selector(pause)] + autorelease], + [[[UIBarButtonItem alloc] + initWithBarButtonSystemItem: UIBarButtonSystemItemFlexibleSpace + target: nil + action: nil] + autorelease], + [[[UIBarButtonItem alloc] + initWithCustomView: info] + autorelease], + nil]; + [overlay addSubview: toolbar]; + [toolbar release]; +} + +- (void) updateCropMask +{ + CGRect r = reader.scanCrop; + r.origin.x *= 426; + r.origin.y *= 320; + r.size.width *= 426; + r.size.height *= 320; + UIView *mask = [masks objectAtIndex: 0]; + mask.frame = CGRectMake(0, -426, 320, r.origin.x); + mask = [masks objectAtIndex: 1]; + mask.frame = CGRectMake(0, r.origin.x - 426, r.origin.y, r.size.width); + + r.origin.y += r.size.height; + mask = [masks objectAtIndex: 2]; + mask.frame = CGRectMake(r.origin.y, r.origin.x - 426, + 320 - r.origin.y, r.size.width); + + r.origin.x += r.size.width; + mask = [masks objectAtIndex: 3]; + mask.frame = CGRectMake(0, r.origin.x - 426, 320, 426 - r.origin.x); +} + +- (void) setCheck: (BOOL) state + forCell: (UITableViewCell*) cell +{ + cell.accessoryType = + ((state) + ? UITableViewCellAccessoryCheckmark + : UITableViewCellAccessoryNone); +} + +- (void) setCheckForTag: (int) tag + inSection: (int) section +{ + for(UITableViewCell *cell in [sections objectAtIndex: section]) + [self setCheck: (cell.tag == tag) + forCell: cell]; +} + +- (void) setCheckForName: (NSString*) name + inSection: (int) section +{ + for(UITableViewCell *cell in [sections objectAtIndex: section]) + [self setCheck: [name isEqualToString: cell.textLabel.text] + forCell: cell]; +} + +- (void) applicationDidFinishLaunching: (UIApplication*) application +{ + self.title = @"ZBar Reader Test"; + + nav = [[UINavigationController alloc] + initWithRootViewController: self]; + nav.delegate = self; + + window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]]; + [window addSubview: nav.view]; + [window makeKeyAndVisible]; + + [self initReader: @"ZBarReaderViewController"]; +} + +- (UITableViewCell*) cellWithTitle: (NSString*) title + tag: (NSInteger) tag + checked: (BOOL) checked +{ + UITableViewCell *cell = [UITableViewCell new]; + cell.textLabel.text = title; + cell.tag = tag; + [self setCheck: checked + forCell: cell]; + return([cell autorelease]); +} + +- (void) initControlCells +{ + // NB don't need SourceTypeSavedPhotosAlbum + static NSString* const sourceNames[] = { + @"Library", @"Camera", @"Album", nil + }; + NSMutableArray *sources = [NSMutableArray array]; + for(int i = 0; sourceNames[i]; i++) + if([[reader class] isSourceTypeAvailable: i]) + [sources addObject: + [self cellWithTitle: sourceNames[i] + tag: i + checked: (reader.sourceType == i)]]; + [sections replaceObjectAtIndex: SOURCE_SECTION + withObject: sources]; + + static NSString* const modeNames[] = { + @"Default", @"Sampling", @"Sequence", nil + }; + NSMutableArray *modes = [NSMutableArray array]; + for(int i = 0; modeNames[i]; i++) + [modes addObject: + [self cellWithTitle: modeNames[i] + tag: i + checked: (reader.cameraMode == i)]]; + [sections replaceObjectAtIndex: CAMODE_SECTION + withObject: modes]; + + static NSString *const deviceNames[] = { + @"Rear", @"Front", nil + }; + NSMutableArray *devices = [NSMutableArray array]; + for(int i = 0; deviceNames[i]; i++) + if([[reader class] + isCameraDeviceAvailable: i]) + [devices addObject: + [self cellWithTitle: deviceNames[i] + tag: i + checked: (reader.cameraDevice == i)]]; + assert(devices.count); + [sections replaceObjectAtIndex: DEVICE_SECTION + withObject: devices]; + + static NSString *const flashNames[] = { + @"Off", @"Auto", @"On", nil + }; + NSMutableArray *flashModes = [NSMutableArray array]; + for(int i = 0; flashNames[i]; i++) + [flashModes addObject: + [self cellWithTitle: flashNames[i] + tag: i - 1 + checked: (reader.cameraFlashMode == i - 1)]]; + [sections replaceObjectAtIndex: FLASH_SECTION + withObject: flashModes]; + + static NSString *const qualityNames[] = { + @"High", @"Medium", @"Low", @"640x480", nil + }; + NSMutableArray *qualities = [NSMutableArray array]; + for(int i = 0; qualityNames[i]; i++) + [qualities addObject: + [self cellWithTitle: qualityNames[i] + tag: i + checked: (reader.videoQuality == i)]]; + [sections replaceObjectAtIndex: QUALITY_SECTION + withObject: qualities]; + + static NSString* const configNames[] = { + @"showsCameraControls", @"showsZBarControls", @"tracksSymbols", + @"enableCache", @"showsHelpOnFail", @"takesPicture", + nil + }; + NSMutableArray *configs = [NSMutableArray array]; + for(int i = 0; configNames[i]; i++) + @try { + BOOL checked = [[reader valueForKey: configNames[i]] boolValue]; + [configs addObject: + [self cellWithTitle: configNames[i] + tag: i + checked: checked]]; + } + @catch(...) { } + [sections replaceObjectAtIndex: CONFIG_SECTION + withObject: configs]; + + UITableViewCell *xDensityCell = + [[[UITableViewCell alloc] + initWithStyle: UITableViewCellStyleValue1 + reuseIdentifier: nil] + autorelease]; + xDensityCell.textLabel.text = @"CFG_X_DENSITY"; + xDensityCell.detailTextLabel.tag = ZBAR_CFG_X_DENSITY; + xDensityCell.detailTextLabel.text = + [NSString stringWithFormat: @"%d", xDensity]; + + UITableViewCell *yDensityCell = + [[[UITableViewCell alloc] + initWithStyle: UITableViewCellStyleValue1 + reuseIdentifier: nil] + autorelease]; + yDensityCell.textLabel.text = @"CFG_Y_DENSITY"; + yDensityCell.detailTextLabel.tag = ZBAR_CFG_Y_DENSITY; + yDensityCell.detailTextLabel.text = + [NSString stringWithFormat: @"%d", yDensity]; + + UITableViewCell *cropCell = + [[[UITableViewCell alloc] + initWithStyle: UITableViewCellStyleValue1 + reuseIdentifier: nil] + autorelease]; + cropCell.textLabel.text = @"scanCrop"; + cropCell.detailTextLabel.text = NSStringFromCGRect(reader.scanCrop); + + UITableViewCell *zoomCell = + [[[UITableViewCell alloc] + initWithStyle: UITableViewCellStyleValue1 + reuseIdentifier: nil] + autorelease]; + zoomCell.textLabel.text = @"zoom"; + zoomCell.detailTextLabel.text = + [NSString stringWithFormat: @"%g", zoom]; + + [sections replaceObjectAtIndex: CUSTOM_SECTION + withObject: [NSArray arrayWithObjects: + xDensityCell, + yDensityCell, + cropCell, + zoomCell, + [self cellWithTitle: @"continuous" + tag: 1 + checked: continuous], + nil]]; + + static const zbar_symbol_type_t allSymbologies[] = { + ZBAR_QRCODE, ZBAR_CODE128, ZBAR_CODE93, ZBAR_CODE39, ZBAR_CODABAR, + ZBAR_I25, ZBAR_DATABAR, ZBAR_DATABAR_EXP, + ZBAR_EAN13, ZBAR_EAN8, + ZBAR_EAN2, ZBAR_EAN5, ZBAR_COMPOSITE, + ZBAR_UPCA, ZBAR_UPCE, + ZBAR_ISBN13, ZBAR_ISBN10, + 0 + }; + NSMutableArray *symbols = [NSMutableArray array]; + [symbolEnables release]; + symbolEnables = [NSMutableArray new]; + BOOL en = YES; + for(int i = 0; allSymbologies[i]; i++) { + zbar_symbol_type_t sym = allSymbologies[i]; + if(defaultSymbologies) + en = !![defaultSymbologies member: + [NSNumber numberWithInteger: sym]]; + else + /* symbologies after ZBAR_EAN5 are disabled by default */ + en = en && (sym != ZBAR_EAN2); + [symbols addObject: + [self cellWithTitle: [ZBarSymbol nameForType: sym] + tag: sym + checked: en]]; + [symbolEnables addObject: [NSNumber numberWithBool: en]]; + } + [sections replaceObjectAtIndex: SYMBOL_SECTION + withObject: symbols]; + + [self.tableView reloadData]; +} + +- (void) viewDidLoad +{ + [super viewDidLoad]; + + UITableView *view = self.tableView; + view.delegate = self; + view.dataSource = self; + + [self initOverlay]; + [self updateCropMask]; + + sections = [[NSMutableArray alloc] + initWithCapacity: NUM_SECTIONS]; + for(int i = 0; i < NUM_SECTIONS; i++) + [sections addObject: [NSNull null]]; + + NSArray *classes = + [NSArray arrayWithObjects: + [self cellWithTitle: @"ZBarReaderViewController" + tag: 0 + checked: YES], + [self cellWithTitle: @"ZBarReaderController" + tag: 1 + checked: NO], + nil]; + [sections replaceObjectAtIndex: CLASS_SECTION + withObject: classes]; + + UITableViewCell *typeCell = [UITableViewCell new]; + typeLabel = [typeCell.textLabel retain]; + UITableViewCell *dataCell = [UITableViewCell new]; + dataLabel = [dataCell.textLabel retain]; + dataLabel.numberOfLines = 0; + dataLabel.lineBreakMode = UILineBreakModeCharacterWrap; + UITableViewCell *imageCell = [UITableViewCell new]; + imageView = [UIImageView new]; + imageView.contentMode = UIViewContentModeScaleAspectFit; + imageView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | + UIViewAutoresizingFlexibleHeight); + UIView *content = imageCell.contentView; + imageView.frame = content.bounds; + [content addSubview: imageView]; + [imageView release]; + NSArray *results = + [NSArray arrayWithObjects: typeCell, dataCell, imageCell, nil]; + [sections replaceObjectAtIndex: RESULT_SECTION + withObject: results]; + + [self initControlCells]; +} + +- (void) viewDidUnload +{ + [sections release]; + sections = nil; + [symbolEnables release]; + symbolEnables = nil; + [manualBtn release]; + manualBtn = nil; + [typeLabel release]; + typeLabel = nil; + [dataLabel release]; + dataLabel = nil; + [imageView release]; + imageView = nil; + [typeOvl release]; + typeOvl = nil; + [dataOvl release]; + dataOvl = nil; + [overlay release]; + overlay = nil; + [masks release]; + masks = nil; + [super viewDidUnload]; +} + +- (void) dealloc +{ + [reader release]; + reader = nil; + [nav release]; + nav = nil; + [window release]; + window = nil; + [super dealloc]; +} + +- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) orient +{ + return(YES); +} + +- (void) scan +{ + found = paused = NO; + imageView.image = nil; + typeLabel.text = nil; + dataLabel.text = nil; + typeOvl.text = nil; + dataOvl.text = nil; + [self.tableView reloadData]; + if(reader.sourceType == UIImagePickerControllerSourceTypeCamera) + reader.cameraOverlayView = (reader.showsZBarControls) ? nil : overlay; + if([reader respondsToSelector: @selector(readerView)]) { + reader.readerView.showsFPS = YES; + if(zoom) + reader.readerView.zoom = zoom; + reader.supportedOrientationsMask = (reader.showsZBarControls) + ? ZBarOrientationMaskAll + : ZBarOrientationMask(UIInterfaceOrientationPortrait); // tmp disable + } + manualBtn.enabled = TARGET_IPHONE_SIMULATOR || + (reader.cameraMode == ZBarReaderControllerCameraModeDefault) || + [reader isKindOfClass: [ZBarReaderViewController class]]; + [self presentModalViewController: reader + animated: YES]; +} + +- (void) help +{ + ZBarHelpController *help = + [[ZBarHelpController alloc] + initWithReason: @"TEST"]; + [self presentModalViewController: help + animated: YES]; + [help release]; +} + +- (void) info +{ + [reader showHelpWithReason: @"INFO"]; +} + +- (void) pause +{ + if(![reader respondsToSelector: @selector(readerView)]) + return; + paused = !paused; + if(paused) + [reader.readerView stop]; + else + [reader.readerView start]; +} + +- (void) manualCapture +{ + [(UIImagePickerController*)reader takePicture]; +} + +// UINavigationControllerDelegate + +- (void) navigationController: (UINavigationController*) _nav + willShowViewController: (UIViewController*) vc + animated: (BOOL) animated +{ + self.navigationItem.leftBarButtonItem = + [[[UIBarButtonItem alloc] + initWithTitle: @"Help" + style: UIBarButtonItemStyleDone + target: self + action: @selector(help)] + autorelease]; + self.navigationItem.rightBarButtonItem = + [[[UIBarButtonItem alloc] + initWithTitle: @"Scan!" + style: UIBarButtonItemStyleDone + target: self + action: @selector(scan)] + autorelease]; +} + +// UITableViewDataSource + +- (NSInteger) numberOfSectionsInTableView: (UITableView*) view +{ + return(sections.count - !found); +} + +- (NSInteger) tableView: (UITableView*) view + numberOfRowsInSection: (NSInteger) idx +{ + NSArray *section = [sections objectAtIndex: idx]; + return(section.count); +} + +- (UITableViewCell*) tableView: (UITableView*) view + cellForRowAtIndexPath: (NSIndexPath*) path +{ + return([[sections objectAtIndex: path.section] + objectAtIndex: path.row]); +} + +- (NSString*) tableView: (UITableView*) view + titleForHeaderInSection: (NSInteger) idx +{ + assert(idx < NUM_SECTIONS); + return(section_titles[idx]); +} + +// UITableViewDelegate + +- (NSIndexPath*) tableView: (UITableView*) view + willSelectRowAtIndexPath: (NSIndexPath*) path +{ + if(path.section == RESULT_SECTION && path.row != 2) + return(nil); + return(path); +} + +- (void) alertUnsupported +{ + UIAlertView *alert = + [[UIAlertView alloc] + initWithTitle: @"Unsupported" + message: @"Setting not available for this reader" + @" (or with this OS on this device)" + delegate: nil + cancelButtonTitle: @"Cancel" + otherButtonTitles: nil]; + [alert show]; + [alert release]; +} + +- (void) advanceCrop: (UILabel*) label +{ + CGRect r = CGRectFromString(label.text); + int i; + for(i = 0; crop_choices[i].size.width;) + if(CGRectEqualToRect(r, crop_choices[i++])) + break; + if(!crop_choices[i].size.width) + i = 0; + r = crop_choices[i]; + reader.scanCrop = r; + label.text = NSStringFromCGRect(r); + + [self updateCropMask]; +} + +- (void) advanceZoom: (UILabel*) label +{ + int i; + for(i = 0; zoom_choices[i] >= 0;) + if(zoom == zoom_choices[i++]) + break; + if(zoom_choices[i] < 0) + i = 0; + zoom = zoom_choices[i]; + assert(zoom >= 0); + label.text = [NSString stringWithFormat: @"%g", zoom]; +} + +- (void) advanceDensity: (UILabel*) label + value: (NSInteger*) value +{ + NSInteger d = *value; + int i; + for(i = 0; density_choices[i] >= 0;) + if(d == density_choices[i++]) + break; + if(density_choices[i] < 0) + i = 0; + *value = d = density_choices[i]; + assert(d >= 0); + [reader.scanner setSymbology: 0 + config: label.tag + to: d]; + label.text = [NSString stringWithFormat: @"%d", d]; +} + +- (void) tableView: (UITableView*) view + didSelectRowAtIndexPath: (NSIndexPath*) path +{ + [view deselectRowAtIndexPath: path + animated: YES]; + + UITableViewCell *cell = [view cellForRowAtIndexPath: path]; + + switch(path.section) + { + case CLASS_SECTION: { + NSString *name = cell.textLabel.text; + [self initReader: name]; + [self updateCropMask]; + [self initControlCells]; + [self setCheckForName: name + inSection: CLASS_SECTION]; + break; + } + + case SOURCE_SECTION: + [self setCheckForTag: reader.sourceType = cell.tag + inSection: SOURCE_SECTION]; + break; + + case CAMODE_SECTION: + @try { + reader.cameraMode = cell.tag; + } + @catch (...) { + [self alertUnsupported]; + } + [self setCheckForTag: reader.cameraMode + inSection: CAMODE_SECTION]; + break; + + case DEVICE_SECTION: + reader.cameraDevice = cell.tag; + [self setCheckForTag: reader.cameraDevice + inSection: DEVICE_SECTION]; + break; + + case FLASH_SECTION: + reader.cameraFlashMode = cell.tag; + [self setCheckForTag: reader.cameraFlashMode + inSection: FLASH_SECTION]; + break; + + case QUALITY_SECTION: + reader.videoQuality = cell.tag; + [self setCheckForTag: reader.videoQuality + inSection: QUALITY_SECTION]; + break; + + case CONFIG_SECTION: { + BOOL state; + NSString *key = cell.textLabel.text; + state = ![[reader valueForKey: key] boolValue]; + @try { + [reader setValue: [NSNumber numberWithBool: state] + forKey: key]; + } + @catch (...) { + [self alertUnsupported]; + } + + // read back and update current state + state = [[reader valueForKey: key] boolValue]; + [self setCheck: state + forCell: cell]; + break; + } + + case CUSTOM_SECTION: + switch(path.row) + { + case 0: + [self advanceDensity: cell.detailTextLabel + value: &xDensity]; + break; + case 1: + [self advanceDensity: cell.detailTextLabel + value: &yDensity]; + break; + case 2: + [self advanceCrop: cell.detailTextLabel]; + break; + case 3: + [self advanceZoom: cell.detailTextLabel]; + break; + case 4: + [self setCheck: continuous = !continuous + forCell: cell]; + break; + default: + assert(0); + } + break; + + case SYMBOL_SECTION: { + BOOL state = ![[symbolEnables objectAtIndex: path.row] boolValue]; + [symbolEnables replaceObjectAtIndex: path.row + withObject: [NSNumber numberWithBool: state]]; + [reader.scanner setSymbology: cell.tag + config: ZBAR_CFG_ENABLE + to: state]; + [self setCheck: state + forCell: cell]; + break; + } + case RESULT_SECTION: + if(path.row == 2) + [[[[UIActionSheet alloc] + initWithTitle: nil + delegate: self + cancelButtonTitle: @"Cancel" + destructiveButtonTitle: nil + otherButtonTitles: @"Save Image", nil] + autorelease] + showInView: self.view]; + break; + default: + assert(0); + } +} + +- (CGFloat) tableView: (UITableView*) view + heightForRowAtIndexPath: (NSIndexPath*) path +{ + if(path.section < RESULT_SECTION) + return(44); + + switch(path.row) { + case 0: return(44); + case 1: return(dataHeight); + case 2: return(300); + default: assert(0); + } + return(44); +} + +// UIActionSheetDelegate + +- (void) actionSheet: (UIActionSheet*) sheet + clickedButtonAtIndex: (NSInteger) idx +{ + if(idx == sheet.cancelButtonIndex) + return; + idx -= sheet.firstOtherButtonIndex; + if(!idx) { + UIImage *img = + [UIImage imageWithData: + UIImagePNGRepresentation(imageView.image)]; + UIImageWriteToSavedPhotosAlbum(img, nil, NULL, NULL); + } +} + +// ZBarReaderDelegate + +- (void) imagePickerController: (UIImagePickerController*) picker + didFinishPickingMediaWithInfo: (NSDictionary*) info +{ + id <NSFastEnumeration> results = + [info objectForKey: ZBarReaderControllerResults]; + assert(results); + + UIImage *image = [info objectForKey: UIImagePickerControllerOriginalImage]; + assert(image); + if(image) + imageView.image = image; + + int quality = 0; + ZBarSymbol *bestResult = nil; + for(ZBarSymbol *sym in results) { + int q = sym.quality; + if(quality < q) { + quality = q; + bestResult = sym; + } + } + + [self performSelector: @selector(presentResult:) + withObject: bestResult + afterDelay: .001]; + if(!continuous) + [picker dismissModalViewControllerAnimated: YES]; +} + +- (void) presentResult: (ZBarSymbol*) sym +{ + found = sym || imageView.image; + NSString *typeName = @"NONE"; + NSString *data = @""; + if(sym) { + typeName = sym.typeName; + data = sym.data; + } + typeLabel.text = typeName; + dataLabel.text = data; + + if(continuous) { + typeOvl.text = typeName; + dataOvl.text = data; + } + + NSLog(@"imagePickerController:didFinishPickingMediaWithInfo:\n"); + NSLog(@" type=%@ data=%@\n", typeName, data); + + CGSize size = [data sizeWithFont: [UIFont systemFontOfSize: 17] + constrainedToSize: CGSizeMake(288, 2000) + lineBreakMode: UILineBreakModeCharacterWrap]; + dataHeight = size.height + 26; + if(dataHeight > 2000) + dataHeight = 2000; + + [self.tableView reloadData]; + [self.tableView scrollToRowAtIndexPath: + [NSIndexPath indexPathForRow: 0 + inSection: RESULT_SECTION] + atScrollPosition:UITableViewScrollPositionTop + animated: NO]; +} + +- (void) imagePickerControllerDidCancel: (UIImagePickerController*) picker +{ + NSLog(@"imagePickerControllerDidCancel:\n"); + [reader dismissModalViewControllerAnimated: YES]; +} + +- (void) readerControllerDidFailToRead: (ZBarReaderController*) _reader + withRetry: (BOOL) retry +{ + NSLog(@"readerControllerDidFailToRead: retry=%s\n", + (retry) ? "YES" : "NO"); + if(!retry) + [_reader dismissModalViewControllerAnimated: YES]; +} + +@end + + +int main (int argc, char *argv[]) +{ + NSAutoreleasePool *pool = [NSAutoreleasePool new]; + int rc = UIApplicationMain(argc, argv, nil, @"AppDelegate"); + [pool release]; + return(rc); +} diff --git a/iphone/examples/readertest/readertest.plist b/iphone/examples/readertest/readertest.plist new file mode 100644 index 0000000..62a8126 --- /dev/null +++ b/iphone/examples/readertest/readertest.plist @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleDisplayName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundleExecutable</key> + <string>${EXECUTABLE_NAME}</string> + <key>CFBundleIconFile</key> + <string></string> + <key>CFBundleIdentifier</key> + <string>net.sourceforge.zbar.test.readertest</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1.0</string> + <key>LSRequiresIPhoneOS</key> + <true/> +</dict> +</plist> diff --git a/iphone/examples/readertest/readertest.xcodeproj/project.pbxproj b/iphone/examples/readertest/readertest.xcodeproj/project.pbxproj new file mode 100644 index 0000000..5d30670 --- /dev/null +++ b/iphone/examples/readertest/readertest.xcodeproj/project.pbxproj @@ -0,0 +1,351 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; + 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; }; + DC48C4D61219E5F70047193B /* libzbar.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DC48C4D01219E5F70047193B /* libzbar.a */; }; + DC48C4D71219E5F70047193B /* zbar-back.png in Resources */ = {isa = PBXBuildFile; fileRef = DC48C4D21219E5F70047193B /* zbar-back.png */; }; + DC48C4D81219E5F70047193B /* zbar-help.html in Resources */ = {isa = PBXBuildFile; fileRef = DC48C4D31219E5F70047193B /* zbar-help.html */; }; + DC48C4D91219E5F70047193B /* zbar-helpicons.png in Resources */ = {isa = PBXBuildFile; fileRef = DC48C4D41219E5F70047193B /* zbar-helpicons.png */; }; + DC48C4DA1219E5F70047193B /* zbar-samples.png in Resources */ = {isa = PBXBuildFile; fileRef = DC48C4D51219E5F70047193B /* zbar-samples.png */; }; + DC824600162B568A0010B2E6 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DC8245FF162B568A0010B2E6 /* Default-568h@2x.png */; }; + DCB9118510BC5DA200B907F0 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCB9118410BC5DA200B907F0 /* QuartzCore.framework */; }; + DCB9118810BC5DB500B907F0 /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = DCD6E13B10B0AFD4002005CD /* libiconv.dylib */; }; + DCD6E0D010B0AD41002005CD /* readertest.m in Sources */ = {isa = PBXBuildFile; fileRef = DCD6E0CF10B0AD41002005CD /* readertest.m */; }; + DCDC6D9B11ACA23000021380 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCDC6D9A11ACA23000021380 /* CoreVideo.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + DCDC6D9F11ACA23900021380 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCDC6D9E11ACA23900021380 /* CoreMedia.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + DCDC6DEC11ACA5B400021380 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCDC6DEB11ACA5B400021380 /* AVFoundation.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 1D6058910D05DD3D006BFB54 /* readertest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = readertest.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + DC48C4BE1219E5F70047193B /* Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decoder.h; sourceTree = "<group>"; }; + DC48C4BF1219E5F70047193B /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Exception.h; sourceTree = "<group>"; }; + DC48C4C01219E5F70047193B /* Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Image.h; sourceTree = "<group>"; }; + DC48C4C11219E5F70047193B /* ImageScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageScanner.h; sourceTree = "<group>"; }; + DC48C4C21219E5F70047193B /* Processor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Processor.h; sourceTree = "<group>"; }; + DC48C4C31219E5F70047193B /* Scanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scanner.h; sourceTree = "<group>"; }; + DC48C4C41219E5F70047193B /* Symbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Symbol.h; sourceTree = "<group>"; }; + DC48C4C51219E5F70047193B /* Video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Video.h; sourceTree = "<group>"; }; + DC48C4C61219E5F70047193B /* Window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Window.h; sourceTree = "<group>"; }; + DC48C4C71219E5F70047193B /* zbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zbar.h; sourceTree = "<group>"; }; + DC48C4C81219E5F70047193B /* ZBarCaptureReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarCaptureReader.h; sourceTree = "<group>"; }; + DC48C4C91219E5F70047193B /* ZBarImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarImage.h; sourceTree = "<group>"; }; + DC48C4CA1219E5F70047193B /* ZBarImageScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarImageScanner.h; sourceTree = "<group>"; }; + DC48C4CB1219E5F70047193B /* ZBarReaderController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderController.h; sourceTree = "<group>"; }; + DC48C4CC1219E5F70047193B /* ZBarReaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderView.h; sourceTree = "<group>"; }; + DC48C4CD1219E5F70047193B /* ZBarReaderViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderViewController.h; sourceTree = "<group>"; }; + DC48C4CE1219E5F70047193B /* ZBarSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarSDK.h; sourceTree = "<group>"; }; + DC48C4CF1219E5F70047193B /* ZBarSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarSymbol.h; sourceTree = "<group>"; }; + DC48C4D01219E5F70047193B /* libzbar.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libzbar.a; sourceTree = "<group>"; }; + DC48C4D21219E5F70047193B /* zbar-back.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-back.png"; sourceTree = "<group>"; }; + DC48C4D31219E5F70047193B /* zbar-help.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "zbar-help.html"; sourceTree = "<group>"; }; + DC48C4D41219E5F70047193B /* zbar-helpicons.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-helpicons.png"; sourceTree = "<group>"; }; + DC48C4D51219E5F70047193B /* zbar-samples.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-samples.png"; sourceTree = "<group>"; }; + DC8245FF162B568A0010B2E6 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; }; + DCB9118410BC5DA200B907F0 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + DCD6E0CE10B0AD41002005CD /* prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = prefix.pch; sourceTree = "<group>"; }; + DCD6E0CF10B0AD41002005CD /* readertest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = readertest.m; sourceTree = "<group>"; }; + DCD6E0D810B0AD55002005CD /* readertest.plist */ = {isa = PBXFileReference; explicitFileType = text.plist.info; fileEncoding = 4; path = readertest.plist; sourceTree = "<group>"; }; + DCD6E13B10B0AFD4002005CD /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = usr/lib/libiconv.dylib; sourceTree = SDKROOT; }; + DCDC6D9A11ACA23000021380 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; + DCDC6D9E11ACA23900021380 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; + DCDC6DEB11ACA5B400021380 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, + 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */, + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, + DCB9118510BC5DA200B907F0 /* QuartzCore.framework in Frameworks */, + DCDC6DEC11ACA5B400021380 /* AVFoundation.framework in Frameworks */, + DCDC6D9F11ACA23900021380 /* CoreMedia.framework in Frameworks */, + DCDC6D9B11ACA23000021380 /* CoreVideo.framework in Frameworks */, + DCB9118810BC5DB500B907F0 /* libiconv.dylib in Frameworks */, + DC48C4D61219E5F70047193B /* libzbar.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 1D6058910D05DD3D006BFB54 /* readertest.app */, + ); + name = Products; + sourceTree = "<group>"; + }; + 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { + isa = PBXGroup; + children = ( + DCD6E0CE10B0AD41002005CD /* prefix.pch */, + DCD6E0CF10B0AD41002005CD /* readertest.m */, + DC48C4BA1219E5F70047193B /* ZBarSDK */, + DC3CEAC61209C07400D7A786 /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = CustomTemplate; + sourceTree = "<group>"; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 1D30AB110D05D00D00671497 /* Foundation.framework */, + 288765FC0DF74451002DB57D /* CoreGraphics.framework */, + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, + DCB9118410BC5DA200B907F0 /* QuartzCore.framework */, + DCDC6DEB11ACA5B400021380 /* AVFoundation.framework */, + DCDC6D9A11ACA23000021380 /* CoreVideo.framework */, + DCDC6D9E11ACA23900021380 /* CoreMedia.framework */, + DCD6E13B10B0AFD4002005CD /* libiconv.dylib */, + ); + name = Frameworks; + sourceTree = "<group>"; + }; + DC3CEAC61209C07400D7A786 /* Resources */ = { + isa = PBXGroup; + children = ( + DCD6E0D810B0AD55002005CD /* readertest.plist */, + DC8245FF162B568A0010B2E6 /* Default-568h@2x.png */, + ); + name = Resources; + sourceTree = "<group>"; + }; + DC48C4BA1219E5F70047193B /* ZBarSDK */ = { + isa = PBXGroup; + children = ( + DC48C4BB1219E5F70047193B /* Headers */, + DC48C4D01219E5F70047193B /* libzbar.a */, + DC48C4D11219E5F70047193B /* Resources */, + ); + path = ZBarSDK; + sourceTree = "<group>"; + }; + DC48C4BB1219E5F70047193B /* Headers */ = { + isa = PBXGroup; + children = ( + DC48C4BC1219E5F70047193B /* ZBarSDK */, + ); + path = Headers; + sourceTree = "<group>"; + }; + DC48C4BC1219E5F70047193B /* ZBarSDK */ = { + isa = PBXGroup; + children = ( + DC48C4BD1219E5F70047193B /* zbar */, + DC48C4C71219E5F70047193B /* zbar.h */, + DC48C4C81219E5F70047193B /* ZBarCaptureReader.h */, + DC48C4C91219E5F70047193B /* ZBarImage.h */, + DC48C4CA1219E5F70047193B /* ZBarImageScanner.h */, + DC48C4CB1219E5F70047193B /* ZBarReaderController.h */, + DC48C4CC1219E5F70047193B /* ZBarReaderView.h */, + DC48C4CD1219E5F70047193B /* ZBarReaderViewController.h */, + DC48C4CE1219E5F70047193B /* ZBarSDK.h */, + DC48C4CF1219E5F70047193B /* ZBarSymbol.h */, + ); + path = ZBarSDK; + sourceTree = "<group>"; + }; + DC48C4BD1219E5F70047193B /* zbar */ = { + isa = PBXGroup; + children = ( + DC48C4BE1219E5F70047193B /* Decoder.h */, + DC48C4BF1219E5F70047193B /* Exception.h */, + DC48C4C01219E5F70047193B /* Image.h */, + DC48C4C11219E5F70047193B /* ImageScanner.h */, + DC48C4C21219E5F70047193B /* Processor.h */, + DC48C4C31219E5F70047193B /* Scanner.h */, + DC48C4C41219E5F70047193B /* Symbol.h */, + DC48C4C51219E5F70047193B /* Video.h */, + DC48C4C61219E5F70047193B /* Window.h */, + ); + path = zbar; + sourceTree = "<group>"; + }; + DC48C4D11219E5F70047193B /* Resources */ = { + isa = PBXGroup; + children = ( + DC48C4D21219E5F70047193B /* zbar-back.png */, + DC48C4D31219E5F70047193B /* zbar-help.html */, + DC48C4D41219E5F70047193B /* zbar-helpicons.png */, + DC48C4D51219E5F70047193B /* zbar-samples.png */, + ); + path = Resources; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 1D6058900D05DD3D006BFB54 /* readertest */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "readertest" */; + buildPhases = ( + 1D60588D0D05DD3D006BFB54 /* Resources */, + 1D60588E0D05DD3D006BFB54 /* Sources */, + 1D60588F0D05DD3D006BFB54 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = readertest; + productName = readertest; + productReference = 1D6058910D05DD3D006BFB54 /* readertest.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "readertest" */; + compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); + mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 1D6058900D05DD3D006BFB54 /* readertest */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 1D60588D0D05DD3D006BFB54 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DC48C4D71219E5F70047193B /* zbar-back.png in Resources */, + DC48C4D81219E5F70047193B /* zbar-help.html in Resources */, + DC48C4D91219E5F70047193B /* zbar-helpicons.png in Resources */, + DC48C4DA1219E5F70047193B /* zbar-samples.png in Resources */, + DC824600162B568A0010B2E6 /* Default-568h@2x.png in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1D60588E0D05DD3D006BFB54 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + DCD6E0D010B0AD41002005CD /* readertest.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1D6058940D05DD3E006BFB54 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = prefix.pch; + INFOPLIST_FILE = readertest.plist; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/ZBarSDK\"", + ); + PRODUCT_NAME = readertest; + }; + name = Debug; + }; + 1D6058950D05DD3E006BFB54 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = prefix.pch; + INFOPLIST_FILE = readertest.plist; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/ZBarSDK\"", + ); + PRODUCT_NAME = readertest; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 3.1; + OTHER_LDFLAGS = "-all_load"; + PREBINDING = NO; + SDKROOT = iphoneos; + SYMROOT = /tmp/readertest.build; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 3.1; + OTHER_LDFLAGS = "-all_load"; + PREBINDING = NO; + SDKROOT = iphoneos; + SYMROOT = /tmp/readertest.build; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "readertest" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1D6058940D05DD3E006BFB54 /* Debug */, + 1D6058950D05DD3E006BFB54 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "readertest" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/iphone/examples/readertest/readertest.xcodeproj/xcshareddata/xcschemes/readertest.xcscheme b/iphone/examples/readertest/readertest.xcodeproj/xcshareddata/xcschemes/readertest.xcscheme new file mode 100644 index 0000000..9264466 --- /dev/null +++ b/iphone/examples/readertest/readertest.xcodeproj/xcshareddata/xcschemes/readertest.xcscheme @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + <BuildActionEntries> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "1D6058900D05DD3D006BFB54" + BuildableName = "readertest.app" + BlueprintName = "readertest" + ReferencedContainer = "container:readertest.xcodeproj"> + </BuildableReference> + </BuildActionEntry> + </BuildActionEntries> + </BuildAction> + <TestAction + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB" + shouldUseLaunchSchemeArgsEnv = "YES" + buildConfiguration = "Debug"> + <Testables> + </Testables> + </TestAction> + <LaunchAction + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB" + displayScaleIsEnabled = "NO" + displayScale = "1.00" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + buildConfiguration = "Debug"> + <BuildableProductRunnable> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "1D6058900D05DD3D006BFB54" + BuildableName = "readertest.app" + BlueprintName = "readertest" + ReferencedContainer = "container:readertest.xcodeproj"> + </BuildableReference> + </BuildableProductRunnable> + <AdditionalOptions> + </AdditionalOptions> + </LaunchAction> + <ProfileAction + displayScaleIsEnabled = "NO" + displayScale = "1.00" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + buildConfiguration = "Release"> + <BuildableProductRunnable> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "1D6058900D05DD3D006BFB54" + BuildableName = "readertest.app" + BlueprintName = "readertest" + ReferencedContainer = "container:readertest.xcodeproj"> + </BuildableReference> + </BuildableProductRunnable> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> |