added: mpdclient file

This commit is contained in:
Bob van Loosen 2012-12-19 22:37:34 +01:00
parent 1f640349c6
commit 61b42c1e8f
3 changed files with 250 additions and 0 deletions

42
src/mpdclient.h Normal file
View file

@ -0,0 +1,42 @@
#ifndef MPDCLIENT_H
#define MPDCLIENT_H
#include <deque>
#include <string>
#include "util/thread.h"
#include "util/condition.h"
#include "util/tcpsocket.h"
enum ECMD
{
CMD_VOLUP,
CMD_VOLDOWN
};
class CMpdClient : public CThread
{
public:
CMpdClient(std::string address, int port);
~CMpdClient();
virtual void Process();
void VolumeUp();
void VolumeDown();
private:
bool OpenSocket();
bool Ping();
bool ProcessCommands();
bool GetVolume(int& volume);
bool SetVolume(int volume);
int m_port;
std::string m_address;
CTcpClientSocket m_socket;
std::deque<ECMD> m_commands;
CCondition m_condition;
};
#endif //MPDCLIENT_H