#ifndef MYTHWIIMOTE_H_
#define MYTHWIIMOTE_H_

#include "mythinputinterface.h"
#include <QObject>
#include <QKeyEvent>
#include <QTimer>
#include <QThread>

#include <cwiid.h>
#include <wiimote.h>


class MythWiimote : public QThread, public MythInputInterface
{
    Q_OBJECT
    Q_INTERFACES(MythInputInterface)
  public:
    MythWiimote();

    /* MythInputInterface */
    void start();
    void stop();
    const QString name() const;
    const QString description() const;

    void setInputManager(MythInputManagerInterface * inputManager);
    /* MythInputInterface end */
  signals:
    void logDebug(const QString &);
    void logInfo(const QString &);
    void logWarning(const QString &);
    void logError(const QString &);
  protected:
    void run();
  private slots:
    void searchWiimote();
    void onWiimoteDiscovered(cwiid_bdinfo infoWiimote);
    void onWiimoteDisconnected(Wiimote * wiimote);

  private:
    virtual ~MythWiimote();

    MythInputManagerInterface * m_inputManager;
    int m_lastWiimoteId;
    int m_noBluetoothmsg;
};
#endif
