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

QLowEnergyServiceData::addCharacteristic

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Reported
    • Priority: Not Evaluated
    • Resolution: Unresolved
    • Affects Version/s: 5.13.1
    • Fix Version/s: None
    • Labels:
      None
    • Platform/s:
      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

            • Assignee:
              ablasche Alex Blasche
              Reporter:
              sherifomran Sherif Omran
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes