From fb6dae1e849e0b2e13a4f59d860895ab8c756c57 Mon Sep 17 00:00:00 2001 From: "matthias.ringwald" Date: Sun, 21 Feb 2010 13:57:48 +0000 Subject: [PATCH] BTstackManager support device discovery - names are not cached yet --- CocoaTouch/include/BTstack/BTDevice.h | 12 +- CocoaTouch/include/BTstack/BTstackManager.h | 10 + CocoaTouch/src/BTDevice.m | 19 +- CocoaTouch/src/BTstackManager.m | 222 +++++++++++++++++--- CocoaTouch/src/TestBTstackManager.m | 23 +- TODO.txt | 13 +- project.xcodeproj/project.pbxproj | 175 ++++++++++++++- 7 files changed, 424 insertions(+), 50 deletions(-) diff --git a/CocoaTouch/include/BTstack/BTDevice.h b/CocoaTouch/include/BTstack/BTDevice.h index f48911f13..5856ea0f0 100644 --- a/CocoaTouch/include/BTstack/BTDevice.h +++ b/CocoaTouch/include/BTstack/BTDevice.h @@ -59,7 +59,7 @@ typedef enum { @interface BTDevice : NSObject { - bd_addr_t address; // potential key + bd_addr_t _address; NSString * name; uint32_t classOfDevice; @@ -67,14 +67,17 @@ typedef enum { uint8_t pageScanRepetitionMode; uint16_t clockOffset; + uint8_t rssi; + + // deprecated BluetoothConnectionState connectionState; } -- (void) setAddress:(bd_addr_t *)addr; -- (bd_addr_t *) address; +- (void) setAddress:(bd_addr_t*)addr; +- (bd_addr_t*) address; - (NSString *) toString; - (NSString *) addressString; -+ (NSString *) stringForAddress:(bd_addr_t *) address; ++ (NSString *) stringForAddress:(bd_addr_t*) address; @property (readonly) BluetoothDeviceType deviceType; @property (readonly) NSString * nameOrAddress; @@ -82,6 +85,7 @@ typedef enum { @property (nonatomic, assign) uint32_t classOfDevice; @property (nonatomic, assign) uint16_t clockOffset; @property (nonatomic, assign) uint8_t pageScanRepetitionMode; +@property (nonatomic, assign) uint8_t rssi; @property (nonatomic, assign) BluetoothConnectionState connectionState; @end diff --git a/CocoaTouch/include/BTstack/BTstackManager.h b/CocoaTouch/include/BTstack/BTstackManager.h index 19ce9e59b..f5b4ece4a 100644 --- a/CocoaTouch/include/BTstack/BTstackManager.h +++ b/CocoaTouch/include/BTstack/BTstackManager.h @@ -55,14 +55,24 @@ typedef enum { kW4Deactivated } ManagerState; +typedef enum { + kInactive = 1, + kW4InquiryMode, + kInquiry, + kRemoteName, +} DiscoveryState; + @protocol BTstackManagerDelegate; @interface BTstackManager : NSObject { @private id _delegate; NSMutableDictionary *deviceInfo; + NSMutableArray *discoveredDevices; BOOL connectedToDaemon; ManagerState state; + DiscoveryState discoveryState; + int discoveryDeviceIndex; } // shared instance diff --git a/CocoaTouch/src/BTDevice.m b/CocoaTouch/src/BTDevice.m index 74c2566f7..7e98ec96e 100644 --- a/CocoaTouch/src/BTDevice.m +++ b/CocoaTouch/src/BTDevice.m @@ -44,25 +44,26 @@ @synthesize connectionState; @synthesize pageScanRepetitionMode; @synthesize clockOffset; +@synthesize rssi; - (BTDevice *)init { name = NULL; - bzero(&address, 6); + bzero(&_address, 6); classOfDevice = kCODInvalid; connectionState = kBluetoothConnectionNotConnected; return self; } -- (void) setAddress:(bd_addr_t *)newAddr{ - BD_ADDR_COPY( &address, newAddr); +- (void) setAddress:(bd_addr_t*)newAddr{ + BD_ADDR_COPY( &_address, newAddr); } -- (bd_addr_t *) address{ - return &address; +- (bd_addr_t*) address{ + return &_address; } -+ (NSString *) stringForAddress:(bd_addr_t *) address { - uint8_t * addr = (uint8_t*) address; ++ (NSString *) stringForAddress:(bd_addr_t*) address { + uint8_t *addr = (uint8_t*) *address; return [NSString stringWithFormat:@"%02x:%02x:%02x:%02x:%02x:%02x", addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]]; } @@ -73,7 +74,7 @@ } - (NSString *) addressString{ - return [BTDevice stringForAddress:&address]; + return [BTDevice stringForAddress:&_address]; } - (BluetoothDeviceType) deviceType{ @@ -87,7 +88,7 @@ } } - (NSString *) toString{ - return [NSString stringWithFormat:@"Device addr %@ name %@ COD %x", [BTDevice stringForAddress:&address], name, classOfDevice]; + return [NSString stringWithFormat:@"Device addr %@ name %@ COD %x", [BTDevice stringForAddress:&_address], name, classOfDevice]; } - (void)dealloc { diff --git a/CocoaTouch/src/BTstackManager.m b/CocoaTouch/src/BTstackManager.m index 941c2ced0..671ab7483 100644 --- a/CocoaTouch/src/BTstackManager.m +++ b/CocoaTouch/src/BTstackManager.m @@ -32,11 +32,11 @@ #import #import +#import #import "../../RFCOMM/rfcomm.h" - #define BTstackManagerID @"ch.ringwald.btstack" - +#define INQUIRY_INTERVAL 3 static BTstackManager * btstackManager = nil; @@ -84,9 +84,13 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe if (!self) return self; state = kDeactivated; + discoveryState = kInactive; connectedToDaemon = NO; _delegate = nil; + // device discovery + discoveredDevices = [[NSMutableArray alloc] init]; + // read device database [self readDeviceInfo]; @@ -124,23 +128,42 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe } -(BTstackError) deactivate { + if (!connectedToDaemon) return BTSTACK_CONNECTION_TO_BTDAEMON_FAILED; + state = kW4Deactivated; + bt_send_cmd(&btstack_set_power_mode, HCI_POWER_OFF); return 0; } + // Discovery -(BTstackError) startDiscovery { + if (state != kActivated) return BTSTACK_NOT_ACTIVATED; + discoveryState = kW4InquiryMode; + bt_send_cmd(&hci_write_inquiry_mode, 0x01); // with RSSI return 0; }; -(BTstackError) stopDiscovery{ return 0; }; + -(int) numberOfDevicesFound{ - return 0; + return [discoveredDevices count]; }; + -(BTDevice*) deviceAtIndex:(int)index{ - return 0; + return (BTDevice*) [discoveredDevices objectAtIndex:index]; }; +-(BTDevice*) deviceForAddress:(bd_addr_t*) address{ + for (BTDevice *device in discoveredDevices){ + // NSLog(@"compare %@ to %@", [BTDevice stringForAddress:address], [device addressString]); + if ( BD_ADDR_CMP(address, [device address]) == 0){ + return device; + } + } + return nil; +} + // Connections -(BTstackError) createL2CAPChannelAtAddress:(bd_addr_t) address withPSM:(uint16_t)psm authenticated:(BOOL)authentication { return 0; @@ -162,18 +185,14 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe return 0; }; -- (void) handlePacketWithType:(uint8_t)packet_type forChannel:(uint16_t)channel andData:(uint8_t *)packet withLen:(uint16_t) size { +- (void) activationHandleEvent:(uint8_t *)packet withLen:(uint16_t) size { switch (state) { - - case kDeactivated: - break; - + case kW4SysBTState: case kW4SysBTDisabled: // BTSTACK_EVENT_SYSTEM_BLUETOOTH_ENABLED - if ( packet_type == HCI_EVENT_PACKET - && packet[0] == BTSTACK_EVENT_SYSTEM_BLUETOOTH_ENABLED){ + if ( packet[0] == BTSTACK_EVENT_SYSTEM_BLUETOOTH_ENABLED){ if (packet[2]){ // system bt on - first time try to disable it if ( state == kW4SysBTState) { @@ -196,20 +215,27 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe break; case kW4Activated: - if (packet_type == HCI_EVENT_PACKET){ - switch (packet[0]){ - case BTSTACK_EVENT_STATE: - if (packet[2] == HCI_STATE_WORKING){ - state = kActivated; - [_delegate activated]; - } - break; - case BTSTACK_EVENT_POWERON_FAILED: - [_delegate activationFailed:BTSTACK_ACTIVATION_POWERON_FAILED]; - state = kDeactivated; - break; - default: - break; + switch (packet[0]){ + case BTSTACK_EVENT_STATE: + if (packet[2] == HCI_STATE_WORKING){ + state = kActivated; + [_delegate activated]; + } + break; + case BTSTACK_EVENT_POWERON_FAILED: + [_delegate activationFailed:BTSTACK_ACTIVATION_POWERON_FAILED]; + state = kDeactivated; + break; + default: + break; + } + break; + + case kW4Deactivated: + if (packet[0] == BTSTACK_EVENT_STATE){ + if (packet[2] == HCI_STATE_OFF){ + state = kDeactivated; + [_delegate deactivated]; } } break; @@ -217,12 +243,154 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe default: break; } +} + +-(void) discoveryRemoteName{ + BOOL found = NO; + while ( discoveryDeviceIndex < [discoveredDevices count]){ + BTDevice *device = [discoveredDevices objectAtIndex:discoveryDeviceIndex]; + if (device.name) { + discoveryDeviceIndex ++; + continue; + } + bd_addr_t *addr = [device address]; + + // BD_ADDR_COPY(&addr, device.address); + // NSLog(@"Get remote name of %@", [BTDevice stringForAddress:addr]); + bt_send_cmd(&hci_remote_name_request, addr, + device.pageScanRepetitionMode, 0, device.clockOffset | 0x8000); + [_delegate discoveryQueryRemoteName:discoveryDeviceIndex]; + found = YES; + break; + } + if (!found) { + // printf("Queried all devices, restart.\n"); + discoveryState = kInquiry; + bt_send_cmd(&hci_inquiry, HCI_INQUIRY_LAP, INQUIRY_INTERVAL, 0); + [_delegate discoveryInquiry]; + } +} + +-(void) discoveryHandleEvent:(uint8_t *)packet withLen:(uint16_t) size { + bd_addr_t addr; + int i; + int numResponses; + + switch (discoveryState) { + + case kInactive: + break; + + case kW4InquiryMode: + if (packet[0] == HCI_EVENT_COMMAND_COMPLETE && COMMAND_COMPLETE_EVENT(packet, hci_write_inquiry_mode) ) { + discoveryState = kInquiry; + bt_send_cmd(&hci_inquiry, HCI_INQUIRY_LAP, INQUIRY_INTERVAL, 0); + [_delegate discoveryInquiry]; + } + break; + + case kInquiry: + + switch (packet[0]){ + case HCI_EVENT_INQUIRY_RESULT: + numResponses = packet[2]; + for (i=0; i @implementation TestBTstackManager --(id) init { - return self; -} --(void) test{ + +-(void) doTest{ bt = [BTstackManager sharedInstance]; [bt setDelegate:self]; BTstackError err = [bt activate]; if (err) NSLog(@"activate err 0x%02x!", err); } + -(void) activated{ NSLog(@"activated!"); + [bt startDiscovery]; } + -(void) activationFailed:(BTstackError)error{ NSLog(@"activationFailed error 0x%02x!", error); }; + +-(void) discoveryInquiry{ + NSLog(@"discoveryInquiry!"); +} +-(void) discoveryQueryRemoteName:(int)deviceIndex{ + NSLog(@"discoveryQueryRemoteName %u/%u!", deviceIndex+1, [bt numberOfDevicesFound]); +} +-(void) deviceInfo:(BTDevice*)device { + NSLog(@"Device Info: addr %@ name %@ COD 0x%06x", [device addressString], [device name], [device classOfDevice] ); +} + @end int main(int argc, char *argv[]) @@ -29,7 +42,7 @@ int main(int argc, char *argv[]) NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; TestBTstackManager * test = [[TestBTstackManager alloc] init]; - [test test]; + [test doTest]; CFRunLoopRun(); [test release]; diff --git a/TODO.txt b/TODO.txt index 19f4f9103..ee1947409 100644 --- a/TODO.txt +++ b/TODO.txt @@ -5,7 +5,15 @@ NEXT: -- Provide BTstack Objective-C class +- Provide BTstackManager Objective-C class + - set remote names in deviceInfo + - store deviceInfo on dealloc + - add discard discovered devices + - create new device discovery view: BTDiscoveryViewController + - implement l2cap code + - implement rfcomm code + + - figure out how to receive iPhone System Power IONotifications (in BTdaemon) to detect, when phone gets locked - some trick - use Cocoa run loop for background app? @@ -14,11 +22,10 @@ NEXT: - move RFCOMM code into BTdaemon - L2CAP - segmentation -- CocoaTouch - - Warning and shutdown of Apple's stack - add timeouts to cocoa run loop - BUG: bt_close crashes when used in CocoaTouch app - BUG: BTdaemon crashes on iPhone when CocoaTouch app is closed (sometimes) +- BUG: malloc warning when BTdaemon is started by launchd == Release 0.2 - Incoming L2CAP supported + improved Inq Dialog diff --git a/project.xcodeproj/project.pbxproj b/project.xcodeproj/project.pbxproj index dd3e54547..aaa00a416 100644 --- a/project.xcodeproj/project.pbxproj +++ b/project.xcodeproj/project.pbxproj @@ -19,6 +19,7 @@ 9C05FC971020D3F300255261 /* socket_connection.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C00F7301017ACC3008DAB17 /* socket_connection.c */; }; 9C18015C108BAA7200824BE7 /* libusb-1.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C18015B108BAA7200824BE7 /* libusb-1.0.dylib */; }; 9C46FC3A0FA906F700ABEF05 /* hci_transport_h4.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C46FC360FA906F700ABEF05 /* hci_transport_h4.c */; }; + 9C50953A112744AA00A30986 /* BTstackManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C509539112744AA00A30986 /* BTstackManager.m */; }; 9C77E79210667F0600F39DCF /* platform_iphone.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C77E79110667F0600F39DCF /* platform_iphone.c */; }; 9C7B5AC0100BD3340065D87E /* linked_list.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C7B5ABF100BD3340065D87E /* linked_list.c */; }; 9C7B5D01100FC9AE0065D87E /* btstack.c in Sources */ = {isa = PBXBuildFile; fileRef = 9CC813A10FFC0774002816F9 /* btstack.c */; }; @@ -30,6 +31,10 @@ 9CCE6CEA1025BD0000FCE9F4 /* hci.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C46FC340FA906F700ABEF05 /* hci.c */; }; 9CEB4F17107AAAEF00DD5720 /* run_loop_posix.c in Sources */ = {isa = PBXBuildFile; fileRef = 9CEB4DAC10753BE600DD5720 /* run_loop_posix.c */; }; 9CF13C1610F8A1C6004C4EEE /* bt_control_iphone.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CF13C1510F8A1C6004C4EEE /* bt_control_iphone.m */; }; + 9CF3F776112F241600D081C9 /* BTstackManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C509539112744AA00A30986 /* BTstackManager.m */; }; + 9CF3F782112F244C00D081C9 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CF3F781112F244B00D081C9 /* UIKit.framework */; }; + 9CF3F95311306FFB00D081C9 /* TestBTstackManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CF3F95211306FFB00D081C9 /* TestBTstackManager.m */; }; + 9CF3F99F113083F100D081C9 /* BTDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C13C9FC10ECED6300B04243 /* BTDevice.m */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -45,7 +50,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 8DD76FB20486AB0100D96B5E /* project */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = project; sourceTree = BUILT_PRODUCTS_DIR; }; + 8DD76FB20486AB0100D96B5E /* project */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = project; sourceTree = BUILT_PRODUCTS_DIR; }; 9C00F7301017ACC3008DAB17 /* socket_connection.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; name = socket_connection.c; path = src/socket_connection.c; sourceTree = ""; }; 9C00F7311017ACC3008DAB17 /* socket_connection.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = socket_connection.h; path = src/socket_connection.h; sourceTree = ""; }; 9C00F7D61019082F008DAB17 /* hci_cmds.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hci_cmds.c; path = src/hci_cmds.c; sourceTree = ""; }; @@ -67,6 +72,8 @@ 9C46FC360FA906F700ABEF05 /* hci_transport_h4.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; name = hci_transport_h4.c; path = src/hci_transport_h4.c; sourceTree = ""; }; 9C46FC370FA906F700ABEF05 /* hci_transport_h4.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = hci_transport_h4.h; path = src/hci_transport_h4.h; sourceTree = ""; }; 9C46FC380FA906F700ABEF05 /* hci_transport.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = hci_transport.h; path = src/hci_transport.h; sourceTree = ""; }; + 9C509539112744AA00A30986 /* BTstackManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BTstackManager.m; path = CocoaTouch/src/BTstackManager.m; sourceTree = ""; }; + 9C50953B112744CD00A30986 /* BTstackManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BTstackManager.h; path = CocoaTouch/include/BTstack/BTstackManager.h; sourceTree = ""; }; 9C5BA8A0110B756500D79BBE /* hci_cmds.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = hci_cmds.h; path = include/btstack/hci_cmds.h; sourceTree = ""; }; 9C5BABAF110E28E900D79BBE /* l2cap-server.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; name = "l2cap-server.c"; path = "example/l2cap-server.c"; sourceTree = ""; }; 9C6459DE1037554B0081A00B /* platform_iphone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = platform_iphone.h; path = src/platform_iphone.h; sourceTree = ""; }; @@ -88,7 +95,7 @@ 9C78A0BB103C9DEE003B2950 /* ch.ringwald.BTstack.plist */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.plist.xml; name = ch.ringwald.BTstack.plist; path = resources/ch.ringwald.BTstack.plist; sourceTree = ""; }; 9C7B5ABF100BD3340065D87E /* linked_list.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = linked_list.c; path = src/linked_list.c; sourceTree = ""; }; 9C7B5B7E100D04450065D87E /* test.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = test.c; path = example/test.c; sourceTree = ""; }; - 9C7B5CF6100FC96A0065D87E /* clientTest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = clientTest; sourceTree = BUILT_PRODUCTS_DIR; }; + 9C7B5CF6100FC96A0065D87E /* clientTest */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = clientTest; sourceTree = BUILT_PRODUCTS_DIR; }; 9C7ECB810FCC85650085DAC5 /* bt_control.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = bt_control.h; path = src/bt_control.h; sourceTree = ""; }; 9C7ECB830FCC85650085DAC5 /* bt_control_iphone.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = bt_control_iphone.h; path = src/bt_control_iphone.h; sourceTree = ""; }; 9C7ECBB30FCC95DD0085DAC5 /* hci_dump.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = hci_dump.h; path = src/hci_dump.h; sourceTree = ""; }; @@ -111,6 +118,13 @@ 9CEB4DAA10753B4B00DD5720 /* run_loop_cocoa.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; name = run_loop_cocoa.m; path = src/run_loop_cocoa.m; sourceTree = ""; }; 9CEB4DAC10753BE600DD5720 /* run_loop_posix.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; name = run_loop_posix.c; path = src/run_loop_posix.c; sourceTree = ""; }; 9CF13C1510F8A1C6004C4EEE /* bt_control_iphone.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; name = bt_control_iphone.m; path = src/bt_control_iphone.m; sourceTree = ""; }; + 9CF3F74C112F201600D081C9 /* BTstackCocoaAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = BTstackCocoaAppDelegate.h; path = CocoaTouch/src/BTstackCocoaAppDelegate.h; sourceTree = ""; }; + 9CF3F74D112F201600D081C9 /* BTstackCocoaAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; name = BTstackCocoaAppDelegate.m; path = CocoaTouch/src/BTstackCocoaAppDelegate.m; sourceTree = ""; }; + 9CF3F75F112F239B00D081C9 /* TestBTstackManager.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestBTstackManager.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 9CF3F781112F244B00D081C9 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 9CF3F95111306FFB00D081C9 /* TestBTstackManager.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = TestBTstackManager.h; path = CocoaTouch/src/TestBTstackManager.h; sourceTree = ""; }; + 9CF3F95211306FFB00D081C9 /* TestBTstackManager.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; name = TestBTstackManager.m; path = CocoaTouch/src/TestBTstackManager.m; sourceTree = ""; }; + 9CF3F95A1130702D00D081C9 /* TestBTstackManager-Info.plist */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.plist.xml; name = "TestBTstackManager-Info.plist"; path = "CocoaTouch/TestBTstackManager-Info.plist"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -130,6 +144,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 9CF3F75D112F239B00D081C9 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9CF3F782112F244C00D081C9 /* UIKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -195,6 +217,7 @@ children = ( 8DD76FB20486AB0100D96B5E /* project */, 9C7B5CF6100FC96A0065D87E /* clientTest */, + 9CF3F75F112F239B00D081C9 /* TestBTstackManager.app */, ); name = Products; sourceTree = ""; @@ -202,10 +225,18 @@ 9C13C9FA10ECED6300B04243 /* CocoaTouch */ = { isa = PBXGroup; children = ( + 9CF3F74C112F201600D081C9 /* BTstackCocoaAppDelegate.h */, + 9CF3F74D112F201600D081C9 /* BTstackCocoaAppDelegate.m */, 9C13C9FB10ECED6300B04243 /* BTDevice.h */, 9C13C9FC10ECED6300B04243 /* BTDevice.m */, 9C13C9FD10ECED6300B04243 /* BTInquiryViewController.h */, 9C13C9FE10ECED6300B04243 /* BTInquiryViewController.m */, + 9C509539112744AA00A30986 /* BTstackManager.m */, + 9C50953B112744CD00A30986 /* BTstackManager.h */, + 9CF3F95111306FFB00D081C9 /* TestBTstackManager.h */, + 9CF3F95211306FFB00D081C9 /* TestBTstackManager.m */, + 9CF3F95A1130702D00D081C9 /* TestBTstackManager-Info.plist */, + 9CF3F781112F244B00D081C9 /* UIKit.framework */, ); name = CocoaTouch; sourceTree = ""; @@ -316,6 +347,23 @@ productReference = 9C7B5CF6100FC96A0065D87E /* clientTest */; productType = "com.apple.product-type.tool"; }; + 9CF3F75E112F239B00D081C9 /* TestBTstackManager */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9CF3F765112F239C00D081C9 /* Build configuration list for PBXNativeTarget "TestBTstackManager" */; + buildPhases = ( + 9CF3F75B112F239B00D081C9 /* Resources */, + 9CF3F75C112F239B00D081C9 /* Sources */, + 9CF3F75D112F239B00D081C9 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = TestBTstackManager; + productName = TestBTstackManager; + productReference = 9CF3F75F112F239B00D081C9 /* TestBTstackManager.app */; + productType = "com.apple.product-type.application"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -330,10 +378,21 @@ targets = ( 8DD76FA90486AB0100D96B5E /* BTdaemon */, 9C7B5CF5100FC96A0065D87E /* clientTest */, + 9CF3F75E112F239B00D081C9 /* TestBTstackManager */, ); }; /* End PBXProject section */ +/* Begin PBXResourcesBuildPhase section */ + 9CF3F75B112F239B00D081C9 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 8DD76FAB0486AB0100D96B5E /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -354,6 +413,7 @@ 9C04B826107D1CED002A63D0 /* run_loop.c in Sources */, 9C04B876107D2B7C002A63D0 /* run_loop_cocoa.m in Sources */, 9CF13C1610F8A1C6004C4EEE /* bt_control_iphone.m in Sources */, + 9C50953A112744AA00A30986 /* BTstackManager.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -370,6 +430,16 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 9CF3F75C112F239B00D081C9 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9CF3F776112F241600D081C9 /* BTstackManager.m in Sources */, + 9CF3F95311306FFB00D081C9 /* TestBTstackManager.m in Sources */, + 9CF3F99F113083F100D081C9 /* BTDevice.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ @@ -510,6 +580,97 @@ }; name = "Debug iPhone"; }; + 9CF3F762112F239C00D081C9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CODE_SIGN_IDENTITY = "Don't Code Sign"; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/UIKit.framework/Headers/UIKit.h"; + INFOPLIST_FILE = "CocoaTouch/TestBTstackManager-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + ONLY_ACTIVE_ARCH = YES; + OTHER_CFLAGS = ( + "-I/Projects/iPhone/btstack/CocoaTouch/include", + "-I/Projects/iPhone/btstack/include", + ); + OTHER_LDFLAGS = ( + "-L/usr/local/lib", + "-lbtstack", + "-framework", + Foundation, + "-framework", + UIKit, + ); + PREBINDING = NO; + PRODUCT_NAME = TestBTstackManager; + SDKROOT = iphonesimulator3.1.2; + }; + name = Debug; + }; + 9CF3F763112F239C00D081C9 /* Debug iPhone */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CODE_SIGN_IDENTITY = "iPhone Developer"; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/UIKit.framework/Headers/UIKit.h"; + INFOPLIST_FILE = "CocoaTouch/TestBTstackManager-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + ONLY_ACTIVE_ARCH = YES; + OTHER_CFLAGS = ( + "-I/Projects/iPhone/btstack/CocoaTouch/include", + "-I/Projects/iPhone/btstack/include", + ); + OTHER_LDFLAGS = ( + "-L/usr/local/lib", + "-lbtstack", + "-framework", + Foundation, + "-framework", + UIKit, + ); + PREBINDING = NO; + PRODUCT_NAME = TestBTstackManager; + SDKROOT = iphonesimulator3.1.2; + }; + name = "Debug iPhone"; + }; + 9CF3F764112F239C00D081C9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/UIKit.framework/Headers/UIKit.h"; + INFOPLIST_FILE = "CocoaTouch/TestBTstackManager-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + ONLY_ACTIVE_ARCH = YES; + OTHER_CFLAGS = ( + "-I/Projects/iPhone/btstack/CocoaTouch/include", + "-I/Projects/iPhone/btstack/include", + ); + OTHER_LDFLAGS = ( + "-L/usr/local/lib", + "-lbtstack", + "-framework", + Foundation, + "-framework", + UIKit, + ); + PREBINDING = NO; + PRODUCT_NAME = TestBTstackManager; + SDKROOT = iphonesimulator3.1.2; + ZERO_LINK = NO; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -543,6 +704,16 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 9CF3F765112F239C00D081C9 /* Build configuration list for PBXNativeTarget "TestBTstackManager" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9CF3F762112F239C00D081C9 /* Debug */, + 9CF3F763112F239C00D081C9 /* Debug iPhone */, + 9CF3F764112F239C00D081C9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;