BTController.hpp Example File
bluetoothsppchat/src/BTController.hpp
#ifndef BTCONTROLLER_HPP
#define BTCONTROLLER_HPP
#include "ChatManager.hpp"
#include "DeviceListing.hpp"
#include "LocalDeviceInfo.hpp"
#include "RemoteDeviceInfo.hpp"
#include <QObject>
class BTController : public QObject
{
Q_OBJECT
Q_PROPERTY(ChatManager* chatManager READ chatManager CONSTANT)
Q_PROPERTY(DeviceListing* deviceListing READ deviceListing CONSTANT)
Q_PROPERTY(LocalDeviceInfo* localDeviceInfo READ localDeviceInfo CONSTANT)
Q_PROPERTY(RemoteDeviceInfo* remoteDeviceInfo READ remoteDeviceInfo CONSTANT)
Q_PROPERTY(bool bluetoothActive READ bluetoothActive NOTIFY bluetoothActiveChanged)
Q_PROPERTY(bool discoverableActive READ discoverableActive NOTIFY discoverableActiveChanged)
public:
BTController(QObject* parent);
virtual ~BTController();
void emitBTDeviceSignal(int event, const QString &btAddr, const QString &eventData);
public Q_SLOTS:
void toggleBluetoothActive();
void toggleDiscoverableActive();
void setRemoteDevice(const QString &address);
Q_SIGNALS:
void BTDeviceSignal(int event, const QString &btAddr, const QString &eventData);
void bluetoothActiveChanged();
void discoverableActiveChanged();
private Q_SLOTS:
void handleBTDeviceEvent(int event, const QString &btAddr, const QString &eventData);
private:
void logQString(const QString &msg);
bool bluetoothActive() const;
bool discoverableActive() const;
ChatManager* chatManager() const;
DeviceListing* deviceListing() const;
LocalDeviceInfo* localDeviceInfo() const;
RemoteDeviceInfo* remoteDeviceInfo() const;
ChatManager* m_chatManager;
DeviceListing* m_deviceListing;
LocalDeviceInfo* m_localDeviceInfo;
RemoteDeviceInfo* m_remoteDeviceInfo;
};
#endif