Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Unable to receive huge data from Peripheral in BLE transfer, with QT 5.14 on Ubuntu 18.04



  • Brief: When receive large data in various chunk. SIGNAL QLowEnergyService::characteristicChanged is not emitting after receiving few chunks of data. Therefore, i am unable to receive full data. Following is the details:

    Scenario:
    Central and Peripheral case [I am looking after central code].
    Peripheral is an IOS/Android based mobile device.
    Central is a Linux Laptop. [Bluetooth HCI version 4.2]
    Central has subscribed a Characteristic (Property: Notify) of Peripheral.
    Total size of data to be transfer is 171520 bytes(approx) from Peripheral.
    Data Packet size is 91 [1 byte of Header, 90 bytes of Data].

    Facing Issue:
    Peripheral is updating its characteristic with small data.
    Central is receiving the data packets.
    So after receiving few data packets (sometimes 30, 50 or 100) from Peripheral,
    Client is not receiving all the data packets from it.

    Problem in QT:

    	/*-------------------------------------
    	          CLIENT SIDE CODE SNIPPET
    	 --------------------------------------*/
    
    	/*
    	 *  Device: a Class, which handles BLE communication.
    	 *  m_service: is pointer of type QLowEnergyService
    	 */
    --> connect(m_service, &QLowEnergyService::characteristicChanged, this, &Device::CharatValueUpdated);
    
    
    	/*
    	 *  This function gets called when, Peripheral sends data
    	 */
    --> void Device::CharatValueUpdated(const QLowEnergyCharacteristic &c, const QByteArray &value)
    	{
    		// Do nothing to avoid overhead
    		// ...................
    		// ...................
    	}
    		  
    fn CharatValueUpdated( QLowEnergyCharacteristic&, QByteArray& ) 
    is my callback/slot function, 
    when Peripheral updates its Characteristic, this function gets called 
    and client receives the updated data in parameter "value".
    

    ISSUE: after getting called for few times, fn "CharatValueUpdated()" does not get called.
    its upto QT which calls this fn, when it receives data from peripheral side.

       The "QLowEnergyService::characteristicChanged" signal triggers randomly sometime 30 or 50 or 150,
       and suddenly stop emmiting this signal without complete data transfer.	   
    

    Note: The same source code works fine on QT Windows 10.


Log in to reply