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. QBluetoothSocket to send bytes
Qt 6.11 is out! See what's new in the release blog

QBluetoothSocket to send bytes

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 1.9k 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.
  • T Offline
    T Offline
    Trianon
    wrote on last edited by
    #1

    I'm using QBluetoothSocket in Qt Quick on a N9 device to communicate with a SPP port/device but this device works with the 'old' 8 bits ascii characters and QBluetoothSocket in Qt Quick only accepts strings (16 bits and length).

    Is there any way I can send raw bytes, for example copy/write the bytes directly in the string variable or casting ?

    I'm a old school windows CE embedded programmer so i'm still learning QML but it's super for the graphics GUI !!

    Thanks

    1 Reply Last reply
    0
    • R Offline
      R Offline
      raja26
      wrote on last edited by
      #2

      I think you can do both, since the string can hold 16bits you will not miss any data. Be sure to convert char* to QString using any of these two methods
      @
      QString::fromAscii(*charData);
      QString str(*charData);@

      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