Index: sources/device/DeviceView.h =================================================================== diff -u -r574c7c5fb48b1fcb72337f5fb4c0119a20288815 -rdb52d097addadd2eef6102340778be143ee81df4 --- sources/device/DeviceView.h (.../DeviceView.h) (revision 574c7c5fb48b1fcb72337f5fb4c0119a20288815) +++ sources/device/DeviceView.h (.../DeviceView.h) (revision db52d097addadd2eef6102340778be143ee81df4) @@ -38,6 +38,52 @@ Q_OBJECT + enum DataRole { + eRole_Start = Qt::UserRole , + // ----- WiFi + eRole_WifiMacAddress , + eRole_WifiSsid , + eRole_WifiSecurityTypes , + eRole_WifiSignalLevel , + eRole_WifiSupported , + eRole_WifiConnected , + // ----- Bluetooth + eRole_BLE_UNUSED , + }; + + QHash dataRoles { + // ----- WiFi + { eRole_WifiMacAddress , "wifiMacAddress" }, + { eRole_WifiSsid , "wifiSsid" }, + { eRole_WifiSecurityTypes , "wifiSecurityTypes" }, + { eRole_WifiSignalLevel , "wifiSignalLevel" }, + { eRole_WifiSupported , "wifiSupported" }, + { eRole_WifiConnected , "wifiConnected" }, + // ----- Bluetooth + }; + + struct DataModel { + // ----- WiFi + QString mWifiMacAddress ; + QString mWifiSSID ; + QString mWifiSecurityTypes ; + qint16 mWifiSignalLevel ; + bool mWifiSupported = false ; + bool mWifiConnected = false ; + // ----- Bluetooth + QString mBle_Unused ; + }; + typedef QList TDataList; + TDataList _dataList; + + typedef QHash TDataRoles; + TDataRoles roleNames ( ) const override { return dataRoles; } + int rowCount (const QModelIndex & = QModelIndex() ) const override { return _dataList.count(); } + QVariant data (const QModelIndex &vIndex , int vRole = Qt::DisplayRole ) const override ; + void dataAppend (const DataModel &vData , bool vFirst ); + void dataClear ( ); + +private: TRIGGER ( bool , response , true) PROPERTY ( bool , accepted , 0) @@ -62,52 +108,16 @@ ATTRIBUTE ( QString , decommission , "", Decommission ) PROPERTY ( bool , decommissionEnabled , true ) - ATTRIBUTE ( QStringList , wifiList , {}, WifiList ) READONLY ( bool , wifiListEnabled , true ) VIEW_DEC_CLASS_EX(VDevice, QAbstractListModel) - enum DataRole { - eRole_DataRole_Start = Qt::UserRole , - - eRole_WifiMacAddress , - eRole_WifiSsid , - eRole_WifiSecurityTypes , - eRole_WifiSignalLevel , - eRole_WifiSupported , - eRole_WifiConnected , - - eRole_BLE_UNUSED , - }; - - struct DataModel { - QString mWifiMacAddress ; - QString mWifiSSID ; - QString mWifiSecurityTypes ; - qint16 mWifiSignalLevel ; - bool mWifiSupported = false ; - bool mWifiConnected = false ; - - QString mBle_Unused ; - }; - - QList _dataList; - -public: - int rowCount (const QModelIndex &parent = QModelIndex() ) const override; - QVariant data (const QModelIndex &vIndex, int vRole = Qt::DisplayRole ) const override; -private: - void addData (const DataModel &vDataModel); - -protected: - QHash roleNames() const override; - private slots: void onPOSTOSVersionData (const QString &vOSVersion); private: - QVariantList parseWifiListResult(const QString &vResult); + void parseWifiListResult(const QString &vResult); bool isCompleteResponse(Model::MDeviceResponseBase::Data vData) { // Either the script exited successfully or the script failed and the reason is provided // There are situations that the script is using the attribute response to update the UI