|
a |
|
b/src/ohreceiver.hxx |
|
|
1 |
/* Copyright (C) 2014 J.F.Dockes
|
|
|
2 |
* This program is free software; you can redistribute it and/or modify
|
|
|
3 |
* it under the terms of the GNU General Public License as published by
|
|
|
4 |
* the Free Software Foundation; either version 2 of the License, or
|
|
|
5 |
* (at your option) any later version.
|
|
|
6 |
*
|
|
|
7 |
* This program is distributed in the hope that it will be useful,
|
|
|
8 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
9 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
10 |
* GNU General Public License for more details.
|
|
|
11 |
*
|
|
|
12 |
* You should have received a copy of the GNU General Public License
|
|
|
13 |
* along with this program; if not, write to the
|
|
|
14 |
* Free Software Foundation, Inc.,
|
|
|
15 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
16 |
*/
|
|
|
17 |
#ifndef _OHRECEIVER_H_X_INCLUDED_
|
|
|
18 |
#define _OHRECEIVER_H_X_INCLUDED_
|
|
|
19 |
|
|
|
20 |
#include <string> // for string
|
|
|
21 |
#include <unordered_map> // for unordered_map
|
|
|
22 |
#include <vector> // for vector
|
|
|
23 |
#include <memory>
|
|
|
24 |
|
|
|
25 |
#include "libupnpp/device/device.hxx" // for UpnpService
|
|
|
26 |
#include "libupnpp/soaphelp.hxx" // for SoapArgs, SoapData
|
|
|
27 |
|
|
|
28 |
#include "execmd.h"
|
|
|
29 |
|
|
|
30 |
using namespace UPnPP;
|
|
|
31 |
class UpMpd;
|
|
|
32 |
class OHPlaylist;
|
|
|
33 |
|
|
|
34 |
class OHReceiver : public UPnPProvider::UpnpService {
|
|
|
35 |
public:
|
|
|
36 |
OHReceiver(UpMpd *dev, OHPlaylist *pl, int httpport);
|
|
|
37 |
|
|
|
38 |
virtual bool getEventData(bool all, std::vector<std::string>& names,
|
|
|
39 |
std::vector<std::string>& values);
|
|
|
40 |
|
|
|
41 |
private:
|
|
|
42 |
int play(const SoapArgs& sc, SoapData& data);
|
|
|
43 |
int stop(const SoapArgs& sc, SoapData& data);
|
|
|
44 |
int setSender(const SoapArgs& sc, SoapData& data);
|
|
|
45 |
int sender(const SoapArgs& sc, SoapData& data);
|
|
|
46 |
int protocolInfo(const SoapArgs& sc, SoapData& data);
|
|
|
47 |
int transportState(const SoapArgs& sc, SoapData& data);
|
|
|
48 |
|
|
|
49 |
bool makestate(std::unordered_map<std::string, std::string> &st);
|
|
|
50 |
void maybeWakeUp(bool ok);
|
|
|
51 |
// State variable storage (previous state)
|
|
|
52 |
std::unordered_map<std::string, std::string> m_state;
|
|
|
53 |
// Current
|
|
|
54 |
std::string m_uri;
|
|
|
55 |
std::string m_metadata;
|
|
|
56 |
|
|
|
57 |
UpMpd *m_dev;
|
|
|
58 |
OHPlaylist *m_pl;
|
|
|
59 |
|
|
|
60 |
std::shared_ptr<ExecCmd> m_cmd;
|
|
|
61 |
int m_httpport;
|
|
|
62 |
std::string m_httpuri;
|
|
|
63 |
};
|
|
|
64 |
|
|
|
65 |
#endif /* _OHRECEIVER_H_X_INCLUDED_ */
|