// // CaptuvoScannerController.m // CaptuvoSDKDemo // // Created by PLUC SeniorDesign on 2/24/15. // Copyright (c) 2015 Anthony J. Carno. All rights reserved. // #import "CaptuvoScannerController.h" @interface CaptuvoScannerController () @end @implementation CaptuvoScannerController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [self initDecoder]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /** @brief This method attempts to establish a connection to the Captuvo SL22 Enterprise Sled and start the decoder hardware. A UIAlertView prompts the user if a connection cannot be established. Additionally, this method adds the current class (self) as a CaptuvoDelegate. @return ProtocolConnectionStatus - the connection status of the Captuvo sled */ - (void)initDecoder { ProtocolConnectionStatus status = [[Captuvo sharedCaptuvoDevice] startDecoderHardware]; if (status == ProtocolConnectionStatusUnableToConnect) { UIAlertView *sledAlert = [[UIAlertView alloc] initWithTitle:@"Connection Error" message:@"Unable to communicate with sled - unknown communication error." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [sledAlert show]; } else if (status == ProtocolConnectionStatusUnableToConnectIncompatiableSledFirmware) { UIAlertView *sledAlert = [[UIAlertView alloc] initWithTitle:@"Connection Error" message:@"Unable to communicate with sled - incompatible sled firmware." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [sledAlert show]; } else if (status == ProtocolConnectionStatusBatteryDepleted) { UIAlertView *sledAlert = [[UIAlertView alloc] initWithTitle:@"Connection Error" message:@"Unable to communicate with sled - battery depleted." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [sledAlert show]; } //[[Captuvo sharedCaptuvoDevice] requestBatteryVoltage] ; //[[Captuvo sharedCaptuvoDevice] requestChargeStatus] ; Codabar *codabarOptions = [[Codabar alloc] init]; codabarOptions.enabled = TRUE; codabarOptions.transmitStatStopChar = FALSE; codabarOptions.checkCharStatus = CodabarCheckCharNoCheckChar; codabarOptions.concatenationStatus = CodabarConcatenationOff; codabarOptions.minMessageLength = 4; codabarOptions.maxMessageLength = 60; [[Captuvo sharedCaptuvoDevice] setDecoderCodabarConfiguration:codabarOptions persistSetting:NO]; } /** @brief This method handles the barcode data returned by the scanner @param (NSString *)data - the scanned barcode (in text form) */ - (void) decoderDataReceived:(NSString *)data { //self.txtBookID.textAlignment = NSTextAlignmentLeft; self.txtBookID.text = data; } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end