BlinkenArea - GitList
Repositories
Blog
Wiki
Blinker
Code
Commits
Branches
Tags
Search
Tree:
f670ca0
Branches
Tags
master
Blinker
src
common
OpConn.cpp
rename noarch (misnormer) to common
Stefan Schuermans
commited
f670ca0
at 2014-01-03 12:06:24
OpConn.cpp
Blame
History
Raw
/* Blinker Copyright 2011-2014 Stefan Schuermans <stefan@blinkenarea.org> Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html a blinkenarea.org project */ #include <string> #include "OpConn.h" #include "OpConnIf.h" namespace Blinker { /** * @brief constructor * @param[in] pConnIf connection interface of this side */ OpConn::OpConn(OpConnIf *pConnIf): m_pConnIf(pConnIf), m_pRemote(NULL) { } /// destructor OpConn::~OpConn() { // think twice before putting something here // might be explicitly deconstructed by remote side } /** * @brief send key command * @param[in] key key that was pressed */ void OpConn::sendKey(char key) { if (m_pRemote) m_pRemote->m_pConnIf->opConnRecvKey(m_pRemote, key); } /** * @brief send play command * @param[in] sound name of sound to play */ void OpConn::sendPlay(const std::string &sound) { if (m_pRemote) m_pRemote->m_pConnIf->opConnRecvPlay(m_pRemote, sound); } /// close connection void OpConn::close() { // inform remote side if (m_pRemote) m_pRemote->m_pConnIf->opConnClose(m_pRemote); // destroy local and remote connection objects if (m_pRemote) delete m_pRemote; delete this; } /** * @brief set remote side of connection * @param[in] pRemote remote side connection object */ void OpConn::setRemote(OpConn *pRemote) { m_pRemote = pRemote; } } // namespace Blinker