Android Question BeaconParser Class

Lvh

Member
Licensed User
Hi,
I am trying BeaconParser library as described in the article "[IoT] BeaconParser - Discover iBeacons and Eddystone beacons".
The application works fine, my Eddystone URL is well detected but the distance information remains fixed on "Distance: 4.9 meters". Is it because the EconParser in the BeaconParser_B4A.zip file is not up to date? (I notice that the code "Sub Manager_DeviceFound ()" is different from that of the Zip file).
I saw in the article that a new version of the BeaconParser was uploaded but where is it located?
 

Lvh

Member
Licensed User
Hi,
It is exactly this version attached to the mentioned post that I use.
I still have the same problem with either an Eddystone Beacon or with an iBeacon while with the nRF Connect application per example, I have live RSSI information in both cases.

At first, I did not pay attention that I have the following Java errors:
java.lang.RuntimeException: java.io.EOFException
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:170)
at anywheresoftware.b4a.BA$2.run(BA.java:360)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6939)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Caused by: java.io.EOFException
at java.io.DataInputStream.readByte(DataInputStream.java:77)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:335)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
... 9 more​
Are they the source of the problem?
On the other hand, I repeat that the code in the zip file
Sub Manager_DeviceFound (Name As String, Id As String, AdvertisingData As Map, RSSI As Double)
Dim beacon As Beacon = Parser.Parse(AdvertisingData, RSSI)
If beacon <> Null Then
beacons.Put(beacon.uniqueid, beacon)
CallSub(Main, "StateChanged")
End If
End Sub
is different from the one published in the post :
Sub Manager_DeviceFound (Name As String, Id As String, AdvertisingData As Map, RSSI As Double)
Dim beacon1 As Beacon = Parser.Parse(AdvertisingData, RSSI)
If beacon1 <> Null Then
'a beacon was discovered.
'find the beacon type based on the BeaconType field.
Select beacon1.BeaconType
Case Parser.TypeiBeacon
Dim ib As iBeacon = beacon1.SpecificData
Log($"iBeacon: ${ib.uuid} (${ib.major}/${ib.minor})"$)
Case Parser.TypeEddystoneUID
Dim euid As EddystoneUID = beacon1.SpecificData
lLog($"Eddystone UID: ${euid.Namespace}:${euid.Instance}"$)
Case Parser.TypeEddystoneURL
Dim eurl As EddystoneURL = beacon1.SpecificData
Log($"Eddystone URL: ${eurl.url}"$)
End Select
End If
End Sub

Do you have an idea?
Best regards.
 
Upvote 0

Lvh

Member
Licensed User
Hi again,
Sorry I forgot to let you know that I did an Log of the RSSI and I has variable data.

Regards
 
Upvote 0
Top