Android Question external library initialization error

Pesciolina

Active Member
Licensed User
good morning, I am trying to read a library of a Caen / Datalogic RFID reader that I attach, as soon as I initialize the library I get the error that I attach
B4X:
#Region Module Attributes
    #FullScreen: False
    #IncludeTitle: True
    #ApplicationLabel: Bluetooth-Caen
    #VersionCode: 1
    #VersionName:
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#AdditionalJar: CAENRFIDLibrary-release.aar

Sub Process_Globals
    Dim admin As BluetoothAdmin
    Dim serial1 As Serial
    Dim foundDevices As List
    Type NameAndMac (Name As String, Mac As String)
    Dim connectedDevice As NameAndMac
    
End Sub

Sub Globals
    Dim btnSearchForDevices As Button
    Dim btnAllowConnection As Button
    
    Dim connection, ctxt, m_port As JavaObject
    
End Sub

Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then
        admin.Initialize("admin")
        serial1.Initialize("serial1")
    End If
    Activity.LoadLayout("1")
    
    IniziazilizzaRFID
        
End Sub

Sub IniziazilizzaRFID()
    
    ctxt = GetContext
    connection.InitializeStatic("com.caen.CAENRFIDLibrary")   
    m_port = connection.RunMethodJO("Connect", Array("BluetoothSocket" ,"00001101-0000-1000-8000-00805F9B34FB"))
    
End Sub

1584704792515.png

thanks for collaboration
Marco
 

Attachments

  • CAENRFIDLibrary-release.zip
    172.9 KB · Views: 168

stevel05

Expert
Licensed User
Longtime User
What code are you trying to implement? The first example in the API manual does not initialize the static library in this manner.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
It's going to be impossible to convert the code without the reader as I can't test it but this may get you started.

B4X:
    Dim MyReader As JavaObject

    Dim CAENRFIDPort As JavaObject

    CAENRFIDPort.InitializeStatic("com.caen.RFIDLibrary.CAENRFIDPort")

    MyReader.InitializeNewInstance("com.caen.RFIDLibrary.CAENRFIDReader",Null)

    MyReader.RunMethod("Connect",Array(CAENRFIDPort.GetField("CAENRFID_RS232"),"COM3"))

    Dim MySource As JavaObject = MyReader.RunMethod("GetSource",Array("Source_0"))

I can only run it as far as the connect call without a reader.

You will have to work out what is returned from the call to Mysource.InventoryTag you may be able to store it as an array of JavaObjects.

Then you will need to understand what the C# Bitconverter class does and rewrite it in B4a.
 
Upvote 0

Pesciolina

Active Member
Licensed User
thanks Steve,
I have to connect to the device via BT and the manual indicates that I have to make a call "createRfcommSocketToServiceRecord (UUID uuid)" to get the value of BTSOCK, I have not found anything in the forum, how should I do it?

Thanks
1584901182301.png

1584901238945.png
 
Upvote 0
Top