mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-25 16:43:28 +00:00
correct address of result field in CONNECTION_RESPONSE (really)
This commit is contained in:
parent
cd56f93151
commit
141679a411
@ -109,18 +109,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
|||||||
remoteNameIndex++;
|
remoteNameIndex++;
|
||||||
[self getNextRemoteName];
|
[self getNextRemoteName];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case L2CAP_EVENT_CHANNEL_OPENED:
|
|
||||||
// inform about new l2cap connection
|
|
||||||
bt_flip_addr(event_addr, &packet[2]);
|
|
||||||
uint16_t psm = READ_BT_16(packet, 10);
|
|
||||||
uint16_t source_cid = READ_BT_16(packet, 12);
|
|
||||||
printf("Channel successfully opened: ");
|
|
||||||
print_bd_addr(event_addr);
|
|
||||||
printf(", handle 0x%02x, psm 0x%02x, source cid 0x%02x, dest cid 0x%02x\n",
|
|
||||||
READ_BT_16(packet, 8), psm, source_cid, READ_BT_16(packet, 14));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HCI_EVENT_COMMAND_COMPLETE:
|
case HCI_EVENT_COMMAND_COMPLETE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -357,8 +346,9 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
|||||||
// valid selection?
|
// valid selection?
|
||||||
int idx = [indexPath indexAtPosition:1];
|
int idx = [indexPath indexAtPosition:1];
|
||||||
if (bluetoothState == HCI_STATE_WORKING && inquiryState == kInquiryInactive && idx < [devices count]){
|
if (bluetoothState == HCI_STATE_WORKING && inquiryState == kInquiryInactive && idx < [devices count]){
|
||||||
if (delegate && [delegate respondsTo:@selector(deviceChoosen:device:)]){
|
// if (delegate && [delegate conformsTo:@protocol(BTInquiryDelegate)]){
|
||||||
[delegate deviceChoosen:self device:[devices objectAtIndex:idx]];
|
if (delegate) {
|
||||||
|
[delegate deviceChoosen:self device:[devices objectAtIndex:idx]];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
[tableView deselectRowAtIndexPath:indexPath animated:TRUE];
|
[tableView deselectRowAtIndexPath:indexPath animated:TRUE];
|
||||||
|
12
TODO.txt
12
TODO.txt
@ -2,8 +2,16 @@
|
|||||||
|
|
||||||
NEXT:
|
NEXT:
|
||||||
- prepare WiiMoteDemo for release
|
- prepare WiiMoteDemo for release
|
||||||
- integrate new inquiry code
|
- on device select:
|
||||||
- use navigation controller to switch views
|
- if name != WiiMote
|
||||||
|
- show alert: need wiimote
|
||||||
|
- stop inquiry
|
||||||
|
- set flag to connecting for wiimote
|
||||||
|
- on connect, switch view
|
||||||
|
- improve user experience of BTstack Inquiry View
|
||||||
|
- shorter inquiry interval
|
||||||
|
- repeat inquiry while BT on
|
||||||
|
- allow to select device and stop inquiry
|
||||||
- figure out why stack doesn't shut Bluetooth off when in sleep for a while/after wakeup
|
- figure out why stack doesn't shut Bluetooth off when in sleep for a while/after wakeup
|
||||||
- provide test version by setting up APT repository within BTstack SVN
|
- provide test version by setting up APT repository within BTstack SVN
|
||||||
- instructions: http://www.saurik.com/id/7
|
- instructions: http://www.saurik.com/id/7
|
||||||
|
@ -18,9 +18,13 @@
|
|||||||
UILabel *status;
|
UILabel *status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)startDemo:(id) arg;
|
||||||
|
|
||||||
|
|
||||||
@property (nonatomic, retain) UIWindow *window;
|
@property (nonatomic, retain) UIWindow *window;
|
||||||
@property (nonatomic, retain) UINavigationController *navControl;
|
@property (nonatomic, retain) UINavigationController *navControl;
|
||||||
@property (nonatomic, retain) UIViewController *glViewControl;
|
@property (nonatomic, retain) UIViewController *glViewControl;
|
||||||
|
@property (nonatomic, retain) BTInquiryViewController *inqViewControl;
|
||||||
@property (nonatomic, retain) EAGLView *glView;
|
@property (nonatomic, retain) EAGLView *glView;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#define USE_BLUETOOTH
|
#define USE_BLUETOOTH
|
||||||
|
|
||||||
bd_addr_t addr = {0x00, 0x19, 0x1d, 0x90, 0x44, 0x68 }; // WiiMote
|
BTDevice *device;
|
||||||
|
|
||||||
WiiMoteOpenGLDemoAppDelegate * theMainApp;
|
WiiMoteOpenGLDemoAppDelegate * theMainApp;
|
||||||
|
|
||||||
@ -26,6 +26,7 @@ WiiMoteOpenGLDemoAppDelegate * theMainApp;
|
|||||||
@synthesize glView;
|
@synthesize glView;
|
||||||
@synthesize navControl;
|
@synthesize navControl;
|
||||||
@synthesize glViewControl;
|
@synthesize glViewControl;
|
||||||
|
@synthesize inqViewControl;
|
||||||
|
|
||||||
#define SIZE 5
|
#define SIZE 5
|
||||||
static void bt_data_cb(uint8_t x, uint8_t y, uint8_t z){
|
static void bt_data_cb(uint8_t x, uint8_t y, uint8_t z){
|
||||||
@ -88,13 +89,23 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
|||||||
// interupt channel openedn succesfully, now open control channel, too.
|
// interupt channel openedn succesfully, now open control channel, too.
|
||||||
bt_send_cmd(&l2cap_create_channel, event_addr, 0x11);
|
bt_send_cmd(&l2cap_create_channel, event_addr, 0x11);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// request acceleration data.. probably has to be sent to control channel 0x11 instead of 0x13
|
// request acceleration data.. probably has to be sent to control channel 0x11 instead of 0x13
|
||||||
uint8_t setMode31[] = { 0x52, 0x12, 0x00, 0x31 };
|
uint8_t setMode31[] = { 0x52, 0x12, 0x00, 0x31 };
|
||||||
bt_send_l2cap( source_cid, setMode31, sizeof(setMode31));
|
bt_send_l2cap( source_cid, setMode31, sizeof(setMode31));
|
||||||
uint8_t setLEDs[] = { 0x52, 0x11, 0x10 };
|
uint8_t setLEDs[] = { 0x52, 0x11, 0x10 };
|
||||||
bt_send_l2cap( source_cid, setLEDs, sizeof(setLEDs));
|
bt_send_l2cap( source_cid, setLEDs, sizeof(setLEDs));
|
||||||
// (*state_cb)("WiiMote connected");
|
|
||||||
|
// start GL demo
|
||||||
|
// [device setConnectionState:kBluetoothConnectionConnected];
|
||||||
|
// [[[theMainApp inqViewControl] tableView] reloadData];
|
||||||
|
|
||||||
|
// do perform on main thread stuff
|
||||||
|
// [[theMainApp navControl] pushViewController:[theMainApp glViewControl] animated:YES];
|
||||||
|
[theMainApp performSelectorOnMainThread:@selector(startDemo:)
|
||||||
|
withObject:nil waitUntilDone:false];
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -104,6 +115,10 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
- (void)startDemo:(id) arg {
|
||||||
|
NSLog(@"startDemo");
|
||||||
|
[navControl pushViewController:glViewControl animated:YES];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)applicationDidFinishLaunching:(UIApplication *)application {
|
- (void)applicationDidFinishLaunching:(UIApplication *)application {
|
||||||
NSLog(@"Started");
|
NSLog(@"Started");
|
||||||
@ -154,10 +169,13 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
|||||||
glView.animationInterval = 1.0 / 60.0;
|
glView.animationInterval = 1.0 / 60.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void) deviceChoosen:(BTInquiryViewController *) inqView device:(BTDevice*) device{
|
-(void) deviceChoosen:(BTInquiryViewController *) inqView device:(BTDevice*) selectedDevice{
|
||||||
NSLog(@"deviceChoosen %@", [device toString]);
|
NSLog(@"deviceChoosen %@", [device toString]);
|
||||||
|
|
||||||
[navControl pushViewController:glViewControl animated:YES];
|
device = selectedDevice;
|
||||||
|
[device setConnectionState:kBluetoothConnectionConnecting];
|
||||||
|
[[inqView tableView] reloadData];
|
||||||
|
bt_send_cmd(&l2cap_create_channel, [device address], 0x13);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ void l2cap_signaling_handler(l2cap_channel_t *channel, uint8_t *packet, uint16_t
|
|||||||
case L2CAP_STATE_WAIT_CONNECT_RSP:
|
case L2CAP_STATE_WAIT_CONNECT_RSP:
|
||||||
switch (code){
|
switch (code){
|
||||||
case CONNECTION_RESPONSE:
|
case CONNECTION_RESPONSE:
|
||||||
result = READ_BT_16 (packet, L2CAP_SIGNALING_DATA_OFFSET+8);
|
result = READ_BT_16 (packet, L2CAP_SIGNALING_DATA_OFFSET+4);
|
||||||
switch (result) {
|
switch (result) {
|
||||||
case 0:
|
case 0:
|
||||||
// successfull connection
|
// successfull connection
|
||||||
|
Loading…
x
Reference in New Issue
Block a user