You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ovassvepCVRPNServer.h 953B

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #include <openvibe/ov_all.h>
  3. #include <toolkit/ovtk_all.h>
  4. #include <map>
  5. #include <vector>
  6. #include <string>
  7. class vrpn_Connection;
  8. class vrpn_Button_Server;
  9. namespace OpenViBE {
  10. namespace SSVEP {
  11. class CApplication;
  12. class CVRPNServer
  13. {
  14. public:
  15. static CVRPNServer* getInstance(CApplication* application);
  16. ~CVRPNServer() = default;
  17. void processFrame();
  18. void addButton(const CString& name, int buttonCount);
  19. void changeButtonState(const std::string& name, int index, int state);
  20. int getButtonState(const std::string& name, const int index) { return m_buttonCache[name][index]; }
  21. private:
  22. static CVRPNServer* m_vrpnServerInstance;
  23. static CApplication* m_application;
  24. explicit CVRPNServer(CApplication* application);
  25. vrpn_Connection* m_connection = nullptr;
  26. std::map<std::string, vrpn_Button_Server*> m_buttonServer;
  27. std::map<std::string, std::vector<int>> m_buttonCache;
  28. };
  29. } // namespace SSVEP
  30. } // namespace OpenViBE