File indexing completed on 2024-05-05 03:52:30

0001 /*
0002  * BluezQt - Asynchronous BlueZ wrapper library
0003  *
0004  * SPDX-FileCopyrightText: 2015 David Rosca <nowrep@gmail.com>
0005  *
0006  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007  */
0008 
0009 #ifndef BLUEZQT_INPUT_H
0010 #define BLUEZQT_INPUT_H
0011 
0012 #include <QObject>
0013 
0014 #include "bluezqt_export.h"
0015 #include "types.h"
0016 
0017 #include <memory>
0018 
0019 namespace BluezQt
0020 {
0021 /**
0022  * @class BluezQt::Input input.h <BluezQt/Input>
0023  *
0024  * %Device input.
0025  *
0026  * This class represents an input interface.
0027  */
0028 class BLUEZQT_EXPORT Input : public QObject
0029 {
0030     Q_OBJECT
0031     Q_PROPERTY(ReconnectMode reconnectMode READ reconnectMode NOTIFY reconnectModeChanged)
0032 
0033 public:
0034     /** Reconnect mode. */
0035     enum ReconnectMode {
0036         /** Device and host are not required to automatically restore the connection. */
0037         NoReconnect,
0038         /** Host restores the connection. */
0039         HostReconnect,
0040         /** Device restores the connection. */
0041         DeviceReconnect,
0042         /** Device shall attempt to restore the lost connection, but host may also restore the connection. */
0043         AnyReconnect,
0044     };
0045     Q_ENUM(ReconnectMode)
0046 
0047     /**
0048      * Destroys an Input object.
0049      */
0050     ~Input() override;
0051 
0052     /**
0053      * Returns a shared pointer from this.
0054      *
0055      * @return InputPtr
0056      */
0057     InputPtr toSharedPtr() const;
0058 
0059     /**
0060      * Returns the reconnect mode.
0061      *
0062      * @return reconnect mode
0063      */
0064     ReconnectMode reconnectMode() const;
0065 
0066 Q_SIGNALS:
0067     /**
0068      * Indicates that input's reconnect mode have changed.
0069      */
0070     void reconnectModeChanged(ReconnectMode mode);
0071 
0072 private:
0073     BLUEZQT_NO_EXPORT explicit Input(const QString &path, const QVariantMap &properties);
0074 
0075     std::unique_ptr<class InputPrivate> const d;
0076 
0077     friend class InputPrivate;
0078     friend class DevicePrivate;
0079 };
0080 
0081 } // namespace BluezQt
0082 
0083 #endif // BLUEZQT_INPUT_H