Sometimes BT devices need some time to wake up and will not respond to the
fist query. I had to patch Proximity (even previous versions) like below to
make out of range detection more reliable.
Index: reduxcomputing-proximity-read-only/AppController.m
===================================================================
--- reduxcomputing-proximity-read-only/AppController.m (revision 22)
+++ reduxcomputing-proximity-read-only/AppController.m (working copy)
@@ -1,6 +1,6 @@
#import "AppController.h"
+#include
-
@implementation AppController
@@ -91,9 +91,12 @@
- (BOOL)isInRange
{
- if( device && [device remoteNameRequest:nil] == kIOReturnSuccess )
- return true;
-
+ int repeat_count = 3;
+ do {
+ if( device && [device remoteNameRequest:nil] == kIOReturnSuccess )
+ return true;
+ usleep(500000L);
+ } while(--repeat_count);
return false;
}
Sometimes BT devices need some time to wake up and will not respond to the
fist query. I had to patch Proximity (even previous versions) like below to
make out of range detection more reliable.
Index: reduxcomputing-proximity-read-only/AppController.m =================================================================== --- reduxcomputing-proximity-read-only/AppController.m (revision 22) +++ reduxcomputing-proximity-read-only/AppController.m (working copy) @@ -1,6 +1,6 @@ #import "AppController.h" +#include - @implementation AppController @@ -91,9 +91,12 @@ - (BOOL)isInRange { - if( device && [device remoteNameRequest:nil] == kIOReturnSuccess ) - return true; - + int repeat_count = 3; + do { + if( device && [device remoteNameRequest:nil] == kIOReturnSuccess ) + return true; + usleep(500000L); + } while(--repeat_count); return false; }