Please nominate your Qt Champions for 2021!

Qt Quick QML Bluetooth StringData Empty

  • Hi guys,

    For now I'm trying to make my phone communicate with my Arduino through bluetooth. I got my phone paired and I successfully connected to my device. However for some reason stringData is giving me an empty string. The event 'onDataAvailable' is triggered and the console is responding but with nothing.

    Did anyone managed to solve this problem?

  • Hi! Are you talking about BluetoothSocket QML Type? To which QML type does onDataAvailable belong to?

  • @Wieland

    Hi Wieland,

    Thanks a lot for your reply.

    Yes I am talking about BluetoothSocket QML Type.

     onDataAvailable: {

    onStringDataChanged: {
    var dataset = socket.stringData;

    both returning empty and both belongs to bluetoothSocket

  • @Wieland

    This is my code

    //----------- BLUETOOTH CONNECTIONS -----------------

    BluetoothDiscoveryModel {
        id: btmodel
        running: true
        remoteAddress: '00:06:66:7D:8F:D9'
        onServiceDiscovered: {
            if (serviceFound)
            serviceFound = true
            service.serviceProtocol = BluetoothService.RfcommProtocol
            console.log("Found new service, Device Address: "+service.deviceAddress + ", Protocol Name: " + service.serviceProtocol + ", Service Name: " + service.serviceName);
    BluetoothSocket {
        id: socket
        connected: true
        onSocketStateChanged: {
            if (BluetoothSocket.Connecting)
        onErrorChanged: {
            if (error == BluetoothSocket.NoError)
            if (error == BluetoothSocket.ServiceNotFoundError)
            console.log("Service Not Found");
        onConnectedChanged: {
            //console.log("SERVER Connected: " + connected);
            if(connected) {
                 console.log("SERVER Connected: " + connected);
            else {
                console.log("SERVER not Connected: " + connected);
         onDataAvailable: {
              // console.log(socket.stringData)
        onStringDataChanged: {
            var dataset = socket.stringData;

  • Also seeing the same issue. Were you able to solve so far @sebpeterkasi ?

  • @7bitbyte for anybody who has this problem: try sending 0x0A (LF) in your packet
    for example: 0xA text
    also I have problem with receiving numbers more than 7f(127) which is maximum in utf8

Log in to reply