iOS Question DataAvailable not fired when using short UUIDs

Angel Maza

Member
Licensed User
Longtime User
Hi,

We are using iBLE library for our app. Works ok. But newer hardware devices, the uuids of service & characteristic have changed to short uuid. I've attached a screenshot.

Connection works as usual, but DataAvailable never called.

I've seen with NativeObject that the service has characteristic uuids, and the corresponding characterístic has values:

B4X:
    Dim serv As NativeObject = managerBLE.GetServiceObject( "180D")
    Log(serv)
    Log( serv.GetField("characteristics") )

<B4INativeObject: (
"<CBCharacteristic: 0x72280e0, UUID = 2A39, properties = 0x12, value = <2100f200 037f0000 0000>, notifying = NO>",
"<CBCharacteristic: 0x72285f0, UUID = A001, properties = 0x2, value = <02>, notifying = NO>",
"<CBCharacteristic: 0x7228740, UUID = A002, properties = 0xA, value = <04>, notifying = NO>",
"<CBCharacteristic: 0x72287a0, UUID = A003, properties = 0xA, value = <00>, notifying = NO>",
"<CBCharacteristic: 0x722af00, UUID = A007, properties = 0xA, value = <00>, notifying = NO>",
"<CBCharacteristic: 0x722af80, UUID = A008, properties = 0xA, value = <00>, notifying = NO>",
"<CBCharacteristic: 0x722afe0, UUID = A00A, properties = 0xA, value = <00>, notifying = NO>",
"<CBCharacteristic: 0x722b040, UUID = A00B, properties = 0xA, value = <00000000 2dfd0100 3f270f00 2c270020 0000>, notifying = NO>",
"<CBCharacteristic: 0x722b0a0, UUID = A00C, properties = 0x12, value = <00000000 00000000 00000000 00000000 0000>, notifying = NO>"
)>


B4X:
        Dim c As NativeObject = managerBLE.GetCharacteristicObject("180D", "2A39")
        Log(c)
        Log( c.GetField("value"))


<B4INativeObject: <CBCharacteristic: 0x72280e0, UUID = 2A39, properties = 0x12, value = <2100f200 037f0000 0000>, notifying = NO>>
<B4INativeObject: <2100f200 037f0000 0000>>

The only change we've seen is the short uuids instead of long uuids.

Thanks.
Best regards.
Angel.
 

Attachments

  • Screenshot_2017-06-23-08-45-14-048_no.nordicsemi.android.mcp.png
    Screenshot_2017-06-23-08-45-14-048_no.nordicsemi.android.mcp.png
    177.3 KB · Views: 170

Angel Maza

Member
Licensed User
Longtime User
Connect works ok. Event Manager_Connected fired. But Manager_DataAvailable doesn't get called when I call ReadData.
 
Upvote 0

Angel Maza

Member
Licensed User
Longtime User
B4X:
Sub ManagerBLE_Connected (services As List)


    hd.ToastMessageShow( "Connected to " & ConnectedName, False )
    ConnectedServices = services

   


    t1.Initialize("t1", 500)
    t1.Enabled = True   
    Log(services)
    'discover the descriptors
    Dim per As NativeObject = managerBLE.GetPeripheralObject
    Log( per.GetField("services") )
    Dim serv As NativeObject = managerBLE.GetServiceObject( "180D")
    Log(serv)
    Log( serv.GetField("characteristics") )
   
    For Each s As Object In ConnectedServices
       
       
        managerBLE.ReadData(s)
    Next
End Sub

Public Sub t1_tick
    'Log("tick")
    'Log(ConnectedServices)
    managerBLE.ReadData( "180D" )
    Dim serv As NativeObject = managerBLE.GetServiceObject( "180D")
   
    'Log(serv)
    Log( serv.GetField("characteristics") )
    For Each s As String In ConnectedServices
        managerBLE.ReadData(s)
        Dim c As NativeObject = managerBLE.GetCharacteristicObject(s, "2A39")
        Log(c)
        Log( c.GetField("value"))
        'Log(c.GetField("descriptors"))
    Next   
End Sub


Sub ManagerBLE_DataAvailable (Service As String, Characteristics As Map)

    Log("dataavailable")

End sub


The call to ReadData doesn't generate DataAvailable event. But the services & characteristics are in the NativeObject.
Same hardware device works ok in android. Last hardware (similar ble device) works ok in b4i with iBLE, the only change is the uuid service/characteristic changed to short (180D, 2A39).

Best regards.
 
Upvote 0

Angel Maza

Member
Licensed User
Longtime User
Sorry for the delay.

I've found what is the problem.

B4X:
Sub ManagerBLE_Connected (services As List)
    hd.ToastMessageShow( "Connected to " & ConnectedName, False )
    ConnectedServices = services
   

    t1.Initialize("t1", 8000) ' 8000ms is enough for initialization
    t1.Enabled = True   
   
    ' if enable this code, there is no detection
    ' of characteristics.
   
    'For Each s As String In ConnectedServices
        'managerBLE.ReadData(s)
    'Next
End Sub

End Sub

Public Sub t1_tick
    Log("tick")   
    For Each s As String In ConnectedServices
        managerBLE.ReadData(s)
    Next   
End Sub

If I enable the code for ReadData in the Connected (so as soon there is connection), the ReadData doesn't fire the DataAvailable. If the timer is enough for internal initialization, the code works ok and DataAvailable fired, otherwise same behaviour (doesn't launch).
 
Upvote 0
Top