#include "VBluetoothDeviceInfo.h" // Qt #include #include // Project using namespace View; /*! * \brief VBluetoothDeviceInfo::VBluetoothDeviceInfo * Constructor for the VBluetoothDeviceInfo class * \param info - the device information */ VBluetoothDeviceInfo::VBluetoothDeviceInfo(const QBluetoothDeviceInfo &info) : _connected(false) { _address = info.address().toString(); _name = info.name(); } /*! * \brief VBluetoothDeviceInfo::VBluetoothDeviceInfo * Constructor for the VBluetoothDeviceInfo class * \param address - (QString) bluetooth address of the device * \param name - (QString) name of the bluetooth device */ VBluetoothDeviceInfo::VBluetoothDeviceInfo(const QString &address, const QString &name) : _address(address), _name(name), _connected(false) {} /*! * \brief VBluetoothDeviceInfo::getName * Gets the name of the device * \return QString - the name of the device */ QString VBluetoothDeviceInfo::getName() const { return _name; } /*! * \brief VBluetoothDeviceInfo::getAddress * Gets the bluetooth address * \return QString - the bluetooth address */ QString VBluetoothDeviceInfo::getAddress() const { return _address; } /*! * \brief VBluetoothDeviceInfo::setConnected * Sets the bluetooth connection state */ void VBluetoothDeviceInfo::setConnected(const bool &conn) { if (conn != _connected) { _connected = conn; emit deviceChanged(); } } /*! * \brief VBluetoothDeviceInfo::isConnected * Gets the bluetooth connection state * \return bool - true if connected, false otherwise */ bool VBluetoothDeviceInfo::isConnected() const { return _connected; } /*! * \brief VBluetoothDeviceInfo::isValid * Checks whether the VBluetoothDeviceInfo object is valid or not. * \return true if valid, false otherwise */ bool VBluetoothDeviceInfo::isValid() const { if (_address.length() != 17) return false; if (_name.length() == 0) return false; return true; }