Open davidgyoung opened 3 years ago
The program will send the detection to STDOUT immediately after it gets a scan callback from the Bluetooth stack. This typically happens within a few milliseconds. So if you are seeing delays, this likely means the text output is buffering as it is piped to another program. Only once the buffer gets full does the output get flushed and arrive at the program reading it.
The solution really depends on your program that consumes the output. I often write consuming programs in Ruby, and I use the PTY Gem to get the output from the CLI utility. I find I get the results delivered very quickly.
@plotti asked, "I gave it a try and it works well, but the output is a bit "bursty" for 1-2 seconds i get nothing then 3-4 things at once then nothing for 1-2 seconds and so on. Is there a way i can make it return results each 0.5 seconds constantly?" -- https://gist.github.com/davidgyoung/0127ad914ea1b6b0f21a53ac3bb97ad3#gistcomment-3703360