Android Question Characteristic problem RN4020 and BLE2

Juan Carlos López

New Member
Licensed User
Longtime User
Hello

I'm working with the RN4020 module, as host-less.
I have defined one private service with 4 characteristics.
When I list the services with the LS command with Teraterm, it lists these:

B4X:
11223344556677889900AABBCCDDEEFF
AA0203040506070809000A0B0C0D0E0F,0018,06,02
BB0203040506070809000A0B0C0D0E0F,001A,06,02
CC0203040506070809000A0B0C0D0E0F,001C,06,02
DD0203040506070809000A0B0C0D0E0F,001E,06,08

On my B4A app, I'm reading the services with this code using the BLE2 library: (from an example I have find somewhere)

B4X:
Sub ble_Connected (Services As Map)
Dim i,j As Int
If ConnectState=cstatePreConnect Then
ConnectState = cstateConnect
For i = 0 To Services.Size - 1
s = Services.GetValueAt(i)
For j = 0 To s.GetCharacteristics.Size - 1
c = s.GetCharacteristics.GetValueAt(j)
Next
Next
PrivServ = Services.GetValueAt(3)
Fabierto = PrivServ.GetCharacteristics.GetValueAt(0)
Fcerrado = PrivServ.GetCharacteristics.GetValueAt(1)
Motor = PrivServ.GetCharacteristics.GetValueAt(2)
Dispositivo = PrivServ.GetCharacteristics.GetValueAt(3)
End If
End Sub

Am I using the characteristic enumeration correctly?
How can I read each characteristic value? It seems I'm using it on the wrong way.

Thank you for your comments.

Juan Carlos.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…