Index: sources/view/VBluetoothDeviceInfo.h =================================================================== diff -u -r0470ff6f209ff0c5089f8f0849b6da04f60f8f41 -rd9c602dc1f1e5ba34bc665264d739ce6509e0198 --- sources/view/VBluetoothDeviceInfo.h (.../VBluetoothDeviceInfo.h) (revision 0470ff6f209ff0c5089f8f0849b6da04f60f8f41) +++ sources/view/VBluetoothDeviceInfo.h (.../VBluetoothDeviceInfo.h) (revision d9c602dc1f1e5ba34bc665264d739ce6509e0198) @@ -8,29 +8,53 @@ // Project +// forward declarations +class tst_views; + namespace View { +/*! + * \brief The VBluetoothDeviceInfo class + * Exposes the name, address, and connection status of a specific bluetooth device + * \details Allows convient access to the name, address, and connection status of a bluetooth device. Allows such data to be + * extracted from the QBluetoothDeviceInfo class so that it can be accessed and displayed easily in qml for each BLE device. + * + */ class VBluetoothDeviceInfo: public QObject { Q_OBJECT + + // friends + friend class::tst_views; + Q_PROPERTY(QString name READ getName NOTIFY deviceChanged) Q_PROPERTY(QString address READ getAddress NOTIFY deviceChanged) + Q_PROPERTY(bool connected READ isConnected NOTIFY deviceChanged) public: - VBluetoothDeviceInfo(const QBluetoothDeviceInfo &device); - - void setDevice(const QBluetoothDeviceInfo &device); + explicit VBluetoothDeviceInfo(const QBluetoothDeviceInfo &device); + VBluetoothDeviceInfo(const QString &address, const QString &name); QString getName() const; QString getAddress() const; - QBluetoothDeviceInfo getDevice() const; + bool isConnected() const; + void setConnected(const bool &conn); + bool isValid() const; signals: void deviceChanged(); private: - QBluetoothDeviceInfo device; -}; + bool operator==(const VBluetoothDeviceInfo &d1) { + if (getAddress() != d1.getAddress()) + return false; + return true; + } + + QString _address; + QString _name; + bool _connected; +}; } #endif // VBLUETOOTHDEVICEINFO_H