techknight Well-Known Member Licensed User Longtime User Jun 27, 2016 #1 Is there a way to retrieve the signal strength/meter of a bluetooth device? Or an active connection? Like Wi-Fi? that would be awesome.
Is there a way to retrieve the signal strength/meter of a bluetooth device? Or an active connection? Like Wi-Fi? that would be awesome.
Erel B4X founder Staff member Licensed User Longtime User Jun 28, 2016 #2 You can find the signal strength (RSSI) while discovering devices: https://www.b4x.com/android/forum/threads/bluetooth-rssi-signal-strenth.43019/#post-261068 Upvote 0
You can find the signal strength (RSSI) while discovering devices: https://www.b4x.com/android/forum/threads/bluetooth-rssi-signal-strenth.43019/#post-261068
techknight Well-Known Member Licensed User Longtime User Jun 28, 2016 #3 Ok, great! However is there anyway to monitor this on the active connection, to let me know I am getting too far away, etc.. While connected? That would be awesome. Also, What is the math of taking the RSSI value and converting it into a bargraph/progressbar? Upvote 0
Ok, great! However is there anyway to monitor this on the active connection, to let me know I am getting too far away, etc.. While connected? That would be awesome. Also, What is the math of taking the RSSI value and converting it into a bargraph/progressbar?
Erel B4X founder Staff member Licensed User Longtime User Jun 28, 2016 #4 techknight said: However is there anyway to monitor this on the active connection, to let me know I am getting too far away, etc.. While connected? Click to expand... The only way is to search for devices. Note that AStream_Error or Terminated events will be raised when the connection breaks. techknight said: Also, What is the math of taking the RSSI value and converting it into a bargraph/progressbar? Click to expand... Not sure that I understand. Maybe this will be helpful: http://www.speedguide.net/faq/how-does-rssi-dbm-relate-to-signal-quality-percent-439 Upvote 0
techknight said: However is there anyway to monitor this on the active connection, to let me know I am getting too far away, etc.. While connected? Click to expand... The only way is to search for devices. Note that AStream_Error or Terminated events will be raised when the connection breaks. techknight said: Also, What is the math of taking the RSSI value and converting it into a bargraph/progressbar? Click to expand... Not sure that I understand. Maybe this will be helpful: http://www.speedguide.net/faq/how-does-rssi-dbm-relate-to-signal-quality-percent-439
techknight Well-Known Member Licensed User Longtime User Jun 28, 2016 #5 Basically I want to show the RSSI value as a level bar, The lower the level the worse the signal is. Of course. So I need to figure out the math for RSSI to level bar. Anyways, Does this RSSI code report the MAC address of the adapter in question? Otherwise how do I match up an RSSI value to a particular device? I brought up an older thread you pointed me to, but all I got was a response of it being an old thread. Was trying to avoid double-posting, when there was already a relevant thread. thanks. Upvote 0
Basically I want to show the RSSI value as a level bar, The lower the level the worse the signal is. Of course. So I need to figure out the math for RSSI to level bar. Anyways, Does this RSSI code report the MAC address of the adapter in question? Otherwise how do I match up an RSSI value to a particular device? I brought up an older thread you pointed me to, but all I got was a response of it being an old thread. Was trying to avoid double-posting, when there was already a relevant thread. thanks.
Erel B4X founder Staff member Licensed User Longtime User Jun 28, 2016 #6 Once you got the intent you can get the mac address with: Code: Copy Dim jo As JavaObject = Intent Dim bluetoothDevice As JavaObject = jo.RunMethod("getParcelableExtra", Array("android.bluetooth.device.extra.DEVICE")) Dim mac As String = bluetoothDevice.RunMethod("getAddress", Null) Upvote 0
Once you got the intent you can get the mac address with: Code: Copy Dim jo As JavaObject = Intent Dim bluetoothDevice As JavaObject = jo.RunMethod("getParcelableExtra", Array("android.bluetooth.device.extra.DEVICE")) Dim mac As String = bluetoothDevice.RunMethod("getAddress", Null)
techknight Well-Known Member Licensed User Longtime User Jun 28, 2016 #7 Undeclared variable Intent? Upvote 0
techknight Well-Known Member Licensed User Longtime User Jun 28, 2016 #8 I figured it out. Used StartingIntent instead of Intent But I noticed the Service will fire whether the app is open or not, so if I am using a different program to discover bluetooth, my service fires. anyway to only allow the service to fire when App is open only? Upvote 0
I figured it out. Used StartingIntent instead of Intent But I noticed the Service will fire whether the app is open or not, so if I am using a different program to discover bluetooth, my service fires. anyway to only allow the service to fire when App is open only?
Erel B4X founder Staff member Licensed User Longtime User Jun 29, 2016 #9 techknight said: anyway to only allow the service to fire when App is open only? Click to expand... You can check in Service_Start whether all the activities are paused (IsPaused) and if yes do nothing. Another option is to switch to a dynamic intent filter with the BroadcastReciever library. Upvote 0
techknight said: anyway to only allow the service to fire when App is open only? Click to expand... You can check in Service_Start whether all the activities are paused (IsPaused) and if yes do nothing. Another option is to switch to a dynamic intent filter with the BroadcastReciever library.