File indexing completed on 2024-04-28 15:17:53

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 namespace BluezQt
0018 {
0019 /**
0020  * @class BluezQt::Input input.h <BluezQt/Input>
0021  *
0022  * %Device input.
0023  *
0024  * This class represents an input interface.
0025  */
0026 class BLUEZQT_EXPORT Input : public QObject
0027 {
0028     Q_OBJECT
0029     Q_PROPERTY(ReconnectMode reconnectMode READ reconnectMode NOTIFY reconnectModeChanged)
0030 
0031 public:
0032     /** Reconnect mode. */
0033     enum ReconnectMode {
0034         /** Device and host are not required to automatically restore the connection. */
0035         NoReconnect,
0036         /** Host restores the connection. */
0037         HostReconnect,
0038         /** Device restores the connection. */
0039         DeviceReconnect,
0040         /** Device shall attempt to restore the lost connection, but host may also restore the connection. */
0041         AnyReconnect,
0042     };
0043     Q_ENUM(ReconnectMode)
0044 
0045     /**
0046      * Destroys an Input object.
0047      */
0048     ~Input() override;
0049 
0050     /**
0051      * Returns a shared pointer from this.
0052      *
0053      * @return InputPtr
0054      */
0055     InputPtr toSharedPtr() const;
0056 
0057     /**
0058      * Returns the reconnect mode.
0059      *
0060      * @return reconnect mode
0061      */
0062     ReconnectMode reconnectMode() const;
0063 
0064 Q_SIGNALS:
0065     /**
0066      * Indicates that input's reconnect mode have changed.
0067      */
0068     void reconnectModeChanged(ReconnectMode mode);
0069 
0070 private:
0071     BLUEZQT_NO_EXPORT explicit Input(const QString &path, const QVariantMap &properties);
0072 
0073     class InputPrivate *const d;
0074 
0075     friend class InputPrivate;
0076     friend class DevicePrivate;
0077 };
0078 
0079 } // namespace BluezQt
0080 
0081 #endif // BLUEZQT_INPUT_H