Skip to content

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

@revned

Description

@revned

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;
 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions