ArthurGuy, I looked at the BLEmini sketch you used as a model and I am a bit confused. If I understand correctly, data from the BLEmini is structured with the first three bytes defining "type, “event_code” and “data_len”. The remainder of the message is of length “data_len” so the entire message can be received and processed. The arduino sample sketch is very structured and “synchronous” processing entire messages and their even_codes.
It seems to me that waiting on the first three bytes with a proper timeout is enough to tell you if a device is available or not. On top of that, the received “event_code” seems to come as a response to a discovery request being sent to the BLEmini. Again, a timeout will tell you if a device is there or not. So I am not sure how your detectDevice() function is supposed to work. Everything you need is already in the arduino libraries.