From 9d6f5e03a642d332e357efeda4f1fdf4932242a9 Mon Sep 17 00:00:00 2001
From: "matthias.ringwald"
 <matthias.ringwald@1a0a8af8-31b5-11de-8e0c-53a27eea117e>
Date: Sat, 8 May 2010 19:12:53 +0000
Subject: [PATCH] allow rotation, clean ups

---
 CocoaTouch/include/BTstack/BTstackManager.h | 5 +++--
 CocoaTouch/src/BTDiscoveryViewController.m  | 6 ++++++
 CocoaTouch/src/BTInquiryViewController.m    | 9 +++++----
 CocoaTouch/src/BTstackManager.m             | 6 +++---
 4 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/CocoaTouch/include/BTstack/BTstackManager.h b/CocoaTouch/include/BTstack/BTstackManager.h
index 6c6f0f1a3..c75e9dfaf 100644
--- a/CocoaTouch/include/BTstack/BTstackManager.h
+++ b/CocoaTouch/include/BTstack/BTstackManager.h
@@ -120,6 +120,9 @@ typedef enum {
 // Link Key Management
 -(void) dropLinkKeyForAddress:(bd_addr_t*) address;
 
+// store remote names and link keys
+-(void)storeDeviceInfo;
+
 // Connections
 -(BTstackError) createL2CAPChannelAtAddress:(bd_addr_t*) address withPSM:(uint16_t)psm authenticated:(BOOL)authentication;
 -(BTstackError) closeL2CAPChannelWithID:(uint16_t) channelID;
@@ -132,8 +135,6 @@ typedef enum {
 
 // TODO add l2cap and rfcomm incoming commands
 
-// store remote names and link keys
--(void)storeDeviceInfo;
 
 @property (nonatomic, assign) NSObject<BTstackManagerDelegate>* delegate;
 @property (nonatomic, retain) NSMutableDictionary *deviceInfo;
diff --git a/CocoaTouch/src/BTDiscoveryViewController.m b/CocoaTouch/src/BTDiscoveryViewController.m
index fcf119137..c96150446 100644
--- a/CocoaTouch/src/BTDiscoveryViewController.m
+++ b/CocoaTouch/src/BTDiscoveryViewController.m
@@ -338,6 +338,12 @@
 	return nil;
 }
 
+// Override to allow orientations other than the default portrait orientation.
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+	return YES;
+	// return NO;
+}
+
 - (void)dealloc {
     [super dealloc];
 }
diff --git a/CocoaTouch/src/BTInquiryViewController.m b/CocoaTouch/src/BTInquiryViewController.m
index f13222f48..3351dea71 100644
--- a/CocoaTouch/src/BTInquiryViewController.m
+++ b/CocoaTouch/src/BTInquiryViewController.m
@@ -35,8 +35,8 @@
 //  Created by Matthias Ringwald on 10/8/09.
 //
 
-#import "BTInquiryViewController.h"
-#import "BTDevice.h"
+#import <BTstack/BTInquiryViewController.h>
+#import <BTstack/BTDevice.h>
 
 #include <btstack/btstack.h>
 #include <dlfcn.h>
@@ -413,8 +413,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
 
 // Override to allow orientations other than the default portrait orientation.
 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
-	// return YES;
-	return NO;
+	return YES;
+	// return NO;
 }
 
 - (void)didReceiveMemoryWarning {
@@ -635,5 +635,6 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
 	return nil;
 }
 
+
 @end
 
diff --git a/CocoaTouch/src/BTstackManager.m b/CocoaTouch/src/BTstackManager.m
index 7076cffd8..6422a2a8c 100644
--- a/CocoaTouch/src/BTstackManager.m
+++ b/CocoaTouch/src/BTstackManager.m
@@ -507,7 +507,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
 		linkKey = [deviceDict objectForKey:PREFS_LINK_KEY];
 	}
 	if (linkKey) {
-		NSLog(@"Sending link key for %@, value %@", devAddress, linkKey);
+		// NSLog(@"Sending link key for %@, value %@", devAddress, linkKey);
 		bt_send_cmd(&hci_link_key_request_reply, &event_addr, [linkKey bytes]);
 	} else {
 		bt_send_cmd(&hci_link_key_request_negative_reply, &event_addr);
@@ -525,14 +525,14 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
 		[deviceInfo setObject:deviceDict forKey:devAddress];
 	}
 	[deviceDict setObject:linkKey forKey:PREFS_LINK_KEY];
-	NSLog(@"Adding link key for %@, value %@", devAddress, linkKey);
+	// NSLog(@"Adding link key for %@, value %@", devAddress, linkKey);
 }
 
 -(void) dropLinkKeyForAddress:(bd_addr_t*) address {
 	NSString *devAddress = [BTDevice stringForAddress:address];
 	NSMutableDictionary * deviceDict = [deviceInfo objectForKey:devAddress];
 	[deviceDict removeObjectForKey:PREFS_LINK_KEY];
-	NSLog(@"Removing link key for %@", devAddress);
+	// NSLog(@"Removing link key for %@", devAddress);
 }
 
 -(void) handlePacketWithType:(uint8_t)packet_type forChannel:(uint16_t)channel andData:(uint8_t *)packet withLen:(uint16_t) size {