#ifndef OMOBIDISPLAYBACKEND_H #define OMOBIDISPLAYBACKEND_H #include #include class OmobiDisplayBackend : public QObject { Q_OBJECT Q_PROPERTY(QBluetoothLeUart* bleController READ getBleController NOTIFY bleControllerChanged) Q_PROPERTY(OmobiDisplayAppState state READ getState WRITE setState NOTIFY stateChanged) public: explicit OmobiDisplayBackend(QObject *parent = nullptr); enum OmobiDisplayAppState { Idle, Scanning, ReadyToConnect, Connecting, Connected }; Q_ENUM(OmobiDisplayAppState) private: OmobiDisplayAppState state; QBluetoothLeUart *ble; public slots: Q_INVOKABLE void startScanning(); Q_INVOKABLE QBluetoothLeUart* getBleController(); Q_INVOKABLE OmobiDisplayAppState getState(); private slots: void handleBluetoothStateChange(QBluetoothLeUart::BluetoothLeUartState state); void handleFoundNewDevice(QBluetoothLeUartDevice* device); void DataHandler(const QString &s); void handleBluetoothDeviceConected(); void setState(OmobiDisplayAppState state); signals: void stateChanged(); void bleControllerChanged(); }; #endif // OMOBIDISPLAYBACKEND_H