]> git.saurik.com Git - winterboard.git/blob - DevEngine.mm
Fixed naming.
[winterboard.git] / DevEngine.mm
1 #include <unistd.h>
2 #include <fcntl.h>
3
4 #import <Foundation/Foundation.h>
5 #import <BluetoothManager/BluetoothManager.h>
6 #import <SpringBoard/SBBluetoothController.h>
7
8 static unsigned connectedDevices_;
9
10 @interface SBBluetoothController (_WinterBoard)
11 - (void) wb_noteDevicesChanged;
12 @end
13
14 @implementation SBBluetoothController (WinterBoard)
15
16 - (void) noteDevicesChanged {
17 if (NSArray *devices = [[BluetoothManager sharedInstance] pairedDevices]) {
18 connectedDevices_ = 0;
19 for (int i = 0, e = [devices count]; i != e; ++i)
20 if ([[devices objectAtIndex:i] connected])
21 ++connectedDevices_;
22 if (connectedDevices_ == 0)
23 unlink("/tmp/neuter");
24 else
25 close(open("/tmp/neuter", O_CREAT | O_TRUNC | O_WRONLY, 644));
26 }
27
28 [self wb_noteDevicesChanged];
29 }
30
31 @end