Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-79179

QLowEnergyServiceData::addCharacteristic

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 5.13.1
    • None
    • Linux/X11

    Description

      It seems that the serviceData does not accept except 1 characteristic in one service.

       

      I tried the following code

       

       

      QLowEnergyAdvertisingData leAdd;

      leAdd.setDiscoverability(QLowEnergyAdvertisingData::DiscoverabilityGeneral);
      leAdd.setLocalName("SensorServer");
      leAdd.setIncludePowerLevel(true);

      QList<QBluetoothUuid> servicesList;

      servicesList.append(QBluetoothUuid::EnvironmentalSensing);
      leAdd.setServices(servicesList);

      QLowEnergyCharacteristicData chData, ipData;

      chData.setUuid(QBluetoothUuid::TemperatureMeasurement);
      chData.setValue(QByteArray(21,0)); //reset all the characteristic field
      chData.setValueLength(2,21); //length of the characteristic from 2 to 21 bytes - maximum character length of a characteristics
      chData.setProperties(QLowEnergyCharacteristic::WriteNoResponse | QLowEnergyCharacteristic::Write);
      const QLowEnergyDescriptorData descriptorData(QBluetoothUuid::ClientCharacteristicConfiguration, QByteArray(2, 0));
      chData.addDescriptor(descriptorData);

      ipData.setUuid(QBluetoothUuid::GlucoseMeasurement);

      ipData.setValue(QByteArray(21,0)); //reset all the characteristic field
      ipData.setValueLength(2,21); //length of the characteristic from 2 to 21 bytes - maximum character length of a characteristics
      ipData.setProperties(QLowEnergyCharacteristic::Read);
      const QLowEnergyDescriptorData ipdescriptorData(QBluetoothUuid::ClientCharacteristicConfiguration, QByteArray(2, 0));
      ipData.addDescriptor(ipdescriptorData);

      QLowEnergyServiceData serviceData;
      serviceData.setUuid(QBluetoothUuid::Temperature);
      serviceData.setType(QLowEnergyServiceData::ServiceTypePrimary);
      serviceData.addCharacteristic(chData);

      serviceData.setUuid(QBluetoothUuid::GlucoseMeasurement);

      serviceData.setType(QLowEnergyServiceData::ServiceTypePrimary);
      serviceData.addCharacteristic(ipData);

      controller = QLowEnergyController::createPeripheral();

       

       

      but the first characteristic chData is added while the second ipData is not.

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            andreasbuhr Andreas Buhr
            sherifomran Sherif Omran
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes