Please nominate your Qt Champions for 2021! https://forum.qt.io/topic/132134/looking-for-the-2021-qt-champions

how to read bluetooth low energy value



  • hello
    i am trying to read bluetooth low energy value for a temperature sensor
    but i have the following questions

    when i studied the heartrate-game example it uses the following to get the updated value from notification

    connect(m_service, &QLowEnergyService::characteristicChanged, this, &DeviceHandler::updateHeartRateValue);
    
    void DeviceHandler::updateHeartRateValue(const QLowEnergyCharacteristic &c, const QByteArray &value)
       auto data = reinterpret_cast<const quint8 *>(value.constData());
       quint8 flags = *data;
       qDebug() << "Data Byte" << &value ;
    
    
    but the low energy scanner example uses 
       qDebug() << "c.value " << c.value().toHex();
    

    my first question:
    what is the difference between value and c.value.hex ?

    when i print them i get the following

    c.value "00c70f00fe"
    Data Byte 0x282855280

    c.value "00d10f00fe"
    Data Byte 0x282848bf0

    c.value "00db0f00fe"
    Data Byte 0x282848660

    c.value "00e50f00fe"
    Data Byte 0x282848c30

    c.value "00ef0f00fe"
    Data Byte 0x282848bf0

    c.value "00f90f00fe"
    Data Byte 0x282848370

    which one is what ?



  • i found the solution, they should be the same, now i can see it. it was printing the adress.

    qDebug() << "Data Byte" << value.toHex() ;
    


  • i found the solution, they should be the same, now i can see it. it was printing the adress.

    qDebug() << "Data Byte" << value.toHex() ;
    

  • Banned

    This post is deleted!

Log in to reply