I want to let my Intel Edison act as a beacon and have discoverable mode on all the time. I edited the file "/etc/bluetooth/main.conf" and changed the line "DiscoverableTimeout = 0". This way, it will always stay in discoverable mode, when enabled in "bluetoothctl".
My problem is that sometimes I cannot discover the module, I can discover other beacons/BLE components easily, but the Edison emits the BLE signal seldom.
I am using an Android phone to discover the components.
Is there any way to increase the frequency the Edison module emits its signal? Or make it more robust?
I'll try to help you with this behavior. I just tested what you mentioned on my Edison (modified /etc/bluetooth/main.conf). I'm not able to replicate the issue on my board, on all my tests the board appeared visible, I even left my Edison still for a few hour and when I came back it was still working as expected.
I'm currently using the latest image (which can be found in https://software.intel.com/en-us/iot/hardware/edison/downloads). So, I suggest you to reflash your board, this might help fix any minor software issue that could be causing this.
Let me know if this helps you.
Using "uname -a", I got the following: Linux edison 3.10.98-poky-edison+ # 1 SMP PREEMPT Mon Jun 6 14:32:08 PDT 2016 i686 GNU/Linux
I think this is pretty recent right? Which one do you have? I re-flashed it quite recently.
How did you check the discovering? Maybe I can replicate your behavior, then I will know it is not the board that is at fault, but my other discovery code.
I am using my Android phone to discover devices, using the bluetooth manager in a custom app. I can find other beacons or other bluetooth devices in general with ease, but the Edison module is a bit slow to appear, if it even appears.
It would be great if you could post or direct me to any other tests that you successfully completed.
I believe I'm using the same image, you can verify it with the command cat /etc/version, you should see the output 201606061707.
The way I checked that the board was always visible was with my PC (running Windows 7). Every time I checked I found my Edison (called Peter, as you can see in the screenshot below) without issues. Could you try to verify it with this method? Maybe the issue is caused by Android when trying to find it.
Let me know.
We are running the same build.
Are you sure it is not cached? I tried the same thing on my Ubuntu machine and it was cached, even when I removed the device.
Anyway, as you have seen, it works to find the device. Did you however notice that it took some time, that it found other bluetooth devices faster? The problem in my Android app is that it does find the Edison sometimes, but then it cannot find it again. On my machine it was slow to be discovered. Other devices came up almost instantly. I am thinking maybe the bluetooth integration in Android (which I think uses bluez deep as the underlying system) does not find the Edison module because it emits its signal unfrequently.
Does this sound like gibberish to you?
I did some tests to verify whether or not the Edison's Bluetooth interface was being cached. So, I tried disabling/enabling the Bluetooth interface (with the commands rfkill unblock bluetooth and rfkill block bluetooth). When I disabled it, the PC lasted ~15 seconds to notice that the device was not available any more. But when I enabled it, the Edison was found again in ~5 seconds. I did not notice any difference in the time the PC lasted to find other devices and the time it lasted to find my Edison. I believe this is the expected operation.
I'm not sure what might be affecting your Edison but reflashing it could help. Also, I used an external power supply on all my tests, this could also affect the behavior of Edison's Bluetooth as the board requires more power to operate when it uses this interface. You could also try this to see if you notice any difference.
Let me know what happens.
I tried to turn on and off the discoverable settings in "bluetoothctl". As you said, it was cached, but then got removed. It took me around 15 seconds as well to get it to be removed. However, when I turned on discoverable ("discoverable on"), it took me up to 10-15 seconds to find it. Not sure why it takes that long. Anyway, now I know this and will configure my app to increase discovery time. I might dig deeper into this later, but for now I will focus on other things.
Thanks for your help!