Android Question Error writing Bluetooth Manager_DataAvailable

Nicolás Cieri

Active Member
Licensed User
Please help, always that i want to write in "b4a" i get the same error...

at anywheresoftware.b4a.objects.BleManager2.WriteData(BleManager2.java:377)

In b4i everything Works Good.

Any idea? Thanks

B4X:
#IF B4A
Sub Manager_DataAvailable (Service As String, Characteristics As Map)
    Try
        'ActivityIndicator2.Visible = False
        'clv.Add(CreateServiceItem(Service), "")
        Dim Chrt As String=""
        For Each id As String In Characteristics.Keys
            LogColor(id,Colors.Magenta)
            'clv.Add(CreateCharacteristicItem(id, Characteristics.Get(id)), "")
            Log( bc.HexFromBytes( Characteristics.Get(id) ) )
            If Chrt="" Then    Chrt=id
        Next
        Dim fm As String = ""
        
        'fm = StringToHex("Hola")
        
        fm = fm & "0D0A"
        Dim Data() As Byte = bc.HexToBytes(fm)
        
        manager.WriteData(Service,Chrt,Data)   
    
        'Sleep(1000)
        
        manager.Disconnect
        manager.StopScan
        bluetoothBtn.Enabled=True
    Catch
        Log(LastException)
        manager.Disconnect
    End Try
End Sub

#End If
 

Nicolás Cieri

Active Member
Licensed User
Please look the attached image.
 

Attachments

  • WhatsApp Image 2022-12-13 at 13.17.10.jpeg
    WhatsApp Image 2022-12-13 at 13.17.10.jpeg
    235.2 KB · Views: 93
Upvote 0

Nicolás Cieri

Active Member
Licensed User
I have tried with a data less than 20, I tried with 5 bytes to test and I get the same error.

at anywheresoftware.b4a.objects.BleManager2.WriteData(BleManager2.java:377)
 
Upvote 0
Top