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.

CStimulusSender.h 1006B

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include <boost/asio.hpp>
  3. #include "IStimulusSender.h"
  4. namespace TCPTagging {
  5. /*
  6. * \class CStimulusSender
  7. * \author Jussi T. Lindgren / Inria
  8. * \brief Simple client to send stimuli to Acquisition Server's TCP Tagging
  9. */
  10. class CStimulusSender : public IStimulusSender
  11. {
  12. public:
  13. CStimulusSender() : m_oStimulusSocket(m_ioService) { }
  14. ~CStimulusSender() override;
  15. // Connect to the TCP Tagging plugin of the Acquisition Server
  16. // If sAddress is empty string, the StimulusSender will be inactive and connect() will not print an error but returns false.
  17. bool connect(const char* sAddress, const char* sStimulusPort) override;
  18. // Send a stimulation.
  19. bool sendStimulation(uint64_t stimulation, uint64_t timestamp = 0, uint64_t flags = (Flag_Fptime | Flag_Autostamp_Clientside)) override;
  20. protected:
  21. boost::asio::io_service m_ioService;
  22. boost::asio::ip::tcp::socket m_oStimulusSocket;
  23. bool m_bConnectedOnce = false;
  24. uint64_t m_lastTimestamp = 0;
  25. };
  26. } // namespace TCPTagging