Commit e0ac4461 authored by Alex Moore's avatar Alex Moore

Updated SDK Demo app with cleaner interface, added beep option (to show...

Updated SDK Demo app with cleaner interface, added beep option (to show ability to customize sled settings)
parent de490a23
......@@ -26,10 +26,6 @@
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
// [[Captuvo sharedCaptuvoDevice] stopDecoderHardware];
// [[Captuvo sharedCaptuvoDevice] stopMSRHardware];
// [[Captuvo sharedCaptuvoDevice] stopPMHardware] ;
}
- (void)applicationDidEnterBackground:(UIApplication *)application
......@@ -37,74 +33,26 @@
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
[[Captuvo sharedCaptuvoDevice] stopDecoderHardware] ;
// [[Captuvo sharedCaptuvoDevice] stopMSRHardware] ;
[[Captuvo sharedCaptuvoDevice] stopPMHardware] ;
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
// NSInteger index = [self.tabBarController selectedIndex] ;
[[Captuvo sharedCaptuvoDevice] startDecoderHardware] ;
// UIAlertView *testAlert = [[UIAlertView alloc] initWithTitle:@"Test resume" message:[NSString stringWithFormat:@"index=%d",index] delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil] ;
// [testAlert show] ;
// switch (index) {
// case 0:
// [((UIViewController*)[self.tabBarController.viewControllers objectAtIndex:0]).navigationController popToRootViewControllerAnimated:YES] ;
//
// break;
// case 1:
// [((UIViewController*)[self.tabBarController.viewControllers objectAtIndex:1]).navigationController popToRootViewControllerAnimated:YES] ;
//
// [[Captuvo sharedCaptuvoDevice] startMSRHardware] ;
// break ;
// case 2:
[[Captuvo sharedCaptuvoDevice] startPMHardware] ;
// break ;
// default:
// break;
// }
[[Captuvo sharedCaptuvoDevice] startPMHardware] ;
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
// NSInteger index = [self.tabBarController selectedIndex] ;
// [[Captuvo sharedCaptuvoDevice] startDecoderHardware] ;
//// UIAlertView *testAlert = [[UIAlertView alloc] initWithTitle:@"Test resume" message:[NSString stringWithFormat:@"index=%d",index] delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil] ;
//// [testAlert show] ;
// switch (index) {
// case 0:
// [((UIViewController*)[self.tabBarController.viewControllers objectAtIndex:0]).navigationController popToRootViewControllerAnimated:YES] ;
//
// break;
// case 1:
// [((UIViewController*)[self.tabBarController.viewControllers objectAtIndex:1]).navigationController popToRootViewControllerAnimated:YES] ;
//
// [[Captuvo sharedCaptuvoDevice] startMSRHardware] ;
// break ;
// case 2:
// [[Captuvo sharedCaptuvoDevice] startPMHardware] ;
// break ;
// default:
// break;
// }
//
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
[[Captuvo sharedCaptuvoDevice] stopDecoderHardware] ;
// [[Captuvo sharedCaptuvoDevice] stopMSRHardware] ;
[[Captuvo sharedCaptuvoDevice] stopPMHardware] ;
}
@end
This diff is collapsed.
......@@ -13,9 +13,14 @@
{
}
@property (weak, nonatomic) IBOutlet UIButton *connectToSledButton;
@property (weak, nonatomic) IBOutlet UILabel *sledNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *sledSerialNumberLabel;
@property (weak, nonatomic) IBOutlet UILabel *sledHardwareRevisionLabel;
@property (weak, nonatomic) IBOutlet UILabel *barcodeLabel;
@property (weak, nonatomic) IBOutlet UIButton *scanButton;
@property (weak, nonatomic) IBOutlet UISwitch *sledBeeperSwitch;
@end
......@@ -10,70 +10,24 @@
@interface ViewController ()
@property Captuvo *sharedCaptuvoDevice;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *manufacturerLabel;
@property (weak, nonatomic) IBOutlet UILabel *modelNumberLabel;
@property (weak, nonatomic) IBOutlet UILabel *serialNumberLabel;
@property (weak, nonatomic) IBOutlet UILabel *firmwareRevLabel;
@end
@implementation ViewController
- (void) prepareForScanning {
ProtocolConnectionStatus status = [[Captuvo sharedCaptuvoDevice] startDecoderHardware];
if (status == ProtocolConnectionStatusConnected) {
printf("ProtocolConnectionStatus - Decoder Hardware Started\n");
}
if (status != ProtocolConnectionStatusConnected) {
printf("ERROR DETECTED: ProtocolConnectionStatus - Decoder Hardware Not Started\n");
}
else {
[[Captuvo sharedCaptuvoDevice] enableDecoderScanning];
//[[Captuvo sharedCaptuvoDevice] startDecoderScanning];
}
//status = [[Captuvo sharedCaptuvoDevice] startPMHardware];
//if (status == ProtocolConnectionStatusConnected) {
// printf("ProtocolConnectionStatus - PM Hardware Started\n");
//}
//else {//if (status != ProtocolConnectionStatusConnected) {
// printf("ERROR DETECTED: ProtocolConnectionStatus - PM Hardware Not Started\n");
//}
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//[[Captuvo sharedCaptuvoDevice] getCaptuvoSerialNumber];
//[Captuvo sharedCaptuvoDevice] = [Captuvo sharedCaptuvoDevice];
self.nameLabel.text = [[Captuvo sharedCaptuvoDevice] getCaptuvoName];
self.manufacturerLabel.text = [[Captuvo sharedCaptuvoDevice] getCaptuvoManufacturer];
self.modelNumberLabel.text = [[Captuvo sharedCaptuvoDevice] getCaptuvoModelNumber];
self.serialNumberLabel.text = [[Captuvo sharedCaptuvoDevice] getCaptuvoSerialNumber];
self.firmwareRevLabel.text = [[Captuvo sharedCaptuvoDevice] getCaptuvoFirmwareRevision];
//[[Captuvo sharedCaptuvoDevice] addCaptuvoDelegate:self];
//[self prepareForScanning];
//[[Captuvo sharedCaptuvoDevice] startDecoderHardware];
[self initCaptuvoSDK];
[self.scanButton addTarget:self action:@selector(scanStartAction:) forControlEvents:UIControlEventTouchDown];
[self.scanButton addTarget:self action:@selector(scanStopAction:) forControlEvents:UIControlEventTouchUpInside];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
//[[Captuvo sharedCaptuvoDevice] removeCaptuvoDelegate:self];
[[Captuvo sharedCaptuvoDevice] removeCaptuvoDelegate:self];
}
- (void)initCaptuvoSDK
{
[[Captuvo sharedCaptuvoDevice] addCaptuvoDelegate:self] ;
[[Captuvo sharedCaptuvoDevice] startDecoderHardware];
[[Captuvo sharedCaptuvoDevice] requestBatteryVoltage] ;
......@@ -81,71 +35,25 @@
}
- (IBAction)scanStartAction:(id)sender {
//self.barcodeLabel.text = @"Joke's on you - trick button :P";
printf("scan Started\n");
[[Captuvo sharedCaptuvoDevice] startDecoderScanning];
}
- (IBAction)scanStopAction:(id)sender {
//self.barcodeLabel.text = @"Joke's on you - trick button :P";
printf("scan Stopped\n");
[[Captuvo sharedCaptuvoDevice] stopDecoderScanning];
- (IBAction)connectToSled:(id)sender {
[self initCaptuvoSDK];
self.sledNameLabel.text = [[Captuvo sharedCaptuvoDevice] getCaptuvoName];
self.sledSerialNumberLabel.text = [[Captuvo sharedCaptuvoDevice] getCaptuvoSerialNumber];
self.sledHardwareRevisionLabel.text = [[Captuvo sharedCaptuvoDevice] getCaptuvoHardwareRevision];
}
//- (void) captuvoConnected {
// UIAlertView *connectedAlert = [[UIAlertView alloc] initWithTitle:@"Sled Connection Status" message:@"Captuvo Sled connected!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
// [connectedAlert show];
//}
//
//- (void) captuvoDisconnected {
// UIAlertView *disconnectedAlert = [[UIAlertView alloc] initWithTitle:@"Sled Connection Status" message:@"Captuvo Sled disconnected!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
// [disconnectedAlert show];
//}
- (void)decoderReady
{
double delayInSeconds = 1.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[[Captuvo sharedCaptuvoDevice] enableDecoderBeeperForGoodRead:YES persistSetting:NO] ;
//setting decoder trigger click status.
// [[Captuvo sharedCaptuvoDevice]requestDecoderTriggerClickStatus];
//setting 5 seconds after will auto stop the aimer light.
[[Captuvo sharedCaptuvoDevice] setDecoderSerialTriggerTimeoutInMilliSeconds:5000 persistSetting:NO];
});
- (IBAction)toggleSledBeeper:(id)sender {
if (self.sledBeeperSwitch.on) {
[[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeOff persistSetting:NO];
}
else if (!self.sledBeeperSwitch.on) {
[[Captuvo sharedCaptuvoDevice] setDecoderGoodReadBeeperVolume:BeeperVolumeMedium persistSetting:NO];
}
}
//- (void)scanKeyAction:(ScanKeyStatus)status {
// if (status == ScanKeyPressing) {
// [[Captuvo sharedCaptuvoDevice] enableDecoderIllumination:TRUE];
// [[Captuvo sharedCaptuvoDevice] enableDecoderAimer:TRUE];
// [[Captuvo sharedCaptuvoDevice] startDecoderScanning];
// }
// else if (status == ScanKeyReleased) {
// [[Captuvo sharedCaptuvoDevice] stopDecoderScanning];
// [[Captuvo sharedCaptuvoDevice] disableDecoderIllumination:TRUE];
// [[Captuvo sharedCaptuvoDevice] disableDecoderAimer:TRUE];
// }
//}
//
//- (void) pmReady {
// UIAlertView *pmReady = [[UIAlertView alloc] initWithTitle:@"PM Status" message:@"PM ready!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
// [pmReady show];
//}
- (void) decoderDataReceived:(NSString *)data {
//printf("Decoder data received: %s", [data cStringUsingEncoding:NSASCIIStringEncoding]);
self.barcodeLabel.textAlignment = NSTextAlignmentLeft;
self.barcodeLabel.text = data;
//[[Captuvo sharedCaptuvoDevice] stopDecoderHardware];
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment