diff --git a/BeerBox.xcodeproj/project.xcworkspace/xcuserdata/LB.xcuserdatad/UserInterfaceState.xcuserstate b/BeerBox.xcodeproj/project.xcworkspace/xcuserdata/LB.xcuserdatad/UserInterfaceState.xcuserstate index e764614..3d703c2 100755 Binary files a/BeerBox.xcodeproj/project.xcworkspace/xcuserdata/LB.xcuserdatad/UserInterfaceState.xcuserstate and b/BeerBox.xcodeproj/project.xcworkspace/xcuserdata/LB.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/BeerBox.xcodeproj/xcuserdata/LB.xcuserdatad/xcschemes/BeerBox.xcscheme b/BeerBox.xcodeproj/xcuserdata/LB.xcuserdatad/xcschemes/BeerBox.xcscheme index b0567ce..e51919e 100755 --- a/BeerBox.xcodeproj/xcuserdata/LB.xcuserdatad/xcschemes/BeerBox.xcscheme +++ b/BeerBox.xcodeproj/xcuserdata/LB.xcuserdatad/xcschemes/BeerBox.xcscheme @@ -23,10 +23,10 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -48,17 +48,21 @@ ReferencedContainer = "container:BeerBox.xcodeproj"> + + - + - + - + - + @@ -19,7 +19,6 @@ - - diff --git a/BeerBox/ViewController.m b/BeerBox/ViewController.m index d0a34c8..594eb1a 100755 --- a/BeerBox/ViewController.m +++ b/BeerBox/ViewController.m @@ -35,21 +35,21 @@ // Dispose of any resources that can be recreated. } + +//############ Connection Handling + - (IBAction)connect:(id)sender { [btControl findHMSoftPeripherals:8]; [NSTimer scheduledTimerWithTimeInterval:8 target:self selector:@selector(scanTimer:) userInfo:nil repeats:NO]; } --(void) scanTimer:(NSTimer *)timer -{ +-(void) scanTimer:(NSTimer *)timer { if(box == nil) [[[UIAlertView alloc] initWithTitle:@"Error" message:@"BeerBox not found!" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil] show]; } - --(void) peripheralFound:(CBPeripheral *)peripheral -{ +-(void) peripheralFound:(CBPeripheral *)peripheral { if([peripheral.name isEqual: @"LBsKeys"]) { box = peripheral; @@ -57,14 +57,19 @@ } } --(void) serialGATTCharValueUpdated:(NSString *)UUID value:(NSData *)data -{ +-(void) serialGATTCharValueUpdated:(NSString *)UUID value:(NSData *)data { NSString *value = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding]; [[[UIAlertView alloc] initWithTitle:@"RCV!" message:value delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil] show]; } -- (IBAction)sendMsgToArduino:(id)sender { +- (IBAction)listDrinks:(id)sender { +} + +- (IBAction)listUsers:(id)sender { +} + +- (IBAction)createUser:(id)sender { NSString *sendString = [NSString stringWithFormat:@"!%@;",_nameEntry.text]; NSData *data = [sendString dataUsingEncoding:[NSString defaultCStringEncoding]]; @@ -95,15 +100,10 @@ } } -- (IBAction)removeUser:(id)sender { -} -- (IBAction)listUsers:(id)sender { -} - (IBAction)revokeRFID:(id)sender { - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Revoke RFID" message:@"Enter an ID" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:@"Add", nil]; alert.alertViewStyle = UIAlertViewStylePlainTextInput; [alert show]; @@ -112,8 +112,6 @@ [[alert textFieldAtIndex:0] resignFirstResponder]; [[alert textFieldAtIndex:0] setKeyboardType:UIKeyboardTypePhonePad]; [[alert textFieldAtIndex:0] becomeFirstResponder]; - - } - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ @@ -127,43 +125,9 @@ } } -- (IBAction)revokeFinger:(id)sender { -} -- (IBAction)checkCount:(id)sender { - - NSString *sendString = [NSString stringWithFormat:@"!%@;",_nameEntry.text]; - NSData *data = [sendString dataUsingEncoding:[NSString defaultCStringEncoding]]; - - if(data.length > 20) - { - int i = 0; - int nIndex = 0; - while ((i + 1) * 20 <= data.length) { - nIndex = i * 20; - if(nIndex > 0) - nIndex--; - NSData *dataSend = [data subdataWithRange:NSMakeRange(nIndex, 20)]; - [btControl write:box data:dataSend]; - i++; - } - i = data.length % 20; - if(i > 0) - { - NSData *dataSend = [data subdataWithRange:NSMakeRange(data.length - i, i)]; - [btControl write:box data:dataSend]; - } - - }else - { - //NSData *data = [MsgToArduino.text dataUsingEncoding:[NSString defaultCStringEncoding]]; - [btControl write:box data:data]; - } -} - - -(void)setConnect {