rename run_loop.c to run_loop_posix.c and add run_loop_cocoa.m

This commit is contained in:
matthias.ringwald 2009-10-01 19:42:45 +00:00
parent 5f9c9ba9c5
commit 50a0f00727
5 changed files with 75 additions and 13 deletions

View File

@ -5,14 +5,19 @@ Last change: status bar icon updates
NEXT:
- bug: hci_state gets confused.
- BlueTool used although hci state should be on (right after quitting example/test)
- BlueTool not used although stack not working
- bug: debug BlueTool's "I'm not a Bluetooth stack" error message
- check that iPhone sleep mode is handled somehow
- support Cocao CFRunLoop in addition to POSIX select run loop
- define struct run_loop_t
- run_loop_posix.c: run_loop_t * BTstack_run_loop = run_loop_posix;
- convert all run_loop calls to use (*BTstack_run_loop->functionX)(..)
- new btstack_open(RUN_LOOP_MODE mode) allows to choose between both
- implement missing functions in run_loop_cocoa: remove data source and timer functions
- prepare WiiMoteDemo for release
- update to current stack version
- add inquiry code
- provide test version by setting up APT repository within BTstack SVN
- instructions: http://www.saurik.com/id/7
== Release Version 0.1
- implement rest of L2CAP state machine
@ -27,6 +32,11 @@ NEXT:
- Inquiry
- Alerts and shutdown of Apple's stack
- create new GPG key for gmail account and sign APT package
- non-reproducible bug: hci_state gets confused.
- BlueTool used although hci state should be on (right after quitting example/test)
- BlueTool not used although stack not working
- more log messages
- non-reproducible bug: debug BlueTool's "I'm not a Bluetooth stack" error message
== Release 0.2 - Incoming L2CAP supported + UI Support

View File

@ -14,7 +14,6 @@
9C00F86510191097008DAB17 /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C00F86210191097008DAB17 /* utils.c */; };
9C00F87410191130008DAB17 /* l2cap_signaling.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C00F87210191130008DAB17 /* l2cap_signaling.c */; };
9C05FC971020D3F300255261 /* socket_connection.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C00F7301017ACC3008DAB17 /* socket_connection.c */; };
9C1F0E9A0FDAE023008F472F /* run_loop.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C1F0E980FDAE023008F472F /* run_loop.c */; };
9C2071F310014D3200A07EA4 /* hci_transport_usb.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C2071F210014D3200A07EA4 /* hci_transport_usb.c */; };
9C46FC3A0FA906F700ABEF05 /* hci_transport_h4.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C46FC360FA906F700ABEF05 /* hci_transport_h4.c */; };
9C77E79210667F0600F39DCF /* platform_iphone.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C77E79110667F0600F39DCF /* platform_iphone.c */; };
@ -22,13 +21,14 @@
9C7B5D01100FC9AE0065D87E /* btstack.c in Sources */ = {isa = PBXBuildFile; fileRef = 9CC813A10FFC0774002816F9 /* btstack.c */; };
9C7B5D03100FC9BB0065D87E /* test.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C7B5B7E100D04450065D87E /* test.c */; };
9C7B5D0D100FC9CE0065D87E /* linked_list.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C7B5ABF100BD3340065D87E /* linked_list.c */; };
9C7B5D0E100FC9D00065D87E /* run_loop.c in Sources */ = {isa = PBXBuildFile; fileRef = 9C1F0E980FDAE023008F472F /* run_loop.c */; };
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 */; };
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 */; };
9CEB4DAB10753B4B00DD5720 /* run_loop_cocoa.m in Sources */ = {isa = PBXBuildFile; fileRef = 9CEB4DAA10753B4B00DD5720 /* run_loop_cocoa.m */; };
9CEB4DAD10753BE600DD5720 /* run_loop_posix.c in Sources */ = {isa = PBXBuildFile; fileRef = 9CEB4DAC10753BE600DD5720 /* run_loop_posix.c */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@ -52,7 +52,6 @@
9C00F87110191130008DAB17 /* l2cap_signaling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = l2cap_signaling.h; path = src/l2cap_signaling.h; sourceTree = "<group>"; };
9C00F87210191130008DAB17 /* l2cap_signaling.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = l2cap_signaling.c; path = src/l2cap_signaling.c; sourceTree = "<group>"; };
9C1813F71042FCCA00C68F09 /* mitm.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; name = mitm.c; path = example/mitm.c; sourceTree = "<group>"; };
9C1F0E980FDAE023008F472F /* run_loop.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; name = run_loop.c; path = src/run_loop.c; sourceTree = "<group>"; };
9C2071F210014D3200A07EA4 /* hci_transport_usb.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; name = hci_transport_usb.c; path = src/hci_transport_usb.c; sourceTree = "<group>"; };
9C46FC340FA906F700ABEF05 /* hci.c */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.c; name = hci.c; path = src/hci.c; sourceTree = "<group>"; };
9C46FC350FA906F700ABEF05 /* hci.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = hci.h; path = src/hci.h; sourceTree = "<group>"; };
@ -98,6 +97,8 @@
9CEB4B7F10715EB000DD5720 /* hci_cmds.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = hci_cmds.h; path = include/btstack/hci_cmds.h; sourceTree = "<group>"; };
9CEB4B8010715EB000DD5720 /* linked_list.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = linked_list.h; path = include/btstack/linked_list.h; sourceTree = "<group>"; };
9CEB4B8110715EB000DD5720 /* utils.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = utils.h; path = include/btstack/utils.h; sourceTree = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -159,7 +160,8 @@
9C00F87110191130008DAB17 /* l2cap_signaling.h */,
9C00F87210191130008DAB17 /* l2cap_signaling.c */,
9C7B5ABF100BD3340065D87E /* linked_list.c */,
9C1F0E980FDAE023008F472F /* run_loop.c */,
9CEB4DAA10753B4B00DD5720 /* run_loop_cocoa.m */,
9CEB4DAC10753BE600DD5720 /* run_loop_posix.c */,
9C00F7301017ACC3008DAB17 /* socket_connection.c */,
9C00F7311017ACC3008DAB17 /* socket_connection.h */,
9C00F86210191097008DAB17 /* utils.c */,
@ -308,7 +310,6 @@
9C88500E0FBF6702004980E4 /* l2cap.c in Sources */,
9C7ECB840FCC85650085DAC5 /* bt_control_iphone.c in Sources */,
9C7ECBB50FCC95DD0085DAC5 /* hci_dump.c in Sources */,
9C1F0E9A0FDAE023008F472F /* run_loop.c in Sources */,
9CC813A20FFC0774002816F9 /* btstack.c in Sources */,
9CC813A50FFC0A51002816F9 /* daemon.c in Sources */,
9C2071F310014D3200A07EA4 /* hci_transport_usb.c in Sources */,
@ -319,6 +320,8 @@
9C00F87410191130008DAB17 /* l2cap_signaling.c in Sources */,
9CCE6CEA1025BD0000FCE9F4 /* hci.c in Sources */,
9C77E79210667F0600F39DCF /* platform_iphone.c in Sources */,
9CEB4DAB10753B4B00DD5720 /* run_loop_cocoa.m in Sources */,
9CEB4DAD10753BE600DD5720 /* run_loop_posix.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -329,7 +332,6 @@
9C7B5D01100FC9AE0065D87E /* btstack.c in Sources */,
9C7B5D03100FC9BB0065D87E /* test.c in Sources */,
9C7B5D0D100FC9CE0065D87E /* linked_list.c in Sources */,
9C7B5D0E100FC9D00065D87E /* run_loop.c in Sources */,
9C00F7D81019082F008DAB17 /* hci_cmds.c in Sources */,
9C00F86410191097008DAB17 /* utils.c in Sources */,
9C05FC971020D3F300255261 /* socket_connection.c in Sources */,

