implemented create connection cancel command and hande it in l2cap

This commit is contained in:
matthias.ringwald 2009-12-14 22:42:14 +00:00
parent 3ce394c4bc
commit afde0c529f
6 changed files with 99 additions and 183 deletions

View File

@ -99,11 +99,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
devices = [[NSMutableArray alloc] init];
inqView = self;
// check for the one missing method
onSDK20 = 0;
// [UITableViewCell instancesRespondToSelector:@selector(initWithFrame:reuseIdentifier:)];
NSLog(@"onSDK20 = %u", onSDK20);
return self;
}

View File

@ -171,6 +171,7 @@ extern hci_cmd_t hci_set_event_mask;
extern hci_cmd_t hci_reset;
extern hci_cmd_t hci_create_connection;
extern hci_cmd_t hci_disconnect;
extern hci_cmd_t hci_create_connection_cancel;
extern hci_cmd_t hci_host_buffer_size;
extern hci_cmd_t hci_write_authentication_enable;
extern hci_cmd_t hci_write_local_name;

View File

@ -15,6 +15,7 @@ echo "Version: $VERSION-$REVISION" >> $PACKAGE/DEBIAN/control
mkdir -p $PACKAGE/usr/local/bin
cp src/BTdaemon $PACKAGE/usr/local/bin
cp example/inquiry $PACKAGE/usr/local/bin
mkdir -p $PACKAGE/usr/local/lib
cp src/libBTstack.dylib $PACKAGE/usr/local/lib

View File

