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. Where to define dataSending?

Where to define dataSending?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 262 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.
  • Z Offline
    Z Offline
    Zhang_Yubiao
    wrote on last edited by
    #1

    Re: BLE: sending data to device

    void BLESerialDevice::writeData(const QByteArray& data) {
    int i = 0;
    while (true) {
    dataSending = data.mid(i, 20);

        if (dataSending.isEmpty()) break;
    
        m_service->writeCharacteristic(writeCharacteristic, dataSending, QLowEnergyService::WriteWithResponse); 
    
        i += 20;
    };
    

    }

    jsulmJ 1 Reply Last reply
    0
    • Z Zhang_Yubiao

      Re: BLE: sending data to device

      void BLESerialDevice::writeData(const QByteArray& data) {
      int i = 0;
      while (true) {
      dataSending = data.mid(i, 20);

          if (dataSending.isEmpty()) break;
      
          m_service->writeCharacteristic(writeCharacteristic, dataSending, QLowEnergyService::WriteWithResponse); 
      
          i += 20;
      };
      

      }

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Zhang_Yubiao What is your exact question?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • Kent-DorfmanK Offline
        Kent-DorfmanK Offline
        Kent-Dorfman
        wrote on last edited by Kent-Dorfman
        #3

        assuming you mean "declare", then right where it is... minimize variable scope.

        If you meet the AI on the road, kill it.

        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