Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qt Quick QML Bluetooth StringData Empty
Forum Updated to NodeBB v4.3 + New Features

Qt Quick QML Bluetooth StringData Empty

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 4 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sebpeterkasi
    wrote on last edited by A Former User
    #1

    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?

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

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

      S 2 Replies Last reply
      0
      • ? A Former User

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

        S Offline
        S Offline
        sebpeterkasi
        wrote on last edited by
        #3

        @Wieland

        Hi Wieland,

        Thanks a lot for your reply.

        Yes I am talking about BluetoothSocket QML Type.

         onDataAvailable: {
               console.log(socket.stringData)
            }
        

        or
        onStringDataChanged: {
        var dataset = socket.stringData;
        console.log(dataset)
        }

        both returning empty and both belongs to bluetoothSocket

        1 Reply Last reply
        0
        • ? A Former User

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

          S Offline
          S Offline
          sebpeterkasi
          wrote on last edited by
          #4

          @Wieland

          This is my code

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

          BluetoothDiscoveryModel {
              id: btmodel
              running: true
              remoteAddress: '00:06:66:7D:8F:D9'
          
          
          
              onServiceDiscovered: {
                  if (serviceFound)
                      return
                  serviceFound = true
                  service.serviceProtocol = BluetoothService.RfcommProtocol
                  console.log("Found new service, Device Address: "+service.deviceAddress + ", Protocol Name: " + service.serviceProtocol + ", Service Name: " + service.serviceName);
                  socket.setService(service)
              }
          
          }
          
          
          BluetoothSocket {
              id: socket
          
              connected: true
          
              onSocketStateChanged: {
                  if (BluetoothSocket.Connecting)
                      console.log("Connecting...");
                  }
          
              onErrorChanged: {
                  if (error == BluetoothSocket.NoError)
                      return;
                  if (error == BluetoothSocket.ServiceNotFoundError)
                  console.log("Service Not Found");
                  }
          
              onConnectedChanged: {
                  //console.log("SERVER Connected: " + connected);
                  if(connected) {
                       console.log("SERVER Connected: " + connected);
                      image22.source="png/BOn.png"
                  }
                  else {
                      console.log("SERVER not Connected: " + connected);
                      image22.source="png/BOff.png"
                  }
              }
          
               onDataAvailable: {
                    // console.log(socket.stringData)
                  }
          
              onStringDataChanged: {
                  var dataset = socket.stringData;
                  console.log("Data")
                  }
          }
          
          1 Reply Last reply
          0
          • 7 Offline
            7 Offline
            7bitbyte
            wrote on last edited by
            #5

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

            H 1 Reply Last reply
            0
            • 7 7bitbyte

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

              H Offline
              H Offline
              hidengach
              wrote on last edited by
              #6

              @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

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved