/* Blinker
   Copyright 2011-2019 Stefan Schuermans <stefan@blinkenarea.org>
   Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
   a blinkenarea.org project */

#ifndef BLINKER_OPCONN_H
#define BLINKER_OPCONN_H

#include <string>

#include "OpConnIf.h"

namespace Blinker {

/// operator connection
class OpConn
{
protected:
  /**
   * @brief constructor
   * @param[in] pConnIf connection interface of this side
   */
  OpConn(OpConnIf *pConnIf);

public:
  /// destructor
  ~OpConn();

private:
  /// copy constructor disabled
  OpConn(const OpConn &that);

  /// assignment operator disabled
  const OpConn & operator=(const OpConn &that);

public:
  /**
   * @brief send key command
   * @param[in] key key that was pressed
   */
  void sendKey(char key);

  /**
   * @brief send play command
   * @param[in] sound name of sound to play
   */
  void sendPlay(const std::string &sound);

  /// close connection
  void close();

protected:
  /**
   * @brief set remote side of connection
   * @param[in] pRemote remote side connection object
   */
  void setRemote(OpConn *pRemote);

protected:
  OpConnIf *m_pConnIf; ///< connection interface of this side
  OpConn   *m_pRemote; ///< remote side connection object

  friend class OpMgr;
}; // class OpConn

} // namespace Blinker

#endif // #ifndef BLINKER_OPCONN_H

