created launchd plist for automatic start of BTdaemon on Mac & iPhone

This commit is contained in:
matthias.ringwald 2009-08-19 21:06:05 +00:00
parent 1c2ee57428
commit e5f8862c28
6 changed files with 45 additions and 8 deletions

View File

@ -5,5 +5,5 @@ iphone_ip=@IPHONE_IP@
install-iphone: src/BTdaemon
cp $< $<-signed
export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate ; ldid -S $<-signed
scp $<-signed root@$(iphone_ip):/var/root/BTdaemon
scp $<-signed root@$(iphone_ip):/usr/bin/BTdaemon
scp resources/ch.ringwald.BTstack.plist root@$(iphone_ip):/Library/LaunchDaemons/

View File

@ -3,15 +3,12 @@
Last milestone reached: Restart client app without restarting BTdaemon possible
NEXT:
- client/server part using unix domain sockets (faster than TCP/IP)
- autostart by launchd
- autostart by launchd: ch.ringwald.BTstack.plist
- provide SIGTERM handler
- 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
- socket handling using kevent
- exists too.
- too complicated
- stop BTdaemon after X minutes idle
- iPhone status icon support
- set BTstack SpringBoard icon from background deamon

View File

@ -67,6 +67,7 @@
9C78A04B103C6734003B2950 /* Default_BTstackActive.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default_BTstackActive.png; path = resources/Default_BTstackActive.png; sourceTree = "<group>"; };
9C78A04C103C6734003B2950 /* FSO_BTstack.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FSO_BTstack.png; path = resources/FSO_BTstack.png; sourceTree = "<group>"; };
9C78A04D103C6734003B2950 /* FSO_BTstackActive.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FSO_BTstackActive.png; path = resources/FSO_BTstackActive.png; sourceTree = "<group>"; };
9C78A0BB103C9DEE003B2950 /* ch.ringwald.BTstack.plist */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.plist.xml; name = ch.ringwald.BTstack.plist; path = resources/ch.ringwald.BTstack.plist; sourceTree = "<group>"; };
9C7B5ABE100BD3340065D87E /* linked_list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = linked_list.h; path = src/linked_list.h; sourceTree = "<group>"; };
9C7B5ABF100BD3340065D87E /* linked_list.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = linked_list.c; path = src/linked_list.c; sourceTree = "<group>"; };
9C7B5B7E100D04450065D87E /* test.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = test.c; path = example/test.c; sourceTree = "<group>"; };
@ -169,6 +170,7 @@
9C78A049103C671D003B2950 /* Resources */ = {
isa = PBXGroup;
children = (
9C78A0BB103C9DEE003B2950 /* ch.ringwald.BTstack.plist */,
9C78A04A103C6734003B2950 /* Default_BTstack.png */,
9C78A04B103C6734003B2950 /* Default_BTstackActive.png */,
9C78A04C103C6734003B2950 /* FSO_BTstack.png */,

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>ch.ringwald.BTstack</string>
<key>OnDemand</key>
<true/>
<key>Program</key>
<string>/usr/bin/BTdaemon</string>
<key>ServiceIPC</key>
<true/>
<key>ProgramArguments</key>
<array/>
<key>StandardErrorPath</key>
<string>/var/log/BTstack.log</string>
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockFamiliy</key>
<string>Unix</string>
<key>SockType</key>
<string>Stream</string>
<key>SockPathName</key>
<string>/tmp/BTstack</string>
<key>SockPathMode</key>
<integer>438</integer>
</dict>
</dict>
</dict>
</plist>

View File

@ -204,7 +204,11 @@ int main (int argc, const char * argv[]){
// handle CTRL-c
signal(SIGINT, daemon_sigint_handler);
// handle SIGTERM - suggested for launchd
signal(SIGTERM, daemon_sigint_handler);
// make stderr unbuffered
setbuf(stderr, NULL);
bluetooth_status_handler(BLUETOOTH_ACTIVE);
// go!

View File

@ -4,6 +4,8 @@
// Created by Matthias Ringwald on 8/15/09.
//
#include "../config.h"
#import "platform_iphone.h"
#ifdef USE_SPRINGBOARD