Skip to content

Commit

Permalink
fix index problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandra Keßler committed Apr 19, 2016
1 parent b3f8aa5 commit 0a9f9aa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
25 changes: 20 additions & 5 deletions Pod/Classes/blueReader.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
#import "blueReader.h"
#include "UARTPeripheral.h"


#ifndef DebugLog
#define DebugLog(...) {if(self.consoleLogging)NSLog(__VA_ARGS__);}
#endif

@interface BlueReader () <UARTPeripheralDelegate,CBCentralManagerDelegate>
@property CBCentralManager *cm;
Expand All @@ -31,9 +32,6 @@ -(id) initWithDelegate:(id<BlueReaderDelegate>)delegate
if(self = [super init])
{
self.consoleLogging = NO;
/*#ifdef DEBUG
self.consoleLogging = YES;
#endif*/
self.delegate = delegate;
self.cm = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
}
Expand Down Expand Up @@ -496,10 +494,27 @@ -(void) didReceiveData:(NSString *)string
if(!cmd)
{
cmd=[string characterAtIndex:i];
if(cmd == [[self.cmds objectAtIndex:0] characterAtIndex:0])
if([self.cmds count] == 0)
{
DebugLog(@"no cmd in queu, got anser %@",string);
}
else if(cmd == [[self.cmds objectAtIndex:0] characterAtIndex:0])
{
DebugLog(@"correct answer found :D");
}
else
{
for(int i = 1; i < [self.cmds count];i++)
{
string = @"";i=0;
if([[self.cmds objectAtIndex:i] hasPrefix:[NSString stringWithFormat:@"%c",cmd]])
{
DebugLog(@"found anser, but @ cmd %d in queue",i+1);
break;
}
DebugLog(@"not finding answer in queue");
}
}
}
else if(cmd && [string characterAtIndex:i] == ':')
{
Expand Down
2 changes: 1 addition & 1 deletion libBlueReader.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "libBlueReader"
s.version = "0.0.5"
s.version = "0.0.6"
s.summary = "libBlueReader is the companion library to the open-source blueReader Hardware"
s.description = <<-DESC
The blueReader NFC-BLE-Adapter is a ready to buy or diy Hardware for reading and writing nfc-tags via a bluetooth enabled Device. This library implements the interfaces for iOS to find a blueReader Bluetooth device, configure the device, and read/ write Tags
Expand Down

0 comments on commit 0a9f9aa

Please sign in to comment.