Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] QByteArray and AT Commands
Qt 6.11 is out! See what's new in the release blog

[SOLVED] QByteArray and AT Commands

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 2.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.
  • X Offline
    X Offline
    xeroblast
    wrote on last edited by
    #1

    anybody in here how to put the AT-Commands to QByteArray?

    for example:
    AT+CMGL="ALL" to QByteArray?
    or
    AT+CMGS=*0000000#<CR>Hello World<Ctrl+Z> to QByteArray? where <CR> is carriage return/Enter button and <Ctrl+Z> is Ctrl button and Z buton.

    thanks a lot.

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      Hi, create a QString, then use the .toAscii on it, it will be a const data * return, you can insert that into the QByteArray.
      @QbyteArray AT_Command = QString("AT+CMGL="ALL"").toAscii()@
      the \ needed to have the " character included in the QString
      .
      Have fun!!

      Greetz, Jeroen

      1 Reply Last reply
      0
      • X Offline
        X Offline
        xeroblast
        wrote on last edited by
        #3

        thanks for the reply but how about something that has carriage return or Ctrl+Z?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,
          I would say (not tested though)
          @
          QByteArray cmd("AT+CMGL="ALL"");
          QByteArray cmd("AT+CMGS=*0000000#\rHello World\x1A");
          @

          You see the other control character in the"ASCII table":http://en.wikipedia.org/wiki/ASCII#ASCII_control_code_chart

          Hope it helps

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • X Offline
            X Offline
            xeroblast
            wrote on last edited by
            #5

            thanks. i will try.

            1 Reply Last reply
            0
            • X Offline
              X Offline
              xeroblast
              wrote on last edited by
              #6

              it really works.. thanks a lot..

              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