View File

@ -5,7 +5,7 @@ prefix = @prefix@
springboard_access_sources = @SPRINGBOARD_ACCESS_SOURCES@
libBTstack_SOURCES = btstack.c hci_cmds.c linked_list.c run_loop.c socket_connection.c utils.c
libBTstack_SOURCES = btstack.c hci_cmds.c linked_list.c run_loop_posix.c socket_connection.c utils.c
BTdaemon_SOURCES = $(libBTstack_SOURCES) \
bt_control_iphone.c \

50
src/run_loop_cocoa.m Normal file
View File

@ -0,0 +1,50 @@
/*
* run_loop_cocoa.c
*
* Created by Matthias Ringwald on 8/2/09.
*/
#include <btstack/btstack.h>
#import <Foundation/Foundation.h>
#import <CoreFoundation/CoreFoundation.h>
static void socketDataCallback (
CFSocketRef s,
CFSocketCallBackType callbackType,
CFDataRef address,
const void *data,
void *info)
{
data_source_t *ds = (data_source_t *) info;
ds->process(ds);
}
void run_loop_add_data_source(data_source_t *dataSource){
// add fd as CF "socket"
// store our dataSource in socket context
CFSocketContext socketContext;
bzero(&socketContext, sizeof(CFSocketContext));
socketContext.info = dataSource;
// create CFSocket from file descriptor
CFSocketRef socket = CFSocketCreateWithNative (
kCFAllocatorDefault,
dataSource->fd,
kCFSocketReadCallBack,
socketDataCallback,
&socketContext
);
// create run loop source and add to run loop
CFRunLoopSourceRef socketRunLoop = CFSocketCreateRunLoopSource ( kCFAllocatorDefault, socket, 0);
CFRunLoopAddSource( CFRunLoopGetCurrent(), socketRunLoop, kCFRunLoopDefaultMode);
}
int run_loop_remove_data_source(data_source_t *dataSource){
// not needed yet
return 0;
}