Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Proximity 'try again' a couple of times before deciding the device is out of range. #1

Open
revned opened this issue Jan 12, 2011 · 1 comment

Comments

@revned
Copy link
Owner

revned commented Jan 12, 2011

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;
 }
@Daij-Djan
Copy link

Implemented In my branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants