InputAppleRemote.mm 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "InputAppleRemote.h"
  2. #include "QsLog.h"
  3. #include "HIDRemote.h"
  4. #include "AppleRemoteDelegate.h"
  5. ///////////////////////////////////////////////////////////////////////////////////////////////////
  6. bool InputAppleRemote::initInput()
  7. {
  8. m_delegate = [[AppleRemoteDelegate alloc] initWithRemoteHandler:this];
  9. return [m_delegate setupRemote];
  10. }
  11. ///////////////////////////////////////////////////////////////////////////////////////////////////
  12. void InputAppleRemote::addRemoteFailed(const QString &error)
  13. {
  14. QLOG_ERROR() << error;
  15. }
  16. ///////////////////////////////////////////////////////////////////////////////////////////////////
  17. void InputAppleRemote::addRemote(const QString &name)
  18. {
  19. m_remotes << name;
  20. QLOG_DEBUG() << "Added remote:" << name;
  21. }
  22. ///////////////////////////////////////////////////////////////////////////////////////////////////
  23. void InputAppleRemote::removeRemote(const QString &name)
  24. {
  25. m_remotes.removeOne(name);
  26. QLOG_DEBUG() << "Remove remote:" << name;
  27. }
  28. ///////////////////////////////////////////////////////////////////////////////////////////////////
  29. void InputAppleRemote::remoteButtonEvent(quint8 code, bool pressed, const QString &name)
  30. {
  31. emit receivedInput("AppleRemote", QString::number(code), pressed);
  32. }