@ -28,19 +28,6 @@
9C7ECB840FCC85650085DAC5 /* bt_control_iphone.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C7ECB820FCC85650085DAC5 /* bt_control_iphone.c */; };
9C7ECBB50FCC95DD0085DAC5 /* hci_dump.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C7ECBB40FCC95DD0085DAC5 /* hci_dump.c */; };
9C88500E0FBF6702004980E4 /* l2cap.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C88500C0FBF6702004980E4 /* l2cap.c */; };
9C88A1E010C7DE310003DF36 /* BTDevice.o in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C88A1AE10C7DE310003DF36 /* BTDevice.o */; };
9C88A1E110C7DE310003DF36 /* BTInquiryViewController.o in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C88A1AF10C7DE310003DF36 /* BTInquiryViewController.o */; };
9C88A1E210C7DE310003DF36 /* main.o in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C88A1B110C7DE310003DF36 /* main.o */; };
9C88A1E310C7DE310003DF36 /* BTDevice.o in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C88A1BF10C7DE310003DF36 /* BTDevice.o */; };
9C88A1E410C7DE310003DF36 /* BTInquiryViewController.o in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C88A1C010C7DE310003DF36 /* BTInquiryViewController.o */; };
9C88A1E510C7DE310003DF36 /* BTInquiryViewController.o~$ in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C88A1C110C7DE310003DF36 /* BTInquiryViewController.o~$ */; };
9C88A1E610C7DE310003DF36 /* BTstackCocoaAppDelegate.o in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C88A1C510C7DE310003DF36 /* BTstackCocoaAppDelegate.o */; };
9C88A1E710C7DE310003DF36 /* BTstackCocoaAppDelegate.o~$ in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C88A1C610C7DE310003DF36 /* BTstackCocoaAppDelegate.o~$ */; };
9C88A1E810C7DE310003DF36 /* main.o in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C88A1C810C7DE310003DF36 /* main.o */; };
9C88A1E910C7DE310003DF36 /* BTDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C88A1DB10C7DE310003DF36 /* BTDevice.m */; };
9C88A1EA10C7DE310003DF36 /* BTInquiryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C88A1DC10C7DE310003DF36 /* BTInquiryViewController.m */; };
9C88A1EB10C7DE310003DF36 /* BTstackCocoaAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C88A1DE10C7DE310003DF36 /* BTstackCocoaAppDelegate.m */; };
9C88A1EC10C7DE310003DF36 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9C88A1DF10C7DE310003DF36 /* main.m */; };
9CC813A20FFC0774002816F9 /* btstack.c in Sources */ = {isa = PBXBuildFile; fileRef = 9CC813A10FFC0774002816F9 /* btstack.c */; };
9CC813A50FFC0A51002816F9 /* daemon.c in Sources */ = {isa = PBXBuildFile; fileRef = 9CC813A40FFC0A51002816F9 /* daemon.c */; };
9CCE6CEA1025BD0000FCE9F4 /* hci.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C46FC340FA906F700ABEF05 /* hci.c */; };
@ -117,60 +104,12 @@
9C88A18C10C7DE310003DF36 /* BTstackCocoa-Info.plist */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.plist.xml; path = "BTstackCocoa-Info.plist"; sourceTree = "<group>"; };
9C88A18D10C7DE310003DF36 /* BTstackCocoa.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = BTstackCocoa.xcodeproj; sourceTree = "<group>"; };
9C88A19010C7DE310003DF36 /* BTstackCocoa_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = BTstackCocoa_Prefix.pch; sourceTree = "<group>"; };
9C88A19410C7DE310003DF36 /* categories.pbxbtree */ = {isa = PBXFileReference; lastKnownFileType = file; path = categories.pbxbtree; sourceTree = "<group>"; };
9C88A19510C7DE310003DF36 /* cdecls.pbxbtree */ = {isa = PBXFileReference; lastKnownFileType = file; path = cdecls.pbxbtree; sourceTree = "<group>"; };
9C88A19610C7DE310003DF36 /* decls.pbxbtree */ = {isa = PBXFileReference; lastKnownFileType = file; path = decls.pbxbtree; sourceTree = "<group>"; };
9C88A19710C7DE310003DF36 /* files.pbxbtree */ = {isa = PBXFileReference; lastKnownFileType = file; path = files.pbxbtree; sourceTree = "<group>"; };
9C88A19810C7DE310003DF36 /* imports.pbxbtree */ = {isa = PBXFileReference; lastKnownFileType = file; path = imports.pbxbtree; sourceTree = "<group>"; };
9C88A19910C7DE310003DF36 /* pbxindex.header */ = {isa = PBXFileReference; lastKnownFileType = file; path = pbxindex.header; sourceTree = "<group>"; };
9C88A19A10C7DE310003DF36 /* protocols.pbxbtree */ = {isa = PBXFileReference; lastKnownFileType = file; path = protocols.pbxbtree; sourceTree = "<group>"; };
9C88A19B10C7DE310003DF36 /* refs.pbxbtree */ = {isa = PBXFileReference; lastKnownFileType = file; path = refs.pbxbtree; sourceTree = "<group>"; };
9C88A19D10C7DE310003DF36 /* control */ = {isa = PBXFileReference; lastKnownFileType = file; path = control; sourceTree = "<group>"; };
9C88A19E10C7DE310003DF36 /* strings */ = {isa = PBXFileReference; lastKnownFileType = file; path = strings; sourceTree = "<group>"; };
9C88A19F10C7DE310003DF36 /* subclasses.pbxbtree */ = {isa = PBXFileReference; lastKnownFileType = file; path = subclasses.pbxbtree; sourceTree = "<group>"; };
9C88A1A010C7DE310003DF36 /* symbols0.pbxsymbols */ = {isa = PBXFileReference; lastKnownFileType = file; path = symbols0.pbxsymbols; sourceTree = "<group>"; };
9C88A1A310C7DE310003DF36 /* BTstackCocoa-all-target-headers.hmap */ = {isa = PBXFileReference; lastKnownFileType = file; path = "BTstackCocoa-all-target-headers.hmap"; sourceTree = "<group>"; };
9C88A1A410C7DE310003DF36 /* BTstackCocoa-generated-files.hmap */ = {isa = PBXFileReference; lastKnownFileType = file; path = "BTstackCocoa-generated-files.hmap"; sourceTree = "<group>"; };
9C88A1A510C7DE310003DF36 /* BTstackCocoa-own-target-headers.hmap */ = {isa = PBXFileReference; lastKnownFileType = file; path = "BTstackCocoa-own-target-headers.hmap"; sourceTree = "<group>"; };
9C88A1A610C7DE310003DF36 /* BTstackCocoa-project-headers.hmap */ = {isa = PBXFileReference; lastKnownFileType = file; path = "BTstackCocoa-project-headers.hmap"; sourceTree = "<group>"; };
9C88A1A710C7DE310003DF36 /* BTstackCocoa.dep */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = BTstackCocoa.dep; sourceTree = "<group>"; };
9C88A1A810C7DE310003DF36 /* BTstackCocoa.hmap */ = {isa = PBXFileReference; lastKnownFileType = file; path = BTstackCocoa.hmap; sourceTree = "<group>"; };
9C88A1A910C7DE310003DF36 /* BTstackCocoa~.dep */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "BTstackCocoa~.dep"; sourceTree = "<group>"; };
9C88A1AA10C7DE310003DF36 /* build-state.dat */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "build-state.dat"; sourceTree = "<group>"; };
9C88A1AB10C7DE310003DF36 /* build-state~.dat */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "build-state~.dat"; sourceTree = "<group>"; };
9C88A1AE10C7DE310003DF36 /* BTDevice.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = BTDevice.o; sourceTree = "<group>"; };
9C88A1AF10C7DE310003DF36 /* BTInquiryViewController.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = BTInquiryViewController.o; sourceTree = "<group>"; };
9C88A1B010C7DE310003DF36 /* BTstackCocoa.LinkFileList */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = BTstackCocoa.LinkFileList; sourceTree = "<group>"; };
9C88A1B110C7DE310003DF36 /* main.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = main.o; sourceTree = "<group>"; };
9C88A1B410C7DE310003DF36 /* BTstackCocoa-all-target-headers.hmap */ = {isa = PBXFileReference; lastKnownFileType = file; path = "BTstackCocoa-all-target-headers.hmap"; sourceTree = "<group>"; };
9C88A1B510C7DE310003DF36 /* BTstackCocoa-generated-files.hmap */ = {isa = PBXFileReference; lastKnownFileType = file; path = "BTstackCocoa-generated-files.hmap"; sourceTree = "<group>"; };
9C88A1B610C7DE310003DF36 /* BTstackCocoa-own-target-headers.hmap */ = {isa = PBXFileReference; lastKnownFileType = file; path = "BTstackCocoa-own-target-headers.hmap"; sourceTree = "<group>"; };
9C88A1B710C7DE310003DF36 /* BTstackCocoa-project-headers.hmap */ = {isa = PBXFileReference; lastKnownFileType = file; path = "BTstackCocoa-project-headers.hmap"; sourceTree = "<group>"; };
9C88A1B810C7DE310003DF36 /* BTstackCocoa.dep */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = BTstackCocoa.dep; sourceTree = "<group>"; };
9C88A1B910C7DE310003DF36 /* BTstackCocoa.hmap */ = {isa = PBXFileReference; lastKnownFileType = file; path = BTstackCocoa.hmap; sourceTree = "<group>"; };
9C88A1BA10C7DE310003DF36 /* BTstackCocoa~.dep */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "BTstackCocoa~.dep"; sourceTree = "<group>"; };
9C88A1BB10C7DE310003DF36 /* build-state.dat */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "build-state.dat"; sourceTree = "<group>"; };
9C88A1BC10C7DE310003DF36 /* build-state~.dat */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "build-state~.dat"; sourceTree = "<group>"; };
9C88A1BF10C7DE310003DF36 /* BTDevice.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = BTDevice.o; sourceTree = "<group>"; };
9C88A1C010C7DE310003DF36 /* BTInquiryViewController.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = BTInquiryViewController.o; sourceTree = "<group>"; };
9C88A1C110C7DE310003DF36 /* BTInquiryViewController.o~$ */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = "BTInquiryViewController.o~$"; sourceTree = "<group>"; };
9C88A1C210C7DE310003DF36 /* BTInquiryViewController.o~> */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "BTInquiryViewController.o~>"; sourceTree = "<group>"; };
9C88A1C310C7DE310003DF36 /* BTInquiryViewController.o~? */ = {isa = PBXFileReference; lastKnownFileType = file; path = "BTInquiryViewController.o~?"; sourceTree = "<group>"; };
9C88A1C410C7DE310003DF36 /* BTstackCocoa.LinkFileList */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = BTstackCocoa.LinkFileList; sourceTree = "<group>"; };
9C88A1C510C7DE310003DF36 /* BTstackCocoaAppDelegate.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = BTstackCocoaAppDelegate.o; sourceTree = "<group>"; };
9C88A1C610C7DE310003DF36 /* BTstackCocoaAppDelegate.o~$ */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = "BTstackCocoaAppDelegate.o~$"; sourceTree = "<group>"; };
9C88A1C710C7DE310003DF36 /* BTstackCocoaAppDelegate.o~> */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = "BTstackCocoaAppDelegate.o~>"; sourceTree = "<group>"; };
9C88A1C810C7DE310003DF36 /* main.o */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.objfile"; path = main.o; sourceTree = "<group>"; };
9C88A1CA10C7DE310003DF36 /* BTstackCocoa.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; path = BTstackCocoa.app; sourceTree = "<group>"; };
9C88A1CB10C7DE310003DF36 /* BTstackCocoa.app.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; path = BTstackCocoa.app.dSYM; sourceTree = "<group>"; };
9C88A1CD10C7DE310003DF36 /* BTstackCocoa.app */ = {isa = PBXFileReference; lastKnownFileType = wrapper.application; path = BTstackCocoa.app; sourceTree = "<group>"; };
9C88A1CE10C7DE310003DF36 /* BTstackCocoa.app.dSYM */ = {isa = PBXFileReference; lastKnownFileType = wrapper.dsym; path = BTstackCocoa.app.dSYM; sourceTree = "<group>"; };
9C88A1D010C7DE310003DF36 /* bluetooth.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = bluetooth.png; sourceTree = "<group>"; };
9C88A1D110C7DE310003DF36 /* computer.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = computer.png; sourceTree = "<group>"; };
9C88A1D210C7DE310003DF36 /* keyboard.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = keyboard.png; sourceTree = "<group>"; };
9C88A1D310C7DE310003DF36 /* LICENSE.txt */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = LICENSE.txt; sourceTree = "<group>"; };
9C88A1D410C7DE310003DF36 /* smartphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = smartphone.png; sourceTree = "<group>"; };
9C88A1D510C7DE310003DF36 /* Untitled.txt */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text; path = Untitled.txt; sourceTree = "<group>"; };
9C88A1D810C7DE310003DF36 /* BTDevice.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = BTDevice.h; sourceTree = "<group>"; };
9C88A1D910C7DE310003DF36 /* BTInquiryViewController.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = BTInquiryViewController.h; sourceTree = "<group>"; };
9C88A1DB10C7DE310003DF36 /* BTDevice.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; path = BTDevice.m; sourceTree = "<group>"; };
@ -203,15 +142,6 @@
files = (
9C04B87A107D2BA7002A63D0 /* CoreFoundation.framework in Frameworks */,
9C18015C108BAA7200824BE7 /* libusb-1.0.dylib in Frameworks */,
9C88A1E010C7DE310003DF36 /* BTDevice.o in Frameworks */,
9C88A1E110C7DE310003DF36 /* BTInquiryViewController.o in Frameworks */,
9C88A1E210C7DE310003DF36 /* main.o in Frameworks */,
9C88A1E310C7DE310003DF36 /* BTDevice.o in Frameworks */,
9C88A1E410C7DE310003DF36 /* BTInquiryViewController.o in Frameworks */,
9C88A1E510C7DE310003DF36 /* BTInquiryViewController.o~$ in Frameworks */,
9C88A1E610C7DE310003DF36 /* BTstackCocoaAppDelegate.o in Frameworks */,
9C88A1E710C7DE310003DF36 /* BTstackCocoaAppDelegate.o~$ in Frameworks */,
9C88A1E810C7DE310003DF36 /* main.o in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -384,17 +314,7 @@
9C88A19310C7DE310003DF36 /* BTstackCocoa.pbxindex */ = {
isa = PBXGroup;
children = (
9C88A19410C7DE310003DF36 /* categories.pbxbtree */,
9C88A19510C7DE310003DF36 /* cdecls.pbxbtree */,
9C88A19610C7DE310003DF36 /* decls.pbxbtree */,
9C88A19710C7DE310003DF36 /* files.pbxbtree */,
9C88A19810C7DE310003DF36 /* imports.pbxbtree */,
9C88A19910C7DE310003DF36 /* pbxindex.header */,
9C88A19A10C7DE310003DF36 /* protocols.pbxbtree */,
9C88A19B10C7DE310003DF36 /* refs.pbxbtree */,
9C88A19C10C7DE310003DF36 /* strings.pbxstrings */,
9C88A19F10C7DE310003DF36 /* subclasses.pbxbtree */,
9C88A1A010C7DE310003DF36 /* symbols0.pbxsymbols */,
);
path = BTstackCocoa.pbxindex;
sourceTree = "<group>";
@ -403,7 +323,6 @@
isa = PBXGroup;
children = (
9C88A19D10C7DE310003DF36 /* control */,
9C88A19E10C7DE310003DF36 /* strings */,
);
path = strings.pbxstrings;
sourceTree = "<group>";
@ -419,15 +338,6 @@
9C88A1A210C7DE310003DF36 /* BTstackCocoa.build */ = {
isa = PBXGroup;
children = (
9C88A1A310C7DE310003DF36 /* BTstackCocoa-all-target-headers.hmap */,
9C88A1A410C7DE310003DF36 /* BTstackCocoa-generated-files.hmap */,
9C88A1A510C7DE310003DF36 /* BTstackCocoa-own-target-headers.hmap */,
9C88A1A610C7DE310003DF36 /* BTstackCocoa-project-headers.hmap */,
9C88A1A710C7DE310003DF36 /* BTstackCocoa.dep */,
9C88A1A810C7DE310003DF36 /* BTstackCocoa.hmap */,
9C88A1A910C7DE310003DF36 /* BTstackCocoa~.dep */,
9C88A1AA10C7DE310003DF36 /* build-state.dat */,
9C88A1AB10C7DE310003DF36 /* build-state~.dat */,
9C88A1AC10C7DE310003DF36 /* Objects-normal */,
);
path = BTstackCocoa.build;
@ -444,10 +354,6 @@
9C88A1AD10C7DE310003DF36 /* armv6 */ = {
isa = PBXGroup;
children = (
9C88A1AE10C7DE310003DF36 /* BTDevice.o */,
9C88A1AF10C7DE310003DF36 /* BTInquiryViewController.o */,
9C88A1B010C7DE310003DF36 /* BTstackCocoa.LinkFileList */,
9C88A1B110C7DE310003DF36 /* main.o */,
);
path = armv6;
sourceTree = "<group>";
@ -463,15 +369,6 @@
9C88A1B310C7DE310003DF36 /* BTstackCocoa.build */ = {
isa = PBXGroup;
children = (
9C88A1B410C7DE310003DF36 /* BTstackCocoa-all-target-headers.hmap */,
9C88A1B510C7DE310003DF36 /* BTstackCocoa-generated-files.hmap */,
9C88A1B610C7DE310003DF36 /* BTstackCocoa-own-target-headers.hmap */,
9C88A1B710C7DE310003DF36 /* BTstackCocoa-project-headers.hmap */,
9C88A1B810C7DE310003DF36 /* BTstackCocoa.dep */,
9C88A1B910C7DE310003DF36 /* BTstackCocoa.hmap */,
9C88A1BA10C7DE310003DF36 /* BTstackCocoa~.dep */,
9C88A1BB10C7DE310003DF36 /* build-state.dat */,
9C88A1BC10C7DE310003DF36 /* build-state~.dat */,
9C88A1BD10C7DE310003DF36 /* Objects-normal */,
);
path = BTstackCocoa.build;
@ -488,16 +385,6 @@
9C88A1BE10C7DE310003DF36 /* i386 */ = {
isa = PBXGroup;
children = (
9C88A1BF10C7DE310003DF36 /* BTDevice.o */,
9C88A1C010C7DE310003DF36 /* BTInquiryViewController.o */,
9C88A1C110C7DE310003DF36 /* BTInquiryViewController.o~$ */,
9C88A1C210C7DE310003DF36 /* BTInquiryViewController.o~> */,
9C88A1C310C7DE310003DF36 /* BTInquiryViewController.o~? */,
9C88A1C410C7DE310003DF36 /* BTstackCocoa.LinkFileList */,
9C88A1C510C7DE310003DF36 /* BTstackCocoaAppDelegate.o */,
9C88A1C610C7DE310003DF36 /* BTstackCocoaAppDelegate.o~$ */,
9C88A1C710C7DE310003DF36 /* BTstackCocoaAppDelegate.o~> */,
9C88A1C810C7DE310003DF36 /* main.o */,
);
path = i386;
sourceTree = "<group>";
@ -505,8 +392,6 @@
9C88A1C910C7DE310003DF36 /* Debug-iphoneos */ = {
isa = PBXGroup;
children = (
9C88A1CA10C7DE310003DF36 /* BTstackCocoa.app */,
9C88A1CB10C7DE310003DF36 /* BTstackCocoa.app.dSYM */,
);
path = "Debug-iphoneos";
sourceTree = "<group>";
@ -514,8 +399,6 @@
9C88A1CC10C7DE310003DF36 /* Debug-iphonesimulator */ = {
isa = PBXGroup;
children = (
9C88A1CD10C7DE310003DF36 /* BTstackCocoa.app */,
9C88A1CE10C7DE310003DF36 /* BTstackCocoa.app.dSYM */,
);
path = "Debug-iphonesimulator";
sourceTree = "<group>";
@ -528,7 +411,6 @@
9C88A1D210C7DE310003DF36 /* keyboard.png */,
9C88A1D310C7DE310003DF36 /* LICENSE.txt */,
9C88A1D410C7DE310003DF36 /* smartphone.png */,
9C88A1D510C7DE310003DF36 /* Untitled.txt */,
);
path = icons;
sourceTree = "<group>";
@ -674,10 +556,6 @@
9CEB4F17107AAAEF00DD5720 /* run_loop_posix.c in Sources */,
9C04B826107D1CED002A63D0 /* run_loop.c in Sources */,
9C04B876107D2B7C002A63D0 /* run_loop_cocoa.m in Sources */,
9C88A1E910C7DE310003DF36 /* BTDevice.m in Sources */,
9C88A1EA10C7DE310003DF36 /* BTInquiryViewController.m in Sources */,
9C88A1EB10C7DE310003DF36 /* BTstackCocoaAppDelegate.m in Sources */,
9C88A1EC10C7DE310003DF36 /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -157,7 +157,10 @@ OPCODE(OGF_LINK_CONTROL, 0x06), "H1"
// Handle, Reason: 0x05, 0x13-0x15, 0x1a, 0x29
// see Errors Codes in BT Spec Part D
};
hci_cmd_t hci_create_connection_cancel = {
OPCODE(OGF_LINK_CONTROL, 0x08), "B"
// BD_ADDR
};
hci_cmd_t hci_accept_connection_request = {
OPCODE(OGF_LINK_CONTROL, 0x09), "B1"
// BD_ADDR, Role: become master, stay slave

View File

@ -137,72 +137,109 @@ void l2cap_disconnect_internal(uint16_t source_cid, uint8_t reason){
}
}
static void l2cap_handle_connection_failed_for_addr(bd_addr_t address, uint8_t status){
linked_item_t *it;
for (it = (linked_item_t *) l2cap_channels; it ; it = it->next){
l2cap_channel_t * channel = (l2cap_channel_t *) it;
if ( ! BD_ADDR_CMP( channel->address, address) ){
if (channel->state == L2CAP_STATE_CLOSED) {
// failure, forward error code
l2cap_emit_channel_opened(channel, status);
// discard channel
linked_list_remove(&l2cap_channels, (linked_item_t *) channel);
free (channel);
}
}
}
}
static void l2cap_handle_connection_success_for_addr(bd_addr_t address, hci_con_handle_t handle){
linked_item_t *it;
for (it = (linked_item_t *) l2cap_channels; it ; it = it->next){
l2cap_channel_t * channel = (l2cap_channel_t *) it;
if ( ! BD_ADDR_CMP( channel->address, address) ){
if (channel->state == L2CAP_STATE_CLOSED) {
// success, start l2cap handshake
channel->handle = handle;
channel->sig_id = l2cap_next_sig_id();
channel->source_cid = l2cap_next_source_cid();
channel->state = L2CAP_STATE_WAIT_CONNECT_RSP;
l2cap_send_signaling_packet( channel->handle, CONNECTION_REQUEST, channel->sig_id, channel->psm, channel->source_cid);
}
}
}
}
void l2cap_event_handler( uint8_t *packet, uint16_t size ){
// handle connection complete events
if (packet[0] == HCI_EVENT_CONNECTION_COMPLETE) {
bd_addr_t address;
bt_flip_addr(address, &packet[5]);
linked_item_t *it;
for (it = (linked_item_t *) l2cap_channels; it ; it = it->next){
l2cap_channel_t * channel = (l2cap_channel_t *) it;
if ( ! BD_ADDR_CMP( channel->address, address) ){
if (channel->state == L2CAP_STATE_CLOSED) {
if (packet[2] == 0){
// success, start l2cap handshake
channel->handle = READ_BT_16(packet, 3);
channel->sig_id = l2cap_next_sig_id();
channel->source_cid = l2cap_next_source_cid();
channel->state = L2CAP_STATE_WAIT_CONNECT_RSP;
l2cap_send_signaling_packet( channel->handle, CONNECTION_REQUEST, channel->sig_id, channel->psm, channel->source_cid);
} else {
// failure, forward error code
l2cap_emit_channel_opened(channel, packet[2]);
// discard channel
linked_list_remove(&l2cap_channels, (linked_item_t *) channel);
free (channel);
}
bd_addr_t address;
hci_con_handle_t handle;
switch(packet[0]){
// handle connection complete events
case HCI_EVENT_CONNECTION_COMPLETE:
bt_flip_addr(address, &packet[5]);
if (packet[2] == 0){
handle = READ_BT_16(packet, 3);
l2cap_handle_connection_success_for_addr(address, handle);
} else {
l2cap_handle_connection_failed_for_addr(address, packet[2]);
}
break;
// handle successful create connection cancel command
case HCI_EVENT_COMMAND_COMPLETE:
if ( COMMAND_COMPLETE_EVENT(packet, hci_create_connection_cancel) ) {
if (packet[5] == 0){
bt_flip_addr(address, &packet[6]);
// CONNECTION TERMINATED BY LOCAL HOST (0X16)
l2cap_handle_connection_failed_for_addr(address, 0x16);
}
}
}
}
// handle disconnection complete events
if (packet[0] == HCI_EVENT_DISCONNECTION_COMPLETE) {
// send l2cap disconnect events for all channels on this handle
hci_con_handle_t handle = READ_BT_16(packet, 3);
linked_item_t *it;
for (it = (linked_item_t *) l2cap_channels; it ; it = it->next){
l2cap_channel_t * channel = (l2cap_channel_t *) it;
if ( channel->handle == handle ){
l2cap_finialize_channel_close(channel);
break;
// handle disconnection complete events
case HCI_EVENT_DISCONNECTION_COMPLETE:
// send l2cap disconnect events for all channels on this handle
handle = READ_BT_16(packet, 3);
linked_item_t *it;
for (it = (linked_item_t *) l2cap_channels; it ; it = it->next){
l2cap_channel_t * channel = (l2cap_channel_t *) it;
if ( channel->handle == handle ){
l2cap_finialize_channel_close(channel);
}
}
}
}
// HCI Connection Timeouts
if (packet[0] == L2CAP_EVENT_TIMEOUT_CHECK && !capture_connection){
hci_con_handle_t handle = READ_BT_16(packet, 2);
linked_item_t *it;
l2cap_channel_t * channel;
int used = 0;
for (it = (linked_item_t *) l2cap_channels; it ; it = it->next){
channel = (l2cap_channel_t *) it;
if (channel->handle == handle) {
used = 1;
break;
// HCI Connection Timeouts
case L2CAP_EVENT_TIMEOUT_CHECK:
if (!capture_connection){
hci_con_handle_t handle = READ_BT_16(packet, 2);
linked_item_t *it;
l2cap_channel_t * channel;
int used = 0;
for (it = (linked_item_t *) l2cap_channels; it ; it = it->next){
channel = (l2cap_channel_t *) it;
if (channel->handle == handle) {
used = 1;
}
}
if (!used) {
hci_send_cmd(&hci_disconnect, handle, 0x13); // remote closed connection
}
}
}
if (!used) {
hci_send_cmd(&hci_disconnect, handle, 0x13); // remote closed connection
}
break;
default:
break;
}
// pass on
(*event_packet_handler)(packet, size);
}
static l2cap_handle_disconnect_request(l2cap_channel_t *channel, uint16_t identifier){
static void l2cap_handle_disconnect_request(l2cap_channel_t *channel, uint16_t identifier){
l2cap_send_signaling_packet( channel->handle, DISCONNECTION_RESPONSE, identifier, channel->dest_cid, channel->source_cid);
l2cap_finialize_channel_close(channel);
}