astarte-platform / astarte-device-sdk-qt5

Astarte Qt5 Device SDK
http://astarte-platform.org/
Apache License 2.0
11 stars 12 forks source link

Accept QList<T> for object fields #39

Closed shikoku1 closed 2 years ago

shikoku1 commented 2 years ago

As of #37, sendData for an object aggregated datastream was accepting only QList<QVariant> for array types, with this patch every QList<T> that can be automatically converted to QList<QVariant> is accepted

    data["..."] = QVariant::fromValue<QList<QString>>({ QString("te"), QString("st") });
    data["..."] = QVariant::fromValue<QList<int>>( { 20, 21 } );
    data["..."] = QVariant::fromValue<QList<QString>>({ QString("ml"), QString("kg") });

    m_sdk->sendData("...", data, QDateTime::currentDateTime());