diff --git a/TODO.txt b/TODO.txt index e3e66bb01..62f82b4b5 100644 --- a/TODO.txt +++ b/TODO.txt @@ -3,18 +3,20 @@ Last milestone reached: Restart client app without restarting BTdaemon possible NEXT: -- iPhone status icon support - - set BTstack SpringBoard icon - client/server part using unix domain sockets (faster than TCP/IP) - autostart by launchd - Unix Socket example Mac: http://lists.apple.com/archives/Macnetworkprog/2007/Oct/msg00078.html - Mac OS X book: 472-485 - check with launchd, too? - - launch.h exists in 3.0 SDK, but also in inofficial headers before + - launch.h exists in 3.0 SDK, but also in inofficial headers before - socket handling using kevent - - exists too. - - too complicated + - exists too. + - too complicated - stop BTdaemon after X minutes idle +- iPhone status icon support + - set BTstack SpringBoard icon from background deamon + - possible without MobileSubstrate + - MobileSubstrate used by veency - extend hci_logger to write to /var/hci_dump.txt as text - better deal with Apple stack - detect that it is running diff --git a/configure.in b/configure.in index 80cd10d91..78231beb5 100644 --- a/configure.in +++ b/configure.in @@ -72,14 +72,15 @@ if test "x$target" = xiphone; then echo "Cross-compiling for iPhone/iPod touch using Apple's iPhone SDK" echo "iPhone IP for install-iphone target: $IPHONE_IP" CC="$DEVELOPER_PATH/usr/bin/arm-apple-darwin9-gcc-$GCC_VERSION" - OBJC="$DEVELOPER_PATH/usr/bin/arm-apple-darwin9-gcc-$GCC_VERSION" + OBJC="$DEVELOPER_PATH/usr/bin/arm-apple-darwin9-g++-$GCC_VERSION" CFLAGS="$CFLAGS -g" - CFLAGS="$CFLAGS -I$SDK_PATH/usr/include" - CFLAGS="$CFLAGS -I$SDK_PATH/usr/lib/gcc/arm-apple-darwin9/$GCC_VERSION/include" - CFLAGS="$CFLAGS -F$SDK_PATH/System/Library/Frameworks" - LDFLAGS="$LDFLAGS -L$SDK_PATH/usr/lib -framework CoreFoundation" + CPPFLAGS="$CPPFLAGS -I$SDK_PATH/usr/include" + CPPFLAGS="$CPPFLAGS -I$SDK_PATH/usr/lib/gcc/arm-apple-darwin9/$GCC_VERSION/include" + CPPFLAGS="$CPPFLAGS -F$SDK_PATH/System/Library/Frameworks" + LDFLAGS="$LDFLAGS -F$SDK_PATH/System/Library/Frameworks" + LDFLAGS="$LDFLAGS -L$SDK_PATH/usr/lib -framework CoreFoundation -framework UIKit" LDFLAGS="$LDFLAGS -L$SDK_PATH/System/Library/Frameworks/IOKit.framework/Versions/A" - LDFLAGS="$LDFLAGS -lIOkit" + LDFLAGS="$LDFLAGS -lIOkit -lobjc" ;; *) AC_MSG_ERROR(Don't know how to compile without Apple's iPhone SDK, sorry.) diff --git a/project.xcodeproj/project.pbxproj b/project.xcodeproj/project.pbxproj index 47a1ad624..87b6d4ebd 100644 --- a/project.xcodeproj/project.pbxproj +++ b/project.xcodeproj/project.pbxproj @@ -63,6 +63,10 @@ 9C46FC380FA906F700ABEF05 /* hci_transport.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = hci_transport.h; path = src/hci_transport.h; sourceTree = ""; }; 9C6459DE1037554B0081A00B /* platform_iphone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = platform_iphone.h; path = src/platform_iphone.h; sourceTree = ""; }; 9C6459DF1037554B0081A00B /* platform_iphone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = platform_iphone.m; path = src/platform_iphone.m; sourceTree = ""; }; + 9C78A04A103C6734003B2950 /* Default_BTstack.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default_BTstack.png; path = resources/Default_BTstack.png; sourceTree = ""; }; + 9C78A04B103C6734003B2950 /* Default_BTstackActive.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default_BTstackActive.png; path = resources/Default_BTstackActive.png; sourceTree = ""; }; + 9C78A04C103C6734003B2950 /* FSO_BTstack.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FSO_BTstack.png; path = resources/FSO_BTstack.png; sourceTree = ""; }; + 9C78A04D103C6734003B2950 /* FSO_BTstackActive.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FSO_BTstackActive.png; path = resources/FSO_BTstackActive.png; sourceTree = ""; }; 9C7B5ABE100BD3340065D87E /* linked_list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = linked_list.h; path = src/linked_list.h; sourceTree = ""; }; 9C7B5ABF100BD3340065D87E /* linked_list.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = linked_list.c; path = src/linked_list.c; sourceTree = ""; }; 9C7B5B7E100D04450065D87E /* test.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = test.c; path = example/test.c; sourceTree = ""; }; @@ -103,6 +107,7 @@ 08FB7794FE84155DC02AAC07 /* project */ = { isa = PBXGroup; children = ( + 9C78A049103C671D003B2950 /* Resources */, 9C7B5B81100D04520065D87E /* Example */, 08FB7795FE84155DC02AAC07 /* Source */, C6A0FF2B0290797F04C91782 /* Documentation */, @@ -161,6 +166,17 @@ name = Products; sourceTree = ""; }; + 9C78A049103C671D003B2950 /* Resources */ = { + isa = PBXGroup; + children = ( + 9C78A04A103C6734003B2950 /* Default_BTstack.png */, + 9C78A04B103C6734003B2950 /* Default_BTstackActive.png */, + 9C78A04C103C6734003B2950 /* FSO_BTstack.png */, + 9C78A04D103C6734003B2950 /* FSO_BTstackActive.png */, + ); + name = Resources; + sourceTree = ""; + }; 9C7B5B81100D04520065D87E /* Example */ = { isa = PBXGroup; children = ( diff --git a/src/Makefile.am b/src/Makefile.am index 837560c89..0f4f7c868 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,7 +14,7 @@ BTdaemon_SOURCES = \ $(usb_support) \ l2cap.c \ l2cap_signaling.c \ - platform_iphone \ + platform_iphone.m \ linked_list.c \ run_loop.c \ socket_connection.c \ diff --git a/src/daemon.c b/src/daemon.c index 8f9aca22c..599f2cd3a 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -203,6 +203,8 @@ int main (int argc, const char * argv[]){ // handle CTRL-c signal(SIGINT, daemon_sigint_handler); + + bluetooth_status_handler(BLUETOOTH_ACTIVE); // go! run_loop_execute(); diff --git a/src/platform_iphone.m b/src/platform_iphone.m index f29b809e2..0727fa67d 100644 --- a/src/platform_iphone.m +++ b/src/platform_iphone.m @@ -6,8 +6,26 @@ #import "platform_iphone.h" +#ifdef __OBJC__ +#import +#import +#endif + +@interface UIApplication (privateStatusBarIconAPI) +- (void)addStatusBarImageNamed:(id)fp8 removeOnAbnormalExit:(BOOL)fp12; +- (void)addStatusBarImageNamed:(id)fp8; +- (void)removeStatusBarImageNamed:(id)fp8; +// iPhoneOS >= 2.2 +- (void)addStatusBarImageNamed:(id)fp8 removeOnExit:(BOOL)fp12; +@end + // update SpringBoard icon void platform_iphone_status_handler(BLUETOOTH_STATE state){ + printf("iphone state %u\n", state); + UIApplication *theApp = [UIApplication sharedApplication]; + printf("the app %u\n", (int) theApp); + [theApp addStatusBarImageNamed:@"BluetoothActive"]; + switch (state) { case BLUETOOTH_OFF: break;