1
0
mirror of https://github.com/bluekitchen/btstack.git synced 2025-03-20 01:21:12 +00:00

allow rotation, clean ups

This commit is contained in:
matthias.ringwald 2010-05-08 19:12:53 +00:00
parent 8667373fa2
commit 9d6f5e03a6
4 changed files with 17 additions and 9 deletions

@ -120,6 +120,9 @@ typedef enum {
// Link Key Management // Link Key Management
-(void) dropLinkKeyForAddress:(bd_addr_t*) address; -(void) dropLinkKeyForAddress:(bd_addr_t*) address;
// store remote names and link keys
-(void)storeDeviceInfo;
// Connections // Connections
-(BTstackError) createL2CAPChannelAtAddress:(bd_addr_t*) address withPSM:(uint16_t)psm authenticated:(BOOL)authentication; -(BTstackError) createL2CAPChannelAtAddress:(bd_addr_t*) address withPSM:(uint16_t)psm authenticated:(BOOL)authentication;
-(BTstackError) closeL2CAPChannelWithID:(uint16_t) channelID; -(BTstackError) closeL2CAPChannelWithID:(uint16_t) channelID;
@ -132,8 +135,6 @@ typedef enum {
// TODO add l2cap and rfcomm incoming commands // TODO add l2cap and rfcomm incoming commands
// store remote names and link keys
-(void)storeDeviceInfo;
@property (nonatomic, assign) NSObject<BTstackManagerDelegate>* delegate; @property (nonatomic, assign) NSObject<BTstackManagerDelegate>* delegate;
@property (nonatomic, retain) NSMutableDictionary *deviceInfo; @property (nonatomic, retain) NSMutableDictionary *deviceInfo;

@ -338,6 +338,12 @@
return nil; return nil;
} }
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
// return NO;
}
- (void)dealloc { - (void)dealloc {
[super dealloc]; [super dealloc];
} }

@ -35,8 +35,8 @@
// Created by Matthias Ringwald on 10/8/09. // Created by Matthias Ringwald on 10/8/09.
// //
#import "BTInquiryViewController.h" #import <BTstack/BTInquiryViewController.h>
#import "BTDevice.h" #import <BTstack/BTDevice.h>
#include <btstack/btstack.h> #include <btstack/btstack.h>
#include <dlfcn.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. // Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// return YES; return YES;
return NO; // return NO;
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
@ -635,5 +635,6 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
return nil; return nil;
} }
@end @end

@ -507,7 +507,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
linkKey = [deviceDict objectForKey:PREFS_LINK_KEY]; linkKey = [deviceDict objectForKey:PREFS_LINK_KEY];
} }
if (linkKey) { 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]); bt_send_cmd(&hci_link_key_request_reply, &event_addr, [linkKey bytes]);
} else { } else {
bt_send_cmd(&hci_link_key_request_negative_reply, &event_addr); 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]; [deviceInfo setObject:deviceDict forKey:devAddress];
} }
[deviceDict setObject:linkKey forKey:PREFS_LINK_KEY]; [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 { -(void) dropLinkKeyForAddress:(bd_addr_t*) address {
NSString *devAddress = [BTDevice stringForAddress:address]; NSString *devAddress = [BTDevice stringForAddress:address];
NSMutableDictionary * deviceDict = [deviceInfo objectForKey:devAddress]; NSMutableDictionary * deviceDict = [deviceInfo objectForKey:devAddress];
[deviceDict removeObjectForKey:PREFS_LINK_KEY]; [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 { -(void) handlePacketWithType:(uint8_t)packet_type forChannel:(uint16_t)channel andData:(uint8_t *)packet withLen:(uint16_t) size {